diff options
Diffstat (limited to 'wizards/com')
148 files changed, 2554 insertions, 2605 deletions
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java index 2d7174bdb69f..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(); @@ -235,7 +231,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data { try { - itemsTables[i].write(""); + itemsTables[i].write(PropertyNames.EMPTY_STRING); } catch (Exception ex) { @@ -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(); } @@ -665,18 +661,18 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data private void writeTitle(TextElement te, XTextRange tr, String text) { - te.text = (text == null ? "" : text); + te.text = (text == null ? PropertyNames.EMPTY_STRING : text); te.write(tr); } private static long DAY_IN_MILLIS = (24 * 60 * 60 * 1000); private String getDateString(String d) { - if (d == null || d.equals("")) + if (d == null || d.equals(PropertyNames.EMPTY_STRING)) { - return ""; + 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, @@ -694,11 +690,11 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data private String getTimeString(String s) { - if (s == null || s.equals("")) + if (s == null || s.equals(PropertyNames.EMPTY_STRING)) { - return ""; + 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(""); + UnoRuntime.queryInterface(XTextContent.class, section).getAnchor().setString(PropertyNames.EMPTY_STRING); } } } @@ -759,8 +755,8 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data try { Object minutesAllSection = getSection(SECTION_MINUTES_ALL); - XTextSection xTextSection = (XTextSection) UnoRuntime.queryInterface(XTextSection.class, minutesAllSection); - xTextSection.getAnchor().setString(""); + 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) { @@ -831,15 +827,15 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data if (itemText.equals(FILLIN_MINUTE_NUM)) { - fillMinutesItem(item, topic[0].Value, ""); + fillMinutesItem(item, topic[0].Value, PropertyNames.EMPTY_STRING); } else if (itemText.equals(FILLIN_MINUTE_TOPIC)) { - fillMinutesItem(item, topic[1].Value, ""); + fillMinutesItem(item, topic[1].Value, PropertyNames.EMPTY_STRING); } else if (itemText.equals(FILLIN_MINUTE_RESPONSIBLE)) { - fillMinutesItem(item, topic[2].Value, ""); + fillMinutesItem(item, topic[2].Value, PropertyNames.EMPTY_STRING); } else if (itemText.equals(FILLIN_MINUTE_TIME)) { @@ -863,7 +859,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data topicStartTime += topicTime * 1000; time += getTimeString(String.valueOf(topicStartTime)); } - fillMinutesItem(item, time, ""); + fillMinutesItem(item, time, PropertyNames.EMPTY_STRING); } } @@ -889,16 +885,16 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data * If the given text is empty, uses a placeholder with the giveb placeholder text. * @param range text range to fill * @param text the text to fill to the text range object. - * @param placeholder the placeholder text to use, if the text argument is empty (null or "") + * @param placeholder the placeholder text to use, if the text argument is empty (null or PropertyNames.EMPTY_STRING) */ private void fillMinutesItem(XTextRange range, Object text, String placeholder) { String paraStyle = (String) Helper.getUnoPropertyValue(range, "ParaStyleName"); range.setString((String) text); Helper.setUnoPropertyValue(range, "ParaStyleName", paraStyle); - if (text == null || text.equals("")) + if (text == null || text.equals(PropertyNames.EMPTY_STRING)) { - if (placeholder != null && !placeholder.equals("")) + if (placeholder != null && !placeholder.equals(PropertyNames.EMPTY_STRING)) { XTextContent placeHolder = createPlaceHolder(docMSF, placeholder, resources.resPlaceHolderHint); try @@ -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? @@ -1024,7 +1020,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data // write items // =========== - String cellName = ""; + String cellName = PropertyNames.EMPTY_STRING; /* now go through all items that belong to this * table. Check each one agains the model. If it should @@ -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(""); + 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 <...> @@ -1316,7 +1312,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data { writtenTopics.add(null); } - writtenTopics.set(topic, ""); + writtenTopics.set(topic, PropertyNames.EMPTY_STRING); // make sure threr are enough rows for me... int rows = getRowCount(table); @@ -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,8 +1760,8 @@ class TextElement extends ParaStyled public void write(Object textRange) { - ((XTextRange) UnoRuntime.queryInterface(XTextRange.class, textRange)).setString(text); - if (!text.equals("")) + UnoRuntime.queryInterface(XTextRange.class, textRange).setString(text); + if (!text.equals(PropertyNames.EMPTY_STRING)) { super.write(textRange); } @@ -1772,7 +1769,7 @@ class TextElement extends ParaStyled } /** - * A Text element which, if the text to write is empty (null or "") + * A Text element which, if the text to write is empty (null or PropertyNames.EMPTY_STRING) * inserts a placeholder instead. * @author rp143992 * @@ -1805,9 +1802,9 @@ class PlaceholderTextElement extends TextElement public void write(Object textRange) { super.write(textRange); - if (text == null || text.equals("")) + 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/AgendaWizardDialog.java b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java index ab600176080d..397985c2a937 100644 --- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java +++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java @@ -105,7 +105,7 @@ public abstract class AgendaWizardDialog extends WizardDialog implements Agenda XButton btnUp; XButton btnDown; - final private String IMGHELP1_HID = ""; + final private String IMGHELP1_HID = PropertyNames.EMPTY_STRING; //Font Descriptors as Class members. @@ -117,7 +117,7 @@ public abstract class AgendaWizardDialog extends WizardDialog implements Agenda AgendaWizardDialogResources resources; private String[] PROPS_LIST = new String[] {"Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH}; - private String[] PROPS_LABEL_B = new String[] {"FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH}; + private String[] PROPS_LABEL_B = new String[] {PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH}; private String[] PROPS_CHECK = new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH}; private String[] PROPS_BUTTON = new String[] {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}; private String[] PROPS_X = new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH}; diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java index 50ee492f8c78..20ad03c428ae 100644 --- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java +++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java @@ -50,6 +50,7 @@ import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.NoValidPathException; import com.sun.star.wizards.common.SystemDialog; import com.sun.star.wizards.common.HelpIds; +import com.sun.star.wizards.common.PropertyNames; import com.sun.star.wizards.document.OfficeDocument; import com.sun.star.wizards.text.ViewHandler; import com.sun.star.wizards.ui.PathSelection; @@ -158,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 @@ -172,7 +173,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog // synchronize GUI and CGAgenda object. makeDA(); - if(myPathSelection.xSaveTextBox.getText().equalsIgnoreCase("")) {myPathSelection.initializePath();} + if(myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(PropertyNames.EMPTY_STRING)) {myPathSelection.initializePath();} executeDialog(agendaTemplate.xFrame); removeTerminateListener(); @@ -184,8 +185,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog removeTerminateListener(); ex.printStackTrace(); running=false; - return; - } + } } @@ -212,7 +212,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog private void initializePaths() { try { sTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard"); - sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", ""); + sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", PropertyNames.EMPTY_STRING); sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../wizard/bitmap"); } catch (NoValidPathException e) { e.printStackTrace(); @@ -221,14 +221,14 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog private void checkSavePath() { if (agenda.cp_TemplatePath == null || - agenda.cp_TemplatePath.equals("") || + agenda.cp_TemplatePath.equals(PropertyNames.EMPTY_STRING) || !getFileAccess().exists(FileAccess.getParentDir(agenda.cp_TemplatePath),false) || !getFileAccess().isDirectory(FileAccess.getParentDir(agenda.cp_TemplatePath ))) { try { agenda.cp_TemplatePath = FileAccess.connectURLs( - FileAccess.getOfficePath(xMSF, "Work", "", "") , + FileAccess.getOfficePath(xMSF, "Work", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING) , resources.resDefaultFilename ); } @@ -243,7 +243,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog */ private void makeDA() { - setControlProperty("listPageDesign", "StringItemList", agendaTemplates[0]); + setControlProperty("listPageDesign", PropertyNames.STRING_ITEM_LIST, agendaTemplates[0]); checkSavePath(); //setFilename(agenda.cp_TemplatePath); @@ -420,7 +420,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog */ private void setFilename(String url) { try { - String path = getFileAccess().getPath(url,""); + String path = getFileAccess().getPath(url,PropertyNames.EMPTY_STRING); Helper.setUnoPropertyValue( getModel(myPathSelection.xSaveTextBox), "Text", path); } catch (Exception ex) { @@ -463,7 +463,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog try { FileAccess fileAccess = new FileAccess(xMSF); sPath = myPathSelection.getSelectedPath(); - if (sPath.equals("")) { + if (sPath.equals(PropertyNames.EMPTY_STRING)) { myPathSelection.triggerPathPicker(); sPath = myPathSelection.getSelectedPath(); } @@ -482,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) { @@ -503,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) { @@ -528,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(); @@ -537,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)); @@ -557,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/CGAgenda.java b/wizards/com/sun/star/wizards/agenda/CGAgenda.java index b7dc1cc37c00..d64ec8372bd3 100644 --- a/wizards/com/sun/star/wizards/agenda/CGAgenda.java +++ b/wizards/com/sun/star/wizards/agenda/CGAgenda.java @@ -28,6 +28,7 @@ package com.sun.star.wizards.agenda; import com.sun.star.wizards.common.ConfigGroup; import com.sun.star.wizards.common.ConfigSet; +import com.sun.star.wizards.common.PropertyNames; /** * CGAgenda means Configuration Group Agenda. @@ -43,13 +44,13 @@ public class CGAgenda extends ConfigGroup /** step 1 - include minutes*/ public boolean cp_IncludeMinutes; /** step 2 - title */ - public String cp_Title = ""; + public String cp_Title = PropertyNames.EMPTY_STRING; /** step 2 - date */ public String cp_Date; /** step 2 - time */ public String cp_Time; /** step 2 - location */ - public String cp_Location = ""; + public String cp_Location = PropertyNames.EMPTY_STRING; /** step 3 - show meeting type */ public boolean cp_ShowMeetingType; /** step 3 - show read */ diff --git a/wizards/com/sun/star/wizards/agenda/CGTopic.java b/wizards/com/sun/star/wizards/agenda/CGTopic.java index 74b818205b9f..6ef5ac21e3ea 100644 --- a/wizards/com/sun/star/wizards/agenda/CGTopic.java +++ b/wizards/com/sun/star/wizards/agenda/CGTopic.java @@ -30,6 +30,7 @@ package com.sun.star.wizards.agenda; import com.sun.star.beans.PropertyValue; import com.sun.star.wizards.common.ConfigGroup; import com.sun.star.wizards.common.Indexable; +import com.sun.star.wizards.common.PropertyNames; /** * CGTopic means: Configuration Group Topic. @@ -74,7 +75,7 @@ public class CGTopic extends ConfigGroup implements Indexable { */ public void setDataToRow(Object row) { PropertyValue[] pv = (PropertyValue[])row; - pv[0].Value = "" + cp_Index + "."; + pv[0].Value = PropertyNames.EMPTY_STRING + cp_Index + "."; pv[1].Value = cp_Topic; pv[2].Value = cp_Responsible; pv[3].Value = cp_Time; diff --git a/wizards/com/sun/star/wizards/agenda/CallWizard.java b/wizards/com/sun/star/wizards/agenda/CallWizard.java index 3dc8dcd8ef91..ae19b4ef311d 100644 --- a/wizards/com/sun/star/wizards/agenda/CallWizard.java +++ b/wizards/com/sun/star/wizards/agenda/CallWizard.java @@ -37,6 +37,7 @@ import com.sun.star.registry.XRegistryKey; import com.sun.star.task.XJob; import com.sun.star.task.XJobExecutor; import com.sun.star.uno.Type; +import com.sun.star.wizards.common.PropertyNames; /** * This class capsulates the class, that implements the minimal component, a factory for @@ -100,7 +101,7 @@ public class CallWizard { public void trigger(String str) { try { - if (str.equalsIgnoreCase("start")) { + if (str.equalsIgnoreCase(PropertyNames.START)) { AgendaWizardDialogImpl aw = new AgendaWizardDialogImpl(xmultiservicefactory); if (!AgendaWizardDialogImpl.running) { aw.startWizard(); @@ -184,7 +185,7 @@ public class CallWizard { }; try { - byteReturn = ("" + this.hashCode()).getBytes(); + byteReturn = (PropertyNames.EMPTY_STRING + this.hashCode()).getBytes(); } catch (Exception exception) { System.err.println(exception); } diff --git a/wizards/com/sun/star/wizards/agenda/TopicsControl.java b/wizards/com/sun/star/wizards/agenda/TopicsControl.java index 25f0cf9103a0..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); } @@ -304,14 +304,14 @@ public class TopicsControl extends ControlScroller implements XFocusListener } /** - * in order to use the "move up", "down" "insert" and "remove" buttons, + * in order to use the "move up", "downPropertyNames.SPACEinsert" and "remove" buttons, * we track the last control the gained focus, in order to know which * row should be handled. * @param fe */ public void focusGained(FocusEvent fe) { - XControl xc = (XControl) UnoRuntime.queryInterface(XControl.class, fe.Source); + XControl xc = UnoRuntime.queryInterface(XControl.class, fe.Source); focusGained(xc); } @@ -463,9 +463,9 @@ public class TopicsControl extends ControlScroller implements XFocusListener // after rotating all the properties from this row on, // we clear the row, so it is practically a new one... PropertyValue[] pv1 = (PropertyValue[]) scrollfields.get(lastFocusRow); - pv1[1].Value = ""; - pv1[2].Value = ""; - pv1[3].Value = ""; + pv1[1].Value = PropertyNames.EMPTY_STRING; + pv1[2].Value = PropertyNames.EMPTY_STRING; + pv1[3].Value = PropertyNames.EMPTY_STRING; // update the preview document. updateDocumentRow(lastFocusRow); @@ -487,10 +487,10 @@ public class TopicsControl extends ControlScroller implements XFocusListener private PropertyValue[] newRow(int i) { PropertyValue[] pv = new PropertyValue[4]; - pv[0] = Properties.createProperty(LABEL + i, "" + (i + 1) + "."); - pv[1] = Properties.createProperty(TOPIC + i, ""); - pv[2] = Properties.createProperty(RESP + i, ""); - pv[3] = Properties.createProperty(TIME + i, ""); + pv[0] = Properties.createProperty(LABEL + i, PropertyNames.EMPTY_STRING + (i + 1) + "."); + pv[1] = Properties.createProperty(TOPIC + i, PropertyNames.EMPTY_STRING); + pv[2] = Properties.createProperty(RESP + i, PropertyNames.EMPTY_STRING); + pv[3] = Properties.createProperty(TIME + i, PropertyNames.EMPTY_STRING); return pv; } @@ -536,9 +536,9 @@ public class TopicsControl extends ControlScroller implements XFocusListener PropertyValue[] data = getTopicData(row); // now - is this row empty? - return data[1].Value.equals("") && - data[2].Value.equals("") && - data[3].Value.equals(""); + return data[1].Value.equals(PropertyNames.EMPTY_STRING) && + data[2].Value.equals(PropertyNames.EMPTY_STRING) && + data[3].Value.equals(PropertyNames.EMPTY_STRING); } /** @@ -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); } /** @@ -1173,7 +1173,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener LABEL_PROPS, new Object[] { - I_8, "" + (i + 1) + ".", new Integer(x + 4), new Integer(y + 2), IStep, new Short((short) tabindex), 10 + I_8, PropertyNames.EMPTY_STRING + (i + 1) + ".", new Integer(x + 4), new Integer(y + 2), IStep, new Short((short) tabindex), 10 }); textbox = dialog.insertTextField(TOPIC + i, "topicTextChanged", this, diff --git a/wizards/com/sun/star/wizards/common/ConfigSet.java b/wizards/com/sun/star/wizards/common/ConfigSet.java index 216f91b5e430..7684de5e10ce 100644 --- a/wizards/com/sun/star/wizards/common/ConfigSet.java +++ b/wizards/com/sun/star/wizards/common/ConfigSet.java @@ -90,11 +90,11 @@ public class ConfigSet implements ConfigNode, XMLProvider, ListModel public void add(int i, Object o) { int name = i; - while (getElement("" + name) != null) + while (getElement(PropertyNames.EMPTY_STRING + name) != null) { name++; } - childrenMap.put("" + name, o); + childrenMap.put(PropertyNames.EMPTY_STRING + name, o); childrenList.add(i, o); fireListDataListenerIntervalAdded(i, i); diff --git a/wizards/com/sun/star/wizards/common/Configuration.java b/wizards/com/sun/star/wizards/common/Configuration.java index 04dd385ddf60..08baa26b412c 100644 --- a/wizards/com/sun/star/wizards/common/Configuration.java +++ b/wizards/com/sun/star/wizards/common/Configuration.java @@ -97,7 +97,7 @@ public abstract class Configuration Object o = getNode(name, parent); if (AnyConverter.isVoid(o)) { - return ""; + return PropertyNames.EMPTY_STRING; } return (String) o; } @@ -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) { @@ -213,7 +212,7 @@ public abstract class Configuration public static String getOfficeLocaleString(XMultiServiceFactory xMSF) { - String sLocale = ""; + String sLocale = PropertyNames.EMPTY_STRING; try { Locale aLocLocale = new Locale(); @@ -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 8902696c37b4..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; @@ -161,7 +159,7 @@ public class Desktop public static void dispatchURL(XMultiServiceFactory xMSF, String sURL, XFrame xFrame) { - dispatchURL(xMSF, sURL, xFrame, ""); + dispatchURL(xMSF, sURL, xFrame, PropertyNames.EMPTY_STRING); } public static void dispatchURL(XDispatch _xDispatch, com.sun.star.util.URL oURL) @@ -182,20 +180,19 @@ 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) { boolean bElementexists = true; int i = 1; - String sIncSuffix = ""; + 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); @@ -212,12 +209,12 @@ public class Desktop { boolean bElementexists = true; int i = 1; - String sIncSuffix = ""; + 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, "", nContFlags, " "); + 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) @@ -258,7 +254,7 @@ public class Desktop if (i < snewname.length()) { String sspecialchar = snewname.substring(i, i + 1); - snewname = JavaTools.replaceSubString(snewname, "", sspecialchar); + snewname = JavaTools.replaceSubString(snewname, PropertyNames.EMPTY_STRING, sspecialchar); } } return snewname; @@ -311,7 +307,7 @@ public class Desktop { return _sElementName; } - while (bElementexists == true) + while (bElementexists) { for (int i = 0; i < _slist.length; i++) { @@ -322,7 +318,7 @@ public class Desktop } scompname = _sElementName + _sSuffixSeparator + a++; } - return ""; + return PropertyNames.EMPTY_STRING; } /** @@ -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); } @@ -377,9 +373,9 @@ public class Desktop try { TemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard"); - UserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", ""); + UserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", PropertyNames.EMPTY_STRING); BitmapPath = FileAccess.combinePaths(xMSF, TemplatePath, "/../wizard/bitmap"); - WorkPath = FileAccess.getOfficePath(xMSF, "Work", "", ""); + WorkPath = FileAccess.getOfficePath(xMSF, "Work", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING); } catch (NoValidPathException nopathexception) { @@ -391,52 +387,48 @@ public class Desktop { try { - String sTemplatePath = FileAccess.getOfficePath(_xMSF, "Template", "share", "/wizard"); - return sTemplatePath; + return FileAccess.getOfficePath(_xMSF, "Template", "share", "/wizard"); } catch (NoValidPathException nopathexception) { } - return ""; + return PropertyNames.EMPTY_STRING; } public static String getUserTemplatePath(XMultiServiceFactory _xMSF) { try { - String sUserTemplatePath = FileAccess.getOfficePath(_xMSF, "Template", "user", ""); - return sUserTemplatePath; + return FileAccess.getOfficePath(_xMSF, "Template", "user", PropertyNames.EMPTY_STRING); } catch (NoValidPathException nopathexception) { } - return ""; + return PropertyNames.EMPTY_STRING; } public static String getBitmapPath(XMultiServiceFactory _xMSF) { try { - String sBitmapPath = FileAccess.combinePaths(_xMSF, getTemplatePath(_xMSF), "/../wizard/bitmap"); - return sBitmapPath; + return FileAccess.combinePaths(_xMSF, getTemplatePath(_xMSF), "/../wizard/bitmap"); } catch (NoValidPathException nopathexception) { } - return ""; + return PropertyNames.EMPTY_STRING; } public static String getWorkPath(XMultiServiceFactory _xMSF) { try { - String sWorkPath = FileAccess.getOfficePath(_xMSF, "Work", "", ""); - return sWorkPath; + return FileAccess.getOfficePath(_xMSF, "Work", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING); } catch (NoValidPathException nopathexception) { } - return ""; + return PropertyNames.EMPTY_STRING; } public static XStringSubstitution createStringSubstitution(XMultiServiceFactory xMSF) @@ -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 6278d7e71a97..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; @@ -74,24 +75,23 @@ public class FileAccess String ResultPath = getOfficePath(xMSF, sPath, xSimpleFileAccess); // As there are several conventions about the look of Url (e.g. with " " or with "%20") you cannot make a // simple String comparison to find out, if a path is already in "ResultPath" - String[] PathList = JavaTools.ArrayoutofString(ResultPath, ";"); + String[] PathList = JavaTools.ArrayoutofString(ResultPath, PropertyNames.SEMI_COLON); int MaxIndex = PathList.length - 1; String CompCurPath; // sAddPath.replace(null, (char) 47); - String CompAddPath = JavaTools.replaceSubString(sAddPath, "", "/"); + String CompAddPath = JavaTools.replaceSubString(sAddPath, PropertyNames.EMPTY_STRING, "/"); String CurPath; for (int i = 0; i <= MaxIndex; i++) { CurPath = JavaTools.convertfromURLNotation(PathList[i]); - CompCurPath = JavaTools.replaceSubString(CurPath, "", "/"); + CompCurPath = JavaTools.replaceSubString(CurPath, PropertyNames.EMPTY_STRING, "/"); if (CompCurPath.equals(CompAddPath)) { return; } } - ResultPath += ";" + sAddPath; - return; - } + ResultPath += PropertyNames.SEMI_COLON + sAddPath; + } public static String deleteLastSlashfromUrl(String _sPath) { @@ -117,7 +117,7 @@ public class FileAccess { try { - String ResultPath = ""; + String ResultPath = PropertyNames.EMPTY_STRING; XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.util.PathSettings"); ResultPath = com.sun.star.uno.AnyConverter.toString(Helper.getUnoPropertyValue(xInterface, sPath)); ResultPath = deleteLastSlashfromUrl(ResultPath); @@ -126,7 +126,7 @@ public class FileAccess catch (Exception exception) { exception.printStackTrace(System.out); - return ""; + return PropertyNames.EMPTY_STRING; } } @@ -135,7 +135,7 @@ public class FileAccess * chapter 6.2.7 * @param xMSF * @param sPath - * @param sType use "share" or "user". Set to "" if not needed eg for the WorkPath; + * @param sType use "share" or "user". Set to PropertyNames.EMPTY_STRING if not needed eg for the WorkPath; * In the return Officepath a possible slash at the end is cut off * @param sSearchDir * @return @@ -145,9 +145,9 @@ public class FileAccess { //This method currently only works with sPath="Template" - String ResultPath = ""; + String ResultPath = PropertyNames.EMPTY_STRING; - String Template_writable = ""; + String Template_writable = PropertyNames.EMPTY_STRING; String[] Template_internal; String[] Template_user; @@ -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); - String WritePath = ""; + 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"); @@ -204,11 +204,11 @@ public class FileAccess catch (Exception exception) { exception.printStackTrace(System.out); - ResultPath = ""; + ResultPath = PropertyNames.EMPTY_STRING; } - if (bexists == false) + if (!bexists) { - throw new NoValidPathException(xMSF, ""); + throw new NoValidPathException(xMSF, PropertyNames.EMPTY_STRING); } return ResultPath; } @@ -217,9 +217,9 @@ public class FileAccess { //This method currently only works with sPath="Template" - // String ResultPath = ""; + // String ResultPath = PropertyNames.EMPTY_STRING; ArrayList<String> aPathList = new ArrayList<String>(); - String Template_writable = ""; + String Template_writable = PropertyNames.EMPTY_STRING; String[] Template_internal; String[] Template_user; @@ -229,8 +229,8 @@ 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); - // String WritePath = ""; + 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; @@ -288,11 +285,11 @@ public class FileAccess catch (Exception exception) { exception.printStackTrace(System.out); - // ResultPath = ""; + // ResultPath = PropertyNames.EMPTY_STRING; } // if (bexists == false) // { -// throw new NoValidPathException(xMSF, ""); +// throw new NoValidPathException(xMSF, PropertyNames.EMPTY_STRING); // } // return ResultPath; return aPathList; @@ -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; @@ -374,7 +371,7 @@ public class FileAccess /* public static String getOfficePath(XMultiServiceFactory xMSF, String sPath, String sType) throws NoValidPathException { - String ResultPath = ""; + String ResultPath = PropertyNames.EMPTY_STRING; Object oPathSettings; int iPathCount; String[] PathList; @@ -383,10 +380,10 @@ public class FileAccess XInterface xUcbInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface); ResultPath = getOfficePath(xMSF, sPath, xSimpleFileAccess); - PathList = JavaTools.ArrayoutofString(ResultPath, ";"); - if (!sType.equals("")) { - ResultPath = ""; - String CurPath = ""; + PathList = JavaTools.ArrayoutofString(ResultPath, PropertyNames.SEMI_COLON); + if (!sType.equals(PropertyNames.EMPTY_STRING)) { + ResultPath = PropertyNames.EMPTY_STRING; + String CurPath = PropertyNames.EMPTY_STRING; String EndString = "/" + sType; int EndLength = EndString.length(); sType = "/" + sType + "/"; @@ -403,11 +400,11 @@ public class FileAccess } } else ResultPath = PathList[0]; - if (ResultPath.equals("") == false) + if (ResultPath.equals(PropertyNames.EMPTY_STRING) == false) bexists = xSimpleFileAccess.exists(ResultPath); } catch (Exception exception) { exception.printStackTrace(System.out); - ResultPath = ""; + ResultPath = PropertyNames.EMPTY_STRING; } if (bexists == false) throw new NoValidPathException(xMSF); @@ -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) @@ -452,46 +449,43 @@ public class FileAccess public static String combinePaths(XMultiServiceFactory xMSF, String _sFirstPath, String _sSecondPath) throws NoValidPathException { boolean bexists = false; - String ReturnPath = ""; + String ReturnPath = PropertyNames.EMPTY_STRING; 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); } catch (Exception exception) { exception.printStackTrace(System.out); - return ""; + return PropertyNames.EMPTY_STRING; } - if (bexists == false) + if (!bexists) { - throw new NoValidPathException(xMSF, ""); + throw new NoValidPathException(xMSF, PropertyNames.EMPTY_STRING); } return ReturnPath; } public static boolean createSubDirectory(XMultiServiceFactory xMSF, XSimpleFileAccess xSimpleFileAccess, String Path) { - String sNoDirCreation = ""; + String sNoDirCreation = PropertyNames.EMPTY_STRING; 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; } @@ -516,7 +510,7 @@ public class FileAccess try { String SubDir; - String SubDirPath = ""; + String SubDirPath = PropertyNames.EMPTY_STRING; int SubLen; int NewLen; int RestLen; @@ -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; } @@ -604,26 +597,26 @@ public class FileAccess */ public static String[][] getFolderTitles(com.sun.star.lang.XMultiServiceFactory xMSF, String FilterName, String FolderName) { - String[][] LocLayoutFiles = new String[2][]; //{"",""}{""}; + String[][] LocLayoutFiles = new String[2][]; //{PropertyNames.EMPTY_STRING,PropertyNames.EMPTY_STRING}{PropertyNames.EMPTY_STRING}; try { java.util.Vector<String> TitleVector = null; java.util.Vector<String> NameVector = null; XInterface xDocInterface = (XInterface) xMSF.createInstance("com.sun.star.document.DocumentProperties"); - XDocumentProperties xDocProps = (XDocumentProperties) UnoRuntime.queryInterface(XDocumentProperties.class, xDocInterface); + 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); TitleVector = new java.util.Vector<String>(/*nameList.length*/); NameVector = new java.util.Vector<String>(nameList.length); - FilterName = FilterName == null || FilterName.equals("") ? null : FilterName + "-"; + FilterName = FilterName == null || FilterName.equals(PropertyNames.EMPTY_STRING) ? null : FilterName + "-"; - String fileName = ""; + String fileName = PropertyNames.EMPTY_STRING; PropertyValue[] noArgs = { }; for (int i = 0; i < nameList.length; i++) { @@ -676,11 +669,11 @@ public class FileAccess public static String getPathFromList(XMultiServiceFactory xMSF, ArrayList _aList, String _sFile) { - String sFoundFile = ""; + String sFoundFile = PropertyNames.EMPTY_STRING; 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++) { @@ -709,16 +702,16 @@ public class FileAccess public static String[][] getFolderTitles(com.sun.star.lang.XMultiServiceFactory xMSF, String _sStartFilterName, ArrayList FolderNames) throws NoValidPathException { - return getFolderTitles(xMSF, _sStartFilterName, FolderNames, ""); + return getFolderTitles(xMSF, _sStartFilterName, FolderNames, PropertyNames.EMPTY_STRING); } private static String getTitle(XMultiServiceFactory xMSF, String _sFile) { - String sTitle = ""; + String sTitle = PropertyNames.EMPTY_STRING; 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(); @@ -732,7 +725,7 @@ public class FileAccess public static String[][] getFolderTitles(com.sun.star.lang.XMultiServiceFactory xMSF, String _sStartFilterName, ArrayList FolderName, String _sEndFilterName) throws NoValidPathException { - String[][] LocLayoutFiles = new String[2][]; //{"",""}{""}; + String[][] LocLayoutFiles = new String[2][]; //{PropertyNames.EMPTY_STRING,PropertyNames.EMPTY_STRING}{PropertyNames.EMPTY_STRING}; if (FolderName.size() == 0) { throw new NoValidPathException(null, "Path not given."); @@ -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) { @@ -759,9 +752,9 @@ public class FileAccess try { String[] nameList = xSimpleFileAccess.getFolderContents(sFolderName, false); - _sStartFilterName = _sStartFilterName == null || _sStartFilterName.equals("") ? null : _sStartFilterName + "-"; + _sStartFilterName = _sStartFilterName == null || _sStartFilterName.equals(PropertyNames.EMPTY_STRING) ? null : _sStartFilterName + "-"; - String fileName = ""; + String fileName = PropertyNames.EMPTY_STRING; for (int i = 0; i < nameList.length; i++) { fileName = getFilename(nameList[i]); @@ -769,13 +762,13 @@ public class FileAccess if (_sStartFilterName == null || fileName.startsWith(_sStartFilterName)) { - if (_sEndFilterName.equals("")) + if (_sEndFilterName.equals(PropertyNames.EMPTY_STRING)) { sTitle = getTitle(xMSF, nameList[i]); } else if (fileName.endsWith(_sEndFilterName)) { - fileName = fileName.replaceAll(_sEndFilterName + "$", ""); + fileName = fileName.replaceAll(_sEndFilterName + "$", PropertyNames.EMPTY_STRING); sTitle = fileName; } else @@ -818,31 +811,28 @@ 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) { - return filenameConverter.getSystemPathFromFileURL(parentURL + (((childURL == null || childURL.equals("")) ? "" : "/" + childURL))); + return filenameConverter.getSystemPathFromFileURL(parentURL + (((childURL == null || childURL.equals(PropertyNames.EMPTY_STRING)) ? PropertyNames.EMPTY_STRING : "/" + childURL))); } /** @@ -855,7 +845,7 @@ public class FileAccess int p = filename.indexOf("."); if (p == -1) { - return ""; + return PropertyNames.EMPTY_STRING; } else { @@ -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)); } /** @@ -1083,7 +1072,7 @@ public class FileAccess public String createNewDir(String parentDir, String name) { - String s = getNewFile(parentDir, name, ""); + String s = getNewFile(parentDir, name, PropertyNames.EMPTY_STRING); if (mkdir(s)) { return s; @@ -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)); @@ -1112,7 +1100,7 @@ public class FileAccess private static String filename(String name, String ext, int i) { - return name + (i == 0 ? "" : String.valueOf(i)) + (ext.equals("") ? "" : "." + ext); + return name + (i == 0 ? PropertyNames.EMPTY_STRING : String.valueOf(i)) + (ext.equals(PropertyNames.EMPTY_STRING) ? PropertyNames.EMPTY_STRING : "." + ext); } public int getSize(String url) @@ -1129,7 +1117,7 @@ public class FileAccess public static String connectURLs(String urlFolder, String urlFilename) { - return urlFolder + (urlFolder.endsWith("/") ? "" : "/") + + return urlFolder + (urlFolder.endsWith("/") ? PropertyNames.EMPTY_STRING : "/") + (urlFilename.startsWith("/") ? urlFilename.substring(1) : urlFilename); } @@ -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 ad8faa2b2d42..19a51bef3e5a 100644 --- a/wizards/com/sun/star/wizards/common/HelpIds.java +++ b/wizards/com/sun/star/wizards/common/HelpIds.java @@ -38,7 +38,7 @@ public class HelpIds "HID:WIZARDS_HID0_CANCEL", // HID:34205 "HID:WIZARDS_HID0_STATUS_DIALOG", // HID:34206 "HID:WIZARDS_HID1_LST_SESSIONS", // HID:34207 - "", + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID1_BTN_DEL_SES", // HID:34209 "HID:WIZARDS_HID2_LST_DOCS", // HID:34210 "HID:WIZARDS_HID2_BTN_ADD_DOC", // HID:34211 @@ -81,13 +81,13 @@ public class HelpIds "HID:WIZARDS_HID5_BTN_BACKGND", // HID:34248 "HID:WIZARDS_HID5_BTN_ICONS", // HID:34249 "HID:WIZARDS_HID6_TXT_SITE_TITLE", // HID:34250 - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID6_TXT_SITE_DESC", // HID:34253 - "", + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID6_DATE_SITE_CREATED", // HID:34255 "HID:WIZARDS_HID6_DATE_SITE_UPDATED", // HID:34256 - "", + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID6_TXT_SITE_EMAIL", // HID:34258 "HID:WIZARDS_HID6_TXT_SITE_COPYRIGHT", // HID:34259 "HID:WIZARDS_HID7_BTN_PREVIEW", // HID:34260 @@ -102,24 +102,24 @@ public class HelpIds "HID:WIZARDS_HID7_BTN_FTP", // HID:34269 "HID:WIZARDS_HID7_CHK_SAVE", // HID:34270 "HID:WIZARDS_HID7_TXT_SAVE", // HID:34271 - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_BG", // HID:34290 "HID:WIZARDS_HID_BG_BTN_OTHER", // HID:34291 "HID:WIZARDS_HID_BG_BTN_NONE", // HID:34292 @@ -143,23 +143,23 @@ public class HelpIds "HID:WIZARDS_HID_BG_BTN_IMG14", // HID:34300 "HID:WIZARDS_HID_BG_BTN_IMG15", // HID:34311 "HID:WIZARDS_HID_BG_BTN_IMG16", // HID:34312 - "", - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGREPORT_DIALOG", // HID:34320 - "", + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGREPORT_0_CMDPREV", // HID:34322 "HID:WIZARDS_HID_DLGREPORT_0_CMDNEXT", // HID:34323 "HID:WIZARDS_HID_DLGREPORT_0_CMDFINISH", // HID:34324 "HID:WIZARDS_HID_DLGREPORT_0_CMDCANCEL", // HID:34325 - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGREPORT_1_LBTABLES", // HID:34330 "HID:WIZARDS_HID_DLGREPORT_1_FIELDSAVAILABLE", // HID:34331 "HID:WIZARDS_HID_DLGREPORT_1_CMDMOVESELECTED", // HID:34332 @@ -169,7 +169,7 @@ public class HelpIds "HID:WIZARDS_HID_DLGREPORT_1_FIELDSSELECTED", // HID:34336 "HID:WIZARDS_HID_DLGREPORT_1_CMDMOVEUP", // HID:34337 "HID:WIZARDS_HID_DLGREPORT_1_CMDMOVEDOWN", // HID:34338 - "", + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGREPORT_2_GROUPING", // HID:34340 "HID:WIZARDS_HID_DLGREPORT_2_CMDGROUP", // HID:34341 "HID:WIZARDS_HID_DLGREPORT_2_CMDUNGROUP", // HID:34342 @@ -188,18 +188,18 @@ public class HelpIds "HID:WIZARDS_HID_DLGREPORT_3_SORT4", // HID:34355 "HID:WIZARDS_HID_DLGREPORT_3_OPTASCEND4", // HID:34356 "HID:WIZARDS_HID_DLGREPORT_3_OPTDESCEND4", // HID:34357 - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGREPORT_4_TITLE", // HID:34362 "HID:WIZARDS_HID_DLGREPORT_4_DATALAYOUT", // HID:34363 "HID:WIZARDS_HID_DLGREPORT_4_PAGELAYOUT", // HID:34364 "HID:WIZARDS_HID_DLGREPORT_4_LANDSCAPE", // HID:34365 "HID:WIZARDS_HID_DLGREPORT_4_PORTRAIT", // HID:34366 - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGREPORT_5_OPTDYNTEMPLATE", // HID:34370 "HID:WIZARDS_HID_DLGREPORT_5_OPTSTATDOCUMENT", // HID:34371 "HID:WIZARDS_HID_DLGREPORT_5_TXTTEMPLATEPATH", // HID:34372 @@ -209,8 +209,8 @@ public class HelpIds "HID:WIZARDS_HID_DLGREPORT_5_TXTDOCUMENTPATH", // HID:34376 "HID:WIZARDS_HID_DLGREPORT_5_CMDDOCUMENTPATH", // HID:34377 "HID:WIZARDS_HID_DLGREPORT_5_CHKLINKTODB", // HID:34378 - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGREPORT_6_TXTTITLE_1", // HID:34381 "HID:WIZARDS_HID_DLGREPORT_6_TXTTITLE_2", // HID:34382 "HID:WIZARDS_HID_DLGREPORT_6_TXTTITLE_3", // HID:34383 @@ -218,29 +218,29 @@ public class HelpIds "HID:WIZARDS_HID_DLGREPORT_6_TXTTITLE_5", // HID:34385 "HID:WIZARDS_HID_DLGREPORT_6_TXTTITLE_6", // HID:34386 "HID:WIZARDS_HID_DLGREPORT_6_TXTTITLE_7", // HID:34387 - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGFORM_DIALOG", // HID:34400 - "", + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGFORM_CMDPREV", // HID:34402 "HID:WIZARDS_HID_DLGFORM_CMDNEXT", // HID:34403 "HID:WIZARDS_HID_DLGFORM_CMDFINISH", // HID:34404 "HID:WIZARDS_HID_DLGFORM_CMDCANCEL", // HID:34405 - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGFORM_MASTER_LBTABLES", // HID:34411 "HID:WIZARDS_HID_DLGFORM_MASTER_FIELDSAVAILABLE", // HID:34412 "HID:WIZARDS_HID_DLGFORM_MASTER_CMDMOVESELECTED", // HID:34413 @@ -250,17 +250,17 @@ public class HelpIds "HID:WIZARDS_HID_DLGFORM_MASTER_FIELDSSELECTED", // HID:34417 "HID:WIZARDS_HID_DLGFORM_MASTER_CMDMOVEUP", // HID:34418 "HID:WIZARDS_HID_DLGFORM_MASTER_CMDMOVEDOWN", // HID:34419 - "", + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGFORM_CHKCREATESUBFORM", // HID:34421 "HID:WIZARDS_HID_DLGFORM_OPTONEXISTINGRELATION", // HID:34422 "HID:WIZARDS_HID_DLGFORM_OPTSELECTMANUALLY", // HID:34423 "HID:WIZARDS_HID_DLGFORM_lstRELATIONS", // HID:34424 - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGFORM_SUB_LBTABLES", // HID:34431 "HID:WIZARDS_HID_DLGFORM_SUB_FIELDSAVAILABLE", // HID:34432 "HID:WIZARDS_HID_DLGFORM_SUB_CMDMOVESELECTED", // HID:34433 @@ -270,7 +270,7 @@ public class HelpIds "HID:WIZARDS_HID_DLGFORM_SUB_FIELDSSELECTED", // HID:34437 "HID:WIZARDS_HID_DLGFORM_SUB_CMDMOVEUP", // HID:34438 "HID:WIZARDS_HID_DLGFORM_SUB_CMDMOVEDOWN", // HID:34439 - "", + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGFORM_LINKER_LSTSLAVELINK1", // HID:34441 "HID:WIZARDS_HID_DLGFORM_LINKER_LSTMASTERLINK1", // HID:34442 "HID:WIZARDS_HID_DLGFORM_LINKER_LSTSLAVELINK2", // HID:34443 @@ -279,8 +279,8 @@ public class HelpIds "HID:WIZARDS_HID_DLGFORM_LINKER_LSTMASTERLINK3", // HID:34446 "HID:WIZARDS_HID_DLGFORM_LINKER_LSTSLAVELINK4", // HID:34447 "HID:WIZARDS_HID_DLGFORM_LINKER_LSTMASTERLINK4", // HID:34448 - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGFORM_CMDALIGNLEFT", // HID:34451 "HID:WIZARDS_HID_DLGFORM_CMDALIGNRIGHT", // HID:34452 "HID:WIZARDS_HID_DLGFORM_CMDLEFTLABELED", // HID:34453 @@ -296,40 +296,40 @@ public class HelpIds "HID:WIZARDS_HID_DLGFORM_CHKNOMODIFICATION", // HID:34463 "HID:WIZARDS_HID_DLGFORM_CHKNODELETION", // HID:34464 "HID:WIZARDS_HID_DLGFORM_CHKNOADDITION", // HID:34465 - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGFORM_LSTSTYLES", // HID:34471 "HID:WIZARDS_HID_DLGFORM_CMDNOBORDER", // HID:34472 "HID:WIZARDS_HID_DLGFORM_CMD3DBORDER", // HID:34473 "HID:WIZARDS_HID_DLGFORM_CMDSIMPLEBORDER", // HID:34474 - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGFORM_TXTPATH", // HID:34481 "HID:WIZARDS_HID_DLGFORM_OPTWORKWITHFORM", // HID:34482 "HID:WIZARDS_HID_DLGFORM_OPTMODIFYFORM", // HID:34483 - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGNEWSLTR_DIALOG", // HID:34500 "HID:WIZARDS_HID_DLGNEWSLTR_OPTSTANDARDLAYOUT", // HID:34501 "HID:WIZARDS_HID_DLGNEWSLTR_OPTPARTYLAYOUT", // HID:34502 @@ -337,19 +337,19 @@ public class HelpIds "HID:WIZARDS_HID_DLGNEWSLTR_OPTSINGLESIDED", // HID:34504 "HID:WIZARDS_HID_DLGNEWSLTR_OPTDOUBLESIDED", // HID:34505 "HID:WIZARDS_HID_DLGNEWSLTR_CMDGOON", // HID:34506 - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGDEPOT_DIALOG_SELLBUY", // HID:34520 "HID:WIZARDS_HID_DLGDEPOT_0_TXTSTOCKID_SELLBUY", // HID:34521 "HID:WIZARDS_HID_DLGDEPOT_0_TXTQUANTITY", // HID:34522 @@ -381,25 +381,25 @@ public class HelpIds "HID:WIZARDS_HID_DLGDEPOT_LSTMARKETS", // HID:34548 "HID:WIZARDS_HID_DLGDEPOT_0_CMDCANCEL_HISTORY", // HID:34549 "HID:WIZARDS_HID_DLGDEPOT_0_CMDGOON_HISTORY", // HID:34550 - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGIMPORT_DIALOG", // HID:34570 "HID:WIZARDS_HID_DLGIMPORT_0_CMDHELP", // HID:34571 "HID:WIZARDS_HID_DLGIMPORT_0_CMDCANCEL", // HID:34572 @@ -424,7 +424,7 @@ public class HelpIds "HID:WIZARDS_HID_DLGIMPORT_2_LBEXPORTDOCUMENTPATH", // HID:34591 "HID:WIZARDS_HID_DLGIMPORT_2_EDEXPORTDOCUMENTPATH", // HID:34592 "HID:WIZARDS_HID_DLGIMPORT_2_CMDEXPORTPATHSELECT", // HID:34593 - "", + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGIMPORT_3_TBSUMMARY", // HID:34595 "HID:WIZARDS_HID_DLGIMPORT_0_CHKWRITER", // HID:34596 "HID:WIZARDS_HID_DLGIMPORT_0_CHKCALC", // HID:34597 @@ -432,34 +432,34 @@ public class HelpIds "HID:WIZARDS_HID_DLGIMPORT_0_CHKMATHGLOBAL", // HID:34599 "HID:WIZARDS_HID_DLGIMPORT_2_CMDTEMPLATEPATHSELECT2", // HID:34600 "HID:WIZARDS_HID_DLGIMPORT_2_CMDDOCUMENTPATHSELECT2", // HID:34601 - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGCORRESPONDENCE_DIALOG", // HID:34630 "HID:WIZARDS_HID_DLGCORRESPONDENCE_CANCEL", // HID:34631 "HID:WIZARDS_HID_DLGCORRESPONDENCE_OPTIONAGENDA1", // HID:34632 @@ -468,28 +468,28 @@ public class HelpIds "HID:WIZARDS_HID_DLGCORRESPONDENCE_OPTIONLETTER1", // HID:34635 "HID:WIZARDS_HID_DLGCORRESPONDENCE_OPTIONLETTER2", // HID:34636 "HID:WIZARDS_HID_DLGCORRESPONDENCE_LETTEROKAY", // HID:34637 - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGSTYLES_DIALOG", // HID:34650 "HID:WIZARDS_HID_DLGSTYLES_LISTBOX", // HID:34651 "HID:WIZARDS_HID_DLGSTYLES_CANCEL", // HID:34652 "HID:WIZARDS_HID_DLGSTYLES_OKAY", // HID:34653 - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGCONVERT_DIALOG", // HID:34660 "HID:WIZARDS_HID_DLGCONVERT_CHECKBOX1", // HID:34661 "HID:WIZARDS_HID_DLGCONVERT_OPTIONBUTTON1", // HID:34662 @@ -511,25 +511,25 @@ public class HelpIds "HID:WIZARDS_HID_DLGCONVERT_CBTARGETOPEN", // HID:34678 "HID:WIZARDS_HID_DLGCONVERT_CHKPROTECT", // HID:34679 "HID:WIZARDS_HID_DLGCONVERT_CHKTEXTDOCUMENTS", // HID:34680 - "", - "", - "", - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGPASSWORD_CMDGOON", // HID:34690 "HID:WIZARDS_HID_DLGPASSWORD_CMDCANCEL", // HID:34691 "HID:WIZARDS_HID_DLGPASSWORD_CMDHELP", // HID:34692 "HID:WIZARDS_HID_DLGPASSWORD_TXTPASSWORD", // HID:34693 - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGHOLIDAYCAL_DIALOG", // HID:34700 "HID:WIZARDS_HID_DLGHOLIDAYCAL_1_PREVIEW", // HID:34701 "HID:WIZARDS_HID_DLGHOLIDAYCAL_1_OPYEAR", // HID:34702 @@ -604,39 +604,39 @@ public class HelpIds "HID:WIZARDS_HID_LTRWIZ_OPTMAKECHANGES", // HID:40814 "HID:WIZARDS_HID_LTRWIZ_TXTPATH", // HID:40815 "HID:WIZARDS_HID_LTRWIZ_CMDPATH", // HID:40816 - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_LTRWIZARD", // HID:40820 "HID:WIZARDS_HID_LTRWIZARD_HELP", // HID:40821 "HID:WIZARDS_HID_LTRWIZARD_BACK", // HID:40822 "HID:WIZARDS_HID_LTRWIZARD_NEXT", // HID:40823 "HID:WIZARDS_HID_LTRWIZARD_CREATE", // HID:40824 "HID:WIZARDS_HID_LTRWIZARD_CANCEL", // HID:40825 - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_QUERYWIZARD_LSTTABLES", // HID:40850 "HID:WIZARDS_HID_QUERYWIZARD_LSTFIELDS", // HID:40851 "HID:WIZARDS_HID_QUERYWIZARD_CMDMOVESELECTED", // HID:40852 @@ -646,12 +646,12 @@ public class HelpIds "HID:WIZARDS_HID_QUERYWIZARD_LSTSELFIELDS", // HID:40856 "HID:WIZARDS_HID_QUERYWIZARD_CMDMOVEUP", // HID:40857 "HID:WIZARDS_HID_QUERYWIZARD_CMDMOVEDOWN", // HID:40858 - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_QUERYWIZARD_SORT1", // HID:40865 "HID:WIZARDS_HID_QUERYWIZARD_OPTASCEND1", // HID:40866 "HID:WIZARDS_HID_QUERYWIZARD_OPTDESCEND1", // HID:40867 @@ -664,7 +664,7 @@ public class HelpIds "HID:WIZARDS_HID_QUERYWIZARD_SORT4", // HID:40874 "HID:WIZARDS_HID_QUERYWIZARD_OPTASCEND4", // HID:40875 "HID:WIZARDS_HID_QUERYWIZARD_OPTDESCEND4", // HID:40876 - "", + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_QUERYWIZARD_OPTMATCHALL", // HID:40878 "HID:WIZARDS_HID_QUERYWIZARD_OPTMATCHANY", // HID:40879 "HID:WIZARDS_HID_QUERYWIZARD_LSTFIELDNAME_1", // HID:40880 @@ -676,12 +676,12 @@ public class HelpIds "HID:WIZARDS_HID_QUERYWIZARD_LSTFIELDNAME_3", // HID:40886 "HID:WIZARDS_HID_QUERYWIZARD_LSTOPERATOR_3", // HID:40887 "HID:WIZARDS_HID_QUERYWIZARD_TXTVALUE_3", // HID:40888 - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_QUERYWIZARD_OPTAGGREGATEDETAILQUERY", // HID:40895 "HID:WIZARDS_HID_QUERYWIZARD_OPTAGGREGATESUMMARYQUERY", // HID:40896 "HID:WIZARDS_HID_QUERYWIZARD_LSTAGGREGATEFUNCTION_1", // HID:40897 @@ -696,20 +696,20 @@ public class HelpIds "HID:WIZARDS_HID_QUERYWIZARD_LSTAGGREGATEFIELDS_5", // HID:40906 "HID:WIZARDS_HID_QUERYWIZARD_BTNAGGREGATEPLUS", // HID:40907 "HID:WIZARDS_HID_QUERYWIZARD_BTNAGGREGATEMINUS", // HID:40908 - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_QUERYWIZARD_LSTFILTERFIELDS", // HID:40915 "HID:WIZARDS_HID_QUERYWIZARD_CMDFILTERMOVESELECTED", // HID:40916 "HID:WIZARDS_HID_QUERYWIZARD_CMDFILTERREMOVESELECTED", // HID:40917 "HID:WIZARDS_HID_QUERYWIZARD_LSTFILTERSELFIELDS", // HID:40918 "HID:WIZARDS_HID_QUERYWIZARD_CMDFILTERMOVEUP", // HID:40919 "HID:WIZARDS_HID_QUERYWIZARD_CMDFILTERMOVEDOWN", // HID:40920 - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_QUERYWIZARD_OPTGROUPMATCHALL", // HID:40923 "HID:WIZARDS_HID_QUERYWIZARD_OPTGROUPMATCHANY", // HID:40924 "HID:WIZARDS_HID_QUERYWIZARD_LSTFILTERFIELDNAME_1", // HID:40925 @@ -721,12 +721,12 @@ public class HelpIds "HID:WIZARDS_HID_QUERYWIZARD_LSTFILTERFIELDNAME_3", // HID:40931 "HID:WIZARDS_HID_QUERYWIZARD_LSTFILTEROPERATOR_3", // HID:40932 "HID:WIZARDS_HID_QUERYWIZARD_TXTFILTERVALUE_3", // HID:40933 - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_QUERYWIZARD_TXTTITLE_1", // HID:40940 "HID:WIZARDS_HID_QUERYWIZARD_TXTTITLE_2", // HID:40941 "HID:WIZARDS_HID_QUERYWIZARD_TXTTITLE_3", // HID:40942 @@ -734,61 +734,61 @@ public class HelpIds "HID:WIZARDS_HID_QUERYWIZARD_TXTTITLE_5", // HID:40944 "HID:WIZARDS_HID_QUERYWIZARD_TXTTITLE_6", // HID:40945 "HID:WIZARDS_HID_QUERYWIZARD_TXTTITLE_7", // HID:40946 - "", - "", - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_QUERYWIZARD_TXTQUERYTITLE", // HID:40955 "HID:WIZARDS_HID_QUERYWIZARD_OPTDISPLAYQUERY", // HID:40956 "HID:WIZARDS_HID_QUERYWIZARD_OPTMODIFYQUERY", // HID:40957 "HID:WIZARDS_HID_QUERYWIZARD_TXTSUMMARY", // HID:40958 - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_QUERYWIZARD", // HID:40970 - "", + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_QUERYWIZARD_BACK", // HID:40972 "HID:WIZARDS_HID_QUERYWIZARD_NEXT", // HID:40973 "HID:WIZARDS_HID_QUERYWIZARD_CREATE", // HID:40974 "HID:WIZARDS_HID_QUERYWIZARD_CANCEL", // HID:40975 - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_IS", // HID:41000 - "", + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_IS_BTN_NONE", // HID:41002 "HID:WIZARDS_HID_IS_BTN_OK", // HID:41003 "HID:WIZARDS_HID_IS_BTN_CANCEL", // HID:41004 @@ -824,9 +824,9 @@ public class HelpIds "HID:WIZARDS_HID_IS_BTN_IMG30", // HID:41034 "HID:WIZARDS_HID_IS_BTN_IMG31", // HID:41035 "HID:WIZARDS_HID_IS_BTN_IMG32", // HID:41036 - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_FTP", // HID:41040 "HID:WIZARDS_HID_FTP_SERVER", // HID:41041 "HID:WIZARDS_HID_FTP_USERNAME", // HID:41042 @@ -836,8 +836,8 @@ public class HelpIds "HID:WIZARDS_HID_FTP_BTN_PATH", // HID:41046 "HID:WIZARDS_HID_FTP_OK", // HID:41047 "HID:WIZARDS_HID_FTP_CANCEL", // HID:41048 - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_AGWIZ", // HID:41051 "HID:WIZARDS_HID_AGWIZ_HELP", // HID:41052 "HID:WIZARDS_HID_AGWIZ_NEXT", // HID:41053 @@ -886,27 +886,27 @@ public class HelpIds "HID:WIZARDS_HID_AGWIZ_5_TXT_TOPIC_5", // HID:41096 "HID:WIZARDS_HID_AGWIZ_5_TXT_RESPONSIBLE_5", // HID:41097 "HID:WIZARDS_HID_AGWIZ_5_TXT_MINUTES_5", // HID:41098 - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_FAXWIZ_OPTBUSINESSFAX", // HID:41120 "HID:WIZARDS_HID_FAXWIZ_LSTBUSINESSSTYLE", // HID:41121 "HID:WIZARDS_HID_FAXWIZ_OPTPRIVATEFAX", // HID:41122 @@ -942,53 +942,53 @@ public class HelpIds "HID:WIZARDS_HID_IMAGECONTROL2", // HID:41152 "HID:WIZARDS_HID_FAXWIZ_TXTPATH", // HID:41153 "HID:WIZARDS_HID_FAXWIZ_CMDPATH", // HID:41154 - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_FAXWIZARD", // HID:41180 "HID:WIZARDS_HID_FAXWIZARD_HELP", // HID:41181 "HID:WIZARDS_HID_FAXWIZARD_BACK", // HID:41182 "HID:WIZARDS_HID_FAXWIZARD_NEXT", // HID:41183 "HID:WIZARDS_HID_FAXWIZARD_CREATE", // HID:41184 "HID:WIZARDS_HID_FAXWIZARD_CANCEL", // HID:41185 - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGTABLE_DIALOG", // HID:41200 - "", + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGTABLE_CMDPREV", // HID:41202 "HID:WIZARDS_HID_DLGTABLE_CMDNEXT", // HID:41203 "HID:WIZARDS_HID_DLGTABLE_CMDFINISH", // HID:41204 @@ -1004,9 +1004,9 @@ public class HelpIds "HID:WIZARDS_HID_DLGTABLE_FIELDSSELECTED", // HID:41214 "HID:WIZARDS_HID_DLGTABLE_CMDMOVEUP", // HID:41215 "HID:WIZARDS_HID_DLGTABLE_CMDMOVEDOWN", // HID:41216 - "", - "", - "", + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, + PropertyNames.EMPTY_STRING, "HID:WIZARDS_HID_DLGTABLE_LB_SELFIELDNAMES", // HID:41220 "HID:WIZARDS_HID_DLGTABLE_CMDMOVEFIELDUP", // HID:41221 "HID:WIZARDS_HID_DLGTABLE_CMDMOVEFIELDDOWN", // HID:41222 @@ -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 836b2a7ea242..43a66301ba27 100644 --- a/wizards/com/sun/star/wizards/common/JavaTools.java +++ b/wizards/com/sun/star/wizards/common/JavaTools.java @@ -52,7 +52,7 @@ public class JavaTools /* public static void main(String args[]) { - String sPath = ""; + String sPath = PropertyNames.EMPTY_STRING; DateTime oDateTime = null; long n; String ConnectStr = "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService"; //localhost ;Lo-1.Germany.sun.com; 10.16.65.155 @@ -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 @@ -200,7 +197,7 @@ public class JavaTools public static String getlongestArrayItem(String[] StringArray) { - String sLongestItem = ""; + String sLongestItem = PropertyNames.EMPTY_STRING; int FieldCount = StringArray.length; int iOldLength = 0; int iCurLength = 0; @@ -218,17 +215,17 @@ public class JavaTools public static String ArraytoString(String[] LocArray) { - String ResultString = ""; + StringBuilder ResultString = new StringBuilder(PropertyNames.EMPTY_STRING); int iLen = LocArray.length; for (int i = 0; i < iLen; i++) { - ResultString += LocArray[i]; + ResultString.append(LocArray[i]); if (i < iLen - 1) { - ResultString += ";"; + ResultString.append(PropertyNames.SEMI_COLON); } } - return ResultString; + return ResultString.toString(); } /** @@ -377,7 +374,7 @@ public class JavaTools public static String[] ArrayoutofString(String MainString, String Token) { String[] StringArray; - if (MainString.equals("") == false) + if (!MainString.equals(PropertyNames.EMPTY_STRING)) { Vector StringVector = new Vector(); String LocString = null; @@ -443,17 +440,17 @@ public class JavaTools { String sFilename = getFilenameOutOfPath(sPath); String[] FilenameList = ArrayoutofString(sFilename, "."); - String FileDescription = ""; + StringBuilder FileDescription = new StringBuilder(PropertyNames.EMPTY_STRING); for (int i = 0; i < FilenameList.length - 1; i++) { - FileDescription += FilenameList[i]; + FileDescription.append(FilenameList[i]); } - return FileDescription; + return FileDescription.toString(); } public static String convertfromURLNotation(String _sURLPath) { - String sPath = ""; + String sPath = PropertyNames.EMPTY_STRING; try { URL oJavaURL = new URL(_sURLPath); @@ -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]; } @@ -762,16 +753,16 @@ public class JavaTools { if (sSecondString != null) { - bissame = sSecondString.equals(""); + bissame = sSecondString.equals(PropertyNames.EMPTY_STRING); } else { - bissame = (sSecondString == null); + bissame = true; } } else { - if (sFirstString.equals("")) + if (sFirstString.equals(PropertyNames.EMPTY_STRING)) { bissame = (sSecondString == null); } 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 109affffd5ef..3a1c3b4ecf0f 100644 --- a/wizards/com/sun/star/wizards/common/NumericalHelper.java +++ b/wizards/com/sun/star/wizards/common/NumericalHelper.java @@ -411,7 +411,7 @@ public class NumericalHelper // return toInt(_aValue); // } // catch(com.sun.star.lang.IllegalArgumentException e) { -// DebugHelper.exception(BasicErrorCode.SbERR_CONVERSION, ""); +// DebugHelper.exception(BasicErrorCode.SbERR_CONVERSION, PropertyNames.EMPTY_STRING); // return 0; // }} // @@ -421,8 +421,8 @@ public class NumericalHelper // return toString(_aValue); // } // catch(com.sun.star.lang.IllegalArgumentException e) { -// DebugHelper.exception(BasicErrorCode.SbERR_CONVERSION, ""); -// return ""; +// DebugHelper.exception(BasicErrorCode.SbERR_CONVERSION, PropertyNames.EMPTY_STRING); +// return PropertyNames.EMPTY_STRING; // }} // // @@ -431,7 +431,7 @@ public class NumericalHelper // return toInt(_aValue, _ndefaultValue); // } // catch(com.sun.star.uno.Exception e) { -// DebugHelper.exception(BasicErrorCode.SbERR_CONVERSION, ""); +// DebugHelper.exception(BasicErrorCode.SbERR_CONVERSION, PropertyNames.EMPTY_STRING); // return 0; // }} // @@ -445,7 +445,7 @@ public class NumericalHelper // return toBoolean(_oObject); // } // catch (java.lang.Exception e){ -// DebugHelper.exception(BasicErrorCode.SbERR_BAD_ARGUMENT, ""); +// DebugHelper.exception(BasicErrorCode.SbERR_BAD_ARGUMENT, PropertyNames.EMPTY_STRING); // return false; // } // } @@ -461,11 +461,11 @@ public class NumericalHelper // return false; // } // else{ -// DebugHelper.exception(BasicErrorCode.SbERR_OUT_OF_RANGE, ""); +// DebugHelper.exception(BasicErrorCode.SbERR_OUT_OF_RANGE, PropertyNames.EMPTY_STRING); // return false; // } // }catch (java.lang.Exception e){ -// DebugHelper.exception(BasicErrorCode.SbERR_OUT_OF_RANGE, ""); +// DebugHelper.exception(BasicErrorCode.SbERR_OUT_OF_RANGE, PropertyNames.EMPTY_STRING); // return false; // }} // @@ -489,12 +489,12 @@ public class NumericalHelper // return false; // } // else{ -// DebugHelper.exception(BasicErrorCode.SbERR_OUT_OF_RANGE, ""); +// DebugHelper.exception(BasicErrorCode.SbERR_OUT_OF_RANGE, PropertyNames.EMPTY_STRING); // return false; // } // } // }catch (java.lang.Exception e){ -// DebugHelper.exception(BasicErrorCode.SbERR_OUT_OF_RANGE, ""); +// DebugHelper.exception(BasicErrorCode.SbERR_OUT_OF_RANGE, PropertyNames.EMPTY_STRING); // return false; // }} /** @@ -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))); @@ -983,13 +983,13 @@ public class NumericalHelper } else { - DebugHelper.exception(1/* BasicErrorCode.SbERR_CONVERSION*/, ""); + DebugHelper.exception(1/* BasicErrorCode.SbERR_CONVERSION*/, PropertyNames.EMPTY_STRING); } } } catch (com.sun.star.uno.Exception e) { - DebugHelper.exception(1 /*BasicErrorCode.SbERR_METHOD_FAILED*/, ""); + DebugHelper.exception(1 /*BasicErrorCode.SbERR_METHOD_FAILED*/, PropertyNames.EMPTY_STRING); } return nreturn; } @@ -1511,7 +1511,7 @@ public class NumericalHelper // } // } // catch (com.sun.star.uno.Exception e){ -// DebugHelper.exception(1 /*BasicErrorCode.SbERR_METHOD_FAILED*/, ""); +// DebugHelper.exception(1 /*BasicErrorCode.SbERR_METHOD_FAILED*/, PropertyNames.EMPTY_STRING); // return false; // }} /** @@ -1554,7 +1554,7 @@ public class NumericalHelper { if (n > MAX_NUMBER || n < MIN_NUMBER) { - DebugHelper.exception(1 /*BasicErrorCode.SbERR_OUT_OF_RANGE*/, ""); + DebugHelper.exception(1 /*BasicErrorCode.SbERR_OUT_OF_RANGE*/, PropertyNames.EMPTY_STRING); } String number = NumericalHelper.toString(new Integer(n)); /* converison idea: every digit is written with a maximum of two @@ -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/PropertyNames.java b/wizards/com/sun/star/wizards/common/PropertyNames.java index 4361b2757773..bef4d4700864 100644 --- a/wizards/com/sun/star/wizards/common/PropertyNames.java +++ b/wizards/com/sun/star/wizards/common/PropertyNames.java @@ -51,4 +51,18 @@ public class PropertyNames public static String PROPERTY_MOVEABLE = "Moveable"; public static String PROPERTY_CLOSEABLE = "Closeable"; public static String PROPERTY_ALIGN = "Align"; + public static String COMMAND = "Command"; + public static String COMMAND_TYPE = "CommandType"; + public static String SELECTED_ITEMS = "SelectedItems"; + public static String URL = "URL"; + public static String ACTIVE_CONNECTION = "ActiveConnection"; + public static String ASC = "ASC"; + public static String SEMI_COLON = ";"; + public static String EMPTY_STRING = ""; + public static String START = "start"; + public static String ORIENTATION = "Orientation"; + public static String READ_ONLY = "ReadOnly"; + public static String SPACE = " "; + public static String STRING_ITEM_LIST = "StringItemList"; + public static String FONT_DESCRIPTOR = "FontDescriptor"; } diff --git a/wizards/com/sun/star/wizards/common/PropertySetHelper.java b/wizards/com/sun/star/wizards/common/PropertySetHelper.java index aec166a5c1c5..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() @@ -371,11 +371,11 @@ public class PropertySetHelper */ public void showProperties() { - String sName = ""; + String sName = PropertyNames.EMPTY_STRING; 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 d49f006a0ca8..5d032639d5e3 100644 --- a/wizards/com/sun/star/wizards/common/UCB.java +++ b/wizards/com/sun/star/wizards/common/UCB.java @@ -121,11 +121,11 @@ public class UCB */ public void copy(String sourceDir, String filename, String targetDir) throws Exception { - copy(sourceDir,filename, targetDir, ""); + copy(sourceDir,filename, targetDir, PropertyNames.EMPTY_STRING); } /** - * target name can be "", in which case the name stays lige the source name + * target name can be PropertyNames.EMPTY_STRING, in which case the name stays lige the source name * @param sourceDir * @param sourceFilename * @param targetDir @@ -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/common/XMLHelper.java b/wizards/com/sun/star/wizards/common/XMLHelper.java index 326ba03fbeea..03af04a959f7 100644 --- a/wizards/com/sun/star/wizards/common/XMLHelper.java +++ b/wizards/com/sun/star/wizards/common/XMLHelper.java @@ -52,7 +52,7 @@ public class XMLHelper Element e = doc.createElement(name); for (int i = 0; i < attNames.length; i++) { - if (attValues[i] != null && (!attValues[i].equals(""))) + if (attValues[i] != null && (!attValues[i].equals(PropertyNames.EMPTY_STRING))) { e.setAttribute(attNames[i], attValues[i]); } diff --git a/wizards/com/sun/star/wizards/db/BlindtextCreator.java b/wizards/com/sun/star/wizards/db/BlindtextCreator.java index b52381def054..989fdcc916e9 100644 --- a/wizards/com/sun/star/wizards/db/BlindtextCreator.java +++ b/wizards/com/sun/star/wizards/db/BlindtextCreator.java @@ -27,6 +27,7 @@ package com.sun.star.wizards.db; import com.sun.star.wizards.common.JavaTools; +import com.sun.star.wizards.common.PropertyNames; /** * @@ -40,7 +41,7 @@ public class BlindtextCreator public static String adjustBlindTextlength(String FieldTitle, int FieldWidth, boolean bIsCurLandscape, boolean bIsGroupTable, String[] _RecordFieldNames) { - String BlindTextString = ""; + String BlindTextString = PropertyNames.EMPTY_STRING; if (bIsGroupTable) { return getBlindTextString(FieldTitle, FieldWidth, FieldWidth); @@ -66,11 +67,10 @@ public class BlindtextCreator public static String getBlindTextString(String FieldTitle, int FieldWidth, int MaxWidth) { - String[] BlindTextArray = JavaTools.ArrayoutofString(BlindText, " "); + String[] BlindTextArray = JavaTools.ArrayoutofString(BlindText, PropertyNames.SPACE); 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()) @@ -88,7 +88,7 @@ public class BlindtextCreator int i = 1; do { - NewPartBlindText = PartBlindText + " " + BlindTextArray[i]; + NewPartBlindText = PartBlindText + PropertyNames.SPACE + BlindTextArray[i]; if (NewPartBlindText.length() < MaxWidth) { PartBlindText = NewPartBlindText; @@ -101,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/ColumnPropertySet.java b/wizards/com/sun/star/wizards/db/ColumnPropertySet.java index db5ceb257118..18e85fea868e 100644 --- a/wizards/com/sun/star/wizards/db/ColumnPropertySet.java +++ b/wizards/com/sun/star/wizards/db/ColumnPropertySet.java @@ -40,7 +40,7 @@ public class ColumnPropertySet TypeInspector oTypeInspector; public XPropertySet xPropertySet; private int nType; - private String sTypeName = ""; + private String sTypeName = PropertyNames.EMPTY_STRING; public ColumnPropertySet(TypeInspector _oTypeInspector, XPropertySet _xPropertySet) { @@ -149,7 +149,7 @@ public class ColumnPropertySet private void setType(int _nType, String _sTypeName, Integer precision) { - if (_sTypeName.equals("")) + if (_sTypeName.equals(PropertyNames.EMPTY_STRING)) { sTypeName = oTypeInspector.getDefaultTypeName(nType, precision); } @@ -174,7 +174,7 @@ public class ColumnPropertySet else if (_spropname.equals(PropertyNames.PROPERTY_NAME)) { String sName = (String) _oValue; - if (!sName.equals("")) + if (!sName.equals(PropertyNames.EMPTY_STRING)) { xPropertySet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); } diff --git a/wizards/com/sun/star/wizards/db/CommandMetaData.java b/wizards/com/sun/star/wizards/db/CommandMetaData.java index 1819d3485994..cb76e3b44a28 100644 --- a/wizards/com/sun/star/wizards/db/CommandMetaData.java +++ b/wizards/com/sun/star/wizards/db/CommandMetaData.java @@ -41,6 +41,7 @@ import com.sun.star.container.XNameAccess; import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.JavaTools; import com.sun.star.wizards.common.NumberFormatter; +import com.sun.star.wizards.common.PropertyNames; import com.sun.star.wizards.common.Resource; import java.util.ArrayList; import java.util.HashMap; @@ -75,8 +76,8 @@ public class CommandMetaData extends DBMetaData private int CommandType; private String Command; boolean bCatalogAtStart = true; - String sCatalogSep = ""; - String sIdentifierQuote = ""; + String sCatalogSep = PropertyNames.EMPTY_STRING; + String sIdentifierQuote = PropertyNames.EMPTY_STRING; boolean bCommandComposerAttributesalreadyRetrieved = false; private XIndexAccess xIndexKeys; @@ -153,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) { @@ -178,7 +178,7 @@ public class CommandMetaData extends DBMetaData } else { - sSortFieldName[1] = "ASC"; + sSortFieldName[1] = PropertyNames.ASC; } aSortFields.add(sSortFieldName); } @@ -334,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 3c6686868ff3..9d8578f5c8ba 100644 --- a/wizards/com/sun/star/wizards/db/CommandName.java +++ b/wizards/com/sun/star/wizards/db/CommandName.java @@ -29,17 +29,18 @@ package com.sun.star.wizards.db; import com.sun.star.sdbc.SQLException; import com.sun.star.uno.Exception; import com.sun.star.wizards.common.JavaTools; +import com.sun.star.wizards.common.PropertyNames; public class CommandName { protected CommandMetaData oCommandMetaData; - protected String CatalogName = ""; - protected String SchemaName = ""; - protected String TableName = ""; - protected String DisplayName = ""; - protected String ComposedName = ""; - protected String AliasName = ""; + protected String CatalogName = PropertyNames.EMPTY_STRING; + protected String SchemaName = PropertyNames.EMPTY_STRING; + protected String TableName = PropertyNames.EMPTY_STRING; + protected String DisplayName = PropertyNames.EMPTY_STRING; + protected String ComposedName = PropertyNames.EMPTY_STRING; + protected String AliasName = PropertyNames.EMPTY_STRING; protected boolean bCatalogAtStart; protected String sCatalogSep; protected String sIdentifierQuote; @@ -59,21 +60,21 @@ public class CommandName oCommandMetaData = _CommandMetaData; if ((_CatalogName != null) && (oCommandMetaData.xDBMetaData.supportsCatalogsInTableDefinitions())) { - if (!_CatalogName.equals("")) + if (!_CatalogName.equals(PropertyNames.EMPTY_STRING)) { CatalogName = _CatalogName; } } if ((_SchemaName != null) && (oCommandMetaData.xDBMetaData.supportsSchemasInTableDefinitions())) { - if (!_SchemaName.equals("")) + if (!_SchemaName.equals(PropertyNames.EMPTY_STRING)) { SchemaName = _SchemaName; } } if (_TableName != null) { - if (!_TableName.equals("")) + if (!_TableName.equals(PropertyNames.EMPTY_STRING)) { TableName = _TableName; } @@ -94,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()); @@ -111,13 +112,13 @@ public class CommandName } } } - if (oCommandMetaData.xDBMetaData.supportsSchemasInDataManipulation() == true) + if (oCommandMetaData.xDBMetaData.supportsSchemasInDataManipulation()) { String[] NameList; NameList = new String[0]; NameList = JavaTools.ArrayoutofString(_DisplayName, "."); SchemaName = NameList[0]; - TableName = NameList[1]; // TODO Was ist mit diesem Fall: CatalogSep = "." und CatalogName = "" + TableName = NameList[1]; // TODO Was ist mit diesem Fall: CatalogSep = "." und CatalogName = PropertyNames.EMPTY_STRING } else { @@ -138,9 +139,9 @@ public class CommandName { if (CatalogName != null) { - if (!CatalogName.equals("")) + if (!CatalogName.equals(PropertyNames.EMPTY_STRING)) { - if (bCatalogAtStart == true) + if (bCatalogAtStart) { ComposedName = quoteName(CatalogName) + sCatalogSep; } @@ -148,12 +149,12 @@ public class CommandName } if (SchemaName != null) { - if (!SchemaName.equals("")) + if (!SchemaName.equals(PropertyNames.EMPTY_STRING)) { ComposedName += quoteName(SchemaName) + "."; } } - if (ComposedName.equals("")) + if (ComposedName.equals(PropertyNames.EMPTY_STRING)) { ComposedName = quoteName(TableName); } @@ -161,9 +162,9 @@ public class CommandName { ComposedName += quoteName(TableName); } - if ((bCatalogAtStart == false) && (CatalogName != null)) + if ((!bCatalogAtStart) && (CatalogName != null)) { - if (!CatalogName.equals("")) + if (!CatalogName.equals(PropertyNames.EMPTY_STRING)) { ComposedName += sCatalogSep + quoteName(CatalogName); } @@ -203,7 +204,7 @@ public class CommandName { if (sName == null) { - sName = ""; + sName = PropertyNames.EMPTY_STRING; } return new StringBuilder(_sIdentifierQuote).append(sName).append(_sIdentifierQuote).toString(); } diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java index 5a151937d73f..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; @@ -187,7 +186,7 @@ public class DBMetaData } catch (Exception e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } } return oNumberFormatter; @@ -215,9 +214,9 @@ public class DBMetaData xNameAccess = UnoRuntime.queryInterface( XNameAccess.class, xDatabaseContext ); DataSourceNames = xNameAccess.getElementNames(); } - catch (Exception exception) + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } } @@ -326,9 +325,9 @@ public class DBMetaData // TODO: Performance leak getColumns() take very long. xColumns = UnoRuntime.queryInterface( XNameAccess.class, xCommandCols.getColumns() ); } - catch (Exception exception) + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } } public XNameAccess getColumns() @@ -357,7 +356,7 @@ public class DBMetaData } catch (Exception e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } return bHasEscapeProcessing; } @@ -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() @@ -453,7 +451,7 @@ public class DBMetaData } catch (SQLException e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); return - 1; } } @@ -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; @@ -507,7 +505,7 @@ public class DBMetaData } catch (SQLException e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } } @@ -530,7 +528,7 @@ public class DBMetaData } catch (Exception e) { - e.printStackTrace(); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } return isSQL92CheckEnabled; } @@ -579,9 +577,9 @@ public class DBMetaData xModel = xDocu.getDatabaseDocument(); } } - catch (Exception exception) + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } } @@ -596,9 +594,9 @@ public class DBMetaData try { XConnection xConnection = null; - if (Properties.hasPropertyValue(curproperties, "ActiveConnection")) + if (Properties.hasPropertyValue(curproperties, PropertyNames.ACTIVE_CONNECTION)) { - xConnection = UnoRuntime.queryInterface( XConnection.class, Properties.getPropertyValue( curproperties, "ActiveConnection" ) ); + xConnection = UnoRuntime.queryInterface( XConnection.class, Properties.getPropertyValue( curproperties, PropertyNames.ACTIVE_CONNECTION ) ); if (xConnection != null) { com.sun.star.container.XChild child = UnoRuntime.queryInterface( com.sun.star.container.XChild.class, xConnection ); @@ -645,23 +643,18 @@ 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) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } catch (UnknownPropertyException e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } catch (WrappedTargetException e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } return false; @@ -684,7 +677,7 @@ public class DBMetaData } catch (Exception e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); return false; } } @@ -701,9 +694,9 @@ public class DBMetaData xConnectionComponent.dispose(); } getDataSourceInterfaces(); - if (bPasswordIsRequired == false) + if (!bPasswordIsRequired) { - DBConnection = _dataSource.getConnection("", ""); + DBConnection = _dataSource.getConnection(PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING); bgetConnection = true; } else @@ -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); @@ -746,11 +739,11 @@ public class DBMetaData } return bgetConnection; } - catch (Exception exception) + catch (Exception e) { String sMsgConnectionImpossible = oResource.getResText(RID_DB_COMMON + 35); showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMsgConnectionImpossible); - exception.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); return false; } } @@ -767,7 +760,7 @@ public class DBMetaData } catch (SQLException e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); return 0; } } @@ -784,7 +777,7 @@ public class DBMetaData } catch (SQLException e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); return 0; } } @@ -816,7 +809,7 @@ public class DBMetaData } catch (SQLException e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); return false; } } @@ -852,7 +845,7 @@ public class DBMetaData XPropertySet xPSet = UnoRuntime.queryInterface( XPropertySet.class, oQuery ); String s = _oSQLQueryComposer.m_xQueryAnalyzer.getQuery(); - xPSet.setPropertyValue("Command", s); + xPSet.setPropertyValue(PropertyNames.COMMAND, s); XNameContainer xNameCont = UnoRuntime.queryInterface( XNameContainer.class, xQueryDefs ); m_connectionTools.getObjectNames().checkNameForCreate(com.sun.star.sdb.CommandType.QUERY, _QueryName); @@ -877,13 +870,13 @@ public class DBMetaData } exception.printStackTrace(System.out); } - catch (SQLException exception) + catch (SQLException e) { - callSQLErrorMessageDialog(exception, null); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } - catch (Exception exception) + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } return false; } @@ -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) @@ -949,7 +940,7 @@ public class DBMetaData NamedValueCollection creationArgs = new NamedValueCollection(); creationArgs.put( PropertyNames.PROPERTY_NAME, basename ); - creationArgs.put( "URL", documentURL ); + creationArgs.put( PropertyNames.URL, documentURL ); creationArgs.put( "AsTemplate", i_createTemplate ); XMultiServiceFactory xDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, _xDocNameAccess ); Object oDBDocument = xDocMSF.createInstanceWithArguments( "com.sun.star.sdb.DocumentDefinition", creationArgs.getPropertyValues() ); @@ -962,7 +953,7 @@ public class DBMetaData } catch (Exception e) { - e.printStackTrace(); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } } @@ -992,7 +983,7 @@ public class DBMetaData } catch (SQLException e) { - e.printStackTrace(); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); } return sColValues; } @@ -1006,7 +997,7 @@ public class DBMetaData } catch (SQLException e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); return null; } } @@ -1020,7 +1011,7 @@ public class DBMetaData } catch (SQLException e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); return null; } } @@ -1041,7 +1032,7 @@ public class DBMetaData } catch (Exception e) { - e.printStackTrace(System.out); + Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e ); return false; } } 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/QueryMetaData.java b/wizards/com/sun/star/wizards/db/QueryMetaData.java index 5fe6cd55c3a9..f6fe9176086c 100644 --- a/wizards/com/sun/star/wizards/db/QueryMetaData.java +++ b/wizards/com/sun/star/wizards/db/QueryMetaData.java @@ -196,7 +196,7 @@ public class QueryMetaData extends CommandMetaData ArrayList<String> CommandNames = new ArrayList<String>(1); for (int i = 0; i < _FieldNames.length; i++) { - String CurCommandName = ""; + String CurCommandName = PropertyNames.EMPTY_STRING; String[] MetaList = JavaTools.ArrayoutofString(_FieldNames[i], "."); if (MetaList.length > 1) { diff --git a/wizards/com/sun/star/wizards/db/RecordParser.java b/wizards/com/sun/star/wizards/db/RecordParser.java index 6c8ddb5b2c36..9f2c6abbc54f 100644 --- a/wizards/com/sun/star/wizards/db/RecordParser.java +++ b/wizards/com/sun/star/wizards/db/RecordParser.java @@ -44,6 +44,7 @@ import com.sun.star.wizards.common.JavaTools; import com.sun.star.wizards.common.NumberFormatter; import com.sun.star.sdbc.XResultSet; import com.sun.star.task.XInteractionHandler; +import com.sun.star.wizards.common.PropertyNames; public class RecordParser extends QueryMetaData { @@ -78,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) { @@ -217,14 +218,14 @@ public class RecordParser extends QueryMetaData try { Helper.setUnoPropertyValue(xRowSet, "DataSourceName", DataSourceName); - Helper.setUnoPropertyValue(xRowSet, "ActiveConnection", DBConnection); - Helper.setUnoPropertyValue(xRowSet, "Command", Command); - Helper.setUnoPropertyValue(xRowSet, "CommandType", new Integer(_nCommandType)); // CommandType + Helper.setUnoPropertyValue(xRowSet, PropertyNames.ACTIVE_CONNECTION, DBConnection); + 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; @@ -240,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 acf47581d3e2..e5b8cb4b3775 100644 --- a/wizards/com/sun/star/wizards/db/RelationController.java +++ b/wizards/com/sun/star/wizards/db/RelationController.java @@ -33,6 +33,7 @@ import com.sun.star.sdbc.XResultSet; import com.sun.star.sdbc.XRow; import com.sun.star.uno.UnoRuntime; import com.sun.star.wizards.common.JavaTools; +import com.sun.star.wizards.common.PropertyNames; /** * @author bc93774 @@ -72,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); @@ -94,7 +95,7 @@ public class RelationController extends CommandName private Object getCatalogName(CommandName _oCommandName) { String sLocCatalog = _oCommandName.getCatalogName(); - if (sLocCatalog.equals("")) + if (sLocCatalog.equals(PropertyNames.EMPTY_STRING)) { return null; } @@ -113,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 6a4ced428ea6..a6d2c2b1cb00 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) { @@ -369,7 +365,7 @@ public class SQLQueryComposer String AliasName = ""; boolean bAliasNameexists = true; String locAliasName = _TableName; - while (bAliasNameexists == true) + while (bAliasNameexists) { bAliasNameexists = (getComposedCommandByAliasName(locAliasName) != null); if (bAliasNameexists) @@ -395,8 +391,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 0330e518b774..491b724e1f09 100644 --- a/wizards/com/sun/star/wizards/db/TableDescriptor.java +++ b/wizards/com/sun/star/wizards/db/TableDescriptor.java @@ -81,8 +81,8 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen private XColumnsSupplier xKeyColumnSupplier; private XPropertySet xKey; private boolean bIDFieldisInserted = false; - private String IDFieldName = ""; - private String sColumnAlreadyExistsMessage = ""; + private String IDFieldName = PropertyNames.EMPTY_STRING; + private String sColumnAlreadyExistsMessage = PropertyNames.EMPTY_STRING; // private WizardDialog oUnoDialog; private XWindow xWindow; @@ -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) { @@ -319,7 +319,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen { try { - xPropTableDataDescriptor.setPropertyValue(PropertyNames.PROPERTY_NAME, ""); + xPropTableDataDescriptor.setPropertyValue(PropertyNames.PROPERTY_NAME, PropertyNames.EMPTY_STRING); if ((xKeyDrop != null) && (xIndexAccessKeys != null)) { int icount = xIndexAccessKeys.getCount(); @@ -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); @@ -374,7 +374,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen { if (_svalue != null) { - if (!_svalue.equals("")) + if (!_svalue.equals(PropertyNames.EMPTY_STRING)) { try { @@ -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++) { @@ -664,7 +664,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen { if (!hasByName(_columnname)) { - if (_columnname.equals("")) + if (_columnname.equals(PropertyNames.EMPTY_STRING)) { return false; } @@ -694,7 +694,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen try { XPropertySet xColPropertySet = xColumnDataDescriptorFactory.createDataDescriptor(); - IDFieldName = Desktop.getUniqueName(getColumnNames(), _columnname, ""); + IDFieldName = Desktop.getUniqueName(getColumnNames(), _columnname, PropertyNames.EMPTY_STRING); xColPropertySet.setPropertyValue(PropertyNames.PROPERTY_NAME, IDFieldName); int nDataType = oTypeInspector.convertDataType(com.sun.star.sdbc.DataType.INTEGER); @@ -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 1f22801fd8c5..bf1a8c3a483f 100644 --- a/wizards/com/sun/star/wizards/db/TypeInspector.java +++ b/wizards/com/sun/star/wizards/db/TypeInspector.java @@ -38,6 +38,7 @@ import com.sun.star.sdbc.XRow; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.UnoRuntime; import com.sun.star.wizards.common.JavaTools; +import com.sun.star.wizards.common.PropertyNames; public class TypeInspector { @@ -87,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))); @@ -153,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) @@ -230,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; + } } } } @@ -284,7 +278,7 @@ public class TypeInspector */ public String getDefaultTypeName(int _curDataType, Integer precision) { - String ret = ""; + String ret = PropertyNames.EMPTY_STRING; for (int i = 0; i < nDataTypeInfos.length; i++) { if (nDataTypeInfos[i] == _curDataType) diff --git a/wizards/com/sun/star/wizards/document/Control.java b/wizards/com/sun/star/wizards/document/Control.java index b5ec0ec4ff63..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); @@ -145,7 +145,7 @@ public class Control extends Shape public String getControlName(String _fieldname) { - String controlname = ""; + String controlname = PropertyNames.EMPTY_STRING; switch (getControlType()) { case FormHandler.SOLABEL: @@ -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() @@ -338,7 +338,7 @@ public class Control extends Shape } xPropertySet.setPropertyValue("Text", stext); aPreferredSize = getPeer().getPreferredSize(); - xPropertySet.setPropertyValue("Text", ""); + xPropertySet.setPropertyValue("Text", PropertyNames.EMPTY_STRING); } return aPreferredSize; } diff --git a/wizards/com/sun/star/wizards/document/DatabaseControl.java b/wizards/com/sun/star/wizards/document/DatabaseControl.java index e26449bc4632..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 @@ -152,7 +152,7 @@ public class DatabaseControl extends Control return FormHandler.oControlData[i].GridColumnName; } } - return ""; + return PropertyNames.EMPTY_STRING; } public int getControlHeight() @@ -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 17dece81a03e..828ae4fc67f0 100644 --- a/wizards/com/sun/star/wizards/document/FormHandler.java +++ b/wizards/com/sun/star/wizards/document/FormHandler.java @@ -59,9 +59,17 @@ import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.lang.XServiceInfo; import com.sun.star.container.XNamed; +import java.util.logging.Level; +import java.util.logging.Logger; public class FormHandler { + private static final String CHECKBOX = "CheckBox"; + private static final String DATEFIELD = "DateField"; + private static final String FORMATTEDFIELD = "FormattedField"; + private static final String IMAGECONTROL = "ImageControl"; + private static final String TEXTFIELD = "TextField"; + private static final String TIMEFIELD = "TimeField"; public XFormsSupplier xFormsSupplier; public XMultiServiceFactory xMSFDoc; @@ -108,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"; @@ -124,30 +132,30 @@ public class FormHandler sModelServices[SOIMAGECONTROL] = "com.sun.star.form.component.DatabaseImageControl"; oControlData = new ControlData[22]; - oControlData[0] = createControlData(DataType.BIT, SOCHECKBOX, "CheckBox", "CheckBox", false); - oControlData[1] = createControlData(DataType.BOOLEAN, SOCHECKBOX, "CheckBox", "CheckBox", false); - oControlData[2] = createControlData(DataType.TINYINT, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[3] = createControlData(DataType.SMALLINT, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[4] = createControlData(DataType.INTEGER, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[5] = createControlData(DataType.BIGINT, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[6] = createControlData(DataType.FLOAT, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[7] = createControlData(DataType.REAL, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[8] = createControlData(DataType.DOUBLE, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[9] = createControlData(DataType.NUMERIC, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[10] = createControlData(DataType.DECIMAL, SONUMERICCONTROL, "FormattedField", "FormattedField", false); - oControlData[11] = createControlData(DataType.CHAR, SOTEXTBOX, "TextField", "TextField", false); - oControlData[12] = createControlData(DataType.VARCHAR, SOTEXTBOX, "TextField", "TextField", true); - oControlData[13] = createControlData(DataType.LONGVARCHAR, SOTEXTBOX, "TextField", "TextField", true); - oControlData[14] = createControlData(DataType.DATE, SODATECONTROL, "DateField", "DateField", false); - oControlData[15] = createControlData(DataType.TIME, SOTIMECONTROL, "TimeField", "TimeField", false); - oControlData[16] = createControlData(DataType.TIMESTAMP, SODATECONTROL, "DateField", "TextField", false); + oControlData[0] = createControlData(DataType.BIT, SOCHECKBOX, CHECKBOX, CHECKBOX, false); + oControlData[1] = createControlData(DataType.BOOLEAN, SOCHECKBOX, CHECKBOX, CHECKBOX, false); + oControlData[2] = createControlData(DataType.TINYINT, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false); + oControlData[3] = createControlData(DataType.SMALLINT, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false); + oControlData[4] = createControlData(DataType.INTEGER, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false); + oControlData[5] = createControlData(DataType.BIGINT, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false); + oControlData[6] = createControlData(DataType.FLOAT, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false); + oControlData[7] = createControlData(DataType.REAL, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false); + oControlData[8] = createControlData(DataType.DOUBLE, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false); + oControlData[9] = createControlData(DataType.NUMERIC, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false); + oControlData[10] = createControlData(DataType.DECIMAL, SONUMERICCONTROL, FORMATTEDFIELD, FORMATTEDFIELD, false); + oControlData[11] = createControlData(DataType.CHAR, SOTEXTBOX, TEXTFIELD, TEXTFIELD, false); + oControlData[12] = createControlData(DataType.VARCHAR, SOTEXTBOX, TEXTFIELD, TEXTFIELD, true); + oControlData[13] = createControlData(DataType.LONGVARCHAR, SOTEXTBOX, TEXTFIELD, TEXTFIELD, true); + oControlData[14] = createControlData(DataType.DATE, SODATECONTROL, DATEFIELD, DATEFIELD, false); + oControlData[15] = createControlData(DataType.TIME, SOTIMECONTROL, TIMEFIELD, TIMEFIELD, false); + oControlData[16] = createControlData(DataType.TIMESTAMP, SODATECONTROL, DATEFIELD, TEXTFIELD, false); // oImageControlData = new ControlData[4]; - oControlData[17] = createControlData(DataType.BINARY, SOIMAGECONTROL, "ImageControl", "TextField", false); - oControlData[18] = createControlData(DataType.VARBINARY, SOIMAGECONTROL, "ImageControl", "TextField", false); - oControlData[19] = createControlData(DataType.LONGVARBINARY, SOIMAGECONTROL, "ImageControl", "TextField", false); - oControlData[20] = createControlData(DataType.BLOB, SOIMAGECONTROL, "ImageControl", "TextField", false); + oControlData[17] = createControlData(DataType.BINARY, SOIMAGECONTROL, IMAGECONTROL, TEXTFIELD, false); + oControlData[18] = createControlData(DataType.VARBINARY, SOIMAGECONTROL, IMAGECONTROL, TEXTFIELD, false); + oControlData[19] = createControlData(DataType.LONGVARBINARY, SOIMAGECONTROL, IMAGECONTROL, TEXTFIELD, false); + oControlData[20] = createControlData(DataType.BLOB, SOIMAGECONTROL, IMAGECONTROL, TEXTFIELD, false); - oControlData[21] = createControlData(DataType.OTHER, SOIMAGECONTROL, "ImageControl", "TextField", false); + oControlData[21] = createControlData(DataType.OTHER, SOIMAGECONTROL, IMAGECONTROL, TEXTFIELD, false); } public int getControlType(int _fieldtype) @@ -156,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; @@ -184,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); @@ -209,8 +216,7 @@ public class FormHandler public XNameContainer getDocumentForms() { - XNameContainer xNamedForms = xFormsSupplier.getForms(); - return xNamedForms; + return xFormsSupplier.getForms(); } public String getValueofHiddenControl(XNameAccess xNamedForm, String ControlName, String sMsg) throws com.sun.star.wizards.document.FormHandler.UnknownHiddenControlException @@ -219,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 { @@ -238,7 +243,7 @@ public class FormHandler try { XInterface xHiddenControl; - if (xNameAccess.hasByName(ControlName) == true) + if (xNameAccess.hasByName(ControlName)) { xHiddenControl = (XInterface) AnyConverter.toObject(new Type(XInterface.class), xNameAccess.getByName(ControlName)); } @@ -249,9 +254,9 @@ public class FormHandler } Helper.setUnoPropertyValue(xHiddenControl, "HiddenValue", ControlValue); } - catch (Exception exception) + catch (Exception ex) { - exception.printStackTrace(System.out); + Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, ex); } } @@ -260,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>"); @@ -271,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); } @@ -285,9 +290,9 @@ public class FormHandler xNamedFormContainer.removeByName(_FormName); } } - catch (com.sun.star.uno.Exception exception) + catch (com.sun.star.uno.Exception ex) { - exception.printStackTrace(System.out); + Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, ex); } } @@ -299,14 +304,14 @@ 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); } } } catch (Exception e) { - e.printStackTrace(System.out); + Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e); } } @@ -318,26 +323,26 @@ public class FormHandler } catch ( WrappedTargetException e ) { - e.printStackTrace( System.err ); + Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e); } catch( final NoSuchElementException e ) { - e.printStackTrace( System.err ); + Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e); } } 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); } @@ -355,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 @@ -363,9 +368,9 @@ public class FormHandler return getFormByName(_FormName); } } - catch (com.sun.star.uno.Exception exception) + catch (com.sun.star.uno.Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e); return null; } } @@ -388,12 +393,12 @@ 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) { - e.printStackTrace(System.out); + Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e); } return xNamedForm; } @@ -484,13 +489,13 @@ 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)); } } catch (Exception e) { - e.printStackTrace(System.out); + Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e); } } @@ -498,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); } } @@ -510,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 @@ -518,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); @@ -531,14 +536,14 @@ 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); } catch (Exception e) { - e.printStackTrace(System.out); + Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e); return null; } } @@ -583,12 +588,12 @@ 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 ex) + catch (Exception e) { - ex.printStackTrace(System.out); + Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e); } } } diff --git a/wizards/com/sun/star/wizards/document/GridControl.java b/wizards/com/sun/star/wizards/document/GridControl.java index ef13d5c12a66..284dc5ef4309 100644 --- a/wizards/com/sun/star/wizards/document/GridControl.java +++ b/wizards/com/sun/star/wizards/document/GridControl.java @@ -76,7 +76,7 @@ public class GridControl extends Shape FieldColumn curfieldcolumn = fieldcolumns[i]; if (curfieldcolumn.getFieldType() == DataType.TIMESTAMP) { - TimeStampControl oControl = new TimeStampControl(new Resource(_xMSF, "", "dbw"), this, curfieldcolumn); + TimeStampControl oControl = new TimeStampControl(new Resource(_xMSF, PropertyNames.EMPTY_STRING, "dbw"), this, curfieldcolumn); } else { diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.java b/wizards/com/sun/star/wizards/document/OfficeDocument.java index ea132453bb30..074ff5350a39 100644 --- a/wizards/com/sun/star/wizards/document/OfficeDocument.java +++ b/wizards/com/sun/star/wizards/document/OfficeDocument.java @@ -81,13 +81,13 @@ 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"; oEventProperties[0].Value = EventType; // "Service", "StarBasic" oEventProperties[1] = new PropertyValue(); - oEventProperties[1].Name = "Script"; //"URL"; + oEventProperties[1].Name = "Script"; //PropertyNames.URL; oEventProperties[1].Value = EventURL; xEventsSuppl.getEvents().replaceByName(EventName, oEventProperties); } @@ -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()) { @@ -131,7 +131,7 @@ public class OfficeDocument PropertyValue[] loadValues = new PropertyValue[2]; loadValues[0] = new PropertyValue(); - loadValues[0].Name = "ReadOnly"; + loadValues[0].Name = PropertyNames.READ_ONLY; loadValues[0].Value = readonly ? Boolean.TRUE : Boolean.FALSE; loadValues[1] = new PropertyValue(); loadValues[1].Name = "Preview"; @@ -144,18 +144,18 @@ public class OfficeDocument try { - xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, frame); - /*if (frame.getName() == null || frame.getName().equals("")); + 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); } } @@ -389,13 +389,13 @@ public class OfficeDocument PropertyValue[][] mediaDescr = new PropertyValue[1][1]; mediaDescr[0][0] = new PropertyValue(); - mediaDescr[0][0].Name = "URL"; + 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); - if (type.equals("")) + 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 88733ee883c1..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) @@ -105,8 +104,8 @@ public class TimeStampControl extends DatabaseControl oResource = _oResource; sDateAppendix = oResource.getResText(UIConsts.RID_FORM + 88); sTimeAppendix = oResource.getResText(UIConsts.RID_FORM + 89); - oDateControl = new DatabaseControl(_oGridControl, _curfieldcolumn, DataType.DATE, _curfieldcolumn.getFieldTitle() + " " + sDateAppendix); - oTimeControl = new DatabaseControl(_oGridControl, _curfieldcolumn, DataType.TIME, _curfieldcolumn.getFieldTitle() + " " + sTimeAppendix); + oDateControl = new DatabaseControl(_oGridControl, _curfieldcolumn, DataType.DATE, _curfieldcolumn.getFieldTitle() + PropertyNames.SPACE + sDateAppendix); + oTimeControl = new DatabaseControl(_oGridControl, _curfieldcolumn, DataType.TIME, _curfieldcolumn.getFieldTitle() + PropertyNames.SPACE + sTimeAppendix); } public void setPropertyValue(String _sPropertyName, Object _aPropertyValue) throws Exception diff --git a/wizards/com/sun/star/wizards/fax/CallWizard.java b/wizards/com/sun/star/wizards/fax/CallWizard.java index 69e061f95918..fd0ad8307a4e 100644 --- a/wizards/com/sun/star/wizards/fax/CallWizard.java +++ b/wizards/com/sun/star/wizards/fax/CallWizard.java @@ -38,6 +38,7 @@ import com.sun.star.registry.XRegistryKey; import com.sun.star.task.XJob; import com.sun.star.task.XJobExecutor; import com.sun.star.uno.Type; +import com.sun.star.wizards.common.PropertyNames; /** * This class capsulates the class, that implements the minimal component, a factory for @@ -105,7 +106,7 @@ public class CallWizard */ public void trigger(String str) { - if (str.equalsIgnoreCase("start")) + if (str.equalsIgnoreCase(PropertyNames.START)) { FaxWizardDialogImpl lw = new FaxWizardDialogImpl(xmultiservicefactory); if (!FaxWizardDialogImpl.running) @@ -189,7 +190,7 @@ public class CallWizard try { - byteReturn = ("" + this.hashCode()).getBytes(); + byteReturn = (PropertyNames.EMPTY_STRING + this.hashCode()).getBytes(); } catch (Exception exception) { diff --git a/wizards/com/sun/star/wizards/fax/FaxDocument.java b/wizards/com/sun/star/wizards/fax/FaxDocument.java index 7cb8178d3264..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(); } @@ -153,7 +152,7 @@ public class FaxDocument extends TextDocument } else { - myFieldHandler.changeUserFieldContent(sFieldName, ""); + myFieldHandler.changeUserFieldContent(sFieldName, PropertyNames.EMPTY_STRING); } } @@ -179,7 +178,7 @@ public class FaxDocument extends TextDocument public void killEmptyUserFields() { TextFieldHandler myFieldHandler = new TextFieldHandler(xMSF, xTextDocument); - myFieldHandler.removeUserFieldByContent(""); + myFieldHandler.removeUserFieldByContent(PropertyNames.EMPTY_STRING); } public void killEmptyFrames() diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.java b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.java index b249bdd76035..02ccab6b177e 100644 --- a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.java +++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.java @@ -179,7 +179,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD lblTitle1 = insertLabel("lblTitle1", new String[] { - "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -305,7 +305,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD lblTitle3 = insertLabel("lblTitle3", new String[] { - "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -453,7 +453,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD lblTitle4 = insertLabel("lblTitle4", new String[] { - "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -511,7 +511,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD lblFooter = insertLabel("lblFooter", new String[] { - "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.FONT_DESCRIPTOR, 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[] { @@ -520,7 +520,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD lblTitle5 = insertLabel("lblTitle5", new String[] { - "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -617,7 +617,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD lblTitle6 = insertLabel("lblTitle6", new String[] { - "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java index 8ee9f0472c57..8f9cf8107c7f 100644 --- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java +++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java @@ -162,13 +162,13 @@ public class FaxWizardDialogImpl extends FaxWizardDialog //update the dialog UI according to the loaded Configuration updateUI(); - if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase("")) + if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(PropertyNames.EMPTY_STRING)) { myPathSelection.initializePath(); } 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() @@ -217,7 +216,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog //myFaxDoc.xTextDocument.lockControllers(); FileAccess fileAccess = new FileAccess(xMSF); sPath = myPathSelection.getSelectedPath(); - if (sPath.equals("")) + if (sPath.equals(PropertyNames.EMPTY_STRING)) { myPathSelection.triggerPathPicker(); sPath = myPathSelection.getSelectedPath(); @@ -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,11 +351,11 @@ 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(); - GraphicValues[0].Name = "URL"; + GraphicValues[0].Name = PropertyNames.URL; GraphicValues[0].Value = "private:resource/svx/imagelist/18000/18022"; XGraphic xGraphic = xGraphicProvider.queryGraphic(GraphicValues); @@ -380,7 +379,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog try { sTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard"); - sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", ""); + sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", PropertyNames.EMPTY_STRING); sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../wizard/bitmap"); } catch (NoValidPathException e) @@ -395,19 +394,19 @@ public class FaxWizardDialogImpl extends FaxWizardDialog { String sFaxSubPath = "/wizard/fax"; sFaxPath = FileAccess.combinePaths(xMSF, sTemplatePath, sFaxSubPath); - sWorkPath = FileAccess.getOfficePath(xMSF, "Work", "", ""); + sWorkPath = FileAccess.getOfficePath(xMSF, "Work", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING); BusinessFiles = FileAccess.getFolderTitles(xMSF, "bus", sFaxPath); PrivateFiles = FileAccess.getFolderTitles(xMSF, "pri", sFaxPath); - setControlProperty("lstBusinessStyle", "StringItemList", BusinessFiles[0]); - setControlProperty("lstPrivateStyle", "StringItemList", PrivateFiles[0]); + setControlProperty("lstBusinessStyle", PropertyNames.STRING_ITEM_LIST, BusinessFiles[0]); + setControlProperty("lstPrivateStyle", PropertyNames.STRING_ITEM_LIST, PrivateFiles[0]); - setControlProperty("lstBusinessStyle", "SelectedItems", new short[] + setControlProperty("lstBusinessStyle", PropertyNames.SELECTED_ITEMS, new short[] { 0 }); - setControlProperty("lstPrivateStyle", "SelectedItems", new short[] + setControlProperty("lstPrivateStyle", PropertyNames.SELECTED_ITEMS, new short[] { 0 }); @@ -424,42 +423,42 @@ 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(); } public void initializeSalutation() { - setControlProperty("lstSalutation", "StringItemList", resources.SalutationLabels); + setControlProperty("lstSalutation", PropertyNames.STRING_ITEM_LIST, resources.SalutationLabels); } public void initializeGreeting() { - setControlProperty("lstGreeting", "StringItemList", resources.GreetingLabels); + setControlProperty("lstGreeting", PropertyNames.STRING_ITEM_LIST, resources.GreetingLabels); } public void initializeCommunication() { - setControlProperty("lstCommunicationType", "StringItemList", resources.CommunicationLabels); + setControlProperty("lstCommunicationType", PropertyNames.STRING_ITEM_LIST, resources.CommunicationLabels); } private void setDefaultForGreetingAndSalutationAndCommunication() { XTextComponent xTextComponent; - xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation); - if (xTextComponent.getText().equals("")) + 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); - if (xTextComponent.getText().equals("")) + 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); - if (xTextComponent.getText().equals("")) + 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 0538eb5fa1b3..543a521c6ce7 100644 --- a/wizards/com/sun/star/wizards/form/CallFormWizard.java +++ b/wizards/com/sun/star/wizards/form/CallFormWizard.java @@ -29,6 +29,7 @@ package com.sun.star.wizards.form; import com.sun.star.beans.PropertyValue; import com.sun.star.uno.Type; import com.sun.star.wizards.common.Properties; +import com.sun.star.wizards.common.PropertyNames; /** This class capsulates the class, that implements the minimal component, a * factory for creating the service (<CODE>__getServiceFactory</CODE>). @@ -81,7 +82,7 @@ public class CallFormWizard { try { - if (sEvent.compareTo("start") == 0) + if (sEvent.compareTo(PropertyNames.START) == 0) { FormWizard CurFormWizard = new FormWizard( m_serviceFactory, m_wizardContext ); CurFormWizard.startFormWizard(); @@ -159,7 +160,7 @@ public class CallFormWizard try { - byteReturn = new 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 056d06934f55..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); - sSlaveListHeader = CurUnoDialog.m_oResource.getResArray(UIConsts.RID_FORM + 20, 4); //new String[rowcount];""; //CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40); - sMasterListHeader = CurUnoDialog.m_oResource.getResArray(UIConsts.RID_FORM + 24, 4);// new String[rowcount];""; //CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40); + 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,14 +197,14 @@ 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]), "SelectedItems", new short[] { 0 }); - Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[i]), "SelectedItems", new short[] { 0 }); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[i]), PropertyNames.SELECTED_ITEMS, new short[] { 0 }); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[i]), PropertyNames.SELECTED_ITEMS, new short[] { 0 }); } } } @@ -225,11 +216,11 @@ public class FieldLinker extends DBLimitedFieldSelection if ((iNextMasterItemPos != 0) && (iNextSlaveItemPos != 0)) { - Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[curindex]), "SelectedItems", new short[] {iNextMasterItemPos }); - Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[curindex]), "SelectedItems", new short[] {iNextSlaveItemPos}); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[curindex]), PropertyNames.SELECTED_ITEMS, new short[] {iNextMasterItemPos }); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[curindex]), PropertyNames.SELECTED_ITEMS, new short[] {iNextSlaveItemPos}); - Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[curindex + 1]), "SelectedItems", new short[] { 0 }); - Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[curindex + 1]), "SelectedItems", new short[] { 0 }); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[curindex + 1]), PropertyNames.SELECTED_ITEMS, new short[] { 0 }); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[curindex + 1]), PropertyNames.SELECTED_ITEMS, new short[] { 0 }); toggleControlRow(curindex, true); } } @@ -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 997b9a885676..7cd25f012cd6 100644 --- a/wizards/com/sun/star/wizards/form/Finalizer.java +++ b/wizards/com/sun/star/wizards/form/Finalizer.java @@ -73,7 +73,7 @@ public class Finalizer }, new Object[] { - UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGFORM_TXTPATH", 97, 35, UIConsts.INTEGERS[8], new Short((short) 82), "", 185 + UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGFORM_TXTPATH", 97, 35, UIConsts.INTEGERS[8], new Short((short) 82), PropertyNames.EMPTY_STRING, 185 }); CurUnoDialog.insertLabel("lblProceed", new String[] @@ -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 f8cc43a1833b..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(); } @@ -161,10 +161,10 @@ public class FormConfiguration oRelationController = _oRelationController; sreferencedTables = oRelationController.getExportedKeys(); bsupportsRelations = (sreferencedTables.length > 0); - Helper.setUnoPropertyValue(UnoDialog.getModel(lstRelations), "StringItemList", sreferencedTables); + 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() @@ -195,7 +195,7 @@ public class FormConfiguration { if (areexistingRelationsdefined()) { - short[] iselected = (short[]) Helper.getUnoArrayPropertyValue(UnoDialog.getModel(lstRelations), "SelectedItems"); + short[] iselected = (short[]) Helper.getUnoArrayPropertyValue(UnoDialog.getModel(lstRelations), PropertyNames.SELECTED_ITEMS); if (iselected != null) { if (iselected.length > 0) @@ -204,7 +204,7 @@ public class FormConfiguration } } } - return ""; + return PropertyNames.EMPTY_STRING; } public void onexistingRelationSelection() @@ -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 8d76f65f6435..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; } @@ -363,7 +363,7 @@ public class FormControlArranger m_currentMaxRowHeight = 0; nSecMaxRowY = 0; m_maxPostionX = 0; - xProgressBar.start("", FieldColumns.length); + xProgressBar.start(PropertyNames.EMPTY_STRING, FieldColumns.length); for (int i = 0; i < FieldColumns.length; i++) { try @@ -596,7 +596,7 @@ public class FormControlArranger { curLabelControl.setSize(new Size(m_LabelWidth, m_LabelHeight)); } -// if (CurHelpText != ""){ +// if (CurHelpText != PropertyNames.EMPTY_STRING){ // oModel.HelpText = CurHelptext; // } } @@ -630,7 +630,7 @@ public class FormControlArranger if (DBControlList[i].getControlType() == FormHandler.SOCHECKBOX) { // Checkboxes have no Label near by - DBControlList[i].setPropertyValue(PropertyNames.PROPERTY_LABEL, ""); + DBControlList[i].setPropertyValue(PropertyNames.PROPERTY_LABEL, PropertyNames.EMPTY_STRING); } } } diff --git a/wizards/com/sun/star/wizards/form/FormDocument.java b/wizards/com/sun/star/wizards/form/FormDocument.java index 8749f2ce39e8..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(); @@ -316,7 +314,7 @@ public class FormDocument extends TextDocument ControlForm oSubControlForm = getControlFormByName(SOSUBFORM); oSubControlForm.setFormProperties(aFormProperties, oSubFormDBMetaData); String sRefTableName = _curFormConfiguration.getreferencedTableName(); - if (sRefTableName.equals("")) + if (sRefTableName.equals(PropertyNames.EMPTY_STRING)) { LinkFieldNames = _curFieldLinker.getLinkFieldNames(); } @@ -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; @@ -512,8 +510,8 @@ public class FormDocument extends TextDocument try { xPropertySet.setPropertyValue("DataSourceName", getDataSourceName()); - xPropertySet.setPropertyValue("Command", _oDBMetaData.getCommandName()); - xPropertySet.setPropertyValue("CommandType", new Integer(_oDBMetaData.getCommandType())); + xPropertySet.setPropertyValue(PropertyNames.COMMAND, _oDBMetaData.getCommandName()); + xPropertySet.setPropertyValue(PropertyNames.COMMAND_TYPE, new Integer(_oDBMetaData.getCommandType())); for (int i = 0; i < _aPropertySetList.length; i++) { xPropertySet.setPropertyValue(_aPropertySetList[i].Name, _aPropertySetList[i].Value); diff --git a/wizards/com/sun/star/wizards/form/FormWizard.java b/wizards/com/sun/star/wizards/form/FormWizard.java index bc49311be433..cff52f46229b 100644 --- a/wizards/com/sun/star/wizards/form/FormWizard.java +++ b/wizards/com/sun/star/wizards/form/FormWizard.java @@ -56,8 +56,8 @@ public class FormWizard extends DatabaseObjectWizard private Finalizer curFinalizer; private static String slblFields; private static String slblSelFields; - private String sShowBinaryFields = ""; - private String serrFormNameexists = ""; + private String sShowBinaryFields = PropertyNames.EMPTY_STRING; + private String serrFormNameexists = PropertyNames.EMPTY_STRING; public static final int SOMAIN_PAGE = 1; public static final int SOSUBFORM_PAGE = 2; public static final int SOSUBFORMFIELDS_PAGE = 3; @@ -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); } @@ -343,7 +343,7 @@ public class FormWizard extends DatabaseObjectWizard { curFormDocument.oSubFormDBMetaData.getConnection(new PropertyValue[] { - Properties.createProperty("ActiveConnection", curFormDocument.oMainFormDBMetaData.DBConnection) + Properties.createProperty(PropertyNames.ACTIVE_CONNECTION, curFormDocument.oMainFormDBMetaData.DBConnection) }); curFormDocument.xProgressBar.setValue(20); buildSteps(); @@ -398,7 +398,7 @@ public class FormWizard extends DatabaseObjectWizard ID = 1; if (sIncSuffix != null) { - if ((!sIncSuffix.equals("")) && (!sIncSuffix.equals("_"))) + if ((!sIncSuffix.equals(PropertyNames.EMPTY_STRING)) && (!sIncSuffix.equals("_"))) { String sID = JavaTools.ArrayoutofString(sIncSuffix, "_")[1]; ID = Integer.parseInt(sID); @@ -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 3ce766717c07..9f6f6d6160dd 100644 --- a/wizards/com/sun/star/wizards/form/StyleApplier.java +++ b/wizards/com/sun/star/wizards/form/StyleApplier.java @@ -122,7 +122,7 @@ public class StyleApplier lstStyles = CurUnoDialog.insertListBox("lstStyles", null, SCHANGELAYOUT, this, new String[] { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "SelectedItems", PropertyNames.PROPERTY_STEP, "StringItemList", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.SELECTED_ITEMS, PropertyNames.PROPERTY_STEP, PropertyNames.STRING_ITEM_LIST, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -177,7 +177,7 @@ public class StyleApplier /* public void initialize(short _iStyleindex){ if (_iStyleindex < lstStyles.getItemCount()){ - Helper.setUnoPropertyValue(UnoDialog.getModel(lstStyles), "SelectedItems", new short[]{_iStyleindex}); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstStyles), PropertyNames.SELECTED_ITEMS, new short[]{_iStyleindex}); applyStyle(true, false); } } @@ -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]; @@ -208,7 +208,7 @@ public class StyleApplier { try { - short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(lstStyles), "SelectedItems")); + short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(lstStyles), PropertyNames.SELECTED_ITEMS)); if (SelFields != null) { return SelFields[0]; @@ -331,7 +331,7 @@ public class StyleApplier int index = JavaTools.FieldInList(_sDataList, _sHeader); if (index > -1) { - String sPropName = ""; + String sPropName = PropertyNames.EMPTY_STRING; int iStyleColor; while (((sPropName.indexOf("}") < 0) && (index < _sDataList.length - 1))) { @@ -345,8 +345,8 @@ public class StyleApplier sPropValue = sPropValue.trim(); if (sPropValue.indexOf("#") > 0) { - sPropValue = JavaTools.replaceSubString(sPropValue, "", ";"); - sPropValue = JavaTools.replaceSubString(sPropValue, "", " "); + sPropValue = JavaTools.replaceSubString(sPropValue, PropertyNames.EMPTY_STRING, PropertyNames.SEMI_COLON); + sPropValue = JavaTools.replaceSubString(sPropValue, PropertyNames.EMPTY_STRING, PropertyNames.SPACE); return Integer.decode(sPropValue).intValue(); } } @@ -367,7 +367,7 @@ public class StyleApplier try { // TODO: check different languages in header layouts - aStylePaths = FileAccess.getOfficePaths(getMSF(), "Config", "", ""); + aStylePaths = FileAccess.getOfficePaths(getMSF(), "Config", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING); FileAccess.combinePaths(getMSF(), aStylePaths, "/wizard/form/styles"); String[][] LayoutFiles = FileAccess.getFolderTitles(getMSF(), null, aStylePaths, ".css"); @@ -384,10 +384,10 @@ public class StyleApplier private String getStylePath() { // TODO: umstellen auf mehrere Pfade - String StylesPath = ""; + String StylesPath = PropertyNames.EMPTY_STRING; try { - StylesPath = FileAccess.getOfficePath(xMSF, "Config", "", ""); + StylesPath = FileAccess.getOfficePath(xMSF, "Config", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING); StylesPath = FileAccess.combinePaths(xMSF, StylesPath, "/wizard/form/styles"); } catch (NoValidPathException e) diff --git a/wizards/com/sun/star/wizards/form/UIControlArranger.java b/wizards/com/sun/star/wizards/form/UIControlArranger.java index cbab5c8c8ae6..82a063c1bb7d 100644 --- a/wizards/com/sun/star/wizards/form/UIControlArranger.java +++ b/wizards/com/sun/star/wizards/form/UIControlArranger.java @@ -191,7 +191,7 @@ public class UIControlArranger { if (listItem == null) { - return ""; + return PropertyNames.EMPTY_STRING; } return HelpTexts[((Integer) listItem).intValue()]; @@ -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/CallWizard.java b/wizards/com/sun/star/wizards/letter/CallWizard.java index ff993c61e506..250d59aea19f 100644 --- a/wizards/com/sun/star/wizards/letter/CallWizard.java +++ b/wizards/com/sun/star/wizards/letter/CallWizard.java @@ -38,6 +38,7 @@ import com.sun.star.registry.XRegistryKey; import com.sun.star.task.XJob; import com.sun.star.task.XJobExecutor; import com.sun.star.uno.Type; +import com.sun.star.wizards.common.PropertyNames; /** * This class capsulates the class, that implements the minimal component, a factory for @@ -105,7 +106,7 @@ public class CallWizard */ public void trigger(String str) { - if (str.equalsIgnoreCase("start")) + if (str.equalsIgnoreCase(PropertyNames.START)) { LetterWizardDialogImpl lw = new LetterWizardDialogImpl(xmultiservicefactory); if (!LetterWizardDialogImpl.running) @@ -189,7 +190,7 @@ public class CallWizard try { - byteReturn = ("" + this.hashCode()).getBytes(); + byteReturn = (PropertyNames.EMPTY_STRING + this.hashCode()).getBytes(); } catch (Exception exception) { diff --git a/wizards/com/sun/star/wizards/letter/LetterDocument.java b/wizards/com/sun/star/wizards/letter/LetterDocument.java index 3160ff1ed011..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(); } @@ -158,7 +157,7 @@ public class LetterDocument extends TextDocument } else { - myFieldHandler.changeUserFieldContent(sFieldName, ""); + myFieldHandler.changeUserFieldContent(sFieldName, PropertyNames.EMPTY_STRING); } } @@ -183,7 +182,7 @@ public class LetterDocument extends TextDocument public void killEmptyUserFields() { TextFieldHandler myFieldHandler = new TextFieldHandler(xMSF, xTextDocument); - myFieldHandler.removeUserFieldByContent(""); + myFieldHandler.removeUserFieldByContent(PropertyNames.EMPTY_STRING); } public void killEmptyFrames() @@ -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/LetterWizardDialog.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java index c8de529d2d41..2f3f87f244ff 100644 --- a/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java +++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java @@ -246,7 +246,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW lblTitle1 = insertLabel("lblTitle1", new String[] { - "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -499,7 +499,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW lblTitle2 = insertLabel("lblTitle2", new String[] { - "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -620,7 +620,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW lblTitle3 = insertLabel("lblTitle3", new String[] { - "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -768,7 +768,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW lblTitle4 = insertLabel("lblTitle4", new String[] { - "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -808,7 +808,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW lblFooter = insertLabel("lblFooter", new String[] { - "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -817,7 +817,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW lblTitle5 = insertLabel("lblTitle5", new String[] { - "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -902,7 +902,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW lblTitle6 = insertLabel("lblTitle6", new String[] { - "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java index 295d900bdec6..a7198b6ba955 100644 --- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java +++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java @@ -177,27 +177,27 @@ public class LetterWizardDialogImpl extends LetterWizardDialog myConfig.cp_PrivateLetter.cp_Norm = oL; initializeTemplates(xMSF); - if (myConfig.cp_BusinessLetter.cp_Greeting.equals("")) + if (myConfig.cp_BusinessLetter.cp_Greeting.equals(PropertyNames.EMPTY_STRING)) { myConfig.cp_BusinessLetter.cp_Greeting = resources.GreetingLabels[0]; } - if (myConfig.cp_BusinessLetter.cp_Salutation.equals("")) + if (myConfig.cp_BusinessLetter.cp_Salutation.equals(PropertyNames.EMPTY_STRING)) { myConfig.cp_BusinessLetter.cp_Salutation = resources.SalutationLabels[0]; } - if (myConfig.cp_PrivateOfficialLetter.cp_Greeting.equals("")) + if (myConfig.cp_PrivateOfficialLetter.cp_Greeting.equals(PropertyNames.EMPTY_STRING)) { myConfig.cp_PrivateOfficialLetter.cp_Greeting = resources.GreetingLabels[1]; } - if (myConfig.cp_PrivateOfficialLetter.cp_Salutation.equals("")) + if (myConfig.cp_PrivateOfficialLetter.cp_Salutation.equals(PropertyNames.EMPTY_STRING)) { myConfig.cp_PrivateOfficialLetter.cp_Salutation = resources.SalutationLabels[1]; } - if (myConfig.cp_PrivateLetter.cp_Greeting.equals("")) + if (myConfig.cp_PrivateLetter.cp_Greeting.equals(PropertyNames.EMPTY_STRING)) { myConfig.cp_PrivateLetter.cp_Greeting = resources.GreetingLabels[2]; } - if (myConfig.cp_PrivateLetter.cp_Salutation.equals("")) + if (myConfig.cp_PrivateLetter.cp_Salutation.equals(PropertyNames.EMPTY_STRING)) { myConfig.cp_PrivateLetter.cp_Salutation = resources.SalutationLabels[2]; } @@ -205,13 +205,13 @@ public class LetterWizardDialogImpl extends LetterWizardDialog //update the dialog UI according to the loaded Configuration updateUI(); - if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase("")) + if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(PropertyNames.EMPTY_STRING)) { myPathSelection.initializePath(); } 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() @@ -258,7 +257,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog //myLetterDoc.xTextDocument.lockControllers(); FileAccess fileAccess = new FileAccess(xMSF); sPath = myPathSelection.getSelectedPath(); - if (sPath.equals("")) + if (sPath.equals(PropertyNames.EMPTY_STRING)) { myPathSelection.triggerPathPicker(); sPath = myPathSelection.getSelectedPath(); @@ -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) @@ -383,7 +382,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog lstBusinessStyleItemChanged(); enableSenderReceiver(); setPossibleFooter(true); - if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase("")) + if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(PropertyNames.EMPTY_STRING)) { myPathSelection.initializePath(); } @@ -403,7 +402,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog disableBusinessPaper(); enableSenderReceiver(); setPossibleFooter(true); - if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase("")) + if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(PropertyNames.EMPTY_STRING)) { myPathSelection.initializePath(); } @@ -423,7 +422,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog disableBusinessPaper(); disableSenderReceiver(); setPossibleFooter(false); - if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase("")) + if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(PropertyNames.EMPTY_STRING)) { myPathSelection.initializePath(); } @@ -687,7 +686,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog //Height of the Company Address in the Receiver Field int iReceiverHeight = (int) (0.5 * 1000); - BusCompanyAddressReceiver = myLetterDoc.new BusinessPaperObject(" ", iFrameWidth, iReceiverHeight, iFrameX, (iFrameY - iReceiverHeight)); + BusCompanyAddressReceiver = myLetterDoc.new BusinessPaperObject(PropertyNames.SPACE, iFrameWidth, iReceiverHeight, iFrameX, (iFrameY - iReceiverHeight)); setPossibleAddressReceiver(false); } @@ -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,21 +931,21 @@ 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); - if (xTextComponent.getText().equals("")) + 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); - if (xTextComponent.getText().equals("")) + 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)); } } @@ -1099,12 +1098,12 @@ public class LetterWizardDialogImpl extends LetterWizardDialog public void initializeSalutation() { - setControlProperty("lstSalutation", "StringItemList", resources.SalutationLabels); + setControlProperty("lstSalutation", PropertyNames.STRING_ITEM_LIST, resources.SalutationLabels); } public void initializeGreeting() { - setControlProperty("lstGreeting", "StringItemList", resources.GreetingLabels); + setControlProperty("lstGreeting", PropertyNames.STRING_ITEM_LIST, resources.GreetingLabels); } public void initializeNorms() @@ -1114,19 +1113,19 @@ public class LetterWizardDialogImpl extends LetterWizardDialog String[] allLocales = lc.getIDs(); Object[] nameList = { - "", "" + PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING }; String[] nameList1 = { - "", "" + PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING }; String[] nameList1b = { - "", "" + PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING }; String[] nameList2 = { - "", "" + PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING }; Vector allPaths = new Vector(); String sLetterSubPath = "/wizard/letter/"; @@ -1135,7 +1134,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog { sTemplatePath = FileAccess.deleteLastSlashfromUrl(sTemplatePath); String[] PathParts = sTemplatePath.split("/"); - String nuString = ""; + String nuString = PropertyNames.EMPTY_STRING; String sMainPath; for (int i = 0; i < (PathParts.length - 1); i++) { @@ -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++) @@ -1212,8 +1211,8 @@ public class LetterWizardDialogImpl extends LetterWizardDialog String[] LanguageLabels; boolean found = false; - String cIsoCode = ""; - String MSID = ""; + String cIsoCode = PropertyNames.EMPTY_STRING; + String MSID = PropertyNames.EMPTY_STRING; int z = 0; for (int i = 0; i < nameList.length; i++) { @@ -1221,7 +1220,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog cIsoCode = FileAccess.getFilename((String) nameList[i]); for (int t = 0; t < allLocales.length; t++) { - String[] aLang = allLocales[t].split(";"); + String[] aLang = allLocales[t].split(PropertyNames.SEMI_COLON); if (cIsoCode.equalsIgnoreCase(aLang[1])) { MSID = aLang[2]; @@ -1233,7 +1232,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog { for (int t = 0; t < allLocales.length; t++) { - String[] aLang = allLocales[t].split(";"); + String[] aLang = allLocales[t].split(PropertyNames.SEMI_COLON); if (cIsoCode.equalsIgnoreCase(aLang[1].substring(0, 2))) { MSID = aLang[2]; @@ -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; @@ -1271,7 +1270,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog //NormPaths = new String[nameList.length]; //LanguageLabels = new String[Norms.length]; - setControlProperty("lstLetterNorm", "StringItemList", LanguageLabels); + setControlProperty("lstLetterNorm", PropertyNames.STRING_ITEM_LIST, LanguageLabels); } private CGLetter getCurrentLetter() @@ -1294,7 +1293,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog try { sTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard"); - sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", ""); + sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", PropertyNames.EMPTY_STRING); sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../wizard/bitmap"); } catch (NoValidPathException e) @@ -1315,19 +1314,19 @@ public class LetterWizardDialogImpl extends LetterWizardDialog OfficialFiles = FileAccess.getFolderTitles(xMSF, "off", sLetterPath); PrivateFiles = FileAccess.getFolderTitles(xMSF, "pri", sLetterPath); - setControlProperty("lstBusinessStyle", "StringItemList", BusinessFiles[0]); - setControlProperty("lstPrivOfficialStyle", "StringItemList", OfficialFiles[0]); - setControlProperty("lstPrivateStyle", "StringItemList", PrivateFiles[0]); + setControlProperty("lstBusinessStyle", PropertyNames.STRING_ITEM_LIST, BusinessFiles[0]); + setControlProperty("lstPrivOfficialStyle", PropertyNames.STRING_ITEM_LIST, OfficialFiles[0]); + setControlProperty("lstPrivateStyle", PropertyNames.STRING_ITEM_LIST, PrivateFiles[0]); - setControlProperty("lstBusinessStyle", "SelectedItems", new short[] + setControlProperty("lstBusinessStyle", PropertyNames.SELECTED_ITEMS, new short[] { 0 }); - setControlProperty("lstPrivOfficialStyle", "SelectedItems", new short[] + setControlProperty("lstPrivOfficialStyle", PropertyNames.SELECTED_ITEMS, new short[] { 0 }); - setControlProperty("lstPrivateStyle", "SelectedItems", new short[] + setControlProperty("lstPrivateStyle", PropertyNames.SELECTED_ITEMS, new short[] { 0 }); @@ -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/CallQueryWizard.java b/wizards/com/sun/star/wizards/query/CallQueryWizard.java index 76da8d5dee55..84870f99646e 100644 --- a/wizards/com/sun/star/wizards/query/CallQueryWizard.java +++ b/wizards/com/sun/star/wizards/query/CallQueryWizard.java @@ -31,6 +31,7 @@ import com.sun.star.beans.PropertyValue; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.Type; import com.sun.star.wizards.common.Properties; +import com.sun.star.wizards.common.PropertyNames; /** This class capsulates the class, that implements the minimal component, a * factory for creating the service (<CODE>__getServiceFactory</CODE>). @@ -81,15 +82,15 @@ public class CallQueryWizard { super(); m_serviceFactory = i_serviceFactory; - registerProperty( "Command", (short)( PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID ) ); - registerProperty( "CommandType", PropertyAttribute.READONLY ); + registerProperty( PropertyNames.COMMAND, (short)( PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID ) ); + registerProperty( PropertyNames.COMMAND_TYPE, PropertyAttribute.READONLY ); } public void trigger(String sEvent) { try { - if (sEvent.compareTo("start") == 0) + if (sEvent.compareTo(PropertyNames.START) == 0) { QueryWizard CurQueryWizard = new QueryWizard( m_serviceFactory, m_wizardContext ); Command = CurQueryWizard.startQueryWizard(); @@ -168,7 +169,7 @@ public class CallQueryWizard try { - byteReturn = ("" + this.hashCode()).getBytes(); + byteReturn = (PropertyNames.EMPTY_STRING + this.hashCode()).getBytes(); } catch (Exception exception) { diff --git a/wizards/com/sun/star/wizards/query/Finalizer.java b/wizards/com/sun/star/wizards/query/Finalizer.java index bfdb93c3bb02..6caf2dfa60a2 100644 --- a/wizards/com/sun/star/wizards/query/Finalizer.java +++ b/wizards/com/sun/star/wizards/query/Finalizer.java @@ -118,7 +118,7 @@ public class Finalizer }); m_queryWizard.insertTextField("txtSummary", 0, null, new String[] { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ReadOnly", PropertyNames.PROPERTY_STEP, "VScroll", PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.READ_ONLY, PropertyNames.PROPERTY_STEP, "VScroll", PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -142,7 +142,7 @@ public class Finalizer String sCurQueryName = AnyConverter.toString(Helper.getUnoPropertyValue(UnoDialog.getModel(m_aTxtTitle), "Text")); if (sCurQueryName != null) { - if (sCurQueryName.equals("")) + if (sCurQueryName.equals(PropertyNames.EMPTY_STRING)) { String[] sCommandNames = CurDBMetaData.getIncludedCommandNames(); sCurQueryName = resQuery + "_" + sCommandNames[0]; @@ -158,14 +158,13 @@ public class Finalizer catch (com.sun.star.uno.Exception exception) { exception.printStackTrace(System.out); - return ""; + return PropertyNames.EMPTY_STRING; } } 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() @@ -176,7 +175,7 @@ public class Finalizer ) return queryName; - return ""; + return PropertyNames.EMPTY_STRING; } public final boolean displayQueryDesign() diff --git a/wizards/com/sun/star/wizards/query/QuerySummary.java b/wizards/com/sun/star/wizards/query/QuerySummary.java index deb56499c3a4..7a0ab0d06beb 100644 --- a/wizards/com/sun/star/wizards/query/QuerySummary.java +++ b/wizards/com/sun/star/wizards/query/QuerySummary.java @@ -29,6 +29,7 @@ package com.sun.star.wizards.query; import com.sun.star.beans.PropertyValue; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.wizards.common.JavaTools; +import com.sun.star.wizards.common.PropertyNames; import com.sun.star.wizards.common.Resource; import com.sun.star.wizards.db.FieldColumn; import com.sun.star.wizards.db.QueryMetaData; @@ -62,12 +63,12 @@ public class QuerySummary extends QueryMetaData { try { - String sFieldNamesFraction = ""; - String sSortingFraction = ""; - String sFilterFraction = ""; - String sAggregateFraction = ""; - String sGroupByFraction = ""; - String sHavingFraction = ""; + String sFieldNamesFraction = PropertyNames.EMPTY_STRING; + String sSortingFraction = PropertyNames.EMPTY_STRING; + String sFilterFraction = PropertyNames.EMPTY_STRING; + String sAggregateFraction = PropertyNames.EMPTY_STRING; + String sGroupByFraction = PropertyNames.EMPTY_STRING; + String sHavingFraction = PropertyNames.EMPTY_STRING; sFieldNamesFraction = combineFieldNameFraction() + sReturnChar; sSortingFraction = combinePartString(RID_QUERY + 51, getSortFieldNames(), RID_QUERY + 52, RID_QUERY + 93, new String[] { @@ -83,7 +84,7 @@ public class QuerySummary extends QueryMetaData } // TODO: remove the last return from the string sSummary = sFieldNamesFraction + sSortingFraction + sFilterFraction + sAggregateFraction + sGroupByFraction + sHavingFraction; - sSummary = JavaTools.replaceSubString(sSummary, "", "~"); + sSummary = JavaTools.replaceSubString(sSummary, PropertyNames.EMPTY_STRING, "~"); } catch (com.sun.star.uno.Exception exception) { @@ -100,7 +101,7 @@ public class QuerySummary extends QueryMetaData { if (_filterconditions != null && _filterconditions.length > 0) { - String sconditions = ""; + String sconditions = PropertyNames.EMPTY_STRING; String sStart = oResource.getResText(_InitResID); String BaseString = oResource.getResText(RID_QUERY + 96); if (_filterconditions.length == 1) @@ -109,7 +110,7 @@ public class QuerySummary extends QueryMetaData for (int i = 0; i < curfilterconditions.length; i++) { sconditions += FilterComponent.getDisplayCondition(BaseString, _filterconditions[0][i], this); - sconditions = appendClauseSeparator(sconditions, " " + sAnd + " ", i, curfilterconditions.length); + sconditions = appendClauseSeparator(sconditions, PropertyNames.SPACE + sAnd + PropertyNames.SPACE, i, curfilterconditions.length); } } else @@ -118,18 +119,17 @@ public class QuerySummary extends QueryMetaData for (int i = 0; i < _filterconditions.length; i++) { sconditions += FilterComponent.getDisplayCondition(BaseString, _filterconditions[i][0], this); - sconditions = appendClauseSeparator(sconditions, " " + sOr + " ", i, _filterconditions.length); + sconditions = appendClauseSeparator(sconditions, PropertyNames.SPACE + sOr + PropertyNames.SPACE, i, _filterconditions.length); } } - String sreturn = sStart + sconditions; - return sreturn; + return sStart + sconditions; } return oResource.getResText(_AlternativeResID); } private String combineFieldNameFraction() { - String CurString = ""; + String CurString = PropertyNames.EMPTY_STRING; String sReturn = oResource.getResText(RID_QUERY + 50); String BaseString = oResource.getResText(RID_QUERY + 92); for (int i = 0; i < FieldColumns.length; i++) @@ -197,7 +197,7 @@ public class QuerySummary extends QueryMetaData public String ArrayFieldsToString(int _InitResID, String[][] _FieldNames, int _BaseStringID, String[] _ReplaceTags) { - String CurString = ""; + String CurString = PropertyNames.EMPTY_STRING; String sReturn = oResource.getResText(_InitResID); int FieldCount = _FieldNames.length; if (FieldCount > 0) diff --git a/wizards/com/sun/star/wizards/query/QueryWizard.java b/wizards/com/sun/star/wizards/query/QueryWizard.java index a0696a435e77..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); } @@ -501,7 +500,7 @@ public class QueryWizard extends DatabaseObjectWizard ID = 1; if (sIncSuffix != null) { - if ((!sIncSuffix.equals("")) && (!sIncSuffix.equals("_"))) + if ((!sIncSuffix.equals(PropertyNames.EMPTY_STRING)) && (!sIncSuffix.equals("_"))) { String sID = JavaTools.ArrayoutofString(sIncSuffix, "_")[1]; ID = Integer.parseInt(sID); diff --git a/wizards/com/sun/star/wizards/report/CallReportWizard.java b/wizards/com/sun/star/wizards/report/CallReportWizard.java index c66596e11c02..8b10e96ac5a3 100644 --- a/wizards/com/sun/star/wizards/report/CallReportWizard.java +++ b/wizards/com/sun/star/wizards/report/CallReportWizard.java @@ -28,11 +28,13 @@ package com.sun.star.wizards.report; import com.sun.star.beans.PropertyValue; import com.sun.star.uno.Type; -import com.sun.star.uno.UnoRuntime; import com.sun.star.text.XTextDocument; import com.sun.star.wizards.common.Properties; import com.sun.star.sdb.application.XDatabaseDocumentUI; import com.sun.star.wizards.common.NamedValueCollection; +import com.sun.star.wizards.common.PropertyNames; +import java.util.logging.Level; +import java.util.logging.Logger; /** This class capsulates the class, that implements the minimal component, a * factory for creating the service (<CODE>__getServiceFactory</CODE>). @@ -114,9 +116,9 @@ public class CallReportWizard { try { - if (sEvent.compareTo("start") == 0) + if (sEvent.compareTo(PropertyNames.START) == 0) { - if (bWizardstartedalready != true) + if (!bWizardstartedalready) { ReportWizard CurReportWizard = new ReportWizard( xmultiservicefactory, m_wizardContext ); CurReportWizard.startReportWizard(); @@ -138,9 +140,9 @@ public class CallReportWizard } } } - catch (Exception exception) + catch (Exception e) { - System.err.println(exception); + Logger.getLogger(CallReportWizard.class.getName()).log(Level.SEVERE, null, e); } System.gc(); } @@ -212,11 +214,11 @@ public class CallReportWizard try { - byteReturn = new String("" + this.hashCode()).getBytes(); + byteReturn = (PropertyNames.EMPTY_STRING + this.hashCode()).getBytes(); } - catch (Exception exception) + catch (Exception e) { - System.err.println(exception); + Logger.getLogger(CallReportWizard.class.getName()).log(Level.SEVERE, null, e); } return (byteReturn); @@ -251,9 +253,9 @@ public class CallReportWizard new Type(com.sun.star.lang.XInitialization.class) }; } - catch (Exception exception) + catch (Exception e) { - System.err.println(exception); + Logger.getLogger(CallReportWizard.class.getName()).log(Level.SEVERE, null, e); } return (typeReturn); diff --git a/wizards/com/sun/star/wizards/report/DBColumn.java b/wizards/com/sun/star/wizards/report/DBColumn.java index ee60f3744000..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(); } } @@ -257,7 +257,7 @@ public class DBColumn XTextCursor xTextCursor = TextDocument.createTextCursor(xNameCell); xTextCursor.gotoStart(false); xTextCursor.gotoEnd(true); - xTextCursor.setString(""); + xTextCursor.setString(PropertyNames.EMPTY_STRING); oTextFieldHandler.insertUserField(xTextCursor, CurDBField.getFieldName(), CurDBField.getFieldTitle()); } @@ -266,7 +266,7 @@ public class DBColumn XTextCursor xTextCursor = TextDocument.createTextCursor(xCell); xTextCursor.gotoStart(false); xTextCursor.gotoEnd(true); - xTextCursor.setString(""); + xTextCursor.setString(PropertyNames.EMPTY_STRING); oTextFieldHandler.insertUserField(xTextCursor, CurDBField.getFieldName(), CurDBField.getFieldTitle()); } @@ -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 00b58fb5e008..5b80ec41e5b8 100644 --- a/wizards/com/sun/star/wizards/report/Dataimport.java +++ b/wizards/com/sun/star/wizards/report/Dataimport.java @@ -34,6 +34,8 @@ import com.sun.star.text.XTextDocument; import com.sun.star.wizards.ui.*; import com.sun.star.wizards.common.*; import com.sun.star.uno.Exception; +import java.util.logging.Level; +import java.util.logging.Logger; public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionListener { // extends ReportWizard @@ -95,8 +97,8 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi // curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/MyHSQL.odb"); //// curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/MyDocAssign.odb"); //baseLocation ); "DataSourceName", "db1"); //// curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography"); -// curproperties[1] = Properties.createProperty("CommandType", new Integer(CommandType.TABLE)); -// curproperties[2] = Properties.createProperty("Command", "Table2"); +// curproperties[1] = Properties.createProperty(PropertyNames.COMMAND_TYPE, new Integer(CommandType.TABLE)); +// curproperties[2] = Properties.createProperty(PropertyNames.COMMAND, "Table2"); // // Dataimport CurDataimport = new Dataimport(xMSF); // TextDocument oTextDocument = new TextDocument(xMSF, true, null); @@ -132,7 +134,7 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblProgressDBConnection", new String[] { - "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH + PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -154,7 +156,7 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblProgressDataImport", new String[] { - "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH + PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -168,7 +170,7 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi }, new Object[] { - 10, "", 12, 42, 0, 120 + 10, PropertyNames.EMPTY_STRING, 12, 42, 0, 120 }); insertButton("cmdCancel", 10000, this, @@ -184,16 +186,15 @@ 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 exception) + } + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger(Dataimport.class.getName()).log(Level.SEVERE, null, e); // return; } - catch (java.lang.Exception jexception) + catch (java.lang.Exception e) { - jexception.printStackTrace(System.out); + Logger.getLogger(Dataimport.class.getName()).log(Level.SEVERE, null, e); // return; } } 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/IReportBuilderLayouter.java b/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java index 6422befd65f0..0de49032b901 100755 --- a/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java +++ b/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java @@ -103,6 +103,14 @@ public interface IReportBuilderLayouter public void insertGroupNames(String[] _aGroupFieldNames); /** + * Insert the names of the groups which should be used as sorting, the group names are names out of the field names. + * + * If a group name is given here, it will not shown in the fields/titles, but must be in the field string list. + * @param _aSortFieldNames + */ + public void insertSortingNames(String[][] _aSortFieldNames); + + /** * This method redraws the whole layout with all it's content */ public void layout(); 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 1de9f32bff23..5498eb89dd55 100644 --- a/wizards/com/sun/star/wizards/report/ReportFinalizer.java +++ b/wizards/com/sun/star/wizards/report/ReportFinalizer.java @@ -176,15 +176,15 @@ public class ReportFinalizer */ public void toggleSubTemplateControls() { - // String sStorePath = ""; + // String sStorePath = PropertyNames.EMPTY_STRING; Short iState = (Short) CurUnoDialog.getControlProperty("optCreateReportTemplate", PropertyNames.PROPERTY_STATE); boolean bDoTemplateEnable = iState.shortValue() == 1; - CurUnoDialog.setControlProperty("optEditTemplate", PropertyNames.PROPERTY_ENABLED, new Boolean(bDoTemplateEnable)); - CurUnoDialog.setControlProperty("optUseTemplate", PropertyNames.PROPERTY_ENABLED, new Boolean(bDoTemplateEnable)); - CurUnoDialog.setControlProperty("lblHowProceed", PropertyNames.PROPERTY_ENABLED, new Boolean(bDoTemplateEnable)); + CurUnoDialog.setControlProperty("optEditTemplate", PropertyNames.PROPERTY_ENABLED, bDoTemplateEnable); + CurUnoDialog.setControlProperty("optUseTemplate", PropertyNames.PROPERTY_ENABLED, bDoTemplateEnable); + CurUnoDialog.setControlProperty("lblHowProceed", PropertyNames.PROPERTY_ENABLED, bDoTemplateEnable); String sTitle = xTitleTextBox.getText(); - boolean bDoEnable = sTitle.equals(""); + boolean bDoEnable = sTitle.equals(PropertyNames.EMPTY_STRING); CurUnoDialog.enableFinishButton(!bDoEnable); } // private boolean fileexists(XMultiServiceFactory _xMSF, String _spath){ @@ -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; } @@ -212,7 +212,7 @@ public class ReportFinalizer if (CurUnoDialog != null) { String LocStoreName = xTitleTextBox.getText(); - if (!LocStoreName.equals("")) + if (!LocStoreName.equals(PropertyNames.EMPTY_STRING)) { StoreName = LocStoreName; } @@ -227,14 +227,14 @@ 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; } catch (Exception e) { e.printStackTrace(System.out); - return ""; + return PropertyNames.EMPTY_STRING; } } @@ -242,7 +242,7 @@ public class ReportFinalizer { final String TitleName = xTitleTextBox.getText(); CurReportDocument.liveupdate_updateReportTitle(TitleName); - CurUnoDialog.enableFinishButton(!"".equals(TitleName)); + CurUnoDialog.enableFinishButton(!PropertyNames.EMPTY_STRING.equals(TitleName)); } public int getReportOpenMode() diff --git a/wizards/com/sun/star/wizards/report/ReportLayouter.java b/wizards/com/sun/star/wizards/report/ReportLayouter.java index 4286b8819c69..0ea91a2f2a30 100644 --- a/wizards/com/sun/star/wizards/report/ReportLayouter.java +++ b/wizards/com/sun/star/wizards/report/ReportLayouter.java @@ -111,7 +111,7 @@ public class ReportLayouter xContentListBox = CurUnoDialog.insertListBox("lstContent", SOCONTENTLST, new ActionListenerImpl(), new ItemListenerImpl(), new String[] { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "SelectedItems", PropertyNames.PROPERTY_STEP, "StringItemList", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.SELECTED_ITEMS, PropertyNames.PROPERTY_STEP, PropertyNames.STRING_ITEM_LIST, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -146,7 +146,7 @@ public class ReportLayouter xLayoutListBox = CurUnoDialog.insertListBox("lstLayout", SOLAYOUTLST, new ActionListenerImpl(), new ItemListenerImpl(), new String[] { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "SelectedItems", PropertyNames.PROPERTY_STEP, "StringItemList", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.SELECTED_ITEMS, PropertyNames.PROPERTY_STEP, PropertyNames.STRING_ITEM_LIST, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -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) { @@ -227,7 +227,7 @@ public class ReportLayouter { // CurReportDocument.getDoc().xTextDocument.lockControllers(); CurReportDocument.layout_setupRecordSection(_defaultTemplatePath); - if (CurUnoDialog.getControlProperty("txtTitle", "Text").equals("")) + if (CurUnoDialog.getControlProperty("txtTitle", "Text").equals(PropertyNames.EMPTY_STRING)) { String[] sCommandNames = CurReportDocument.getRecordParser().getIncludedCommandNames(); CurUnoDialog.setControlProperty("txtTitle", "Text", sCommandNames[0]); @@ -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 3ab9e704b9b9..79196826def1 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextDocument.java +++ b/wizards/com/sun/star/wizards/report/ReportTextDocument.java @@ -53,9 +53,16 @@ import com.sun.star.wizards.text.TextStyleHandler; import com.sun.star.wizards.text.TextFieldHandler; import com.sun.star.wizards.text.ViewHandler; import com.sun.star.wizards.document.FormHandler; +import java.util.logging.Level; +import java.util.logging.Logger; class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implements Comparator { + + private static final String ISLANDSCAPE = "IsLandscape"; + private static final String ISVISIBLE = "IsVisible"; + private static final String QUERYNAME = "QueryName"; + private static final String SIZE = "Size"; // private XMultiServiceFactory xMSF; // private XMultiServiceFactory xMSFDoc; private Object ReportPageStyle; @@ -102,7 +109,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen lateInit(oResource, _aRP); } - void lateInit(Resource oResource, RecordParser _aRecordParser) + private void lateInit(Resource oResource, RecordParser _aRecordParser) { oTextTableHandler = new TextTableHandler(xMSFDoc, xTextDocument); oTextSectionHandler = new TextSectionHandler(xMSFDoc, xTextDocument); @@ -146,12 +153,11 @@ 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 exception) + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e); // In doubt we rather suggest this is LayoutMode... return true; } @@ -172,7 +178,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen } // xProgressBar.setValue(100); oViewHandler.selectFirstPage(oTextTableHandler); - // xProgressBar.end(); + // xProgressBar.end(); } public void swapLayoutTemplate(String LayoutTemplatePath/*, String BitmapPath*/) @@ -181,39 +187,59 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { // xProgressBar.start("", 10); this.LayoutTemplatePath = LayoutTemplatePath; - boolean bOldIsCurLandscape = AnyConverter.toBoolean(Helper.getUnoPropertyValue(ReportPageStyle, "IsLandscape")); + boolean bOldIsCurLandscape = AnyConverter.toBoolean(Helper.getUnoPropertyValue(ReportPageStyle, ISLANDSCAPE)); oTextStyleHandler.loadStyleTemplates(LayoutTemplatePath, "LoadPageStyles"); // xProgressBar.setValue(60); changePageOrientation(bOldIsCurLandscape); // xProgressBar.setValue(100); oViewHandler.selectFirstPage(oTextTableHandler); - // xProgressBar.end(); + // xProgressBar.end(); } - catch (Exception exception) + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e); } } public void createReportForm(String SOREPORTFORMNAME) { com.sun.star.container.XNameContainer xNamedForm = oFormHandler.insertFormbyName(SOREPORTFORMNAME); - XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xNamedForm); - oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "CommandType", new String(Integer.toString(CurDBMetaData.getCommandType()))); + XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, xNamedForm); + oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, PropertyNames.COMMAND_TYPE, Integer.toString(CurDBMetaData.getCommandType())); if (CurDBMetaData.getCommandType() == CommandType.QUERY) { - oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "QueryName", CurDBMetaData.getCommandName()); - // oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "Command", ""); - DBMetaData.CommandObject oCommand = CurDBMetaData.getQueryByName(CurDBMetaData.getCommandName()); - oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "Command", CurDBMetaData.Command); + oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, QUERYNAME, CurDBMetaData.getCommandName()); + oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, PropertyNames.COMMAND, ""); + //DBMetaData.CommandObject oCommand = CurDBMetaData.getQueryByName(CurDBMetaData.getCommandName()); + //oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, COMMAND, CurDBMetaData.Command); } else { - oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "QueryName", ""); - oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "Command", CurDBMetaData.Command); + oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, QUERYNAME, ""); + oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, PropertyNames.COMMAND, CurDBMetaData.Command); } oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "GroupFieldNames", JavaTools.ArraytoString(CurDBMetaData.GroupFieldNames)); oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "FieldNames", JavaTools.ArraytoString(CurDBMetaData.getFieldNames())); + String[][] sortFieldNames = CurDBMetaData.getSortFieldNames(); + if (sortFieldNames != null && sortFieldNames.length > 0) + { + final String space = ","; + final String colon = ";"; + StringBuilder orderBy = new StringBuilder(); + for (String[] sortPair : sortFieldNames) + { + orderBy.append(sortPair[0]).append(space).append(sortPair[1]).append(colon); + } + if (orderBy.length() != 0) + { + orderBy.delete(orderBy.lastIndexOf(colon), orderBy.length()); + } + oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "Sorting", orderBy.toString()); + } + else + { + oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "Sorting", ""); + } oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "RecordFieldNames", JavaTools.ArraytoString(CurDBMetaData.getRecordFieldNames())); } @@ -230,9 +256,9 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen ReportPageStyle = Helper.getUnoObjectbyName(oPageStyleFamily, "Standard"); FirstPageStyle = Helper.getUnoObjectbyName(oPageStyleFamily, "First Page"); } - catch (Exception exception) + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e); } } @@ -242,15 +268,15 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { com.sun.star.awt.Size oNewSize; getReportPageStyles(); - com.sun.star.awt.Size oLocSize = (com.sun.star.awt.Size) Helper.getUnoStructValue(ReportPageStyle, "Size"); - bIsCurLandscape = AnyConverter.toBoolean(Helper.getUnoPropertyValue(ReportPageStyle, "IsLandscape")); + com.sun.star.awt.Size oLocSize = (com.sun.star.awt.Size) Helper.getUnoStructValue(ReportPageStyle, SIZE); + bIsCurLandscape = AnyConverter.toBoolean(Helper.getUnoPropertyValue(ReportPageStyle, ISLANDSCAPE)); if (bIsCurLandscape != bNewLandscape) { oNewSize = new com.sun.star.awt.Size(oLocSize.Height, oLocSize.Width); - Helper.setUnoPropertyValue(ReportPageStyle, "IsLandscape", new Boolean(bNewLandscape)); - Helper.setUnoPropertyValue(ReportPageStyle, "Size", oNewSize); - Helper.setUnoPropertyValue(FirstPageStyle, "IsLandscape", new Boolean(bNewLandscape)); - Helper.setUnoPropertyValue(FirstPageStyle, "Size", oNewSize); + Helper.setUnoPropertyValue(ReportPageStyle, ISLANDSCAPE, bNewLandscape); + Helper.setUnoPropertyValue(ReportPageStyle, SIZE, oNewSize); + Helper.setUnoPropertyValue(FirstPageStyle, ISLANDSCAPE, bNewLandscape); + Helper.setUnoPropertyValue(FirstPageStyle, SIZE, oNewSize); int iLeftMargin = AnyConverter.toInt(Helper.getUnoPropertyValue(ReportPageStyle, "LeftMargin")); int iRightMargin = AnyConverter.toInt(Helper.getUnoPropertyValue(ReportPageStyle, "RightMargin")); PageWidth = oNewSize.Width - iLeftMargin - iRightMargin; @@ -260,9 +286,9 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen } } } - catch (Exception exception) + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e); } } @@ -290,22 +316,15 @@ 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; } - catch (Exception exception) + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e); return false; } } @@ -352,6 +371,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen // { // return (JavaTools.FieldInList(CurDBMetaData.GroupFieldNames, _FieldName) != -1); // } + public void replaceFieldValueInRecordSection(int RecordCount) { int GroupCount = CurDBMetaData.GroupFieldNames.length; @@ -367,7 +387,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen String TableName; DBColumn OldDBColumn; DBColumn CurDBColumn; - XNameAccess xTableNames = oTextTableHandler.xTextTablesSupplier.getTextTables(); + // XNameAccess xTableNames = oTextTableHandler.xTextTablesSupplier.getTextTables(); int GroupFieldCount = SelGroupNames.length; for (int i = 0; i < GroupFieldCount; i++) { @@ -471,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) { @@ -555,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); @@ -639,7 +643,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { try { - Vector aFieldColumns = new Vector(); + ArrayList<FieldColumn> aFieldColumns = new ArrayList<FieldColumn>(); for (int i = 0; i < _FieldColumns.length; i++) { FieldColumn CurFieldColumn = _FieldColumns[i]; @@ -654,7 +658,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen } catch (RuntimeException e) { - e.printStackTrace(System.out); + Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e); return null; } } @@ -668,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++) { @@ -695,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++) { @@ -710,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++) { @@ -720,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) { @@ -728,7 +732,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen { // xRelativeTextContentRemove.removeTextContentBefore(xTextContent); xRelativeTextContentRemove.removeTextContentAfter(xTextContent); - // IllegalArgumentException may be thrown when no paragraphbreak is there + // IllegalArgumentException may be thrown when no paragraphbreak is there } catch (IllegalArgumentException iexception) { @@ -751,17 +755,17 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen for (int i = 0; i < GroupFieldCount; i++) { oTextSection = xTextSections.getByName(GROUPSECTION + String.valueOf(i + 1)); - Helper.setUnoPropertyValue(oTextSection, "IsVisible", new Boolean(_IsVisible)); + Helper.setUnoPropertyValue(oTextSection, ISVISIBLE, _IsVisible); } if (xTextSections.hasByName(RECORDSECTION)) { oTextSection = xTextSections.getByName(RECORDSECTION); - Helper.setUnoPropertyValue(oTextSection, "IsVisible", new Boolean(_IsVisible)); + Helper.setUnoPropertyValue(oTextSection, ISVISIBLE, _IsVisible); } } - catch (Exception exception) + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e); } } diff --git a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java index ceecaf28ba4f..6a79d0f37d84 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java +++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java @@ -30,16 +30,12 @@ package com.sun.star.wizards.report; import com.sun.star.awt.VclWindowPeerAttribute; import com.sun.star.awt.XWindowPeer; import com.sun.star.beans.PropertyValue; -import com.sun.star.container.NoSuchElementException; import com.sun.star.container.XNameAccess; import com.sun.star.container.XNameContainer; import com.sun.star.container.XNamed; -import com.sun.star.frame.XController; import com.sun.star.frame.XFrame; -import com.sun.star.lang.IllegalArgumentException; import com.sun.star.lang.XComponent; import com.sun.star.sdb.CommandType; -import com.sun.star.sdbc.SQLException; import com.sun.star.table.XCellRange; import com.sun.star.text.XTextContent; import com.sun.star.text.XTextCursor; @@ -57,9 +53,9 @@ import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.sdb.application.DatabaseObject; import com.sun.star.sdb.application.XDatabaseDocumentUI; +import com.sun.star.wizards.common.PropertyNames; import com.sun.star.wizards.common.SystemDialog; import com.sun.star.wizards.db.DBMetaData; -import com.sun.star.wizards.db.SQLQueryComposer; import com.sun.star.wizards.document.OfficeDocument; import com.sun.star.wizards.ui.UIConsts; import java.util.ArrayList; @@ -193,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 ); @@ -202,9 +198,9 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme } } } - catch (Exception exception) + catch (Exception ex) { - exception.printStackTrace(System.out); + Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex ); } return xNamedTextSection; } @@ -228,40 +224,54 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme XNameContainer xNamedForms = getDoc().oFormHandler.getDocumentForms(); Object oDBForm = Helper.getUnoObjectbyName(xNamedForms, ReportWizard.SOREPORTFORMNAME); boolean bgetConnection; - String sQueryName = ""; + String sQueryName = PropertyNames.EMPTY_STRING; if (oDBForm != null) { String sMsg = sMsgHiddenControlMissing + (char) 13 + sMsgEndAutopilot; XNameAccess xNamedForm = UnoRuntime.queryInterface( XNameAccess.class, oDBForm ); - getRecordParser().Command = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "Command", sMsg); - String sCommandType = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "CommandType", sMsg); + getRecordParser().Command = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, PropertyNames.COMMAND, sMsg); + String sCommandType = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, PropertyNames.COMMAND_TYPE, sMsg); String sGroupFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "GroupFieldNames", sMsg); String sFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "FieldNames", sMsg); + final String sorting = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "Sorting", sMsg); String sRecordFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "RecordFieldNames", sMsg); if (xNamedForm.hasByName("QueryName")) { sQueryName = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "QueryName", sMsg); } - String[] sFieldNameList = JavaTools.ArrayoutofString(sFieldNames, ";"); - String[] sNewList = JavaTools.ArrayoutofString(sRecordFieldNames, ";"); + String[] sFieldNameList = JavaTools.ArrayoutofString(sFieldNames, PropertyNames.SEMI_COLON); + String[] sNewList = JavaTools.ArrayoutofString(sRecordFieldNames, PropertyNames.SEMI_COLON); + if ( !PropertyNames.EMPTY_STRING.equals(sorting)) + { + String[] sortList = JavaTools.ArrayoutofString(sorting, PropertyNames.SEMI_COLON); + ArrayList<String[]> aSortFields = new ArrayList<String[]>(); + for (String sortEntry : sortList) + { + aSortFields.add(JavaTools.ArrayoutofString(sortEntry, ",")); + } + String[][] sortFieldNames = new String[aSortFields.size()][2]; + aSortFields.toArray(sortFieldNames); + getRecordParser().setSortFieldNames(sortFieldNames); + } getRecordParser().setRecordFieldNames(sNewList); - getRecordParser().GroupFieldNames = JavaTools.ArrayoutofString(sGroupFieldNames, ";"); + getRecordParser().GroupFieldNames = JavaTools.ArrayoutofString(sGroupFieldNames, PropertyNames.SEMI_COLON); getRecordParser().setCommandType(Integer.valueOf(sCommandType).intValue()); + sMsgQueryCreationImpossible = JavaTools.replaceSubString(sMsgQueryCreationImpossible, getRecordParser().Command, "<STATEMENT>"); bgetConnection = getRecordParser().getConnection(_properties); int nCommandType = com.sun.star.sdb.CommandType.COMMAND; boolean bexecute = false; if (bgetConnection) { - - if ((getRecordParser().getCommandType() == CommandType.QUERY) && (getRecordParser().Command.equals(""))) + if ((getRecordParser().getCommandType() == CommandType.QUERY) && (getRecordParser().Command.equals(PropertyNames.EMPTY_STRING))) { DBMetaData.CommandObject oCommand = getRecordParser().getQueryByName(sQueryName); if (getRecordParser().hasEscapeProcessing(oCommand.getPropertySet())) { - getRecordParser().Command = (String) oCommand.getPropertySet().getPropertyValue("Command"); + getRecordParser().Command = (String) oCommand.getPropertySet().getPropertyValue(PropertyNames.COMMAND); getRecordParser().getSQLQueryComposer().m_xQueryAnalyzer.setQuery(getRecordParser().Command); getRecordParser().getSQLQueryComposer().prependSortingCriteria(); + getRecordParser().Command = getRecordParser().getSQLQueryComposer().getQuery(); } else { @@ -293,13 +303,14 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme { return false; } - catch (java.lang.Exception javaexception) + catch (java.lang.Exception ex) { - javaexception.printStackTrace(System.out); + Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex ); return false; } - catch (com.sun.star.wizards.document.FormHandler.UnknownHiddenControlException exception) + catch (com.sun.star.wizards.document.FormHandler.UnknownHiddenControlException ex) { + Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex ); return false; } } @@ -322,8 +333,6 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme Object CurGroupValue; String CurGroupTableName; // RecordParser CurDBMetaData = getRecordParser(); - com.sun.star.style.BreakType CorrBreakValue = null; - String CorrPageDescName = ""; getDoc().oTextFieldHandler.fixDateFields(true); getDoc().removeAllVisibleTextSections(); getDoc().removeNonLayoutTextTables(); @@ -338,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"); @@ -352,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); @@ -389,7 +398,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme for (ColIndex = 0; ColIndex < GroupFieldCount; ColIndex++) { CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(ColIndex); - Object oValue = ""; + Object oValue = PropertyNames.EMPTY_STRING; addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFGROUPSECTION + Integer.toString(ColIndex + 1), CurDBColumn, oValue); } addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFRECORDSECTION, null, null); @@ -403,8 +412,9 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme } getDoc().oTextSectionHandler.breakLinkofTextSections(); } - catch (Exception exception) + catch (Exception ex) { + Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex ); } // catch (java.lang.Exception javaexception) // { @@ -462,7 +472,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme xNameCellCursor = ReportTextDocument.createTextCursor(CurDBColumn.xNameCell); xNameCellCursor.gotoStart(false); FieldContent = getDoc().oTextFieldHandler.getUserFieldContent(xNameCellCursor); - if (!FieldContent.equals("")) + if (!FieldContent.equals(PropertyNames.EMPTY_STRING)) { xNameCellCursor.goRight((short) 1, true); xNameCellCursor.setString(FieldContent); @@ -629,6 +639,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme } catch (Exception e) { + Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, e ); } } return m_aReportPath; @@ -646,7 +657,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme return sPath; } } - return ""; + return PropertyNames.EMPTY_STRING; } public String getLayoutPath() @@ -661,7 +672,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme return sPath; } } - return ""; + return PropertyNames.EMPTY_STRING; } public int getDefaultPageOrientation() diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java index 224cd7abeff3..000f093b54d5 100644 --- a/wizards/com/sun/star/wizards/report/ReportWizard.java +++ b/wizards/com/sun/star/wizards/report/ReportWizard.java @@ -79,7 +79,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, private ReportLayouter CurReportLayouter; private ReportFinalizer CurReportFinalizer; private int nReportMode = ReportFinalizer.SOCREATEDOCUMENT; - private String m_sReportName = ""; + private String m_sReportName = PropertyNames.EMPTY_STRING; protected static final String SOREPORTFORMNAME = "ReportSource"; private static final int SOMAINPAGE = 1; private static final int SOTITLEPAGE = 2; @@ -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; @@ -272,10 +272,17 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, final SQLQueryComposer sqlQueryComposer = recordParser.getSQLQueryComposer(); if (this.CurDBCommandFieldSelection.getSelectedCommandType() == CommandType.TABLE) { - bQueryCreated = sqlQueryComposer.setQueryCommand(this.xWindow, false, false); - m_reportDocument.setCommandType(CommandType.COMMAND); - String sQuery = sqlQueryComposer.getQuery(); - m_reportDocument.setCommand(sQuery); + if (m_reportDocument instanceof ReportTextImplementation) + { + bQueryCreated = sqlQueryComposer.setQueryCommand(this.xWindow, false, false); + m_reportDocument.setCommandType(CommandType.COMMAND); + String sQuery = sqlQueryComposer.getQuery(); + m_reportDocument.setCommand(sQuery); + } + else + { + bQueryCreated = true; + } } else { @@ -284,24 +291,25 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, String sQueryName = CurDBCommandFieldSelection.getSelectedCommandName(); DBMetaData.CommandObject oCommand = recordParser.getQueryByName(sQueryName); bHasEscapeProcessing = recordParser.hasEscapeProcessing(oCommand.getPropertySet()); - String sCommand = (String) oCommand.getPropertySet().getPropertyValue("Command"); + String sCommand = (String) oCommand.getPropertySet().getPropertyValue(PropertyNames.COMMAND); if (bHasEscapeProcessing) { - // String sCommand = (String) oCommand.xPropertySet.getPropertyValue("Command"); - bQueryCreated = (!sCommand.equals("")); - sqlQueryComposer.m_xQueryAnalyzer.setQuery(sCommand); - sqlQueryComposer.prependSortingCriteria(); -// TODO: check with query - m_reportDocument.setCommandType(CommandType.COMMAND); - m_reportDocument.setCommand(sqlQueryComposer.getQuery()); - bQueryCreated = true; + // String sCommand = (String) oCommand.xPropertySet.getPropertyValue(PropertyNames.COMMAND); + bQueryCreated = (!sCommand.equals(PropertyNames.EMPTY_STRING)); + if (m_reportDocument instanceof ReportTextImplementation) + { + sqlQueryComposer.m_xQueryAnalyzer.setQuery(sCommand); + sqlQueryComposer.prependSortingCriteria(); + m_reportDocument.setCommandType(CommandType.COMMAND); + m_reportDocument.setCommand(sqlQueryComposer.getQuery()); + } } else { m_reportDocument.setCommandType(CommandType.COMMAND); m_reportDocument.setCommand(sCommand); - bQueryCreated = true; } + bQueryCreated = true; } catch (Exception e) { @@ -398,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 @@ -416,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; @@ -463,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) { @@ -569,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); @@ -589,7 +590,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, public static String getBlindTextNote(Object _aDocument, Resource _oResource) { - String sBlindTextNote = ""; + String sBlindTextNote = PropertyNames.EMPTY_STRING; if (_aDocument instanceof ReportTextImplementation) { sBlindTextNote = _oResource.getResText(UIConsts.RID_REPORT + 75); @@ -619,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) @@ -631,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 } @@ -698,7 +699,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, m_nID = 1; if (sIncSuffix != null) { - if ((!sIncSuffix.equals("")) && (!sIncSuffix.equals("_"))) + if ((!sIncSuffix.equals(PropertyNames.EMPTY_STRING)) && (!sIncSuffix.equals("_"))) { String sID = JavaTools.ArrayoutofString(sIncSuffix, "_")[1]; m_nID = Integer.parseInt(sID); @@ -717,7 +718,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, else { boolean bEnabled = (CurGroupFieldSelection.getSelectedFieldNames().length > 0); - Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPPAGE), PropertyNames.PROPERTY_ENABLED, new Boolean(bEnabled)); + Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPPAGE), PropertyNames.PROPERTY_ENABLED, bEnabled); } } @@ -732,7 +733,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener, else { boolean bEnabled = (CurGroupFieldSelection.getSelectedFieldNames().length > 0); - Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPPAGE), PropertyNames.PROPERTY_ENABLED, new Boolean(bEnabled)); + Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPPAGE), PropertyNames.PROPERTY_ENABLED, bEnabled); } } diff --git a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java index 6a90214696a5..0b55936da3fb 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java +++ b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java @@ -33,7 +33,6 @@ import com.sun.star.awt.XWindowPeer; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertySet; import com.sun.star.container.XHierarchicalNameContainer; -import com.sun.star.container.XNameContainer; import com.sun.star.frame.XController; import com.sun.star.frame.XDispatch; import com.sun.star.frame.XDispatchProvider; @@ -60,6 +59,7 @@ import java.util.Set; import java.util.Vector; import com.sun.star.wizards.common.FileAccess; import com.sun.star.wizards.common.NamedValueCollection; +import com.sun.star.wizards.common.PropertyNames; import com.sun.star.wizards.report.IReportBuilderLayouter; import com.sun.star.wizards.report.IReportDefinitionReadAccess; import com.sun.star.wizards.report.IReportDocument; @@ -78,23 +78,24 @@ import java.util.logging.Logger; public class ReportBuilderImplementation extends ReportImplementationHelper implements IReportDocument, IReportDefinitionReadAccess { - private Resource m_resource; - private XDatabaseDocumentUI m_documentUI; + private Resource m_resource; + private XDatabaseDocumentUI m_documentUI; private static final int MAXIMUM_GROUPCOUNT = 4; + private String[] groupNames = null; - private ReportBuilderImplementation( XMultiServiceFactory _serviceFactory ) + private ReportBuilderImplementation(XMultiServiceFactory _serviceFactory) { // creates an access to the ReportBuilder Extension super(_serviceFactory, ReportLayouter.SOOPTLANDSCAPE); } - public static IReportDocument create( XMultiServiceFactory i_serviceFactory ) + public static IReportDocument create(XMultiServiceFactory i_serviceFactory) { - return new ReportBuilderImplementation( i_serviceFactory ); + return new ReportBuilderImplementation(i_serviceFactory); } - public void initialize( final XDatabaseDocumentUI i_documentUI, final Resource i_resource ) + public void initialize(final XDatabaseDocumentUI i_documentUI, final Resource i_resource) { m_documentUI = i_documentUI; m_resource = i_resource; @@ -106,12 +107,11 @@ 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; - private String m_sReportBuilderLayoutName = ""; + private String m_sReportBuilderLayoutName = PropertyNames.EMPTY_STRING; /** * Get access to the current ReportLayouter, which depends on the name. @@ -120,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; @@ -139,15 +138,18 @@ public class ReportBuilderImplementation extends ReportImplementationHelper try { NamedValueCollection creationArgs = new NamedValueCollection(); - creationArgs.put( "DocumentServiceName", "com.sun.star.report.ReportDefinition" ); - creationArgs.put( "Mode", "remote" ); + creationArgs.put("DocumentServiceName", "com.sun.star.report.ReportDefinition"); + creationArgs.put("Mode", "remote"); - XComponent[] docDefinition = new XComponent[] { null }; + XComponent[] docDefinition = new XComponent[] + { + null + }; XComponent reportDefinitionComp = m_documentUI.createComponentWithArguments( - DatabaseObject.REPORT, creationArgs.getPropertyValues(), docDefinition ); + DatabaseObject.REPORT, creationArgs.getPropertyValues(), docDefinition); - m_documentDefinition = UnoRuntime.queryInterface( XPropertySet.class, docDefinition[0] ); - m_reportDocument = UnoRuntime.queryInterface( XReportDefinition.class, reportDefinitionComp ); + m_documentDefinition = UnoRuntime.queryInterface(XPropertySet.class, docDefinition[0]); + m_reportDocument = UnoRuntime.queryInterface(XReportDefinition.class, reportDefinitionComp); } catch (com.sun.star.uno.Exception e) { @@ -164,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() @@ -209,11 +210,11 @@ public class ReportBuilderImplementation extends ReportImplementationHelper try { final XController xController = getReportDefinition().getCurrentController(); - final XDispatchProvider xDP = UnoRuntime.queryInterface( XDispatchProvider.class, xController ); + final XDispatchProvider xDP = UnoRuntime.queryInterface(XDispatchProvider.class, xController); // Create special service for parsing of given URL. final Object aURLTransformer = getMSF().createInstance("com.sun.star.util.URLTransformer"); - final XURLTransformer xURLTransformer = UnoRuntime.queryInterface( com.sun.star.util.XURLTransformer.class, aURLTransformer ); + final XURLTransformer xURLTransformer = UnoRuntime.queryInterface(com.sun.star.util.XURLTransformer.class, aURLTransformer); com.sun.star.util.URL[] aURL = new com.sun.star.util.URL[1]; aURL[0] = new com.sun.star.util.URL(); @@ -273,14 +274,14 @@ public class ReportBuilderImplementation extends ReportImplementationHelper return; } - final XCommandProcessor xProcessor = UnoRuntime.queryInterface( XCommandProcessor.class, m_documentDefinition ); + final XCommandProcessor xProcessor = UnoRuntime.queryInterface(XCommandProcessor.class, m_documentDefinition); final com.sun.star.ucb.Command aCommand = new com.sun.star.ucb.Command(); aCommand.Name = "store"; xProcessor.execute(aCommand, xProcessor.createCommandIdentifier(), null); final XHierarchicalNameContainer aNameContainer = UnoRuntime.queryInterface(XHierarchicalNameContainer.class, m_aReportDocument); - aNameContainer.insertByHierarchicalName( Name, m_documentDefinition ); + aNameContainer.insertByHierarchicalName(Name, m_documentDefinition); } public boolean liveupdate_addGroupNametoDocument(String[] GroupNames, String CurGroupTitle, Vector GroupFieldVector, ArrayList ReportPath, int iSelCount) @@ -366,19 +367,19 @@ public class ReportBuilderImplementation extends ReportImplementationHelper { try { - if ( m_documentDefinition != null ) + if (m_documentDefinition != null) { // set the document to "not modified", to ensure that it won't ask the user before closing - XModifiable documentModify = UnoRuntime.queryInterface( XModifiable.class, m_reportDocument ); - documentModify.setModified( false ); + XModifiable documentModify = UnoRuntime.queryInterface(XModifiable.class, m_reportDocument); + documentModify.setModified(false); // actually close - XSubDocument subComponent = UnoRuntime.queryInterface( XSubDocument.class, m_documentDefinition ); + XSubDocument subComponent = UnoRuntime.queryInterface(XSubDocument.class, m_documentDefinition); subComponent.close(); } } - catch ( Exception ex ) + catch (Exception ex) { - Logger.getLogger( ReportBuilderImplementation.class.getName() ).log( Level.SEVERE, null, ex ); + Logger.getLogger(ReportBuilderImplementation.class.getName()).log(Level.SEVERE, null, ex); } m_documentDefinition = null; m_reportDocument = null; @@ -407,15 +408,15 @@ public class ReportBuilderImplementation extends ReportImplementationHelper { } - private XComponent loadReport( final String i_reportName ) + private XComponent loadReport(final String i_reportName) { try { - return m_documentUI.loadComponent( DatabaseObject.REPORT, i_reportName, false ); + return m_documentUI.loadComponent(DatabaseObject.REPORT, i_reportName, false); } - catch ( Exception ex ) + catch (Exception ex) { - Logger.getLogger( ReportBuilderImplementation.class.getName() ).log( Level.SEVERE, null, ex ); + Logger.getLogger(ReportBuilderImplementation.class.getName()).log(Level.SEVERE, null, ex); } return null; } @@ -428,19 +429,19 @@ public class ReportBuilderImplementation extends ReportImplementationHelper aCommand.Name = "open"; try { - final Object result = commandProcessor.execute( aCommand, commandProcessor.createCommandIdentifier(), null ); - return UnoRuntime.queryInterface( XComponent.class, result ); + final Object result = commandProcessor.execute(aCommand, commandProcessor.createCommandIdentifier(), null); + return UnoRuntime.queryInterface(XComponent.class, result); } - catch ( Exception ex ) + catch (Exception ex) { - Logger.getLogger( ReportBuilderImplementation.class.getName() ).log( Level.SEVERE, null, ex ); + Logger.getLogger(ReportBuilderImplementation.class.getName()).log(Level.SEVERE, null, ex); } return null; } - public void createAndOpenReportDocument( String i_name, boolean i_asTemplate, boolean i_openForEditing ) + public void createAndOpenReportDocument(String i_name, boolean i_asTemplate, boolean i_openForEditing) { - if ( i_openForEditing ) + if (i_openForEditing) { // we won't destroy the report builder window, also don't create a document // Do we need to reopen the report builder with the known name? @@ -449,13 +450,13 @@ public class ReportBuilderImplementation extends ReportImplementationHelper return; } - if ( i_asTemplate ) + if (i_asTemplate) { // don't need the report definition anymore - the document it represents has already been stored closeReportDefinition(); // open the report, again, this time not in design, but containing data - loadReport( i_name ); + loadReport(i_name); } else { @@ -466,8 +467,10 @@ public class ReportBuilderImplementation extends ReportImplementationHelper closeReportDefinition(); // store the generated report - if ( getRecordParser().storeDatabaseDocumentToTempPath( document, i_name ) ) - getRecordParser().addReportDocument( document, false ); + if (getRecordParser().storeDatabaseDocumentToTempPath(document, i_name)) + { + getRecordParser().addReportDocument(document, false); + } } dispose(); @@ -509,10 +512,17 @@ public class ReportBuilderImplementation extends ReportImplementationHelper public void setSorting(String[][] _aSortFieldNames) { getRecordParser().setSortFieldNames(_aSortFieldNames); + if (groupNames != null) + { + getRecordParser().prependSortFieldNames(groupNames); + } + getReportBuilderLayouter().insertSortingNames(_aSortFieldNames); + getReportBuilderLayouter().layout(); } public void setGrouping(String[] _aGroupFieldNames) { + groupNames = _aGroupFieldNames; getRecordParser().prependSortFieldNames(_aGroupFieldNames); getReportBuilderLayouter().insertGroupNames(_aGroupFieldNames); @@ -532,12 +542,12 @@ public class ReportBuilderImplementation extends ReportImplementationHelper try { // Check general availability of office paths - m_aReportPath = FileAccess.getOfficePaths( getMSF(), "Template", "share", "/wizard" ); - FileAccess.combinePaths( getMSF(), m_aReportPath, "/wizard/report" ); + m_aReportPath = FileAccess.getOfficePaths(getMSF(), "Template", "share", "/wizard"); + FileAccess.combinePaths(getMSF(), m_aReportPath, "/wizard/report"); } - catch ( NoValidPathException ex ) + catch (NoValidPathException ex) { - Logger.getLogger( ReportBuilderImplementation.class.getName() ).log( Level.SEVERE, null, ex ); + Logger.getLogger(ReportBuilderImplementation.class.getName()).log(Level.SEVERE, null, ex); } } return m_aReportPath; @@ -545,7 +555,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper public String getContentPath() { - return ""; + return PropertyNames.EMPTY_STRING; } public int getDefaultPageOrientation() @@ -573,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) { @@ -727,7 +736,6 @@ public class ReportBuilderImplementation extends ReportImplementationHelper getReportDefinition().setCommandType(_nCommand); } - public void checkInvariants() throws java.lang.Exception { final String sDefaultHeaderLayoutPath = getDefaultHeaderLayout(); @@ -737,12 +745,9 @@ public class ReportBuilderImplementation extends ReportImplementationHelper } FileAccess aAccess = new FileAccess(getGlobalMSF()); - if (! aAccess.exists(sDefaultHeaderLayoutPath, true)) + if (!aAccess.exists(sDefaultHeaderLayoutPath, true)) { throw new java.io.IOException("default.otr"); } } - } - - diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java index ccb74ebf6f07..02ad2438bb59 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java @@ -28,6 +28,7 @@ package com.sun.star.wizards.reportbuilder.layout; import com.sun.star.awt.Rectangle; +import com.sun.star.report.XGroup; import com.sun.star.report.XSection; import com.sun.star.wizards.common.Resource; import com.sun.star.wizards.report.IReportDefinitionReadAccess; @@ -52,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() @@ -98,7 +98,7 @@ public class ColumnarSingleColumn extends ReportBuilderLayouter doNotBreakInTable(xSection); } - protected void insertDetailFieldTitles() + protected void insertDetailFieldTitles(int lastGroupPostion) { // we won't extra field titles } 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 d79713524021..9dd9bb78201c 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java @@ -28,6 +28,7 @@ package com.sun.star.wizards.reportbuilder.layout; import com.sun.star.awt.Rectangle; +import com.sun.star.report.XGroup; import com.sun.star.report.XSection; import com.sun.star.wizards.common.Resource; import com.sun.star.wizards.report.IReportDefinitionReadAccess; @@ -52,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() @@ -130,7 +130,7 @@ public class ColumnarTwoColumns extends ReportBuilderLayouter doNotBreakInTable(xSection); } - protected void insertDetailFieldTitles() + protected void insertDetailFieldTitles(int lastGroupPostion) { // we won't extra field titles } diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java b/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java index 55fdafe6c79a..12999090e646 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java @@ -41,6 +41,7 @@ import com.sun.star.report.XReportDefinition; import com.sun.star.report.XSection; import com.sun.star.uno.UnoRuntime; import com.sun.star.wizards.common.Properties; +import com.sun.star.wizards.common.PropertyNames; /** * @@ -180,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) { @@ -188,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) { @@ -217,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(); @@ -226,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 && @@ -236,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) { @@ -316,11 +317,11 @@ 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("URL", _sPath); - aLoadProps[1] = Properties.createProperty("ReadOnly", Boolean.TRUE); + aLoadProps[0] = Properties.createProperty(PropertyNames.URL, _sPath); + aLoadProps[1] = Properties.createProperty(PropertyNames.READ_ONLY, Boolean.TRUE); m_xReportDefinition.load(aLoadProps); analyseReportDefinition(); diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java index 9fd891a446f2..3fa72ca047b2 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java @@ -29,6 +29,7 @@ package com.sun.star.wizards.reportbuilder.layout; import com.sun.star.awt.Rectangle; +import com.sun.star.report.XGroup; import com.sun.star.report.XSection; import com.sun.star.wizards.common.Resource; import com.sun.star.wizards.report.IReportDefinitionReadAccess; @@ -53,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() @@ -159,7 +159,7 @@ public class InBlocksLabelsAbove extends ColumnarTwoColumns doNotBreakInTable(xSection); } - protected void insertDetailFieldTitles() + protected void insertDetailFieldTitles(int lastGroupPostion) { // we won't extra field titles } diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java index c03cf7cec909..34c2f9c10280 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java @@ -29,6 +29,7 @@ package com.sun.star.wizards.reportbuilder.layout; import com.sun.star.awt.Rectangle; +import com.sun.star.report.XGroup; import com.sun.star.report.XSection; import com.sun.star.wizards.common.Resource; import com.sun.star.wizards.report.IReportDefinitionReadAccess; @@ -53,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() @@ -126,7 +126,7 @@ public class InBlocksLabelsLeft extends ColumnarTwoColumns doNotBreakInTable(xSection); } - protected void insertDetailFieldTitles() + protected void insertDetailFieldTitles(int lastGroupPostion) { // we won't extra field titles } diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java index 0c2e5af3bd36..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. * @@ -72,6 +71,8 @@ import com.sun.star.wizards.report.IReportDefinitionReadAccess; import com.sun.star.wizards.ui.UIConsts; import java.util.HashMap; import java.util.Locale; +import java.util.logging.Level; +import java.util.logging.Logger; /** * This class is abstract and more like a helper for create different layouts for Report Builder Wizard. @@ -83,6 +84,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter private IReportDefinitionReadAccess m_xReportDefinitionReadAccess; private Resource m_aResource; + private String[][] m_aSortNames; /** * dispose the ReportBuilderLayouter @@ -91,7 +93,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter { closeDesignTemplate(); m_xReportDefinitionReadAccess = null; - // m_xReportBuilderLayouter = null; + // m_xReportBuilderLayouter = null; } /** @@ -148,11 +150,11 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter insertPageFooter(); clearGroups(); - insertGroups(); + int lastGroupPostion = insertGroups(); clearDetails(); // clearFieldTitles(); - insertDetailFieldTitles(); + insertDetailFieldTitles(lastGroupPostion); insertDetailFields(); } catch (java.lang.ArrayIndexOutOfBoundsException e) @@ -163,13 +165,13 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter { throw e; } - catch (Exception e) + catch (Exception ex) { - // Exception not set. Not from interest here. - int dummy = 0; + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex); } } // ------------------------------------------------------------------------- + /** * Remove all Groups */ @@ -183,13 +185,14 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter { xGroups.removeByIndex(0); } - catch (com.sun.star.uno.Exception e) + catch (com.sun.star.uno.Exception ex) { - // Exception not set. Not from interest here. + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex); } } } // ------------------------------------------------------------------------- + /** * Remove all fields * @param _xSectionToClear @@ -206,13 +209,12 @@ 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 e) + catch (com.sun.star.uno.Exception ex) { - // Exception not set. - int dummy = 0; + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex); } } @@ -226,6 +228,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter // public void clearFieldTitles() // { // } + /** * * @param _nGroupCount @@ -291,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(); @@ -299,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; @@ -307,10 +310,9 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter } } } - catch (com.sun.star.uno.Exception e) + catch (com.sun.star.uno.Exception ex) { - // TODO: Exception not set. - e.printStackTrace(); + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex); } return aUsedStyle; } @@ -352,6 +354,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter return m_nPageWidth; } // ------------------------------------------------------------------------- + /** * Stores the Group names. To insert/create a report with such group names, call layout() * @param _aGroupNames @@ -361,6 +364,11 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter m_aGroupNames = _aGroupNames; } + public void insertSortingNames(String[][] _aSortFieldNames) + { + m_aSortNames = _aSortFieldNames; + } + protected void copyGroupProperties(int _nGroup) { if (getDesignTemplate() != null) @@ -368,103 +376,111 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter try { final XGroups xForeignGroups = getDesignTemplate().getGroups(); - int nGroups = xForeignGroups.getCount(); - Object aForeignGroup = xForeignGroups.getByIndex(_nGroup); - XGroup xForeignGroup = (XGroup) UnoRuntime.queryInterface(XGroup.class, aForeignGroup); - XSection xForeignGroupSection = xForeignGroup.getHeader(); - - if (xForeignGroupSection != null) + if (_nGroup < xForeignGroups.getCount()) { - final XGroups xGroups = getReportDefinition().getGroups(); - Object aGroup = xGroups.getByIndex(_nGroup); - XGroup xGroup = (XGroup) UnoRuntime.queryInterface(XGroup.class, aGroup); - XSection xGroupSection = xGroup.getHeader(); + XGroup xForeignGroup = UnoRuntime.queryInterface(XGroup.class, xForeignGroups.getByIndex(_nGroup)); + XSection xForeignGroupSection = xForeignGroup.getHeader(); - // copy Properties - copyProperties(xForeignGroupSection, xGroupSection); + if (xForeignGroupSection != null) + { + final XGroups xGroups = getReportDefinition().getGroups(); + Object aGroup = xGroups.getByIndex(_nGroup); + XGroup xGroup = UnoRuntime.queryInterface(XGroup.class, aGroup); + XSection xGroupSection = xGroup.getHeader(); + + // copy Properties + copyProperties(xForeignGroupSection, xGroupSection); + } } } - catch (Exception e) + catch (Exception ex) { - int dummy = 0; + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex); } } } // ------------------------------------------------------------------------- - protected void insertGroups() - { - if (m_aGroupNames == null) - { - return; - } + protected int insertGroups() + { final XGroups xGroups = getReportDefinition().getGroups(); - final int nLeftPageIndent = getLeftPageIndent(); - final int nLabelWidth = getMaxLabelWidth(); // 3000; - final int nUsablePageWidth = getPageWidth() - getLeftPageIndent() - getRightPageIndent() - getLeftGroupIndent(getCountOfGroups()); - final int nFieldWidth = nUsablePageWidth - nLabelWidth; - - // after done with all groups, we need access to the last group, for set property 'KeepTogether' so we remember it. - XGroup aLastGroup = null; + int lastGroupPosition = -1; - for (int i = 0; i < m_aGroupNames.length; i++) + if (m_aGroupNames != null) { - final XGroup xGroup = xGroups.createGroup(); - aLastGroup = xGroup; + final int nLeftPageIndent = getLeftPageIndent(); + final int nLabelWidth = getMaxLabelWidth(); // 3000; + final int nUsablePageWidth = getPageWidth() - getLeftPageIndent() - getRightPageIndent() - getLeftGroupIndent(getCountOfGroups()); + final int nFieldWidth = nUsablePageWidth - nLabelWidth; - // TODO: debug what the m_aGroupNames are, "field:[...]" or the "fieldname" - xGroup.setExpression(m_aGroupNames[i]); - xGroup.setHeaderOn(true); - // we don't want any group footer (default off) - // xGroup.setFooterOn(true); + XGroup aLastGroup = null; + // after done with all groups, we need access to the last group, for set property 'KeepTogether' so we remember it. - try + for (int i = 0; i < m_aGroupNames.length; i++) { - // we need to append by hand - // TODO: documentation is unclear here, that we have to insert by hand - int nCount = xGroups.getCount(); - xGroups.insertByIndex(nCount, xGroup); + lastGroupPosition = i; + final XGroup xGroup = xGroups.createGroup(); + aLastGroup = xGroup; - final XSection xGroupSection = xGroup.getHeader(); - copyGroupProperties(nCount); - - Rectangle aRect = new Rectangle(); - aRect.X = nLeftPageIndent + getLeftGroupIndent(i); - SectionObject aSO = getDesignTemplate().getGroupLabel(i); - int nLabelHeight = 0; -// if (aSO != null) -// { - nLabelHeight = aSO.getHeight(LayoutConstants.LabelHeight); - aRect = insertLabel(xGroupSection, getTitleFromFieldName(m_aGroupNames[i]), aRect, nLabelWidth, aSO); -// } -// else -// { -// nLabelHeight = 500; -// aRect = insertBoldLabel(xGroupSection, getTitleFromFieldName(m_aGroupNames[i]), aRect, nLabelWidth); -// } - final String sGroupName = convertToFieldName(m_aGroupNames[i]); - aSO = getDesignTemplate().getGroupTextField(i); - insertFormattedField(xGroupSection, sGroupName, aRect, nFieldWidth, aSO); + xGroup.setExpression(m_aGroupNames[i]); + xGroup.setHeaderOn(true); - // draw a line under the label/formattedfield - aRect.X = nLeftPageIndent + getLeftGroupIndent(i); - aRect.Y = nLabelHeight; - final int nLineWidth = getPageWidth() - getRightPageIndent() - aRect.X; - final int nLineHeight = LayoutConstants.LineHeight; - insertHorizontalLine(xGroupSection, aRect, nLineWidth, nLineHeight); - xGroupSection.setHeight(nLabelHeight + nLineHeight); + try + { + int nCount = xGroups.getCount(); + xGroups.insertByIndex(nCount, xGroup); + final XSection xGroupSection = xGroup.getHeader(); + copyGroupProperties(nCount); + + Rectangle aRect = new Rectangle(); + aRect.X = nLeftPageIndent + getLeftGroupIndent(i); + SectionObject aSO = getDesignTemplate().getGroupLabel(i); + aRect = insertLabel(xGroupSection, getTitleFromFieldName(m_aGroupNames[i]), aRect, nLabelWidth, aSO); + final String sGroupName = convertToFieldName(m_aGroupNames[i]); + aSO = getDesignTemplate().getGroupTextField(i); + aRect = insertFormattedField(xGroupSection, sGroupName, aRect, nFieldWidth, aSO); + int height = aRect.Height; + + // draw a line under the label/formattedfield + aRect.X = nLeftPageIndent + getLeftGroupIndent(i); + aRect.Y = aRect.Height; + final int nLineWidth = getPageWidth() - getRightPageIndent() - aRect.X; + final int nLineHeight = LayoutConstants.LineHeight; + insertHorizontalLine(xGroupSection, aRect, nLineWidth, nLineHeight); + xGroupSection.setHeight(height + nLineHeight); + } + catch (com.sun.star.uno.Exception ex) + { + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex); + } } - catch (com.sun.star.uno.Exception e) + + // hold the inner group together + if (aLastGroup != null) { - // TODO: Exception not set. + doNotBreakInTable(aLastGroup); } } - - // hold the inner group together - if (aLastGroup != null) + if (m_aSortNames != null) { - doNotBreakInTable(aLastGroup); + for (String[] sortFieldName : m_aSortNames) + { + try + { + final XGroup xGroup = xGroups.createGroup(); + xGroup.setExpression(sortFieldName[0]); + xGroup.setSortAscending(PropertyNames.ASC.equals(sortFieldName[1])); + xGroup.setHeaderOn(false); + int nCount = xGroups.getCount(); + xGroups.insertByIndex(nCount, xGroup); + } + catch (java.lang.Exception ex) + { + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex); + } + } } + return lastGroupPosition; } // ------------------------------------------------------------------------- @@ -487,10 +503,10 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter return m_aFieldTitleNames[i]; } } - return ""; + return PropertyNames.EMPTY_STRING; } - protected int getTypeFromFieldName(String _sField) + protected int getTypeFromFieldName(String _sField) { for (int i = 0; i < m_aFieldNames.length; i++) { @@ -514,6 +530,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter return false; } // ------------------------------------------------------------------------- + /** * Helper to get all field names without the names which are already in the group names * @param _aList @@ -542,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; } @@ -578,8 +595,10 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter return getNamesWithoutGroupNames(m_aFieldNames, m_aFieldTitleNames); } // ------------------------------------------------------------------------- - abstract protected void insertDetailFieldTitles(); + + abstract protected void insertDetailFieldTitles(int lastGroupPostion); // ------------------------------------------------------------------------- + /** * Give a list off all field names to insert the field names, call layout() * @param _aFieldNames @@ -627,12 +646,14 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter copyProperties(xForeignSection, xSection); } } - catch (Exception e) + catch (Exception ex) { + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex); } } } // ------------------------------------------------------------------------- + protected Rectangle insertLabel(XSection _xSection, String _sLabel, Rectangle _aRect, int _nWidth, SectionObject _aSO) { if (_xSection != null) @@ -640,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. @@ -678,15 +699,15 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter xFixedText.setHeight(nHeight); _xSection.add(xFixedText); } - catch (com.sun.star.uno.Exception e) + catch (com.sun.star.uno.Exception ex) { - // TODO: Exception not set. - int dummy = 0; + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex); } } return _aRect; } // ------------------------------------------------------------------------- + protected String convertToFieldName(String _sElementName) { final StringBuffer aDataField = new StringBuffer(32); @@ -694,17 +715,18 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter return aDataField.toString(); } + protected String convertFromFieldName(String _sName) { 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; } // ------------------------------------------------------------------------- + /** * Insert a already formatted field name into a given section * @@ -732,9 +754,9 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter int nHeight = LayoutConstants.FormattedFieldHeight; int nType = getTypeFromFieldName(convertFromFieldName(_sFormattedfield)); - if (nType == DataType.BINARY || - nType == DataType.VARBINARY || - nType == DataType.LONGVARBINARY) + if (nType == DataType.BINARY + || nType == DataType.VARBINARY + || nType == DataType.LONGVARBINARY) { aField = getMSFofReportDefinition().createInstance("com.sun.star.report.ImageControl"); nHeight = LayoutConstants.BinaryHeight; @@ -744,20 +766,21 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter aField = getMSFofReportDefinition().createInstance("com.sun.star.report.FormattedField"); nHeight = LayoutConstants.FormattedFieldHeight; if (nType == DataType.LONGVARCHAR) /* memo */ + { nHeight = LayoutConstants.MemoFieldHeight; // special case for memo } } _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. xReportControlModel.setDataField(_sFormattedfield); if (_aSO != null) { - // TODO: there seems to be some problems with copy all properties from the design template to the current design + // TODO: there seems to be some problems with copy all properties from the design template to the current design final FontDescriptor aFD = _aSO.getFontDescriptor(); if (aFD != null) { @@ -772,12 +795,12 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter _aRect.X += _nWidth; xReportControlModel.setHeight(nHeight); - if (nType == DataType.BINARY || - nType == DataType.VARBINARY || - nType == DataType.LONGVARBINARY) + if (nType == DataType.BINARY + || nType == DataType.VARBINARY + || 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); @@ -795,19 +818,19 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter // xReportControlModel.??? // } } - catch (com.sun.star.beans.UnknownPropertyException e) + catch (com.sun.star.beans.UnknownPropertyException ex) { - // seems we not able to set ParaAdjust + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex); } } // 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(); @@ -819,10 +842,9 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter _xSection.add(xReportControlModel); } } - catch (com.sun.star.uno.Exception e) + catch (com.sun.star.uno.Exception ex) { - // TODO: Exception not set. - int dummy = 0; + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex); } } return _aRect; @@ -845,12 +867,12 @@ 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; } // ------------------------------------------------------------------------- + protected Rectangle insertVerticalLine(XSection _xSection, Rectangle _aRect, int _nWidth, int _nHeight) { return insertLine(_xSection, _aRect, _nWidth, _nHeight, 1); @@ -868,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 @@ -882,15 +904,15 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter xFixedLine.setHeight(_nHeight); _xSection.add(xFixedLine); } - catch (com.sun.star.uno.Exception e) + catch (com.sun.star.uno.Exception ex) { - // TODO: Exception not set. - int dummy = 0; + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex); } } return _aRect; } // ------------------------------------------------------------------------- + protected void clearReportHeader() { XSection xSection; @@ -902,9 +924,9 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter emptySection(xSection); } } - catch (com.sun.star.container.NoSuchElementException e) + catch (com.sun.star.container.NoSuchElementException ex) { - // Exception not set. Not really from interest. + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex); } } @@ -930,6 +952,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter } catch (Exception e) { + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e); } } else @@ -953,7 +976,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter } catch (com.sun.star.container.NoSuchElementException e) { - // Exception not set. Not really from interest. + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e); } } @@ -979,6 +1002,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter } catch (Exception e) { + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e); } } else @@ -989,6 +1013,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter } } // ------------------------------------------------------------------------- + protected void clearPageHeader() { XSection xSection; @@ -1002,7 +1027,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter } catch (com.sun.star.container.NoSuchElementException e) { - // Exception not set. Not really from interest. + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e); } } @@ -1017,7 +1042,6 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter // // DebugHelper.writeInfo("Date: " + aBuf.toString()); // return aBuf.toString(); // } - // protected String getCurrentDate() // { // Calendar aCalendar = Calendar.getInstance(); @@ -1060,7 +1084,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter } catch (com.sun.star.container.NoSuchElementException e) { - // Exception not set. Should not from interest here. + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e); } } @@ -1108,49 +1132,49 @@ 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(); - aPropertySetHelper.setPropertyValueDontThrow("FontDescriptor", _aFont); + aPropertySetHelper.setPropertyValueDontThrow(PropertyNames.FONT_DESCRIPTOR, _aFont); final Object aUnoCtrlFixedText = getGlobalMSF().createInstance("com.sun.star.awt.UnoControlFixedText"); // 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) { - // TODO: Exception not set. + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e); } return aSizeMM_100TH; } @@ -1161,24 +1185,24 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter { return m_sTableName; } - return ""; + return PropertyNames.EMPTY_STRING; } protected String getUserNameFromConfiguration() { - String sFirstName = ""; - String sLastName = ""; + String sFirstName = PropertyNames.EMPTY_STRING; + String sLastName = PropertyNames.EMPTY_STRING; try { Object oProdNameAccess = Configuration.getConfigurationRoot(getGlobalMSF(), "org.openoffice.UserProfile/Data", false); sFirstName = (String) Helper.getUnoObjectbyName(oProdNameAccess, "givenname"); sLastName = (String) Helper.getUnoObjectbyName(oProdNameAccess, "sn"); } - catch (Exception exception) + catch (Exception e) { - exception.printStackTrace(System.out); + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e); } - return sFirstName + " " + sLastName; + return sFirstName + PropertyNames.SPACE + sLastName; } /** @@ -1188,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(); @@ -1210,6 +1234,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter } catch (Exception e) { + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e); } } } @@ -1230,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) @@ -1238,14 +1263,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter Object aClone = aComponent.createClone(); if (aClone != null) { - String sName = aComponent.getName(); - com.sun.star.awt.Point aPosition = aComponent.getPosition(); - Size aSize = aComponent.getSize(); - - XShape aShape = (XShape) UnoRuntime.queryInterface(XShape.class, aClone); - String sShapeType = aShape.getShapeType(); - com.sun.star.awt.Point aShapePoint = aShape.getPosition(); - Size aShapeSize = aShape.getSize(); + 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. @@ -1260,9 +1278,10 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter } catch (Exception e) { + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e); } - // String sName = xForeignSection.getName(); - // int dummy = 0; + // String sName = xForeignSection.getName(); + // int dummy = 0; } protected void insertPageHeader() @@ -1287,9 +1306,9 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter } catch (Exception e) { + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e); + } } - return; - } else { // we won't a page header @@ -1364,7 +1383,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter } catch (com.sun.star.uno.Exception e) { - // TODO: Exception not set. + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e); } } } @@ -1390,6 +1409,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter } catch (Exception e) { + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e); } } else @@ -1423,8 +1443,8 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter final String sSurroundDoubleQuotes = "\"" + sPageOf + "\""; final String sPageNumber = sSurroundDoubleQuotes.replaceAll("#page#", "\" & PageNumber() & \""); final String sPageCount = sPageNumber.replaceAll("#count#", "\" & PageCount() & \""); - final String sNoLastUnusedQuotes = sPageCount.replaceAll(" & \\\"\\\"", ""); - final String sNoFirstUnusedQuotes = sNoLastUnusedQuotes.replaceAll("\\\"\\\" & ", ""); + final String sNoLastUnusedQuotes = sPageCount.replaceAll(" & \\\"\\\"", PropertyNames.EMPTY_STRING); + final String sNoFirstUnusedQuotes = sNoLastUnusedQuotes.replaceAll("\\\"\\\" & ", PropertyNames.EMPTY_STRING); final int nUsablePageWidth = getPageWidth() - getLeftPageIndent() - getRightPageIndent(); @@ -1445,17 +1465,16 @@ 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); } catch (Exception e) { - // TODO: Exception not set. + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e); } } } @@ -1574,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); @@ -1595,7 +1614,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter } catch (com.sun.star.uno.Exception e) { - // TODO: Exception not set. + Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e); } } return nWidth; @@ -1623,7 +1642,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter String sDefaultHeaderLayout = m_xReportDefinitionReadAccess.getDefaultHeaderLayout(); loadAndSetBackgroundTemplate(sDefaultHeaderLayout); - // copy all functions from the design template to the current report definition + // copy all functions from the design template to the current report definition // XFunctions xOtherFunctions = m_xDesignTemplate.getReportDefinition().getFunctions(); // final int nFunctionCount = xOtherFunctions.getCount(); // for (int i=0;i<nFunctionCount;i++) @@ -1678,8 +1697,8 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter closeDesignTemplate(); String sName = FileAccess.getFilename(LayoutTemplatePath); - if (sName.toLowerCase().equals("default.otr_") || - LayoutTemplatePath.equals("DefaultLayoutOfHeaders")) + if (sName.toLowerCase().equals("default.otr_") + || LayoutTemplatePath.equals("DefaultLayoutOfHeaders")) { // this is the default layout, we don't want to have a layout for this. } @@ -1690,4 +1709,3 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter } } } - 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/SectionObject.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java index 797ac097f915..106b2a341d17 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java @@ -65,14 +65,12 @@ abstract public class SectionObject public int getHeight(int _nDefault) { - final int nHeight = getPropertySetHelper().getPropertyValueAsInteger(PropertyNames.PROPERTY_HEIGHT, _nDefault); - return nHeight; + return getPropertySetHelper().getPropertyValueAsInteger(PropertyNames.PROPERTY_HEIGHT, _nDefault); } public float getCharWeight(float _nDefault) { - final float fCharWeight = (float) getPropertySetHelper().getPropertyValueAsDouble("CharWeight", _nDefault); - return fCharWeight; + return(float) getPropertySetHelper().getPropertyValueAsDouble("CharWeight", _nDefault); } public void setFontToBold() 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 0fe168b28263..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() @@ -92,60 +91,59 @@ public class Tabular extends ReportBuilderLayouter xSection.setHeight(nHeight); } - protected void insertDetailFieldTitles() + protected void insertDetailFieldTitles(int lastGroupPostion) { final String[] aFieldTitleNames = getFieldTitleNames(); - if (aFieldTitleNames == null) + if (aFieldTitleNames == null || aFieldTitleNames.length == 0) { return; } - if (aFieldTitleNames.length == 0) - { - return; - } - final int nGroups = getReportDefinition().getGroups().getCount(); try { - XSection xSection = null; SectionObject aSO = null; - if (nGroups == 0) + final XGroups xGroups = getReportDefinition().getGroups(); + final XGroup xGroup; + if (lastGroupPostion == -1) { // Spezial case, there is no Group. - final XGroups xGroups = getReportDefinition().getGroups(); - final XGroup xGroup = xGroups.createGroup(); + xGroup = xGroups.createGroup(); xGroup.setHeaderOn(true); xGroups.insertByIndex(xGroups.getCount(), xGroup); - xSection = xGroup.getHeader(); copyGroupProperties(0); aSO = getDesignTemplate().getDetailLabel(); aSO.setFontToBold(); } else { - final XGroups xGroups = getReportDefinition().getGroups(); // we insert the titles in the last group - final Object aGroup = xGroups.getByIndex(nGroups - 1); - final XGroup xGroup = (XGroup) UnoRuntime.queryInterface(XGroup.class, aGroup); - xSection = xGroup.getHeader(); + xGroup = UnoRuntime.queryInterface(XGroup.class, xGroups.getByIndex(lastGroupPostion)); // We don't need to copy the GroupProperties, because this is done in the insertGroup() member function // copyGroupProperties(0); - aSO = getDesignTemplate().getGroupLabel(nGroups - 1); + aSO = getDesignTemplate().getGroupLabel(lastGroupPostion); } + XSection xSection = xGroup.getHeader(); Rectangle aRect = new Rectangle(); -// TODO: getCountOfGroups() == nGroups??? aRect.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups()); - // TODO: group line is fix - aRect.Y = aSO.getHeight(LayoutConstants.LabelHeight) + LayoutConstants.LineHeight; // group height + a little empty line + if (lastGroupPostion == -1) + { + xSection.setHeight(0); // group height + a little empty line) + aRect.Y = 0; + } + else + { + aRect.Y = xSection.getHeight() + LayoutConstants.LineHeight; + } + final int nWidth = calculateFieldWidth(getLeftGroupIndent(getCountOfGroups()), aFieldTitleNames.length); for (int i = 0; i < aFieldTitleNames.length; i++) { aRect = insertLabel(xSection, aFieldTitleNames[i], aRect, nWidth, aSO); } - xSection.setHeight(aSO.getHeight(LayoutConstants.LabelHeight) + LayoutConstants.LineHeight + aSO.getHeight(LayoutConstants.LabelHeight)); + xSection.setHeight(xSection.getHeight() + aSO.getHeight(LayoutConstants.LabelHeight)); } catch (com.sun.star.uno.Exception e) { 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 af685eadf343..e3c5c690fad3 100644 --- a/wizards/com/sun/star/wizards/table/CallTableWizard.java +++ b/wizards/com/sun/star/wizards/table/CallTableWizard.java @@ -30,6 +30,7 @@ import com.sun.star.beans.PropertyAttribute; import com.sun.star.beans.PropertyValue; import com.sun.star.uno.Type; import com.sun.star.wizards.common.Properties; +import com.sun.star.wizards.common.PropertyNames; /** This class capsulates the class, that implements the minimal component, a * factory for creating the service (<CODE>__getServiceFactory</CODE>). @@ -80,15 +81,15 @@ public class CallTableWizard { super(); m_serviceFactory = i_serviceFactory; - registerProperty( "Command", (short)( PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID ) ); - registerProperty( "CommandType", PropertyAttribute.READONLY ); + registerProperty( PropertyNames.COMMAND, (short)( PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID ) ); + registerProperty( PropertyNames.COMMAND_TYPE, PropertyAttribute.READONLY ); } public void trigger( String sEvent ) { try { - if ( sEvent.compareTo("start") == 0 ) + if ( sEvent.compareTo(PropertyNames.START) == 0 ) { TableWizard CurTableWizard = new TableWizard( m_serviceFactory, m_wizardContext ); Command = CurTableWizard.startTableWizard(); @@ -166,7 +167,7 @@ public class CallTableWizard try { - byteReturn = new 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 cf00c86f90d4..95e556f920b7 100644 --- a/wizards/com/sun/star/wizards/table/FieldDescription.java +++ b/wizards/com/sun/star/wizards/table/FieldDescription.java @@ -40,7 +40,7 @@ import com.sun.star.wizards.common.PropertyNames; public class FieldDescription { - private String tablename = ""; + private String tablename = PropertyNames.EMPTY_STRING; // String fieldname; private String keyname; private XNameAccess xNameAccessTableNode; @@ -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 5c5111e273b1..d19a6e0eb21d 100644 --- a/wizards/com/sun/star/wizards/table/FieldFormatter.java +++ b/wizards/com/sun/star/wizards/table/FieldFormatter.java @@ -110,7 +110,7 @@ public class FieldFormatter implements XItemListener btnShiftUp = CurUnoDialog.insertButton("btnShiftUp", "shiftFieldNameUp", this, new String[] { - PropertyNames.PROPERTY_ENABLED, "FontDescriptor", 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 + PropertyNames.PROPERTY_ENABLED, PropertyNames.FONT_DESCRIPTOR, 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[] { @@ -120,7 +120,7 @@ public class FieldFormatter implements XItemListener btnShiftDown = CurUnoDialog.insertButton("btnShiftDown", "shiftFieldNameDown", this, new String[] { - PropertyNames.PROPERTY_ENABLED, "FontDescriptor", 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 + PropertyNames.PROPERTY_ENABLED, PropertyNames.FONT_DESCRIPTOR, 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[] { @@ -132,7 +132,7 @@ public class FieldFormatter implements XItemListener btnminus = CurUnoDialog.insertButton("btnminus", "removeFieldName", this, new String[] { - "FontDescriptor", 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 + PropertyNames.FONT_DESCRIPTOR, 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[] { @@ -142,7 +142,7 @@ public class FieldFormatter implements XItemListener btnplus = CurUnoDialog.insertButton("btnplus", "addFieldName", this, new String[] { - "FontDescriptor", 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 + PropertyNames.FONT_DESCRIPTOR, 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[] { @@ -152,7 +152,7 @@ public class FieldFormatter implements XItemListener CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "ColDescriptorHeader", new String[] { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, "Orientation", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + 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[] { @@ -177,7 +177,7 @@ public class FieldFormatter implements XItemListener }, new Object[] { - UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGTABLE_COLNAME", 274, 37, IFieldFormatStep, new Short(curtabindex++), "", 50 + UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGTABLE_COLNAME", 274, 37, IFieldFormatStep, new Short(curtabindex++), PropertyNames.EMPTY_STRING, 50 }); txtfieldname.addTextListener(CurUnoDialog); CurUnoDialog.getPeerConfiguration().setAccessibleName(btnplus, sbtnplushelptext); @@ -198,7 +198,7 @@ public class FieldFormatter implements XItemListener 85, 158, 49, IFieldFormatStep, new Short(curtabindex++), 166, 50 }); //, "HID:WIZARDS_HID_DLGTABLE_COLMODIFIER" curTableDescriptor = _curTableDescriptor; - Helper.setUnoPropertyValue(oColumnDescriptorModel, "ActiveConnection", _curTableDescriptor.DBConnection); + Helper.setUnoPropertyValue(oColumnDescriptorModel, PropertyNames.ACTIVE_CONNECTION, _curTableDescriptor.DBConnection); txtfieldname.setMaxTextLen((short) this.curTableDescriptor.getMaxColumnNameLength()); } else @@ -210,8 +210,8 @@ public class FieldFormatter implements XItemListener CurUnoDialog.repaintDialogStep(); } } - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList", _fieldnames); - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[] + Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST, _fieldnames); + Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[] { 0 }); @@ -224,7 +224,7 @@ public class FieldFormatter implements XItemListener { boolean benableShiftUpButton = false; boolean benableShiftDownButton = false; - boolean bfieldnameisselected = Helper.getUnoArrayPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems") != null; + boolean bfieldnameisselected = Helper.getUnoArrayPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS) != null; int ilistcount = /* xlstFieldNames.getItemCount();*/ UnoDialog.getListBoxItemCount(xlstFieldNames); boolean blistispopulated = (ilistcount > 0); if (bfieldnameisselected) @@ -233,20 +233,20 @@ 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); } public void addFieldName() { - String snewfieldname = Desktop.getUniqueName(xlstFieldNames.getItems(), suntitled, ""); + String snewfieldname = Desktop.getUniqueName(xlstFieldNames.getItems(), suntitled, PropertyNames.EMPTY_STRING); short icount = xlstFieldNames.getItemCount(); if (CurUnoDialog.verifyfieldcount(icount)) { xlstFieldNames.addItem(snewfieldname, icount); - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[] + Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[] { icount }); @@ -262,7 +262,7 @@ public class FieldFormatter implements XItemListener public void removeFieldName() { - String[] fieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList"); + String[] fieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST); short ipos = UnoDialog.getSelectedItemPos(xlstFieldNames); String fieldname = fieldnames[ipos]; xlstFieldNames.removeItems(ipos, (short) 1); @@ -270,7 +270,7 @@ public class FieldFormatter implements XItemListener int ilistcount = /* xlstFieldNames.getItemCount();*/ UnoDialog.getListBoxItemCount(xlstFieldNames); if ((ipos) < ilistcount) { - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[] + Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[] { ipos }); @@ -280,14 +280,14 @@ public class FieldFormatter implements XItemListener if (ilistcount > -1) { ipos = (short) ((short) ilistcount - (short) 1); - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[] + Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[] { ipos }); } } curTableDescriptor.dropColumnbyName(fieldname); - fieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList"); + fieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST); boolean benable = ((ipos > -1) && (ipos < fieldnames.length)); if (benable) { @@ -297,11 +297,11 @@ public class FieldFormatter implements XItemListener } else { - Helper.setUnoPropertyValue(UnoDialog.getModel(txtfieldname), "Text", ""); - Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, new Boolean(benable)); + Helper.setUnoPropertyValue(UnoDialog.getModel(txtfieldname), "Text", PropertyNames.EMPTY_STRING); + 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(); } @@ -323,8 +323,8 @@ public class FieldFormatter implements XItemListener String[] fieldnames = xlstFieldNames.getItems(); short ipos = xlstFieldNames.getSelectedItemPos(); fieldnames[ipos] = newfieldname; - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList", fieldnames); - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[] + Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST, fieldnames); + Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[] { ipos }); @@ -336,10 +336,10 @@ public class FieldFormatter implements XItemListener { short ipos = xlstFieldNames.getSelectedItemPos(); String[] snewlist = shiftArrayItem(xlstFieldNames.getItems(), ipos, -1); - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList", snewlist); + Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST, snewlist); if ((ipos - 1) > -1) { - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[] + Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[] { (short) (ipos - 1) }); @@ -352,10 +352,10 @@ public class FieldFormatter implements XItemListener { short ipos = xlstFieldNames.getSelectedItemPos(); String[] snewlist = shiftArrayItem(xlstFieldNames.getItems(), ipos, 1); - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList", snewlist); + Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST, snewlist); if ((ipos + 1) < xlstFieldNames.getItemCount()) { - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[] + Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[] { (short) (ipos + 1) }); @@ -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) @@ -415,13 +414,13 @@ public class FieldFormatter implements XItemListener public boolean iscompleted() { - String[] sfieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList"); + String[] sfieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST); return sfieldnames.length > 0; } public String[] getFieldNames() { - return (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList"); + return (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST); } /* (non-Javadoc) diff --git a/wizards/com/sun/star/wizards/table/Finalizer.java b/wizards/com/sun/star/wizards/table/Finalizer.java index 83c92aeb731f..dd6933385927 100644 --- a/wizards/com/sun/star/wizards/table/Finalizer.java +++ b/wizards/com/sun/star/wizards/table/Finalizer.java @@ -92,7 +92,7 @@ public class Finalizer }, new Object[] { - UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGTABLE_TXT_NAME", 97, 35, IFINALSTEP, new Short(curtabindex++), "", 223 + UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGTABLE_TXT_NAME", 97, 35, IFINALSTEP, new Short(curtabindex++), PropertyNames.EMPTY_STRING, 223 }); txtTableName.addTextListener(CurUnoDialog); txtTableName.setMaxTextLen((short) this.curtabledescriptor.getMaxTableNameLength()); @@ -103,7 +103,7 @@ public class Finalizer if (sCatalogNames.length > 0) { bsupportsCatalogs = true; - String sCatalog = ""; + String sCatalog = PropertyNames.EMPTY_STRING; try { sCatalog = curtabledescriptor.DBConnection.getCatalog(); @@ -127,7 +127,7 @@ public class Finalizer xCatalogListBox = CurUnoDialog.insertListBox("lstCatalog", null, null, new String[] { - "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "LineCount", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, "StringItemList", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "LineCount", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.STRING_ITEM_LIST, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -138,7 +138,7 @@ public class Finalizer { isel = 0; } - CurUnoDialog.setControlProperty("lstCatalog", "SelectedItems", new short[] + CurUnoDialog.setControlProperty("lstCatalog", PropertyNames.SELECTED_ITEMS, new short[] { (short) isel }); @@ -158,7 +158,7 @@ public class Finalizer if (sSchemaNames.length > 0) { bsupportsSchemata = true; - String sSchema = ""; + String sSchema = PropertyNames.EMPTY_STRING; try { sSchema = (String) curtabledescriptor.getDataSourcePropertySet().getPropertyValue("User"); @@ -182,7 +182,7 @@ public class Finalizer xSchemaListBox = CurUnoDialog.insertListBox("lstSchema", null, null, new String[] { - "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "LineCount", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, "StringItemList", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "LineCount", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.STRING_ITEM_LIST, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -193,7 +193,7 @@ public class Finalizer { isel = 0; } - CurUnoDialog.setControlProperty("lstSchema", "SelectedItems", new short[] + CurUnoDialog.setControlProperty("lstSchema", PropertyNames.SELECTED_ITEMS, new short[] { (short) isel }); @@ -302,7 +302,7 @@ public class Finalizer public void setTableName(String _tablename) { - if (txtTableName.getText().equals("")) + if (txtTableName.getText().equals(PropertyNames.EMPTY_STRING)) { String ssuffix = Desktop.getIncrementSuffix(curtabledescriptor.getTableNamesAsNameAccess(), getComposedTableName(_tablename)); txtTableName.setText(_tablename + ssuffix); @@ -317,7 +317,7 @@ public class Finalizer public String getTableName(String _firsttablename) { - if (txtTableName.getText().equals("")) + if (txtTableName.getText().equals(PropertyNames.EMPTY_STRING)) { setTableName(_firsttablename); } @@ -332,7 +332,7 @@ public class Finalizer } else { - return ""; + return PropertyNames.EMPTY_STRING; } } @@ -344,7 +344,7 @@ public class Finalizer } else { - return ""; + return PropertyNames.EMPTY_STRING; } } diff --git a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java index aec63204f64a..6246b3ef037f 100644 --- a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java +++ b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java @@ -210,7 +210,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener } } String selfield = lstSinglePrimeKey.getSelectedItem(); - Helper.setUnoPropertyValue(UnoDialog.getModel(lstSinglePrimeKey), "StringItemList", fieldnames); + Helper.setUnoPropertyValue(UnoDialog.getModel(lstSinglePrimeKey), PropertyNames.STRING_ITEM_LIST, fieldnames); if (selfield != null) { if (JavaTools.FieldInList(fieldnames, selfield) > -1) @@ -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 e7b94596a90a..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; @@ -196,7 +197,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X public void initializeTable(int _iTable) { - Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[] + Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.SELECTED_ITEMS, new short[] { (short) _iTable }); @@ -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() @@ -266,7 +264,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X { for (int i = 0; i < CurTableWizardUnoDialog.fielditems.size(); i++) { - String stablename = ""; + String stablename = PropertyNames.EMPTY_STRING; try { FieldDescription ofielddescription = (FieldDescription) CurTableWizardUnoDialog.fielditems.get(fieldnames[i]); @@ -276,7 +274,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X { e.printStackTrace(System.out); } - if (!stablename.equals("")) + if (!stablename.equals(PropertyNames.EMPTY_STRING)) { return stablename; } @@ -347,7 +345,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X if (iduplicate != -1) { XNameAccess xNameAccessFieldNode; - String sdisplayname = Desktop.getUniqueName(NewItems, NewItems[iduplicate], ""); + String sdisplayname = Desktop.getUniqueName(NewItems, NewItems[iduplicate], PropertyNames.EMPTY_STRING); FieldDescription curfielddescription = new FieldDescription(xMSF, aLocale, this, sdisplayname, NewItems[iduplicate], imaxcolumnchars); CurTableWizardUnoDialog.fielditems.put(sdisplayname, curfielddescription); NewItems[iduplicate] = sdisplayname; diff --git a/wizards/com/sun/star/wizards/table/TableWizard.java b/wizards/com/sun/star/wizards/table/TableWizard.java index 79ddb8ae1039..d5f4c706b174 100644 --- a/wizards/com/sun/star/wizards/table/TableWizard.java +++ b/wizards/com/sun/star/wizards/table/TableWizard.java @@ -53,7 +53,7 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener, ScenarioSelector curScenarioSelector; FieldFormatter curFieldFormatter; PrimaryKeyHandler curPrimaryKeyHandler; - String sMsgWizardName = ""; + String sMsgWizardName = PropertyNames.EMPTY_STRING; public Hashtable fielditems; int wizardmode; String tablename; @@ -66,7 +66,7 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener, public static final int SOFIELDSFORMATPAGE = 2; public static final int SOPRIMARYKEYPAGE = 3; public static final int SOFINALPAGE = 4; - private String sMsgColumnAlreadyExists = ""; + private String sMsgColumnAlreadyExists = PropertyNames.EMPTY_STRING; String WizardHeaderText[] = new String[8]; private String m_tableName; @@ -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); } @@ -325,15 +325,15 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener, Object oFormWizard = this.xMSF.createInstance("com.sun.star.wizards.form.CallFormWizard"); NamedValueCollection wizardContext = new NamedValueCollection(); - wizardContext.put( "ActiveConnection", curTableDescriptor.DBConnection ); + wizardContext.put( PropertyNames.ACTIVE_CONNECTION, curTableDescriptor.DBConnection ); wizardContext.put( "DataSource", curTableDescriptor.getDataSource() ); - wizardContext.put( "CommandType", CommandType.TABLE ); - wizardContext.put( "Command", scomposedtablename ); + wizardContext.put( PropertyNames.COMMAND_TYPE, CommandType.TABLE ); + wizardContext.put( PropertyNames.COMMAND, scomposedtablename ); wizardContext.put( "DocumentUI", m_docUI ); XInitialization xInitialization = UnoRuntime.queryInterface( XInitialization.class, oFormWizard ); xInitialization.initialize( wizardContext.getPropertyValues() ); XJobExecutor xJobExecutor = UnoRuntime.queryInterface( XJobExecutor.class, oFormWizard ); - xJobExecutor.trigger("start"); + xJobExecutor.trigger(PropertyNames.START); } catch (Exception e) { @@ -387,7 +387,7 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener, { jexception.printStackTrace(System.out); } - return ""; + return PropertyNames.EMPTY_STRING; } public boolean getTableResources() diff --git a/wizards/com/sun/star/wizards/text/TextDocument.java b/wizards/com/sun/star/wizards/text/TextDocument.java index 4fe2e9f0d710..6e873c049167 100644 --- a/wizards/com/sun/star/wizards/text/TextDocument.java +++ b/wizards/com/sun/star/wizards/text/TextDocument.java @@ -74,6 +74,7 @@ import com.sun.star.wizards.common.Desktop; import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.JavaTools; import com.sun.star.wizards.common.Helper.DateUtils; +import com.sun.star.wizards.common.PropertyNames; import com.sun.star.wizards.document.OfficeDocument; public class TextDocument @@ -111,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) { @@ -126,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) { @@ -152,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) @@ -162,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) @@ -183,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) { @@ -203,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("", 100); + 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(); @@ -225,21 +226,21 @@ 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("", 100); + xProgressBar.start(PropertyNames.EMPTY_STRING, 100); xProgressBar.setValue(5); } @@ -248,7 +249,7 @@ public class TextDocument PropertyValue loadValues[] = new PropertyValue[3]; // open document in the Preview mode loadValues[0] = new PropertyValue(); - loadValues[0].Name = "ReadOnly"; + loadValues[0].Name = PropertyNames.READ_ONLY; loadValues[0].Value = Boolean.TRUE; loadValues[1] = new PropertyValue(); loadValues[1].Name = "AsTemplate"; @@ -262,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) @@ -273,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 @@ -296,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"); } @@ -321,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 @@ -356,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; @@ -365,14 +365,14 @@ public class TextDocument iScale = (iLastPos - iFirstPos) / iScaleLen; xTextCursor.gotoStart(false); xTextCursor.gotoEnd(true); - xTextCursor.setString(""); + xTextCursor.setString(PropertyNames.EMPTY_STRING); unlockallControllers(); return iScale; } public void unlockallControllers() { - while (xTextDocument.hasControllersLocked() == true) + while (xTextDocument.hasControllersLocked()) { xTextDocument.unlockControllers(); } @@ -380,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(); } @@ -396,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 + " " + (String) sn; + String fullname = gn + PropertyNames.SPACE + sn; Calendar cal = new GregorianCalendar(); int year = cal.get(Calendar.YEAR); @@ -413,12 +413,12 @@ 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); String description = xDocProps2.getDescription(); - description = description + " " + TemplateDescription; + description = description + PropertyNames.SPACE + TemplateDescription; description = JavaTools.replaceSubString(description, WizardName, "<wizard_name>"); description = JavaTools.replaceSubString(description, myDate, "<current_date>"); xDocProps2.setDescription(description); @@ -449,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; } @@ -469,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 e25227516058..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(); } @@ -82,21 +82,20 @@ public class TextFieldHandler Object oTextField = Helper.getUnoPropertyValue(xTextRange, "TextField"); if (com.sun.star.uno.AnyConverter.isVoid(oTextField)) { - return ""; + return PropertyNames.EMPTY_STRING; } 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) { exception.printStackTrace(System.out); } - return ""; + return PropertyNames.EMPTY_STRING; } public void insertUserField(XTextCursor xTextCursor, String FieldName, String FieldTitle) @@ -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 42fd75879c3c..b20d016f8ee8 100644 --- a/wizards/com/sun/star/wizards/text/TextSectionHandler.java +++ b/wizards/com/sun/star/wizards/text/TextSectionHandler.java @@ -43,6 +43,7 @@ import com.sun.star.uno.AnyConverter; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; import com.sun.star.wizards.common.Helper; +import com.sun.star.wizards.common.PropertyNames; public class TextSectionHandler { @@ -58,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) @@ -66,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); @@ -88,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); } @@ -102,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) @@ -115,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) { @@ -138,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); } } @@ -158,10 +159,10 @@ 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 = ""; + oSectionLink.FileURL = PropertyNames.EMPTY_STRING; for (int i = 0; i < iSectionCount; i++) { oTextSection = xAllTextSections.getByIndex(i); @@ -170,7 +171,7 @@ public class TextSectionHandler "FileLink", "LinkRegion" }, new Object[] { - oSectionLink, "" + oSectionLink, PropertyNames.EMPTY_STRING }); } } @@ -183,13 +184,13 @@ public class TextSectionHandler public void breakLinkOfTextSection(Object oTextSection) { SectionFileLink oSectionLink = new SectionFileLink(); - oSectionLink.FileURL = ""; + oSectionLink.FileURL = PropertyNames.EMPTY_STRING; Helper.setUnoPropertyValues(oTextSection, new String[] { "FileLink", "LinkRegion" }, new Object[] { - oSectionLink, "" + oSectionLink, PropertyNames.EMPTY_STRING }); } @@ -217,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) { @@ -251,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 e6c952e65785..e9f6cd737e7d 100644 --- a/wizards/com/sun/star/wizards/text/TextStyleHandler.java +++ b/wizards/com/sun/star/wizards/text/TextStyleHandler.java @@ -36,6 +36,7 @@ import com.sun.star.text.XTextDocument; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; +import com.sun.star.wizards.common.PropertyNames; public class TextStyleHandler { @@ -49,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 = ""; + 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); } @@ -79,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; } @@ -97,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 3f37d68123a6..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[] @@ -127,7 +126,7 @@ public class AggregateComponent extends ControlScroller CurUnoDialog.insertButton("btnplus", SOADDROW, new ActionListenerImpl(), new String[] { - "FontDescriptor", 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 + PropertyNames.FONT_DESCRIPTOR, 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[] { @@ -136,7 +135,7 @@ public class AggregateComponent extends ControlScroller CurUnoDialog.insertButton("btnminus", SOREMOVEROW, new ActionListenerImpl(), new String[] { - "FontDescriptor", 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 + PropertyNames.FONT_DESCRIPTOR, 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[] { @@ -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); } @@ -528,7 +525,7 @@ public class AggregateComponent extends ControlScroller xFunctionListBox = CurUnoDialog.insertListBox(getFunctionControlName(index), 1, null, new ItemListenerImpl(), new String[] { - "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, "StringItemList", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.STRING_ITEM_LIST, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -570,13 +567,13 @@ public class AggregateComponent extends ControlScroller private void insertFieldNames() { - Helper.setUnoPropertyValue(UnoDialog.getModel(xFieldListBox), "StringItemList", CurDBMetaData.NumericFieldNames); + Helper.setUnoPropertyValue(UnoDialog.getModel(xFieldListBox), PropertyNames.STRING_ITEM_LIST, CurDBMetaData.NumericFieldNames); } private boolean isComplete() { - boolean bfieldnameisselected = (Helper.getUnoArrayPropertyValue(UnoDialog.getModel(xFieldListBox), "SelectedItems") != null); - boolean bfunctionisselected = (Helper.getUnoArrayPropertyValue(UnoDialog.getModel(xFunctionListBox), "SelectedItems") != null); + boolean bfieldnameisselected = (Helper.getUnoArrayPropertyValue(UnoDialog.getModel(xFieldListBox), PropertyNames.SELECTED_ITEMS) != null); + boolean bfunctionisselected = (Helper.getUnoArrayPropertyValue(UnoDialog.getModel(xFunctionListBox), PropertyNames.SELECTED_ITEMS) != null); return (bfieldnameisselected && bfunctionisselected); } diff --git a/wizards/com/sun/star/wizards/ui/ButtonList.java b/wizards/com/sun/star/wizards/ui/ButtonList.java index 2239b940798e..e85343f42464 100644 --- a/wizards/com/sun/star/wizards/ui/ButtonList.java +++ b/wizards/com/sun/star/wizards/ui/ButtonList.java @@ -135,7 +135,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener new Object[] { Integer.valueOf(imageTextHeight), - "", + PropertyNames.EMPTY_STRING, "(1)", Integer.valueOf(nXPos), Integer.valueOf(nYPos), @@ -190,7 +190,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener lblCounter = dialog.insertLabel(m_aControlName + "_lblCounter", pNames1, new Object[] { Integer.valueOf(LINE_HEIGHT), - "", + PropertyNames.EMPTY_STRING, Integer.valueOf(pos.Width + btnSize.intValue() + 1), Integer.valueOf(pos.Height + (m_aButtonSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + ((btnSize.intValue() - LINE_HEIGHT) / 2)), step, @@ -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); } @@ -675,7 +673,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener private void refreshImageText() { Object item = m_nCurrentSelection >= 0 ? getListModel().getElementAt(m_nCurrentSelection) : null; - final String sText = " " + renderer.render(item); + final String sText = PropertyNames.SPACE + renderer.render(item); Helper.setUnoPropertyValue(getModel(lblImageText), PropertyNames.PROPERTY_LABEL, sText); } @@ -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) @@ -770,7 +768,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener // @Override public String render(Object counter) { - return "" + ((Counter) counter).start + ".." + ((Counter) counter).end + "/" + ((Counter) counter).max; + return PropertyNames.EMPTY_STRING + ((Counter) counter).start + ".." + ((Counter) counter).end + "/" + ((Counter) counter).max; } } @@ -891,9 +889,9 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener } // check which Button is pressed. - String sControlName = aHelper.getPropertyValueAsString(PropertyNames.PROPERTY_NAME, ""); + 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 1352f70f9e83..14a5f88796ba 100644 --- a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java @@ -63,7 +63,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject) { - short[] SelItems = (short[]) CurUnoDialog.getControlProperty(sTableListBoxName, "SelectedItems"); + short[] SelItems = (short[]) CurUnoDialog.getControlProperty(sTableListBoxName, PropertyNames.SELECTED_ITEMS); if (SelItems.length > 0) { iOldSelPos = m_iSelPos; @@ -187,7 +187,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator } else { - return ""; + return PropertyNames.EMPTY_STRING; } } @@ -205,7 +205,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator private short getselectedItemPos() { - short[] iSelPoses = ((short[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems")); + short[] iSelPoses = ((short[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.SELECTED_ITEMS)); if (iSelPoses.length > 0) { return iSelPoses[0]; @@ -214,7 +214,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator { if (this.bpreselectCommand) { - String[] sItemList = ((String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), "StringItemList")); + String[] sItemList = ((String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.STRING_ITEM_LIST)); if (sItemList.length > 0) { return (short) 0; @@ -229,10 +229,10 @@ public class CommandFieldSelection extends FieldSelection implements Comparator try { boolean binitialize = false; - String curCommandName = ""; + String curCommandName = PropertyNames.EMPTY_STRING; //As the peer of the control might not yet exist we have to query the model for the SelectedItems short iSelPos = getselectedItemPos(); - // String[] sLocList = (String[]) CurUnoDialog.getControlProperty(sTableListBoxName, "StringItemList"); + // String[] sLocList = (String[]) CurUnoDialog.getControlProperty(sTableListBoxName, PropertyNames.STRING_ITEM_LIST); final String sSelectedTableName = xTableListBox.getItem(iSelPos); if (!bgetQueries) { @@ -245,14 +245,14 @@ public class CommandFieldSelection extends FieldSelection implements Comparator if (sSelectedTableName.startsWith(sTablePrefix)) { CurDBMetaData.setCommandType(CommandType.TABLE); - curCommandName = JavaTools.replaceSubString(sSelectedTableName, "", sTablePrefix); + curCommandName = JavaTools.replaceSubString(sSelectedTableName, PropertyNames.EMPTY_STRING, sTablePrefix); CurDBMetaData.setTableByName(curCommandName); binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.TABLE, AppendMode); } else { CurDBMetaData.setCommandType(CommandType.QUERY); - curCommandName = JavaTools.replaceSubString(sSelectedTableName, "", sQueryPrefix); + curCommandName = JavaTools.replaceSubString(sSelectedTableName, PropertyNames.EMPTY_STRING, sQueryPrefix); CurDBMetaData.setQueryByName(curCommandName); binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.QUERY, AppendMode); } @@ -304,7 +304,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator ContentList = setPrefixinArray(ContentList, sTablePrefix, 0, CurDBMetaData.getTableNames().length); } java.util.Arrays.sort(ContentList, this); - Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "StringItemList", ContentList); + Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.STRING_ITEM_LIST, ContentList); short iSelPos = getselectedItemPos(); if (bpreselectCommand) { @@ -320,9 +320,9 @@ public class CommandFieldSelection extends FieldSelection implements Comparator else { emptyFieldsListBoxes(); - iSelArray = new short[] { (short) iSelPos }; + iSelArray = new short[] {iSelPos}; } - Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", iSelArray); + Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.SELECTED_ITEMS, iSelArray); toggleCommandListBox(true); if (bgetFields) { @@ -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() @@ -404,10 +404,10 @@ public class CommandFieldSelection extends FieldSelection implements Comparator { try { - if (Properties.hasPropertyValue(_aPropertyValue, "CommandType")) + if (Properties.hasPropertyValue(_aPropertyValue, PropertyNames.COMMAND_TYPE)) { - int nCommandType = AnyConverter.toInt(Properties.getPropertyValue(_aPropertyValue, "CommandType")); - String sCommand = AnyConverter.toString(Properties.getPropertyValue(_aPropertyValue, "Command")); + int nCommandType = AnyConverter.toInt(Properties.getPropertyValue(_aPropertyValue, PropertyNames.COMMAND_TYPE)); + String sCommand = AnyConverter.toString(Properties.getPropertyValue(_aPropertyValue, PropertyNames.COMMAND)); if (sCommand != null) { preselectCommand(sCommand, nCommandType, _bReadOnly); @@ -424,12 +424,12 @@ public class CommandFieldSelection extends FieldSelection implements Comparator { if (_selitem.length() > 0) { - String[] sitems = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), "StringItemList"); + String[] sitems = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.STRING_ITEM_LIST); String sPrefix = getCommandPrefix(_nCommandType); short iselpos = (short) JavaTools.FieldInList(sitems, sPrefix + _selitem); if (iselpos > -1) { - Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[] + Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.SELECTED_ITEMS, new short[] { iselpos }); @@ -438,13 +438,13 @@ public class CommandFieldSelection extends FieldSelection implements Comparator } else { - Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[] + Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.SELECTED_ITEMS, new short[] { }); } if (_bReadOnly) { - Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "ReadOnly", new Boolean(_selitem.length() > 0)); + Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.READ_ONLY, Boolean.valueOf(_selitem.length() > 0)); } } @@ -452,22 +452,22 @@ public class CommandFieldSelection extends FieldSelection implements Comparator { if (_selitem.length() > 0) { - String[] sitems = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), "StringItemList"); + String[] sitems = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.STRING_ITEM_LIST); short iselpos = (short) JavaTools.FieldInList(sitems, getTablePrefix() + _selitem); if (iselpos > -1) { - Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[] { iselpos }); + Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.SELECTED_ITEMS, new short[] { iselpos }); } this.fillUpFieldsListbox(); } else { - Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[] {} ); + Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.SELECTED_ITEMS, new short[] {} ); this.fillUpFieldsListbox(); } if (_bReadOnly) { - Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "ReadOnly", 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 b8f2036f9867..59b01fee772b 100644 --- a/wizards/com/sun/star/wizards/ui/ControlScroller.java +++ b/wizards/com/sun/star/wizards/ui/ControlScroller.java @@ -26,8 +26,6 @@ ************************************************************************/ package com.sun.star.wizards.ui; -import com.sun.star.awt.XScrollBar; -import com.sun.star.awt.AdjustmentEvent; import com.sun.star.beans.*; import com.sun.star.awt.*; import com.sun.star.lang.XMultiServiceFactory; @@ -130,11 +128,11 @@ public abstract class ControlScroller new AdjustmentListenerImpl(), new String[] { - PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "Orientation", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.ORIENTATION, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH }, 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; @@ -158,7 +156,7 @@ public abstract class ControlScroller protected void setScrollBarOrientationHorizontal() { - Helper.setUnoPropertyValue(xScrollBar, "Orientation", new Integer(ScrollBarOrientation.HORIZONTAL)); + Helper.setUnoPropertyValue(xScrollBar, PropertyNames.ORIENTATION, new Integer(ScrollBarOrientation.HORIZONTAL)); } /** @@ -173,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[] @@ -245,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(); } } @@ -301,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) @@ -312,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)); } } @@ -326,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)); } @@ -343,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) }); } @@ -397,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 { @@ -453,7 +449,7 @@ public abstract class ControlScroller { Object oControlModel = UnoDialog.getModel(CurUnoDialog.xDlgContainer.getControl(controlname)); String propertyname = UnoDialog.getDisplayProperty(oControlModel); - if (propertyname != "") + if (!propertyname.equals(PropertyNames.EMPTY_STRING)) { CurUnoDialog.setControlProperty(controlname, propertyname, newvalue); } @@ -463,7 +459,7 @@ public abstract class ControlScroller { Object oControlModel = UnoDialog.getModel(CurUnoDialog.xDlgContainer.getControl(controlname)); String propertyname = UnoDialog.getDisplayProperty(oControlModel); - if (propertyname != "") + 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 341ab73828c5..1bf70e77faa6 100644 --- a/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java @@ -30,6 +30,7 @@ import com.sun.star.awt.XListBox; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.JavaTools; +import com.sun.star.wizards.common.PropertyNames; /** * @author Administrator @@ -90,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++) { @@ -112,17 +113,14 @@ 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; } protected void initializeListBox(XListBox xListBox, String[] _AllFieldNames, String[] _SelFieldNames, int curindex) { short[] SelList = null; - Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "StringItemList", _AllFieldNames); + Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), PropertyNames.STRING_ITEM_LIST, _AllFieldNames); if (_SelFieldNames != null) { if (curindex < _SelFieldNames.length) @@ -136,22 +134,22 @@ public abstract class DBLimitedFieldSelection { SelList = new short[] { (short) (0) }; } - Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "SelectedItems", SelList); + Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), PropertyNames.SELECTED_ITEMS, SelList); return; } } SelList = new short[] { (short) (0) }; - Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "SelectedItems", SelList); + Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), PropertyNames.SELECTED_ITEMS, SelList); } protected void initializeListBox(XListBox xListBox, String[] _AllFieldNames, String _SelFieldName) { - Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "StringItemList", _AllFieldNames); + Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), PropertyNames.STRING_ITEM_LIST, _AllFieldNames); short[] SelList = null; int index = JavaTools.FieldInList(_AllFieldNames, _SelFieldName); SelList = new short[] { (short) (index) }; - Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "SelectedItems", SelList); + Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), PropertyNames.SELECTED_ITEMS, SelList); } } diff --git a/wizards/com/sun/star/wizards/ui/DocumentPreview.java b/wizards/com/sun/star/wizards/ui/DocumentPreview.java index 173fae87f01b..db7a3fd959fc 100644 --- a/wizards/com/sun/star/wizards/ui/DocumentPreview.java +++ b/wizards/com/sun/star/wizards/ui/DocumentPreview.java @@ -37,6 +37,7 @@ import com.sun.star.uno.UnoRuntime; import com.sun.star.util.CloseVetoException; import com.sun.star.util.XCloseable; import com.sun.star.wizards.common.Properties; +import com.sun.star.wizards.common.PropertyNames; /** * @author rpiterman @@ -75,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); @@ -98,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); } @@ -115,7 +116,7 @@ public class DocumentPreview { if (xFrame != null) { - ((XCloseable) UnoRuntime.queryInterface(XCloseable.class, xFrame)).close(false); + UnoRuntime.queryInterface(XCloseable.class, xFrame).close(false); } } @@ -126,7 +127,7 @@ public class DocumentPreview case PREVIEW_MODE: return setDocument(url, new String[] { - "Preview", "ReadOnly" + "Preview", PropertyNames.READ_ONLY }, new Object[] { Boolean.TRUE, Boolean.TRUE @@ -148,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; @@ -163,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 8159de0dd1dd..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[] @@ -317,7 +317,7 @@ public class FieldSelection Object btnmoveup = CurUnoDialog.insertButton("cmdMoveUp" + sIncSuffix, SOCMDMOVEUP, new ActionListenerImpl(), new String[] { - PropertyNames.PROPERTY_ENABLED, "FontDescriptor", 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 + PropertyNames.PROPERTY_ENABLED, PropertyNames.FONT_DESCRIPTOR, 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[] { @@ -327,7 +327,7 @@ public class FieldSelection Object btnmovedown = CurUnoDialog.insertButton("cmdMoveDown" + sIncSuffix, SOCMDMOVEDOWN, new ActionListenerImpl(), new String[] { - PropertyNames.PROPERTY_ENABLED, "FontDescriptor", 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 + PropertyNames.PROPERTY_ENABLED, PropertyNames.FONT_DESCRIPTOR, 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[] { @@ -336,8 +336,8 @@ public class FieldSelection CurUnoDialog.getPeerConfiguration().setAccessibleName(btnmoveselected, AccessTextMoveSelected); CurUnoDialog.getPeerConfiguration().setAccessibleName(btnremoveselected, AccessTextRemoveSelected); - CurUnoDialog.getPeerConfiguration().setAccessibleName(xFieldsListBox, JavaTools.replaceSubString(slblFields, "", "~")); - CurUnoDialog.getPeerConfiguration().setAccessibleName(xSelectedFieldsListBox, JavaTools.replaceSubString(slblSelFields, "", "~")); + CurUnoDialog.getPeerConfiguration().setAccessibleName(xFieldsListBox, JavaTools.replaceSubString(slblFields, PropertyNames.EMPTY_STRING, "~")); + CurUnoDialog.getPeerConfiguration().setAccessibleName(xSelectedFieldsListBox, JavaTools.replaceSubString(slblSelFields, PropertyNames.EMPTY_STRING, "~")); if (btnmoveall != null) { CurUnoDialog.getPeerConfiguration().setAccessibleName(btnmoveall, AccessTextMoveAll); @@ -402,7 +402,7 @@ public class FieldSelection String NeighborItem = NewItemList[iSelIndex + iNeighbor]; NewItemList[iSelIndex + iNeighbor] = CurItem; NewItemList[iSelIndex] = NeighborItem; - CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, "StringItemList", NewItemList); + CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, PropertyNames.STRING_ITEM_LIST, NewItemList); xSelectedFieldsListBox.selectItem(CurItem, true); if (xFieldSelection != null) { @@ -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) @@ -497,10 +497,10 @@ public class FieldSelection try { toggleListboxControls(Boolean.FALSE); - CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, "StringItemList", new String[] + CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, PropertyNames.STRING_ITEM_LIST, new String[] { }); - CurUnoDialog.setControlProperty("lstFields" + sIncSuffix, "StringItemList", new String[] + CurUnoDialog.setControlProperty("lstFields" + sIncSuffix, PropertyNames.STRING_ITEM_LIST, new String[] { }); } @@ -670,14 +670,14 @@ public class FieldSelection public String[] getSelectedFieldNames() { - return (String[]) CurUnoDialog.getControlProperty("lstSelFields" + sIncSuffix, "StringItemList"); + return (String[]) CurUnoDialog.getControlProperty("lstSelFields" + sIncSuffix, PropertyNames.STRING_ITEM_LIST); } public void setSelectedFieldNames(String[] _sfieldnames) { - CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, "StringItemList", _sfieldnames); + CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, PropertyNames.STRING_ITEM_LIST, _sfieldnames); String[] sleftboxfieldnames = JavaTools.removefromList(xFieldsListBox.getItems(), _sfieldnames); - CurUnoDialog.setControlProperty("lstFields" + sIncSuffix, "StringItemList", sleftboxfieldnames); + CurUnoDialog.setControlProperty("lstFields" + sIncSuffix, PropertyNames.STRING_ITEM_LIST, sleftboxfieldnames); } public void setModified(boolean _bModified) @@ -692,6 +692,6 @@ public class FieldSelection public void changeSelectedFieldNames(String[] _sfieldnames) { - CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, "StringItemList", _sfieldnames); + CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, PropertyNames.STRING_ITEM_LIST, _sfieldnames); } } diff --git a/wizards/com/sun/star/wizards/ui/FilterComponent.java b/wizards/com/sun/star/wizards/ui/FilterComponent.java index 09937a6af6d4..8c8ee10a1a83 100644 --- a/wizards/com/sun/star/wizards/ui/FilterComponent.java +++ b/wizards/com/sun/star/wizards/ui/FilterComponent.java @@ -128,7 +128,7 @@ public class FilterComponent public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject) { int iKey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList); - String sControlName = ""; + String sControlName = PropertyNames.EMPTY_STRING; switch (iKey) { case SO_FIRSTFIELDNAME: @@ -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,16 +222,15 @@ 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) { e.printStackTrace(System.out); } - return ""; + return PropertyNames.EMPTY_STRING; } public PropertyValue[][] getFilterConditions() @@ -246,10 +244,10 @@ 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, ""); + column.addProperty(PropertyNames.PROPERTY_NAME, PropertyAttribute.BOUND, PropertyNames.EMPTY_STRING); column.addProperty("Value", (short) (PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE), null); final XPropertySet columnSet = UnoRuntime.queryInterface(XPropertySet.class, column); @@ -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 @@ -341,7 +339,7 @@ public class FilterComponent String sreturn = JavaTools.replaceSubString(_BaseString, FieldName, "<FIELDNAME>"); String soperator = sLogicOperators[_filtercondition.Handle - 1]; sreturn = JavaTools.replaceSubString(sreturn, soperator, "<LOGICOPERATOR>"); - String sDisplayValue = ""; + String sDisplayValue = PropertyNames.EMPTY_STRING; if ((_filtercondition.Handle != SQLFilterOperator.SQLNULL) && (_filtercondition.Handle != SQLFilterOperator.NOT_SQLNULL) && !AnyConverter.isVoid(_filtercondition.Value)) @@ -355,14 +353,14 @@ public class FilterComponent { e.printStackTrace(System.out); } - return ""; + return PropertyNames.EMPTY_STRING; } private int getfilterstate() { 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, @@ -678,7 +676,7 @@ public class FilterComponent PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, - "StringItemList", + PropertyNames.STRING_ITEM_LIST, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, @@ -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, @@ -734,11 +732,11 @@ public class FilterComponent { try { - short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTFIELDNAME]), "SelectedItems")); + short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTFIELDNAME]), PropertyNames.SELECTED_ITEMS)); if (SelFields.length > 0) { int nSelOperator = getSelectedOperator(); - // short[] SelOperator = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems")); + // short[] SelOperator = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), PropertyNames.SELECTED_ITEMS)); if (nSelOperator == com.sun.star.sdb.SQLFilterOperator.SQLNULL || /* is null */ nSelOperator == com.sun.star.sdb.SQLFilterOperator.NOT_SQLNULL) /* is not null */ @@ -761,7 +759,7 @@ public class FilterComponent if (!AnyConverter.isVoid(oValue)) { String sValue = (String.valueOf(oValue)); - return (!sValue.equals("")); + return (!sValue.equals(PropertyNames.EMPTY_STRING)); } } } @@ -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)) @@ -788,8 +786,8 @@ public class FilterComponent String sValue = AnyConverter.toString(_filtercondition.Value); if (sValue.indexOf("{D '") > -1) { - sValue = JavaTools.replaceSubString(sValue, "", "{D '"); - sValue = JavaTools.replaceSubString(sValue, "", "' }"); + sValue = JavaTools.replaceSubString(sValue, PropertyNames.EMPTY_STRING, "{D '"); + sValue = JavaTools.replaceSubString(sValue, PropertyNames.EMPTY_STRING, "' }"); try { oQueryMetaData.getNumberFormatter().convertStringToNumber(iDateFormat, sValue); @@ -801,8 +799,8 @@ public class FilterComponent } else if (sValue.indexOf("{T '") > -1) { - sValue = JavaTools.replaceSubString(sValue, "", "{T '"); - sValue = JavaTools.replaceSubString(sValue, "", "' }"); + sValue = JavaTools.replaceSubString(sValue, PropertyNames.EMPTY_STRING, "{T '"); + sValue = JavaTools.replaceSubString(sValue, PropertyNames.EMPTY_STRING, "' }"); try { oQueryMetaData.getNumberFormatter().convertStringToNumber(iTimeFormat, sValue); @@ -836,7 +834,7 @@ public class FilterComponent protected void setFieldNames(String[] _FieldNames) { - Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTFIELDNAME]), "StringItemList", _FieldNames); + Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTFIELDNAME]), PropertyNames.STRING_ITEM_LIST, _FieldNames); FieldNames = _FieldNames; } @@ -867,7 +865,7 @@ public class FilterComponent }; try { - iselected = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems")); + iselected = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), PropertyNames.SELECTED_ITEMS)); } catch (Exception e) { @@ -875,7 +873,7 @@ public class FilterComponent } if ((iselected.length) == 0) { - Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems", new short[] + Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), PropertyNames.SELECTED_ITEMS, new short[] { 0 }); @@ -891,7 +889,7 @@ public class FilterComponent { try { - short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTFIELDNAME]), "SelectedItems")); + short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTFIELDNAME]), PropertyNames.SELECTED_ITEMS)); return FieldNames[SelFields[0]]; } catch (Exception exception) @@ -907,7 +905,7 @@ public class FilterComponent { try { - short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems")); + short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), PropertyNames.SELECTED_ITEMS)); switch (SelFields[0]) { case 0: diff --git a/wizards/com/sun/star/wizards/ui/ImageList.java b/wizards/com/sun/star/wizards/ui/ImageList.java index 3f57e93edaa1..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[] @@ -240,7 +240,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener lblImageText = dialog.insertLabel(name + "_imageText", pNames1, new Object[] { new Integer(imageTextHeight), - "", + PropertyNames.EMPTY_STRING, new Integer(pos.Width + 1), new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height), step, @@ -281,7 +281,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener lblCounter = dialog.insertLabel(name + "_lblCounter", pNames1, new Object[] { new Integer(LINE_HEIGHT), - "", + PropertyNames.EMPTY_STRING, new Integer(pos.Width + btnSize.intValue() + 1), new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + ((btnSize.intValue() - LINE_HEIGHT) / 2)), step, @@ -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); } /** @@ -818,7 +818,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener private void refreshImageText() { Object item = selected >= 0 ? getListModel().getElementAt(selected) : null; - Helper.setUnoPropertyValue(getModel(lblImageText), PropertyNames.PROPERTY_LABEL, " " + renderer.render(item)); + Helper.setUnoPropertyValue(getModel(lblImageText), PropertyNames.PROPERTY_LABEL, PropertyNames.SPACE + renderer.render(item)); } /** @@ -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(); } /* @@ -945,7 +945,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener public String render(Object counter) { - return "" + ((Counter) counter).start + ".." + ((Counter) counter).end + "/" + ((Counter) counter).max; + return PropertyNames.EMPTY_STRING + ((Counter) counter).start + ".." + ((Counter) counter).end + "/" + ((Counter) counter).max; } } @@ -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 a19ca220490b..fbeb54f84f35 100755 --- a/wizards/com/sun/star/wizards/ui/PathSelection.java +++ b/wizards/com/sun/star/wizards/ui/PathSelection.java @@ -41,9 +41,9 @@ public class PathSelection XMultiServiceFactory xMSF; int iDialogType; int iTransferMode; - public String sDefaultDirectory = ""; - public String sDefaultName = ""; - public String sDefaultFilter = ""; + public String sDefaultDirectory = PropertyNames.EMPTY_STRING; + public String sDefaultName = PropertyNames.EMPTY_STRING; + public String sDefaultFilter = PropertyNames.EMPTY_STRING; public boolean usedPathPicker = false; public XPathSelectionListener xAction; public XTextComponent xSaveTextBox; @@ -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,16 +89,16 @@ 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", "ReadOnly", Boolean.TRUE); + //CurUnoDialog.setControlProperty("txtSavePath", PropertyNames.READ_ONLY, Boolean.TRUE); CurUnoDialog.setControlProperty("txtSavePath", PropertyNames.PROPERTY_ENABLED, Boolean.FALSE); CurUnoDialog.insertButton("cmdSelectPath", "triggerPathPicker", this, new String[] { 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 19617b593bd6..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]); @@ -129,7 +129,7 @@ public class PeerConfig implements XWindowListener for (int i = 0; i < this.aImageUrlTasks.size(); i++) { ImageUrlTask aImageUrlTask = (ImageUrlTask) aImageUrlTasks.elementAt(i); - String sImageUrl = ""; + String sImageUrl = PropertyNames.EMPTY_STRING; if (AnyConverter.isInt(aImageUrlTask.oResource)) { sImageUrl = oUnoDialog.getWizardImageUrl(((Integer) aImageUrlTask.oResource).intValue(), ((Integer) aImageUrlTask.oHCResource).intValue()); @@ -138,7 +138,7 @@ public class PeerConfig implements XWindowListener { sImageUrl = oUnoDialog.getImageUrl(((String) aImageUrlTask.oResource), ((String) aImageUrlTask.oHCResource)); } - if (!sImageUrl.equals("")) + if (!sImageUrl.equals(PropertyNames.EMPTY_STRING)) { Helper.setUnoPropertyValue(aImageUrlTask.oModel, PropertyNames.PROPERTY_IMAGEURL, sImageUrl); } @@ -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 d15f5131b560..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,21 +97,21 @@ 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, "Orientation", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + 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[] { - new Boolean(true), new Boolean(bDoEnable), 12, HIDString, new Short(UnoDialog.getListBoxLineCount()), "lstSort" + new Integer(i + 1), IListBoxPosX, new Integer(iCurPosY + 14), IStep, new Short(curtabindex++), IListBoxWidth + true, bDoEnable, 12, HIDString, new Short(UnoDialog.getListBoxLineCount()), "lstSort" + new Integer(i + 1), IListBoxPosX, new Integer(iCurPosY + 14), IStep, new Short(curtabindex++), IListBoxWidth }); //new Short((short) (17+i*4)) HIDString = HelpIds.getHelpIdString(FirstHelpIndex + 1); @@ -120,7 +120,7 @@ public class SortingComponent PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Tag", PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Boolean(bDoEnable), 10, HIDString, sSortAscend[i], IOptButtonPosX, new Integer(iCurPosY + 10), new Short((short) 1), IStep, new Short(curtabindex++), new String("ASC"), IOptButtonWidth + bDoEnable, 10, HIDString, sSortAscend[i], IOptButtonPosX, new Integer(iCurPosY + 10), new Short((short) 1), IStep, new Short(curtabindex++), PropertyNames.ASC, IOptButtonWidth }); //, new Short((short) (18+i*4)) HIDString = HelpIds.getHelpIdString(FirstHelpIndex + 2); @@ -129,7 +129,7 @@ public class SortingComponent PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Tag", PropertyNames.PROPERTY_WIDTH }, new Object[] { - new Boolean(bDoEnable), 10, HIDString, sSortDescend[i], IOptButtonPosX, new Integer(iCurPosY + 24), new Short((short) 0), IStep, new Short(curtabindex++), new String("DESC"), IOptButtonWidth + bDoEnable, 10, HIDString, sSortDescend[i], IOptButtonPosX, new Integer(iCurPosY + 24), new Short((short) 0), IStep, new Short(curtabindex++), "DESC", IOptButtonWidth }); //, new Short((short) (19+i*4)) iCurPosY = iCurPosY + 36; FirstHelpIndex += 3; @@ -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(), "StringItemList", ViewFieldNames); - CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 1).toString(), "SelectedItems", 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(), "ReadOnly", new Boolean(_breadonly)); + CurUnoDialog.setControlProperty("lstSort" + Integer.toString(_index + 1), PropertyNames.READ_ONLY, Boolean.valueOf(_breadonly)); } /** @@ -261,12 +258,12 @@ public class SortingComponent ArrayList<String> SortDescriptions = new ArrayList<String>(); for (int i = 0; i <= MaxSortIndex; i++) { - if (!((Boolean) CurUnoDialog.getControlProperty("lstSort" + (i + 1), "ReadOnly"))) + if (!((Boolean) CurUnoDialog.getControlProperty("lstSort" + (i + 1), PropertyNames.READ_ONLY))) { CurFieldName = xSortListBox[i].getSelectedItem(); SortDescriptions.add(CurFieldName); - iCurState = ((Short) CurUnoDialog.getControlProperty("optAscend" + new Integer(i + 1).toString(), PropertyNames.PROPERTY_STATE)).shortValue(); - SortFieldNames.add(new String[]{CurFieldName,iCurState == 1 ? "ASC" :"DESC" }); + iCurState = ((Short) CurUnoDialog.getControlProperty("optAscend" + Integer.toString(i + 1), PropertyNames.PROPERTY_STATE)).shortValue(); + SortFieldNames.add(new String[]{CurFieldName,iCurState == 1 ? PropertyNames.ASC :"DESC" }); } } // When searching for a duplicate entry we can neglect wether the entries are to be sorted ascending or descending @@ -303,7 +300,7 @@ public class SortingComponent toggleSortListBox(i, (false)); if (i < MaxSortIndex) { - CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 2).toString(), "SelectedItems", 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(), "SelectedItems", new short[] + CurUnoDialog.setControlProperty("lstSort" + Integer.toString(i + 1), PropertyNames.SELECTED_ITEMS, new short[] { iNextItemPos }); - CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 2).toString(), "SelectedItems", 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(), "SelectedItems", 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(), "SelectedItems", 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 e4f92d537841..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; @@ -277,19 +272,19 @@ public class UnoDialog implements EventNames // This function may look ugly, but this is the only way to check the count // of values in the model,which is always right. // the control is only a view and could be right or not. - final String[] fieldnames = (String[]) Helper.getUnoPropertyValue(getModel(_xListBox), "StringItemList"); + final String[] fieldnames = (String[]) Helper.getUnoPropertyValue(getModel(_xListBox), PropertyNames.STRING_ITEM_LIST); return fieldnames.length; } public static short getSelectedItemPos(XListBox _xListBox) { - short ipos[] = (short[]) Helper.getUnoPropertyValue(getModel(_xListBox), "SelectedItems"); + short ipos[] = (short[]) Helper.getUnoPropertyValue(getModel(_xListBox), PropertyNames.SELECTED_ITEMS); return ipos[0]; } public static boolean isListBoxSelected(XListBox _xListBox) { - short ipos[] = (short[]) Helper.getUnoPropertyValue(getModel(_xListBox), "SelectedItems"); + short ipos[] = (short[]) Helper.getUnoPropertyValue(getModel(_xListBox), PropertyNames.SELECTED_ITEMS); return ipos.length > 0; } @@ -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(); } @@ -697,11 +689,11 @@ public class UnoDialog implements EventNames public static void deselectListBox(XInterface _xBasisListBox) { Object oListBoxModel = getModel(_xBasisListBox); - Object sList = Helper.getUnoPropertyValue(oListBoxModel, "StringItemList"); - Helper.setUnoPropertyValue(oListBoxModel, "StringItemList", new String[] + Object sList = Helper.getUnoPropertyValue(oListBoxModel, PropertyNames.STRING_ITEM_LIST); + Helper.setUnoPropertyValue(oListBoxModel, PropertyNames.STRING_ITEM_LIST, new String[] { }); - Helper.setUnoPropertyValue(oListBoxModel, "StringItemList", sList); + Helper.setUnoPropertyValue(oListBoxModel, PropertyNames.STRING_ITEM_LIST, sList); } public void calculateDialogPosition(Rectangle FramePosSize) @@ -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,17 +793,17 @@ 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) { FontDescriptor oFontDesc = new FontDescriptor(); oFontDesc.Weight = FontWeight; - setControlProperty(ControlName, "FontDescriptor", oFontDesc); + setControlProperty(ControlName, PropertyNames.FONT_DESCRIPTOR, oFontDesc); } /** @@ -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)) { @@ -863,7 +855,7 @@ public class UnoDialog implements EventNames xListBox.removeItems((short) 0, (short) 1); if (SelPos > 0) { - setControlProperty(ListBoxName, "SelectedItems", new short[SelPos]); + setControlProperty(ListBoxName, PropertyNames.SELECTED_ITEMS, new short[SelPos]); xListBox.selectItemPos((short) (SelPos - 1), true); } } @@ -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); } @@ -1000,7 +991,7 @@ public class UnoDialog implements EventNames */ public static String getDisplayProperty(int itype) { - // String propertyname = ""; + // String propertyname = PropertyNames.EMPTY_STRING; switch (itype) { case UIConsts.CONTROLTYPE.FIXEDTEXT: @@ -1036,9 +1027,9 @@ public class UnoDialog implements EventNames case UIConsts.CONTROLTYPE.PATTERNFIELD: return "Text"; case UIConsts.CONTROLTYPE.LISTBOX: - return "SelectedItems"; + return PropertyNames.SELECTED_ITEMS; default: - return ""; + return PropertyNames.EMPTY_STRING; } } @@ -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 a872accecdcc..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) @@ -369,13 +368,12 @@ public class UnoDialog2 extends UnoDialog implements EventNames public String translateURL(String relativeURL) { - return ""; + return PropertyNames.EMPTY_STRING; } 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 859904e7fc6f..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) { @@ -467,7 +466,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "lnNaviSep", new String[] { - PropertyNames.PROPERTY_HEIGHT, "Orientation", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_HEIGHT, PropertyNames.ORIENTATION, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -477,7 +476,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "lnRoadSep", new String[] { - PropertyNames.PROPERTY_HEIGHT, "Orientation", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_HEIGHT, PropertyNames.ORIENTATION, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -496,30 +495,30 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL }, new Object[] { - new Boolean(true), IButtonHeight, oWizardResource.getResText(UIConsts.RID_COMMON + 15), new Integer(iHelpPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.HELP_value), ICurStep, new Short(curtabindex++), IButtonWidth + true, IButtonHeight, oWizardResource.getResText(UIConsts.RID_COMMON + 15), new Integer(iHelpPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.HELP_value), ICurStep, new Short(curtabindex++), IButtonWidth }); insertButton("btnWizardBack", BACK_ACTION_PERFORMED, propNames, new Object[] { - new Boolean(false), IButtonHeight, HelpIds.getHelpIdString(hid + 2), oWizardResource.getResText(UIConsts.RID_COMMON + 13), new Integer(iBackPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth + false, IButtonHeight, HelpIds.getHelpIdString(hid + 2), oWizardResource.getResText(UIConsts.RID_COMMON + 13), new Integer(iBackPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth }); insertButton("btnWizardNext", NEXT_ACTION_PERFORMED, propNames, new Object[] { - new Boolean(true), IButtonHeight, HelpIds.getHelpIdString(hid + 3), oWizardResource.getResText(UIConsts.RID_COMMON + 14), new Integer(iNextPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth + true, IButtonHeight, HelpIds.getHelpIdString(hid + 3), oWizardResource.getResText(UIConsts.RID_COMMON + 14), new Integer(iNextPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth }); insertButton("btnWizardFinish", FINISH_ACTION_PERFORMED, propNames, new Object[] { - new Boolean(true), IButtonHeight, HelpIds.getHelpIdString(hid + 4), oWizardResource.getResText(UIConsts.RID_COMMON + 12), new Integer(iFinishPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth + true, IButtonHeight, HelpIds.getHelpIdString(hid + 4), oWizardResource.getResText(UIConsts.RID_COMMON + 12), new Integer(iFinishPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth }); insertButton("btnWizardCancel", CANCEL_ACTION_PERFORMED, propNames, new Object[] { - new Boolean(true), IButtonHeight, HelpIds.getHelpIdString(hid + 5), oWizardResource.getResText(UIConsts.RID_COMMON + 11), new Integer(iCancelPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth + true, IButtonHeight, HelpIds.getHelpIdString(hid + 5), oWizardResource.getResText(UIConsts.RID_COMMON + 11), new Integer(iCancelPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth }); setControlProperty("btnWizardNext", "DefaultButton", Boolean.TRUE); @@ -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)); } } @@ -747,7 +746,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL insertLabel("lblQueryTitle" + String.valueOf(i), new String[] { - "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { 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 4c8d009f967a..7da0981104ba 100644 --- a/wizards/com/sun/star/wizards/ui/event/DataAware.java +++ b/wizards/com/sun/star/wizards/ui/event/DataAware.java @@ -320,7 +320,7 @@ public abstract class DataAware { ex2.printStackTrace(); } catch (NullPointerException npe) { if (getMethod.getReturnType().equals(String.class)) - return ""; + return PropertyNames.EMPTY_STRING; if (getMethod.getReturnType().equals(Short.class)) return new Short((short) 0); if (getMethod.getReturnType().equals(Integer.class)) @@ -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 3a5a1f6b637a..7d0d4194f892 100644 --- a/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java +++ b/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java @@ -312,11 +312,11 @@ public class DataAwareFields if (convertTo.equals(Boolean.class)) { - return (s != null && !s.equals("") && s.equals("true")) ? Boolean.TRUE : Boolean.FALSE; + return (s != null && !s.equals(PropertyNames.EMPTY_STRING) && s.equals("true")) ? Boolean.TRUE : Boolean.FALSE; } else if (convertTo.equals(Integer.class)) { - if (s == null || s.equals("")) + if (s == null || s.equals(PropertyNames.EMPTY_STRING)) { return Any.VOID; } @@ -327,7 +327,7 @@ public class DataAwareFields } else if (convertTo.equals(Double.class)) { - if (s == null || s.equals("")) + if (s == null || s.equals(PropertyNames.EMPTY_STRING)) { return Any.VOID; } @@ -352,7 +352,7 @@ public class DataAwareFields { try { - field.set(target, value == null || (value.equals(Any.VOID)) ? "" : value.toString()); + field.set(target, value == null || (value.equals(Any.VOID)) ? PropertyNames.EMPTY_STRING : value.toString()); } catch (IllegalAccessException ex) { @@ -380,7 +380,7 @@ public class DataAwareFields { if (field.getType().equals(String.class)) { - return ""; + return PropertyNames.EMPTY_STRING; } if (field.getType().equals(Short.class)) { @@ -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 b2dc75f22f48..73980b9afdd1 100644 --- a/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java +++ b/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java @@ -34,6 +34,7 @@ import com.sun.star.awt.XComboBox; import com.sun.star.awt.XListBox; import com.sun.star.uno.UnoRuntime; import com.sun.star.wizards.common.Helper; +import com.sun.star.wizards.common.PropertyNames; /** * @author rpiterman @@ -52,7 +53,7 @@ public class ListModelBinder implements ListDataListener { if (item == null) { - return ""; + return PropertyNames.EMPTY_STRING; } else { @@ -63,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_); } @@ -99,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) @@ -119,12 +120,12 @@ public class ListModelBinder implements ListDataListener protected short[] getSelectedItems() { - return (short[]) Helper.getUnoPropertyValue(unoListModel, "SelectedItems"); + return (short[]) Helper.getUnoPropertyValue(unoListModel, PropertyNames.SELECTED_ITEMS); } protected void setSelectedItems(short[] selected) { - Helper.setUnoPropertyValue(unoListModel, "SelectedItems", selected); + Helper.setUnoPropertyValue(unoListModel, PropertyNames.SELECTED_ITEMS, selected); } /* (non-Javadoc) @@ -179,8 +180,8 @@ public class ListModelBinder implements ListDataListener public static void fillList(Object list, Object[] items, Renderer renderer) { - XListBox xlist = (XListBox) UnoRuntime.queryInterface(XListBox.class, list); - Helper.setUnoPropertyValue(UnoDataAware.getModel(list), "StringItemList", new String[] + XListBox xlist = UnoRuntime.queryInterface(XListBox.class, list); + Helper.setUnoPropertyValue(UnoDataAware.getModel(list), PropertyNames.STRING_ITEM_LIST, new String[] { }); for (short i = 0; i < items.length; i++) @@ -194,8 +195,8 @@ public class ListModelBinder implements ListDataListener public static void fillComboBox(Object list, Object[] items, Renderer renderer) { - XComboBox xComboBox = (XComboBox) UnoRuntime.queryInterface(XComboBox.class, list); - Helper.setUnoPropertyValue(UnoDataAware.getModel(list), "StringItemList", new String[] + XComboBox xComboBox = UnoRuntime.queryInterface(XComboBox.class, list); + Helper.setUnoPropertyValue(UnoDataAware.getModel(list), PropertyNames.STRING_ITEM_LIST, new String[] { }); for (short i = 0; i < items.length; i++) diff --git a/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java b/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java index 86c50b13ce02..2f86de798bfd 100644 --- a/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java +++ b/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java @@ -28,7 +28,6 @@ package com.sun.star.wizards.ui.event; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import com.sun.star.wizards.common.PropertyNames; /** * Encapsulate a Method invocation. @@ -87,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/SimpleDataAware.java b/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java index 8a9c2200d76d..e6c23226d0e7 100644 --- a/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java +++ b/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java @@ -69,7 +69,7 @@ public class SimpleDataAware extends DataAware return (Boolean)value; else if (value.getClass().isArray()) return ((short[])value).length != 0 ? Boolean.TRUE : Boolean.FALSE; - else if (value.equals("")) return Boolean.FALSE; + else if (value.equals(PropertyNames.EMPTY_STRING)) return Boolean.FALSE; else return Boolean.TRUE; } diff --git a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java index acc0ed8787e6..f97ae8f24577 100644 --- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java +++ b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java @@ -126,7 +126,7 @@ public class UnoDataAware extends DataAware { return ((short[]) value).length != 0 ? Boolean.TRUE : Boolean.FALSE; } - else if (value.equals("")) + else if (value.equals(PropertyNames.EMPTY_STRING)) { return Boolean.FALSE; } @@ -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) @@ -179,7 +179,7 @@ public class UnoDataAware extends DataAware public static UnoDataAware attachEditControl(Object data, String prop, Object unoControl, Listener listener, boolean field) { - return attachTextControl(data, prop, unoControl, listener, "Text", field, ""); + return attachTextControl(data, prop, unoControl, listener, "Text", field, PropertyNames.EMPTY_STRING); } public static UnoDataAware attachDateControl(Object data, String prop, Object unoControl, Listener listener, boolean field) @@ -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)) @@ -232,26 +232,26 @@ public class UnoDataAware extends DataAware public static UnoDataAware attachLabel(Object data, String prop, Object label, final Listener listener, boolean field) { return new UnoDataAware(data, - field ? DataAwareFields.getFieldValueFor(data, prop, "") + field ? DataAwareFields.getFieldValueFor(data, prop, PropertyNames.EMPTY_STRING) : new DataAware.PropertyValue(prop, data), label, PropertyNames.PROPERTY_LABEL); } 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]) : new DataAware.PropertyValue(prop, data), - listBox, "SelectedItems"); + listBox, PropertyNames.SELECTED_ITEMS); xListBox.addItemListener(itemListener(uda, listener)); return uda; } 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/BackgroundsDialog.java b/wizards/com/sun/star/wizards/web/BackgroundsDialog.java index 70c40fbc6072..f31294a190b5 100644 --- a/wizards/com/sun/star/wizards/web/BackgroundsDialog.java +++ b/wizards/com/sun/star/wizards/web/BackgroundsDialog.java @@ -33,6 +33,7 @@ import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.wizards.common.ConfigSet; import com.sun.star.wizards.common.Configuration; import com.sun.star.wizards.common.FileAccess; +import com.sun.star.wizards.common.PropertyNames; import com.sun.star.wizards.common.SystemDialog; import com.sun.star.wizards.ui.ImageList; import com.sun.star.wizards.web.data.CGImage; @@ -127,7 +128,7 @@ public class BackgroundsDialog extends ImageListDialog { Object configView = Configuration.getConfigurationRoot(xMSF, FileAccess.connectURLs(WebWizardConst.CONFIG_PATH, "BackgroundImages"), true); int i = Configuration.getChildrenNames(configView).length + 1; - Object o = Configuration.addConfigNode(configView, "" + i); + Object o = Configuration.addConfigNode(configView, PropertyNames.EMPTY_STRING + i); Configuration.set(s, "Href", o); Configuration.commit(configView); } @@ -172,7 +173,7 @@ public class BackgroundsDialog extends ImageListDialog public String render(Object object) { - return object == null ? "" : FileAccess.getPathFilename(fileAccess.getPath((String) object, null)); + return object == null ? PropertyNames.EMPTY_STRING : FileAccess.getPathFilename(fileAccess.getPath((String) object, null)); } } diff --git a/wizards/com/sun/star/wizards/web/CallWizard.java b/wizards/com/sun/star/wizards/web/CallWizard.java index 4fab3ea43bf9..6cabc6f145d1 100644 --- a/wizards/com/sun/star/wizards/web/CallWizard.java +++ b/wizards/com/sun/star/wizards/web/CallWizard.java @@ -38,6 +38,7 @@ import com.sun.star.task.XJob; import com.sun.star.task.XJobExecutor; import com.sun.star.uno.Type; import com.sun.star.wizards.common.Desktop; +import com.sun.star.wizards.common.PropertyNames; import com.sun.star.wizards.common.Resource; /** @@ -107,7 +108,7 @@ public class CallWizard */ public void trigger(String str) { - if (str.equalsIgnoreCase("start")) + if (str.equalsIgnoreCase(PropertyNames.START)) { if (webWizard == null) { @@ -226,7 +227,7 @@ public class CallWizard try { - byteReturn = ("" + this.hashCode()).getBytes(); + byteReturn = (PropertyNames.EMPTY_STRING + this.hashCode()).getBytes(); } catch (Exception exception) { @@ -284,7 +285,7 @@ public class CallWizard { XMultiServiceFactory xmsf = Desktop.connect(ConnectStr); CallWizard.WizardImplementation ww = new CallWizard.WizardImplementation(xmsf); - ww.trigger("start"); + ww.trigger(PropertyNames.START); } catch (Exception exception) diff --git a/wizards/com/sun/star/wizards/web/FTPDialog.java b/wizards/com/sun/star/wizards/web/FTPDialog.java index c95a060f167f..f707690394ea 100644 --- a/wizards/com/sun/star/wizards/web/FTPDialog.java +++ b/wizards/com/sun/star/wizards/web/FTPDialog.java @@ -153,16 +153,16 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID //Resources Object private FTPDialogResources resources; private List dataAware = new Vector(); - public String username = ""; - public String password = ""; + public String username = PropertyNames.EMPTY_STRING; + public String password = PropertyNames.EMPTY_STRING; /** * The ftp host name */ - public String host = ""; + public String host = PropertyNames.EMPTY_STRING; /** * The ftp directory. */ - private String dir = ""; + private String dir = PropertyNames.EMPTY_STRING; /** * the ftp publish object which contains the * data for this dialog. @@ -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, @@ -353,7 +353,7 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID PROPNAMES_BUTTON2, new Object[] { - INTEGER_14, "", resources.resbtnHelp_value, "btnHelp", 57, 142, new Short((short) PushButtonType.HELP_value), new Short((short) 15), INTEGER_50 + INTEGER_14, PropertyNames.EMPTY_STRING, resources.resbtnHelp_value, "btnHelp", 57, 142, new Short((short) PushButtonType.HELP_value), new Short((short) 15), INTEGER_50 }); } @@ -379,8 +379,8 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID public short execute(UnoDialog parent) throws Exception { host = extractHost(publish.cp_URL); - username = publish.cp_Username == null ? "" : publish.cp_Username; - password = publish.password == null ? "" : publish.password; + username = publish.cp_Username == null ? PropertyNames.EMPTY_STRING : publish.cp_Username; + password = publish.password == null ? PropertyNames.EMPTY_STRING : publish.password; dir = extractDir(publish.cp_URL); setLabel(STATUS_UNKONWN); @@ -419,7 +419,7 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID { if (ftpUrl == null || ftpUrl.length() < 6) { - return ""; + return PropertyNames.EMPTY_STRING; } String url = ftpUrl.substring(6); int i = url.indexOf("/"); @@ -469,11 +469,11 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID /** * @param s - * @return true if the string is null or "". + * @return true if the string is null or PropertyNames.EMPTY_STRING. */ private final boolean isEmpty(String s) { - return (s == null) || (s.equals("")); + return (s == null) || (s.equals(PropertyNames.EMPTY_STRING)); } /** @@ -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; } /** @@ -724,7 +721,7 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID public void chooseDirectory() { SystemDialog sd = SystemDialog.createOfficeFolderDialog(xMSF); - String newUrl = sd.callFolderDialog(resources.resFTPDirectory, "", getFullUrl()); + String newUrl = sd.callFolderDialog(resources.resFTPDirectory, PropertyNames.EMPTY_STRING, getFullUrl()); if (newUrl != null) { /* if the user chose a local directory, diff --git a/wizards/com/sun/star/wizards/web/IconsDialog.java b/wizards/com/sun/star/wizards/web/IconsDialog.java index 6228180a75f4..83be292e79b8 100644 --- a/wizards/com/sun/star/wizards/web/IconsDialog.java +++ b/wizards/com/sun/star/wizards/web/IconsDialog.java @@ -32,6 +32,7 @@ import com.sun.star.awt.Size; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.wizards.common.ConfigSet; import com.sun.star.wizards.common.FileAccess; +import com.sun.star.wizards.common.PropertyNames; import com.sun.star.wizards.ui.ImageList; import com.sun.star.wizards.web.data.CGIconSet; @@ -79,7 +80,7 @@ public class IconsDialog extends ImageListDialog implements ImageList.IImageRend resources.resCounter }); - htmlexpDirectory = FileAccess.getOfficePath(xmsf, "Gallery", "share", ""); + htmlexpDirectory = FileAccess.getOfficePath(xmsf, "Gallery", "share", PropertyNames.EMPTY_STRING); set = set_; objects = new Integer[set.getSize() * icons.length]; for (int i = 0; i < objects.length; i++) @@ -174,7 +175,7 @@ public class IconsDialog extends ImageListDialog implements ImageList.IImageRend { if (object == null) { - return ""; + return PropertyNames.EMPTY_STRING; } int i = ((Number) object).intValue(); int iset = getIconsetNum(i); diff --git a/wizards/com/sun/star/wizards/web/ImageListDialog.java b/wizards/com/sun/star/wizards/web/ImageListDialog.java index c726c0266df1..3943271408fe 100644 --- a/wizards/com/sun/star/wizards/web/ImageListDialog.java +++ b/wizards/com/sun/star/wizards/web/ImageListDialog.java @@ -165,7 +165,7 @@ public abstract class ImageListDialog extends UnoDialog2 implements UIConsts PROPNAMES, new Object[] { - Boolean.FALSE, INTEGER_14, "", resources[RES_HELP], "CommandButton3", iButtonsX, 71, new Short((short) com.sun.star.awt.PushButtonType.HELP_value), new Short((short) 9), INTEGER_50 + Boolean.FALSE, INTEGER_14, PropertyNames.EMPTY_STRING, resources[RES_HELP], "CommandButton3", iButtonsX, 71, new Short((short) com.sun.star.awt.PushButtonType.HELP_value), new Short((short) 9), INTEGER_50 }); if (showOtherButton) @@ -208,7 +208,7 @@ public abstract class ImageListDialog extends UnoDialog2 implements UIConsts lblTitle = insertLabel("lblTitle", new String[] { - "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -275,9 +275,9 @@ public abstract class ImageListDialog extends UnoDialog2 implements UIConsts public String render(Object counter) { - String s = JavaTools.replaceSubString(template, "" + ((Counter) counter).start, START); - s = JavaTools.replaceSubString(s, "" + ((Counter) counter).end, END); - s = JavaTools.replaceSubString(s, "" + ((Counter) counter).max, TOTAL); + String s = JavaTools.replaceSubString(template, PropertyNames.EMPTY_STRING + ((Counter) counter).start, START); + s = JavaTools.replaceSubString(s, PropertyNames.EMPTY_STRING + ((Counter) counter).end, END); + s = JavaTools.replaceSubString(s, PropertyNames.EMPTY_STRING + ((Counter) counter).max, TOTAL); return s; } } diff --git a/wizards/com/sun/star/wizards/web/LogTaskListener.java b/wizards/com/sun/star/wizards/web/LogTaskListener.java index f1814f9e4cb6..8666aaf9738e 100644 --- a/wizards/com/sun/star/wizards/web/LogTaskListener.java +++ b/wizards/com/sun/star/wizards/web/LogTaskListener.java @@ -33,6 +33,7 @@ */ package com.sun.star.wizards.web; +import com.sun.star.wizards.common.PropertyNames; import java.io.PrintStream; import com.sun.star.wizards.ui.event.TaskEvent; @@ -96,7 +97,7 @@ public class LogTaskListener implements TaskListener, ErrorHandler */ public boolean error(Exception ex, Object arg, int ix, int i) { - System.out.println("" + arg + "//" + ix + "//Exception: " + ex.getLocalizedMessage()); + System.out.println(PropertyNames.EMPTY_STRING + arg + "//" + ix + "//Exception: " + ex.getLocalizedMessage()); ex.printStackTrace(); return true; } diff --git a/wizards/com/sun/star/wizards/web/Process.java b/wizards/com/sun/star/wizards/web/Process.java index d1ae8e23763e..f861a82865e3 100644 --- a/wizards/com/sun/star/wizards/web/Process.java +++ b/wizards/com/sun/star/wizards/web/Process.java @@ -43,6 +43,7 @@ import org.w3c.dom.Document; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.wizards.common.ConfigSet; import com.sun.star.wizards.common.FileAccess; +import com.sun.star.wizards.common.PropertyNames; import com.sun.star.wizards.common.UCB; import com.sun.star.wizards.ui.event.Task; import com.sun.star.wizards.web.data.CGContent; @@ -163,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; } /** @@ -240,8 +240,7 @@ public class Process implements WebWizardConst, ProcessErrors { try { - String s = FileAccess.getOfficePath(xmsf, "Temp", "", ""); - return s; + return FileAccess.getOfficePath(xmsf, "Temp", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING); } catch (Exception e) { @@ -308,7 +307,7 @@ public class Process implements WebWizardConst, ProcessErrors //2. background image String background = settings.cp_DefaultSession.cp_Design.cp_BackgroundImage; - if (background != null && !background.equals("")) + if (background != null && !background.equals(PropertyNames.EMPTY_STRING)) { sourceDir = FileAccess.getParentDir(background); filename = background.substring(sourceDir.length()); @@ -354,7 +353,7 @@ public class Process implements WebWizardConst, ProcessErrors catch (Exception ex) { //error in copying media - error(ex, "", ERROR_PUBLISH_MEDIA, ErrorHandler.ERROR_PROCESS_FATAL); + error(ex, PropertyNames.EMPTY_STRING, ERROR_PUBLISH_MEDIA, ErrorHandler.ERROR_PROCESS_FATAL); return false; } @@ -435,7 +434,7 @@ public class Process implements WebWizardConst, ProcessErrors } catch (Exception ex) { - error(ex, "", ERROR_GENERATE_XSLT, ErrorHandler.ERROR_PROCESS_FATAL); + error(ex, PropertyNames.EMPTY_STRING, ERROR_GENERATE_XSLT, ErrorHandler.ERROR_PROCESS_FATAL); return false; } @@ -519,7 +518,7 @@ public class Process implements WebWizardConst, ProcessErrors for (Iterator i = templates.keySet().iterator(); i.hasNext();) { - String key = ""; + String key = PropertyNames.EMPTY_STRING; key = (String) i.next(); @@ -586,7 +585,7 @@ public class Process implements WebWizardConst, ProcessErrors * faileure here is fatal. */ contentDir = fileAccess.createNewDir(dir, content.cp_Name); - if (contentDir == null || contentDir.equals("")) + if (contentDir == null || contentDir.equals(PropertyNames.EMPTY_STRING)) { throw new IOException("Directory " + dir + " could not be created."); } @@ -697,7 +696,7 @@ public class Process implements WebWizardConst, ProcessErrors * the copyExporter does not change * the extension of the target... */ - String destExt = (exporter.cp_Extension.equals("") + String destExt = (exporter.cp_Extension.equals(PropertyNames.EMPTY_STRING) ? FileAccess.getExtension(docFilename) : exporter.cp_Extension); diff --git a/wizards/com/sun/star/wizards/web/StatusDialog.java b/wizards/com/sun/star/wizards/web/StatusDialog.java index 3e3d40f54e76..c0e6b08f6cff 100644 --- a/wizards/com/sun/star/wizards/web/StatusDialog.java +++ b/wizards/com/sun/star/wizards/web/StatusDialog.java @@ -109,7 +109,7 @@ public class StatusDialog extends UnoDialog2 implements TaskListener }, new Object[] { - 8, "", new Integer(width * 2 / 3), 6, new Short(tabstop++), new Integer(width / 3 - 4) + 8, PropertyNames.EMPTY_STRING, new Integer(width * 2 / 3), 6, new Short(tabstop++), new Integer(width / 3 - 4) }); progressBar = insertProgressBar("progress", new String[] diff --git a/wizards/com/sun/star/wizards/web/StylePreview.java b/wizards/com/sun/star/wizards/web/StylePreview.java index 93507929d84b..c6c095eb9388 100644 --- a/wizards/com/sun/star/wizards/web/StylePreview.java +++ b/wizards/com/sun/star/wizards/web/StylePreview.java @@ -28,6 +28,7 @@ package com.sun.star.wizards.web; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.wizards.common.FileAccess; +import com.sun.star.wizards.common.PropertyNames; import com.sun.star.wizards.web.data.CGStyle; /** @@ -98,7 +99,7 @@ public class StylePreview String css = FileAccess.connectURLs(wwRoot, "styles/" + style.cp_CssHref); - if (background == null || background.equals("")) + if (background == null || background.equals(PropertyNames.EMPTY_STRING)) { //delete the background image if (fileAccess.exists(backgroundFilename, false)) @@ -137,7 +138,7 @@ public class StylePreview */ private String createTempDir(XMultiServiceFactory xmsf) throws Exception { - String tempPath = FileAccess.getOfficePath(xmsf, "Temp", "", ""); + String tempPath = FileAccess.getOfficePath(xmsf, "Temp", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING); String s = fileAccess.createNewDir(tempPath, "wwiz"); fileAccess.createNewDir(s, "images"); return s; diff --git a/wizards/com/sun/star/wizards/web/TOCPreview.java b/wizards/com/sun/star/wizards/web/TOCPreview.java index 1fb70a11d4b5..bd7f84527343 100644 --- a/wizards/com/sun/star/wizards/web/TOCPreview.java +++ b/wizards/com/sun/star/wizards/web/TOCPreview.java @@ -35,6 +35,7 @@ import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.util.URL; import com.sun.star.wizards.common.Desktop; import com.sun.star.wizards.common.FileAccess; +import com.sun.star.wizards.common.PropertyNames; import com.sun.star.wizards.common.UCB; import com.sun.star.wizards.ui.event.Task; import com.sun.star.wizards.web.data.CGLayout; @@ -101,7 +102,7 @@ public class TOCPreview { Document doc = (Document) settings.cp_DefaultSession.createDOM(); CGLayout layout = settings.cp_DefaultSession.getLayout(); - Task task = new Task("", "", 10000); + Task task = new Task(PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING, 10000); Process.generate(xmsf, layout, doc, fileAccess, tempDir, task); Process.copyLayoutFiles(ucb, fileAccess, settings, layout, tempDir); xDispatch.dispatch(openHyperlink, loadArgs); //Dispatch.dispatch(openHyperlink, loadArgs); @@ -110,7 +111,7 @@ public class TOCPreview private PropertyValue[] loadArgs(String url) { PropertyValue pv = new PropertyValue(); - pv.Name = "URL"; + pv.Name = PropertyNames.URL; pv.Value = url; return new PropertyValue[] { diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.java b/wizards/com/sun/star/wizards/web/WWD_Events.java index 26f518c4e6c8..b37e0fff39e6 100644 --- a/wizards/com/sun/star/wizards/web/WWD_Events.java +++ b/wizards/com/sun/star/wizards/web/WWD_Events.java @@ -67,10 +67,10 @@ public abstract class WWD_Events extends WWD_Startup private static final short[] EMPTY_SHORT_ARRAY = new short[0]; /** * Tracks the current loaded session. - * If "" - it means the current session is the default one (empty) + * If PropertyNames.EMPTY_STRING - it means the current session is the default one (empty) * If a session is loaded, this will be the name of the loaded session. */ - protected String currentSession = ""; + protected String currentSession = PropertyNames.EMPTY_STRING; /** * He - my constructor ! @@ -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); } @@ -106,11 +106,11 @@ public abstract class WWD_Events extends WWD_Startup { if ((old == 1)) { - String sessionToLoad = ""; - short[] s = (short[]) Helper.getUnoPropertyValue(getModel(lstLoadSettings), "SelectedItems"); + String sessionToLoad = PropertyNames.EMPTY_STRING; + short[] s = (short[]) Helper.getUnoPropertyValue(getModel(lstLoadSettings), PropertyNames.SELECTED_ITEMS); if (s.length == 0 || s[0] == 0) { - sessionToLoad = ""; + sessionToLoad = PropertyNames.EMPTY_STRING; } else { @@ -135,7 +135,7 @@ public abstract class WWD_Events extends WWD_Startup */ public void sessionSelected() { - short[] s = (short[]) Helper.getUnoPropertyValue(getModel(lstLoadSettings), "SelectedItems"); + short[] s = (short[]) Helper.getUnoPropertyValue(getModel(lstLoadSettings), PropertyNames.SELECTED_ITEMS); setEnabled(btnDelSession, s.length > 0 && s[0] > 0); } @@ -148,18 +148,18 @@ public abstract class WWD_Events extends WWD_Startup { final StatusDialog sd = getStatusDialog(); - final Task task = new Task("LoadDocs", "", 10); + final Task task = new Task("LoadDocs", PropertyNames.EMPTY_STRING, 10); sd.execute(this, task, resources.resLoadingSession); task.start(); setSelectedDoc(EMPTY_SHORT_ARRAY); - Helper.setUnoPropertyValue(getModel(lstDocuments), "SelectedItems", EMPTY_SHORT_ARRAY); - Helper.setUnoPropertyValue(getModel(lstDocuments), "StringItemList", EMPTY_STRING_ARRAY); + Helper.setUnoPropertyValue(getModel(lstDocuments), PropertyNames.SELECTED_ITEMS, EMPTY_SHORT_ARRAY); + Helper.setUnoPropertyValue(getModel(lstDocuments), PropertyNames.STRING_ITEM_LIST, EMPTY_STRING_ARRAY); Object view = null; - if (sessionToLoad.equals("")) + if (sessionToLoad.equals(PropertyNames.EMPTY_STRING)) { view = Configuration.getConfigurationRoot(xMSF, CONFIG_PATH + "/DefaultSession", false); } @@ -175,7 +175,7 @@ public abstract class WWD_Events extends WWD_Startup task.setMax(session.cp_Content.cp_Documents.getSize() * 5 + 7); task.advance(true); - if (sessionToLoad.equals("")) + if (sessionToLoad.equals(PropertyNames.EMPTY_STRING)) { setSaveSessionName(session); } @@ -212,7 +212,7 @@ public abstract class WWD_Events extends WWD_Startup */ public void delSession() { - short[] selected = (short[]) Helper.getUnoPropertyValue(getModel(lstLoadSettings), "SelectedItems"); + short[] selected = (short[]) Helper.getUnoPropertyValue(getModel(lstLoadSettings), PropertyNames.SELECTED_ITEMS); if (selected.length == 0) { return; @@ -254,7 +254,7 @@ public abstract class WWD_Events extends WWD_Startup { Helper.setUnoPropertyValue(getModel(btnDelSession), PropertyNames.PROPERTY_ENABLED, Boolean.FALSE); // select... } - Helper.setUnoPropertyValue(getModel(lstLoadSettings), "SelectedItems", nextSelected); + Helper.setUnoPropertyValue(getModel(lstLoadSettings), PropertyNames.SELECTED_ITEMS, nextSelected); //ListModelBinder.fillComboBox(cbSaveSettings, settings.savedSessions.items(), null); @@ -310,7 +310,7 @@ public abstract class WWD_Events extends WWD_Startup { fillExportList(settings.getExporters(doc.appType)); } - else; // do nothing + selectedDoc = s; @@ -332,7 +332,7 @@ public abstract class WWD_Events extends WWD_Startup { return; } - final Task task = new Task("", "", files.length * 5); + final Task task = new Task(PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING, files.length * 5); /* * If more than a certain number @@ -455,7 +455,7 @@ public abstract class WWD_Events extends WWD_Startup { if (background == null) { - background = ""; + background = PropertyNames.EMPTY_STRING; } settings.cp_DefaultSession.cp_Design.cp_BackgroundImage = (String) background; refreshStylePreview(); @@ -543,7 +543,7 @@ public abstract class WWD_Events extends WWD_Startup */ public void setPublishLocalDir() { - String dir = showFolderDialog("Local destination directory", "", settings.cp_DefaultSession.cp_OutDirectory); + String dir = showFolderDialog("Local destination directory", PropertyNames.EMPTY_STRING, settings.cp_DefaultSession.cp_OutDirectory); //if ok was pressed... setPublishUrl(LOCAL_PUBLISHER, dir, 0); @@ -898,7 +898,7 @@ public abstract class WWD_Events extends WWD_Startup } else { - return ""; + return PropertyNames.EMPTY_STRING; } } @@ -965,7 +965,7 @@ public abstract class WWD_Events extends WWD_Startup */ final CGPublish p = getPublisher(FTP_PUBLISHER); // if ftp is checked, and no proxies are set, and password is empty... - if (p.cp_Publish && (!proxies) && (p.password == null || p.password.equals(""))) + if (p.cp_Publish && (!proxies) && (p.password == null || p.password.equals(PropertyNames.EMPTY_STRING))) { if (showFTPDialog(p)) { @@ -1036,7 +1036,7 @@ public abstract class WWD_Events extends WWD_Startup } else { - settings.cp_LastSavedSession = ""; + settings.cp_LastSavedSession = PropertyNames.EMPTY_STRING; } try { @@ -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_General.java b/wizards/com/sun/star/wizards/web/WWD_General.java index fd716e1b9c06..cb109fd01668 100644 --- a/wizards/com/sun/star/wizards/web/WWD_General.java +++ b/wizards/com/sun/star/wizards/web/WWD_General.java @@ -64,7 +64,7 @@ public abstract class WWD_General extends WebWizardDialog StatusDialog statusDialog = new StatusDialog(xMSF, StatusDialog.STANDARD_WIDTH, resources.resLoadingSession, false, new String[] { - resources.prodName, "", "", "", "", "" + resources.prodName, PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING }, HelpIds.getHelpIdString(HID0_STATUS_DIALOG)); try { @@ -302,7 +302,7 @@ public abstract class WWD_General extends WebWizardDialog public boolean checkSaveSession() { return (!isSaveSession() || - !getSessionSaveName().equals("")); + !getSessionSaveName().equals(PropertyNames.EMPTY_STRING)); } @@ -317,7 +317,7 @@ public abstract class WWD_General extends WebWizardDialog if (p.cp_Publish) { String url = (String) Helper.getUnoPropertyValue(getModel(text), property); - if ((url == null) || (url.equals(""))) + if ((url == null) || (url.equals(PropertyNames.EMPTY_STRING))) { throw new IllegalArgumentException(); } diff --git a/wizards/com/sun/star/wizards/web/WWD_Startup.java b/wizards/com/sun/star/wizards/web/WWD_Startup.java index 2a250c84c266..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); @@ -265,7 +265,7 @@ public abstract class WWD_Startup extends WWD_General ilLayouts.setListModel(settings.cp_Layouts); ilLayouts.create(this); - checkContent(settings.cp_DefaultSession.cp_Content, new Task("", "", 99999), this.xControl); + checkContent(settings.cp_DefaultSession.cp_Content, new Task(PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING, 99999), this.xControl); //saved sessions, styles, combobox save session. // also set the chosen saved session... @@ -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); @@ -548,7 +548,7 @@ public abstract class WWD_Startup extends WWD_General protected void selectSession() { int selectedSession = 0; - if (settings.cp_LastSavedSession != null && !settings.cp_LastSavedSession.equals("")) + if (settings.cp_LastSavedSession != null && !settings.cp_LastSavedSession.equals(PropertyNames.EMPTY_STRING)) { Object ses = settings.cp_SavedSessions.getElement(settings.cp_LastSavedSession); @@ -557,7 +557,7 @@ public abstract class WWD_Startup extends WWD_General selectedSession = settings.cp_SavedSessions.getIndexOf(ses); } } - Helper.setUnoPropertyValue(getModel(lstLoadSettings), "SelectedItems", new short[] + Helper.setUnoPropertyValue(getModel(lstLoadSettings), PropertyNames.SELECTED_ITEMS, new short[] { (short) selectedSession }); @@ -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, */ @@ -682,8 +682,8 @@ public abstract class WWD_Startup extends WWD_General }); pubAware.add(uda); pubAware.add( - isLabel ? UnoDataAware.attachLabel(p, "URL", textbox, checkPublish, false) - : UnoDataAware.attachEditControl(p, "URL", textbox, checkPublish, false)); + isLabel ? UnoDataAware.attachLabel(p, PropertyNames.URL, textbox, checkPublish, false) + : UnoDataAware.attachEditControl(p, PropertyNames.URL, textbox, checkPublish, false)); } @@ -806,7 +806,7 @@ public abstract class WWD_Startup extends WWD_General catch (FileNotFoundException ex) { - int relocate = SystemDialog.showMessageBox(xMSF, xC.getPeer(), "WarningBox", VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO, getFileAccess().getPath(doc.cp_URL, "") + "\n\n" + resources.resSpecifyNewFileLocation); + int relocate = SystemDialog.showMessageBox(xMSF, xC.getPeer(), "WarningBox", VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO, getFileAccess().getPath(doc.cp_URL, PropertyNames.EMPTY_STRING) + "\n\n" + resources.resSpecifyNewFileLocation); if (relocate == 2) { @@ -831,7 +831,7 @@ public abstract class WWD_Startup extends WWD_General //file is a directory AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), JavaTools.replaceSubString(resources.resErrIsDirectory, - getFileAccess().getPath(doc.cp_URL, ""), + getFileAccess().getPath(doc.cp_URL, PropertyNames.EMPTY_STRING), "%FILENAME"), ErrorHandler.ERROR_PROCESS_FATAL); return false; @@ -842,7 +842,7 @@ public abstract class WWD_Startup extends WWD_General exp.printStackTrace(); AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), JavaTools.replaceSubString(resources.resErrDocValidate, - getFileAccess().getPath(doc.cp_URL, ""), + getFileAccess().getPath(doc.cp_URL, PropertyNames.EMPTY_STRING), "%FILENAME"), ErrorHandler.ERROR_PROCESS_FATAL); return false; } @@ -907,7 +907,7 @@ public abstract class WWD_Startup extends WWD_General void updateBackgroundText() { String bg = settings.cp_DefaultSession.cp_Design.cp_BackgroundImage; - if (bg == null || bg.equals("")) + if (bg == null || bg.equals(PropertyNames.EMPTY_STRING)) { bg = resources.resBackgroundNone; } @@ -922,7 +922,7 @@ public abstract class WWD_Startup extends WWD_General { String iconset = settings.cp_DefaultSession.cp_Design.cp_IconSet; String iconsetName; - if (iconset == null || iconset.equals("")) + if (iconset == null || iconset.equals(PropertyNames.EMPTY_STRING)) { iconsetName = resources.resIconsetNone; } diff --git a/wizards/com/sun/star/wizards/web/WebWizardDialog.java b/wizards/com/sun/star/wizards/web/WebWizardDialog.java index 7c782354c0dd..7191e65bedb8 100644 --- a/wizards/com/sun/star/wizards/web/WebWizardDialog.java +++ b/wizards/com/sun/star/wizards/web/WebWizardDialog.java @@ -196,11 +196,11 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }; private static String[] PROPNAMES_TXT_2 = new String[] { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ReadOnly", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.READ_ONLY, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }; private static String[] PROPNAMES_TITLE = new String[] { - "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }; private static Integer INTEGER_91 = 91; private static Integer INTEGER_97 = 97; @@ -270,7 +270,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC PROPNAMES_TXT, new Object[] { - INTEGERS[2], "", "lnLoadSettings", 91, 147, INTEGERS[1], new Short(tabIndex++), 234 + INTEGERS[2], PropertyNames.EMPTY_STRING, "lnLoadSettings", 91, 147, INTEGERS[1], new Short(tabIndex++), 234 }); lblLoadSettings = insertLabel("lblLoadSettings", new String[] @@ -341,7 +341,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC btnDocUp = insertButton("btnDocUp", BTNDOCUP_ACTION_PERFORMED, new String[] { - "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -350,7 +350,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC btnDocDown = insertButton("btnDocDown", BTNDOCDOWN_ACTION_PERFORMED, new String[] { - "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH + PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -620,7 +620,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC }, new Object[] { - 0, Boolean.FALSE, 78, "", "imgPreview", 91, 100, Boolean.FALSE, INTEGERS[5], new Short((short) 55), 232 + 0, Boolean.FALSE, 78, PropertyNames.EMPTY_STRING, "imgPreview", 91, 100, Boolean.FALSE, INTEGERS[5], new Short((short) 55), 232 }); } @@ -853,7 +853,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC PROPNAMES_TXT, new Object[] { - INTEGERS[2], "", "lnSaveSetting", 97, 151, INTEGERS[7], new Short(tabIndex++), 228 + INTEGERS[2], PropertyNames.EMPTY_STRING, "lnSaveSetting", 97, 151, INTEGERS[7], new Short(tabIndex++), 228 }); chkSaveSettings = insertCheckBox("chkSaveSettings", CHKSAVESETTINGS_ITEM_CHANGED, PROPNAMES_CHKBOX, @@ -926,7 +926,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC public String render(Object listItem) { - return listItem == null ? "" : ((CGLayout) listItem).cp_Name; + return listItem == null ? PropertyNames.EMPTY_STRING : ((CGLayout) listItem).cp_Name; } } } 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 765e49d1f6ee..e3612acf88f3 100644 --- a/wizards/com/sun/star/wizards/web/data/CGDocument.java +++ b/wizards/com/sun/star/wizards/web/data/CGDocument.java @@ -72,20 +72,20 @@ public class CGDocument extends ConfigSetItem implements XMLProvider public static final int PAGE_TYPE_UNKNOWN = 0; public static final int PAGE_TYPE_PAGE = 1; public static final int PAGE_TYPE_SLIDE = 2; - public String cp_Title = ""; - public String cp_Description = ""; + public String cp_Title = PropertyNames.EMPTY_STRING; + public String cp_Description = PropertyNames.EMPTY_STRING; public String cp_URL; - public String cp_Author = ""; + public String cp_Author = PropertyNames.EMPTY_STRING; public String cp_Exporter; /** * the destination filename to which this * document will be exported to. */ - public String localFilename = ""; - public String urlFilename = ""; - public String title = ""; - public String description = ""; - public String author = ""; + public String localFilename = PropertyNames.EMPTY_STRING; + public String urlFilename = PropertyNames.EMPTY_STRING; + public String title = PropertyNames.EMPTY_STRING; + public String description = PropertyNames.EMPTY_STRING; + public String author = PropertyNames.EMPTY_STRING; public DateTime createDate; public DateTime updateDate; public int sizeBytes = -1; @@ -124,7 +124,7 @@ public class CGDocument extends ConfigSetItem implements XMLProvider cp_URL = getSettings().getFileAccess(xmsf).getURL(url); if (task == null) { - task = new Task("", "", 5); + task = new Task(PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING, 5); } validate(xmsf, task); } @@ -159,7 +159,7 @@ public class CGDocument extends ConfigSetItem implements XMLProvider task.advance(true); //2 - String path = getSettings().getFileAccess(xmsf).getPath(cp_URL, ""); + String path = getSettings().getFileAccess(xmsf).getPath(cp_URL, PropertyNames.EMPTY_STRING); localFilename = FileAccess.getFilename(path, File.separator); /* if the type is a star office convertable document @@ -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 @@ -202,23 +202,23 @@ public class CGDocument extends ConfigSetItem implements XMLProvider valid = true; - if (cp_Title.equals("")) + if (cp_Title.equals(PropertyNames.EMPTY_STRING)) { cp_Title = title; } - if (cp_Title.equals("")) + if (cp_Title.equals(PropertyNames.EMPTY_STRING)) { cp_Title = localFilename; } - if (cp_Description.equals("")) + if (cp_Description.equals(PropertyNames.EMPTY_STRING)) { cp_Description = description; } - if (cp_Author.equals("")) + if (cp_Author.equals(PropertyNames.EMPTY_STRING)) { cp_Author = author; } - if (cp_Exporter == null || cp_Exporter.equals("")) + if (cp_Exporter == null || cp_Exporter.equals(PropertyNames.EMPTY_STRING)) { cp_Exporter = (String) getSettings().cp_Exporters.getKey( getSettings().getExporters(appType)[0]); @@ -237,19 +237,19 @@ public class CGDocument extends ConfigSetItem implements XMLProvider } String media = (mediaDesc == null) - ? "" : (String) Properties.getPropertyValue(mediaDescriptor, PropertyNames.PROPERTY_NAME); + ? PropertyNames.EMPTY_STRING : (String) Properties.getPropertyValue(mediaDescriptor, PropertyNames.PROPERTY_NAME); appType = getDocType(media); //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")); } @@ -260,7 +260,7 @@ public class CGDocument extends ConfigSetItem implements XMLProvider */ private String getDocType(String media) { - if (media.equals("")) + if (media.equals(PropertyNames.EMPTY_STRING)) { return TypeDetection.NO_TYPE; } @@ -317,16 +317,16 @@ public class CGDocument extends ConfigSetItem implements XMLProvider }, new String[] { - d.cp_DisplayTitle ? cp_Title : "", - d.cp_DisplayDescription ? cp_Description : "", - d.cp_DisplayAuthor ? cp_Author : "", - d.cp_DisplayFileFormat ? getTargetTypeName(exp) : "", - d.cp_DisplayFilename ? localFilename : "", - d.cp_DisplayCreateDate ? createDate() : "", - d.cp_DisplayUpdateDate ? updateDate() : "", - d.cp_DisplayPages && (pages > -1) ? "" + pages() : "", //TODO when do i calculate pages? - d.cp_DisplaySize ? sizeKB() : "",//TODO when do i calculate size? - d.cp_DisplayFormatIcon ? getIcon(exp) : "", + d.cp_DisplayTitle ? cp_Title : PropertyNames.EMPTY_STRING, + d.cp_DisplayDescription ? cp_Description : PropertyNames.EMPTY_STRING, + d.cp_DisplayAuthor ? cp_Author : PropertyNames.EMPTY_STRING, + d.cp_DisplayFileFormat ? getTargetTypeName(exp) : PropertyNames.EMPTY_STRING, + d.cp_DisplayFilename ? localFilename : PropertyNames.EMPTY_STRING, + d.cp_DisplayCreateDate ? createDate() : PropertyNames.EMPTY_STRING, + d.cp_DisplayUpdateDate ? updateDate() : PropertyNames.EMPTY_STRING, + d.cp_DisplayPages && (pages > -1) ? PropertyNames.EMPTY_STRING + pages() : PropertyNames.EMPTY_STRING, //TODO when do i calculate pages? + d.cp_DisplaySize ? sizeKB() : PropertyNames.EMPTY_STRING,//TODO when do i calculate size? + d.cp_DisplayFormatIcon ? getIcon(exp) : PropertyNames.EMPTY_STRING, dirName, urlFilename }); } @@ -335,7 +335,7 @@ public class CGDocument extends ConfigSetItem implements XMLProvider { if (this.updateDate == null) { - return ""; + return PropertyNames.EMPTY_STRING; } return getSettings().formatter.formatCreated(this.updateDate); } @@ -344,7 +344,7 @@ public class CGDocument extends ConfigSetItem implements XMLProvider { if (this.createDate == null) { - return ""; + return PropertyNames.EMPTY_STRING; } return getSettings().formatter.formatCreated(this.createDate); } @@ -353,7 +353,7 @@ public class CGDocument extends ConfigSetItem implements XMLProvider { if (sizeBytes == -1) { - return ""; + return PropertyNames.EMPTY_STRING; } else { @@ -363,8 +363,8 @@ public class CGDocument extends ConfigSetItem implements XMLProvider private String pages() { - return pages == -1 ? "" - : JavaTools.replaceSubString(pagesTemplate(), "" + pages, "%NUMBER"); + return pages == -1 ? PropertyNames.EMPTY_STRING + : JavaTools.replaceSubString(pagesTemplate(), PropertyNames.EMPTY_STRING + pages, "%NUMBER"); } private String pagesTemplate() @@ -373,26 +373,26 @@ public class CGDocument extends ConfigSetItem implements XMLProvider switch (pagesType) { case PAGE_TYPE_UNKNOWN: - return ""; + return PropertyNames.EMPTY_STRING; case PAGE_TYPE_PAGE: return getSettings().resources[CGSettings.RESOURCE_PAGES_TEMPLATE]; case PAGE_TYPE_SLIDE: return getSettings().resources[CGSettings.RESOURCE_SLIDES_TEMPLATE]; default: - return ""; + return PropertyNames.EMPTY_STRING; } } private String getTargetTypeName(CGExporter exp) { - return (exp.targetTypeName.equals("")) + return (exp.targetTypeName.equals(PropertyNames.EMPTY_STRING)) ? (String) Properties.getPropertyValue(mediaDescriptor, "UIName") : exp.targetTypeName; } private String getIcon(CGExporter exporter) { - return exporter.cp_Icon.equals("") ? getIcon(this.appType) : exporter.cp_Icon; + return exporter.cp_Icon.equals(PropertyNames.EMPTY_STRING) ? getIcon(this.appType) : exporter.cp_Icon; } private String getIcon(String appType) diff --git a/wizards/com/sun/star/wizards/web/data/CGExporter.java b/wizards/com/sun/star/wizards/web/data/CGExporter.java index c23073fbed01..0ee8ec894dc0 100644 --- a/wizards/com/sun/star/wizards/web/data/CGExporter.java +++ b/wizards/com/sun/star/wizards/web/data/CGExporter.java @@ -27,6 +27,7 @@ package com.sun.star.wizards.web.data; import com.sun.star.wizards.common.ConfigSet; +import com.sun.star.wizards.common.PropertyNames; public class CGExporter extends ConfigSetItem { @@ -42,7 +43,7 @@ public class CGExporter extends ConfigSetItem public String cp_TargetType; public boolean cp_Binary; public int cp_PageType; - public String targetTypeName = ""; + public String targetTypeName = PropertyNames.EMPTY_STRING; public ConfigSet cp_Arguments = new ConfigSet(CGArgument.class); public String toString() @@ -52,6 +53,6 @@ public class CGExporter extends ConfigSetItem public boolean supports(String mime) { - return (cp_SupportedMimeTypes.equals("") || cp_SupportedMimeTypes.indexOf(mime) > -1); + return (cp_SupportedMimeTypes.equals(PropertyNames.EMPTY_STRING) || cp_SupportedMimeTypes.indexOf(mime) > -1); } } diff --git a/wizards/com/sun/star/wizards/web/data/CGPublish.java b/wizards/com/sun/star/wizards/web/data/CGPublish.java index 1a3746a3873d..51e53fca6da6 100644 --- a/wizards/com/sun/star/wizards/web/data/CGPublish.java +++ b/wizards/com/sun/star/wizards/web/data/CGPublish.java @@ -27,6 +27,7 @@ package com.sun.star.wizards.web.data; import com.sun.star.wizards.common.ConfigGroup; +import com.sun.star.wizards.common.PropertyNames; /** * @@ -82,13 +83,13 @@ public class CGPublish extends ConfigGroup catch (Exception e) { e.printStackTrace(); - return ""; + return PropertyNames.EMPTY_STRING; } } private String ftpURL() { return "ftp://" + cp_Username + - ((password != null && password.length() > 0) ? ":" + password : "") + "@" + cp_URL.substring(7); + ((password != null && password.length() > 0) ? ":" + password : PropertyNames.EMPTY_STRING) + "@" + cp_URL.substring(7); } } diff --git a/wizards/com/sun/star/wizards/web/data/CGSettings.java b/wizards/com/sun/star/wizards/web/data/CGSettings.java index ecc538b9fa83..60e711c3c2ae 100644 --- a/wizards/com/sun/star/wizards/web/data/CGSettings.java +++ b/wizards/com/sun/star/wizards/web/data/CGSettings.java @@ -83,8 +83,8 @@ public class CGSettings extends ConfigGroup xmsf = xmsf_; try { - soTemplateDir = FileAccess.getOfficePath(xmsf, "Config", "", ""); - soGalleryDir = FileAccess.getOfficePath(xmsf, "Gallery", "share", ""); + soTemplateDir = FileAccess.getOfficePath(xmsf, "Config", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING); + soGalleryDir = FileAccess.getOfficePath(xmsf, "Gallery", "share", PropertyNames.EMPTY_STRING); root = this; formatter = new Formatter(xmsf, document); resources = resources_; @@ -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)); @@ -152,7 +152,7 @@ public class CGSettings extends ConfigGroup throws NoSuchElementException, WrappedTargetException { - if (!exporter.cp_TargetType.equals("")) + if (!exporter.cp_TargetType.equals(PropertyNames.EMPTY_STRING)) { exporter.targetTypeName = (String) Properties.getPropertyValue( diff --git a/wizards/com/sun/star/wizards/web/data/CGStyle.java b/wizards/com/sun/star/wizards/web/data/CGStyle.java index e6258d8c5fe1..c268e568ae03 100644 --- a/wizards/com/sun/star/wizards/web/data/CGStyle.java +++ b/wizards/com/sun/star/wizards/web/data/CGStyle.java @@ -26,6 +26,8 @@ ************************************************************************/ package com.sun.star.wizards.web.data; +import com.sun.star.wizards.common.PropertyNames; + public class CGStyle extends ConfigSetItem { @@ -42,7 +44,7 @@ public class CGStyle extends ConfigSetItem public String getBackgroundUrl() { - if (cp_BackgroundImage == null || cp_BackgroundImage.equals("")) + if (cp_BackgroundImage == null || cp_BackgroundImage.equals(PropertyNames.EMPTY_STRING)) { return null; } 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) |