diff options
author | Noel Grandin <noel@peralex.com> | 2014-08-13 10:08:31 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-08-13 10:24:10 +0200 |
commit | 34bcf9b498bccb5c924f4cec850ff15d88df6f07 (patch) | |
tree | 4d9604ec8c3b73639338ec45a0618b5daa5cf0ed /wizards | |
parent | 347926e8e57c1825261daa46c1886aa2ebf9571b (diff) |
java: remove dead methods
found by UCDetector
Change-Id: I219caa8e680dba5a395541a778df6144841c4dde
Diffstat (limited to 'wizards')
57 files changed, 182 insertions, 2805 deletions
diff --git a/wizards/com/sun/star/wizards/common/Configuration.java b/wizards/com/sun/star/wizards/common/Configuration.java index ab774d787e2e..3f0b93671965 100644 --- a/wizards/com/sun/star/wizards/common/Configuration.java +++ b/wizards/com/sun/star/wizards/common/Configuration.java @@ -112,27 +112,11 @@ public abstract class Configuration set(new Integer(value), name, parent); } - public static void set(short value, String name, Object parent) throws Exception - { - set(new Short(value), name, parent); - } - public static void set(String value, String name, Object parent) throws Exception - { - set((Object) value, name, parent); - } - public static void set(boolean value, String name, Object parent) throws Exception - { - if (value) - { - set(Boolean.TRUE, name, parent); - } - else - { - set(Boolean.FALSE, name, parent); - } - } + + + public static void set(Object value, String name, Object parent) throws com.sun.star.lang.IllegalArgumentException, PropertyVetoException, UnknownPropertyException, WrappedTargetException { @@ -233,20 +217,11 @@ public abstract class Configuration return getLocale(xMSF, "org.openoffice.Setup/L10N/", "ooSetupSystemLocale"); } - public static Locale getUILocale(XMultiServiceFactory xMSF) - { - return getLocale(xMSF, "org.openoffice.Setup/L10N/", "ooLocale"); - } - public static String getLocaleString(XMultiServiceFactory xMSF) - { - return getLocaleString(xMSF, "org.openoffice.Setup/L10N/", "ooSetupSystemLocale"); - } - public static String getUILocaleString(XMultiServiceFactory xMSF) - { - return getLocaleString(xMSF, "org.openoffice.Setup/L10N/", "ooLocale"); - } + + + /** * This method creates a new configuration node and adds it @@ -290,28 +265,11 @@ public abstract class Configuration } } - public static void commit(Object configView) throws WrappedTargetException - { - XChangesBatch xUpdateControl = UnoRuntime.queryInterface(XChangesBatch.class, configView); - xUpdateControl.commitChanges(); - } - public static void updateConfiguration(XMultiServiceFactory xmsf, String path, String name, ConfigNode node, Object param) throws com.sun.star.uno.Exception, com.sun.star.container.ElementExistException, NoSuchElementException, WrappedTargetException - { - Object view = Configuration.getConfigurationRoot(xmsf, path, true); - addConfigNode(path, name); - node.writeConfiguration(view, param); - XChangesBatch xUpdateControl = UnoRuntime.queryInterface(XChangesBatch.class, view); - xUpdateControl.commitChanges(); - } - public static void removeNode(XMultiServiceFactory xmsf, String path, String name) throws com.sun.star.uno.Exception, com.sun.star.container.ElementExistException, NoSuchElementException, WrappedTargetException - { - Object view = Configuration.getConfigurationRoot(xmsf, path, true); - removeNode(view, name); - XChangesBatch xUpdateControl = UnoRuntime.queryInterface(XChangesBatch.class, view); - xUpdateControl.commitChanges(); - } + + + public static String[] getNodeDisplayNames(XNameAccess _xNameAccessNode) { @@ -377,10 +335,7 @@ public abstract class Configuration return null; } - public static XNameAccess getChildNodebyDisplayName(XNameAccess _xNameAccessNode, String _displayname) - { - return getChildNodebyDisplayName(_xNameAccessNode, _displayname, PropertyNames.PROPERTY_NAME); - } + private static XNameAccess getChildNodebyDisplayName(XNameAccess _xNameAccessNode, String _displayname, String _nodename) { diff --git a/wizards/com/sun/star/wizards/common/DebugHelper.java b/wizards/com/sun/star/wizards/common/DebugHelper.java index 16c39fb53286..cc3bdf3e8742 100644 --- a/wizards/com/sun/star/wizards/common/DebugHelper.java +++ b/wizards/com/sun/star/wizards/common/DebugHelper.java @@ -21,11 +21,7 @@ import com.sun.star.uno.Exception; public class DebugHelper { -//TODO - Verify these methods. Can not remove? - public static void exception(String DetailedMessage, Exception ex, int err, String additionalArgument) throws java.lang.Exception - { -// throw new UnsupportedOperationException("Not supported yet."); - } + public static void exception(int err, String additionalArgument) throws java.lang.Exception { diff --git a/wizards/com/sun/star/wizards/common/Desktop.java b/wizards/com/sun/star/wizards/common/Desktop.java index ad0e161291c9..efaff7d624c8 100644 --- a/wizards/com/sun/star/wizards/common/Desktop.java +++ b/wizards/com/sun/star/wizards/common/Desktop.java @@ -86,17 +86,9 @@ public class Desktop return UnoRuntime.queryInterface(XComponent.class, xFrame.getController().getModel()); } - public static XTextDocument getActiveTextDocument(XMultiServiceFactory _xMSF) - { - XComponent xComponent = getActiveComponent(_xMSF); - return UnoRuntime.queryInterface(XTextDocument.class, xComponent); - } - public static XSpreadsheetDocument getActiveSpreadsheetDocument(XMultiServiceFactory _xMSF) - { - XComponent xComponent = getActiveComponent(_xMSF); - return UnoRuntime.queryInterface(XSpreadsheetDocument.class, xComponent); - } + + private static XDispatch getDispatcher(XFrame xFrame, String _stargetframe, com.sun.star.util.URL oURL) { @@ -297,35 +289,7 @@ public class Desktop return PropertyNames.EMPTY_STRING; } - /** - * @deprecated use Configuration.getConfigurationRoot() with the same parameters instead - */ - public static XInterface getRegistryKeyContent(XMultiServiceFactory xMSF, String KeyName, boolean bForUpdate) - { - try - { - Object oConfigProvider; - PropertyValue[] aNodePath = new PropertyValue[1]; - oConfigProvider = xMSF.createInstance("com.sun.star.configuration.ConfigurationProvider"); - aNodePath[0] = new PropertyValue(); - aNodePath[0].Name = "nodepath"; - aNodePath[0].Value = KeyName; - XMultiServiceFactory xMSFConfig = UnoRuntime.queryInterface(XMultiServiceFactory.class, oConfigProvider); - if (bForUpdate) - { - return (XInterface) xMSFConfig.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", aNodePath); - } - else - { - return (XInterface) xMSFConfig.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", aNodePath); - } - } - catch (Exception exception) - { - exception.printStackTrace(System.err); - return null; - } - } + private static String getTemplatePath(XMultiServiceFactory _xMSF) { @@ -339,17 +303,7 @@ public class Desktop return PropertyNames.EMPTY_STRING; } - public static String getUserTemplatePath(XMultiServiceFactory _xMSF) - { - try - { - return FileAccess.getOfficePath(_xMSF, "Template", "user", PropertyNames.EMPTY_STRING); - } - catch (NoValidPathException nopathexception) - { - } - return PropertyNames.EMPTY_STRING; - } + public static String getBitmapPath(XMultiServiceFactory _xMSF) { @@ -363,77 +317,9 @@ public class Desktop return PropertyNames.EMPTY_STRING; } - public static String getWorkPath(XMultiServiceFactory _xMSF) - { - try - { - return FileAccess.getOfficePath(_xMSF, "Work", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING); - } - catch (NoValidPathException nopathexception) - { - } - return PropertyNames.EMPTY_STRING; - } - public static XStringSubstitution createStringSubstitution(XMultiServiceFactory xMSF) - { - Object xPathSubst = null; - try - { - xPathSubst = xMSF.createInstance("com.sun.star.util.PathSubstitution"); - } - catch (com.sun.star.uno.Exception e) - { - e.printStackTrace(); - } - if (xPathSubst != null) - { - return UnoRuntime.queryInterface(XStringSubstitution.class, xPathSubst); - } - else - { - return null; - } - } - /** - * This method searches (and hopefully finds...) a frame - * with a componentWindow. - * It does it in three phases: - * 1. Check if the given desktop argument has a componentWindow. - * If it is null, the myFrame argument is taken. - * 2. Go up the tree of frames and search a frame with a component window. - * 3. Get from the desktop all the components, and give the first one - * which has a frame. - */ - public static XFrame findAFrame(XMultiServiceFactory xMSF, XFrame myFrame, XFrame desktop) - throws NoSuchElementException, - WrappedTargetException - { - if (desktop == null) - { - desktop = myFrame; // we go up in the tree... - } - while (desktop != null && desktop.getComponentWindow() == null) - { - desktop = desktop.findFrame("_parent", FrameSearchFlag.PARENT); - } - if (desktop == null) - { - for (XEnumeration e = Desktop.getDesktop(xMSF).getComponents().createEnumeration(); e.hasMoreElements();) - { - Object comp = ((Any) e.nextElement()).getObject(); - XModel xModel = UnoRuntime.queryInterface(XModel.class, comp); - XFrame xFrame = xModel.getCurrentController().getFrame(); - if (xFrame != null && xFrame.getComponentWindow() != null) - { - return xFrame; - } - } - } - return desktop; - } } diff --git a/wizards/com/sun/star/wizards/common/FileAccess.java b/wizards/com/sun/star/wizards/common/FileAccess.java index febdb5612ac8..4dbad312210a 100644 --- a/wizards/com/sun/star/wizards/common/FileAccess.java +++ b/wizards/com/sun/star/wizards/common/FileAccess.java @@ -52,28 +52,7 @@ import com.sun.star.document.XDocumentProperties; public class FileAccess { - public static void addOfficePath(XMultiServiceFactory xMSF, String sPath, String sAddPath) - { - XSimpleFileAccess xSimpleFileAccess = null; - 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, PropertyNames.SEMI_COLON); - int MaxIndex = PathList.length - 1; - String CompCurPath; - 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, PropertyNames.EMPTY_STRING, "/"); - if (CompCurPath.equals(CompAddPath)) - { - return; - } - } - ResultPath += PropertyNames.SEMI_COLON + sAddPath; - } + private static String deleteLastSlashfromUrl(String _sPath) { @@ -395,148 +374,6 @@ public class FileAccess } } - // checks if the root of a path exists. if the parameter xWindowPeer is not null then also the directory is - // created when it does not exists and the user - public static boolean PathisValid(XMultiServiceFactory xMSF, String Path, String sMsgFilePathInvalid, boolean baskbeforeOverwrite) - { - try - { - String SubDir; - String SubDirPath = PropertyNames.EMPTY_STRING; - int SubLen; - int NewLen; - int RestLen; - boolean bexists; - boolean bSubDirexists = true; - String LowerCasePath; - String NewPath = Path; - XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); - XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface); - if (baskbeforeOverwrite) - { - if (xSimpleFileAccess.exists(Path)) - { - Resource oResource = new Resource(xMSF, "ImportWizard", "imp"); - String sFileexists = oResource.getResText(1053); - String NewString = JavaTools.convertfromURLNotation(Path); - sFileexists = JavaTools.replaceSubString(sFileexists, NewString, "<1>"); - sFileexists = JavaTools.replaceSubString(sFileexists, String.valueOf((char) 13), "<CR>"); - int iLeave = SystemDialog.showMessageBox(xMSF, "QueryBox", VclWindowPeerAttribute.YES_NO, sFileexists); - if (iLeave == 3) - { - return false; - } - } - } - String[] DirArray = JavaTools.ArrayoutofString(Path, "/"); - int MaxIndex = DirArray.length - 1; - if (MaxIndex > 0) - { - for (int i = MaxIndex; i >= 0; i--) - { - SubDir = DirArray[i]; - SubLen = SubDir.length(); - NewLen = NewPath.length(); - RestLen = NewLen - SubLen; - if (RestLen > 0) - { - NewPath = NewPath.substring(0, NewLen - SubLen - 1); - if (i == MaxIndex) - { - SubDirPath = NewPath; - } - bexists = xSimpleFileAccess.exists(NewPath); - if (bexists) - { - LowerCasePath = NewPath.toLowerCase(); - bexists = (!((LowerCasePath.equals("file:///")) || (LowerCasePath.equals("file://")) || (LowerCasePath.equals("file:/")) || (LowerCasePath.equals("file:")))); - } - if (bexists) - { - if (!bSubDirexists) - { - return createSubDirectory(xMSF, xSimpleFileAccess, SubDirPath); - } - return true; - } - else - { - bSubDirexists = false; - } - } - } - } - SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMsgFilePathInvalid); - return false; - } - catch (com.sun.star.uno.Exception exception) - { - exception.printStackTrace(System.err); - SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMsgFilePathInvalid); - return false; - } - } - - /** - * searches a directory for files which start with a certain - * prefix, and returns their URLs and document-titles. - * @param FilterName the prefix of the filename. a "-" is added to the prefix ! - * @param FolderName the folder (URL) to look for files... - * @return an array with two array members. The first one, with document titles, - * the second with the corresponding URLs. - * @deprecated please use the getFolderTitles() with ArrayList - */ - public static String[][] getFolderTitles(com.sun.star.lang.XMultiServiceFactory xMSF, String FilterName, String FolderName) - { - String[][] LocLayoutFiles = new String[2][]; - try - { - java.util.ArrayList<String> TitleVector = null; - java.util.ArrayList<String> NameVector = null; - - XInterface xDocInterface = (XInterface) xMSF.createInstance("com.sun.star.document.DocumentProperties"); - XDocumentProperties xDocProps = UnoRuntime.queryInterface(XDocumentProperties.class, xDocInterface); - - XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); - com.sun.star.ucb.XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface); - - String[] nameList = xSimpleFileAccess.getFolderContents(FolderName, false); - - TitleVector = new java.util.ArrayList<String>(/*nameList.length*/); - NameVector = new java.util.ArrayList<String>(nameList.length); - - FilterName = FilterName == null || FilterName.equals(PropertyNames.EMPTY_STRING) ? null : FilterName + "-"; - - String fileName = PropertyNames.EMPTY_STRING; - PropertyValue[] noArgs = { }; - for (int i = 0; i < nameList.length; i++) - { - fileName = getFilename(nameList[i]); - - if (FilterName == null || fileName.startsWith(FilterName)) - { - xDocProps.loadFromMedium(nameList[i], noArgs); - NameVector.add(nameList[i]); - TitleVector.add(xDocProps.getTitle()); - } - } - String[] LocNameList = new String[NameVector.size()]; - String[] LocTitleList = new String[TitleVector.size()]; - - NameVector.toArray(LocNameList); - TitleVector.toArray(LocTitleList); - LocLayoutFiles[1] = LocNameList; - LocLayoutFiles[0] = LocTitleList; - - JavaTools.bubblesortList(LocLayoutFiles); - } - catch (Exception exception) - { - exception.printStackTrace(System.err); - } - return LocLayoutFiles; - } - /** * We search in all given path for a given file */ @@ -704,12 +541,6 @@ public class FileAccess return filenameConverter.getFileURLFromSystemPath(parentPath, f.getAbsolutePath()); } - public String getURL(String path) - { - File f = new File(path); - return filenameConverter.getFileURLFromSystemPath(path, f.getAbsolutePath()); - } - public String getPath(String parentURL, String childURL) { return filenameConverter.getSystemPathFromFileURL(parentURL + (((childURL == null || childURL.equals(PropertyNames.EMPTY_STRING)) ? PropertyNames.EMPTY_STRING : "/" + childURL))); @@ -775,72 +606,12 @@ public class FileAccess return def; } - public boolean isDirectory(String filename) - { - try - { - return fileAccess.isFolder(filename); - } - catch (CommandAbortedException e) - { - } - catch (Exception e) - { - } - - return false; - } - - /** - * lists the files in a given directory - */ - public String[] listFiles(String dir, boolean includeFolders) - { - try - { - return fileAccess.getFolderContents(dir, includeFolders); - } - catch (CommandAbortedException e) - { - } - catch (Exception e) - { - } - - return new String[0]; - } - - public boolean delete(String file) - { - try - { - fileAccess.kill(file); - return true; - } - catch (CommandAbortedException e) - { - e.printStackTrace(System.err); - } - catch (Exception e) - { - e.printStackTrace(System.err); - } - - return false; - } - public static String getFilename(String path) { return getFilename(path, "/"); } - /** - * return the filename out of a system-dependent path - */ - public static String getPathFilename(String path) - { - return getFilename(path, File.separator); - } + private static String getFilename(String path, String pathSeparator) { @@ -855,37 +626,9 @@ public class FileAccess return filename.substring(0, filename.length() - (sExtension.length() + 1)); } - public boolean copy(String source, String target) - { - try - { - fileAccess.copy(source, target); - return true; - } - catch (CommandAbortedException e) - { - } - catch (Exception e) - { - } - return false; - } - public DateTime getLastModified(String url) - { - try - { - return fileAccess.getDateTimeModified(url); - } - catch (CommandAbortedException e) - { - } - catch (Exception e) - { - } - return null; - } + /** * @return the parent dir of the given url. @@ -906,18 +649,7 @@ public class FileAccess return url.substring(0, lastPos); } - public String createNewDir(String parentDir, String name) - { - String s = getNewFile(parentDir, name, PropertyNames.EMPTY_STRING); - if (mkdir(s)) - { - return s; - } - else - { - return null; - } - } + private String getNewFile(String parentDir, String name, String extension) { @@ -939,18 +671,6 @@ public class FileAccess return name + (i == 0 ? PropertyNames.EMPTY_STRING : String.valueOf(i)) + (ext.equals(PropertyNames.EMPTY_STRING) ? PropertyNames.EMPTY_STRING : "." + ext); } - public int getSize(String url) - { - try - { - return fileAccess.getSize(url); - } - catch (Exception ex) - { - return -1; - } - } - public static String connectURLs(String urlFolder, String urlFilename) { return urlFolder + (urlFolder.endsWith("/") ? PropertyNames.EMPTY_STRING : "/") + @@ -989,33 +709,4 @@ public class FileAccess return sFileData; } - /** - * shortens a filename to a user displayable representation. - */ - public static String getShortFilename(String path, int maxLength) - { - int firstPart = 0; - - if (path.length() > maxLength) - { - if (path.startsWith("/")) - { // unix - int nextSlash = path.indexOf("/", 1) + 1; - firstPart = Math.min(nextSlash, (maxLength - 3) / 2); - } - else - { //windows - firstPart = Math.min(10, (maxLength - 3) / 2); - } - - String s1 = path.substring(0, firstPart); - String s2 = path.substring(path.length() - (maxLength - (3 + firstPart))); - - return s1 + "..." + s2; - } - else - { - return path; - } - } } diff --git a/wizards/com/sun/star/wizards/common/Helper.java b/wizards/com/sun/star/wizards/common/Helper.java index 9287bbccea31..79b6dcb5d74e 100644 --- a/wizards/com/sun/star/wizards/common/Helper.java +++ b/wizards/com/sun/star/wizards/common/Helper.java @@ -92,21 +92,7 @@ public class Helper } } - public static Object getPropertyValue(PropertyValue[] CurPropertyValue, String PropertyName) - { - int MaxCount = CurPropertyValue.length; - for (int i = 0; i < MaxCount; i++) - { - if (CurPropertyValue[i] != null) - { - if (CurPropertyValue[i].Name.equals(PropertyName)) - { - return CurPropertyValue[i].Value; - } - } - } - throw new RuntimeException(); - } + public static Object getUnoPropertyValue(Object oUnoObject, String PropertyName, java.lang.Class<?> xClass) { @@ -134,53 +120,9 @@ public class Helper } } - public static Object getPropertyValuefromAny(Object[] CurPropertyValue, String PropertyName) - { - if (CurPropertyValue != null) - { - int MaxCount = CurPropertyValue.length; - for (int i = 0; i < MaxCount; i++) - { - if (CurPropertyValue[i] != null) - { - PropertyValue aValue = (PropertyValue) CurPropertyValue[i]; - if (aValue != null && aValue.Name.equals(PropertyName)) - { - return aValue.Value; - } - } - } - } - return null; - } - public static Object getPropertyValuefromAny(Object[] CurPropertyValue, String PropertyName, java.lang.Class<?> xClass) - { - try - { - if (CurPropertyValue != null) - { - int MaxCount = CurPropertyValue.length; - for (int i = 0; i < MaxCount; i++) - { - if (CurPropertyValue[i] != null) - { - PropertyValue aValue = (PropertyValue) CurPropertyValue[i]; - if (aValue != null && aValue.Name.equals(PropertyName)) - { - return com.sun.star.uno.AnyConverter.toObject(new com.sun.star.uno.Type(xClass), aValue.Value); - } - } - } - } - return null; - } - catch (Exception exception) - { - exception.printStackTrace(System.err); - return null; - } - } + + public static Object getUnoPropertyValue(Object oUnoObject, String PropertyName) { @@ -382,20 +324,14 @@ public class Helper } - public String format(int formatIndex, int date) - { - return formatter.convertNumberToString(formatIndex, getDocumentDateAsDouble(date)); - } + public String format(int formatIndex, DateTime date) { return formatter.convertNumberToString(formatIndex, getDocumentDateAsDouble(date)); } - public String format(int formatIndex, long javaTimeInMillis) - { - return formatter.convertNumberToString(formatIndex, getDocumentDateAsDouble(javaTimeInMillis)); - } + } public static XComponentContext getComponentContext(XMultiServiceFactory _xMSF) diff --git a/wizards/com/sun/star/wizards/common/JavaTools.java b/wizards/com/sun/star/wizards/common/JavaTools.java index 0c52e9115d52..018314eaa4e8 100644 --- a/wizards/com/sun/star/wizards/common/JavaTools.java +++ b/wizards/com/sun/star/wizards/common/JavaTools.java @@ -34,37 +34,11 @@ public class JavaTools { } - public static String[] copyStringArray(String[] FirstArray) - { - if (FirstArray != null) - { - String[] SecondArray = new String[FirstArray.length]; - System.arraycopy(FirstArray, 0, SecondArray, 0, FirstArray.length); - return SecondArray; - } - else - { - return null; - } - } - public static Object[] initializeArray(Object[] olist, Object ovalue) - { - for (int i = 0; i < olist.length; i++) - { - olist[i] = ovalue; - } - return olist; - } - public static Object[][] initializeMultiDimArray(Object[][] olist, Object[] ovalue) - { - for (int i = 0; i < olist.length; i++) - { - olist[i] = ovalue; - } - return olist; - } + + + public static String[] ArrayOutOfMultiDimArray(String _sMultiDimArray[][], int _index) { @@ -80,15 +54,7 @@ public class JavaTools return sRetArray; } - public static int[] initializeintArray(int FieldCount, int nValue) - { - int[] LocintArray = new int[FieldCount]; - for (int i = 0; i < LocintArray.length; i++) - { - LocintArray[i] = nValue; - } - return LocintArray; - } + /**converts a list of Integer values included in an Integer vector to a list of int values */ @@ -134,18 +100,7 @@ public class JavaTools } } - public static String[] multiDimListToArray(String[][] multidimlist) - { - String[] retlist = new String[] - { - }; - retlist = new String[multidimlist.length]; - for (int i = 0; i < multidimlist.length; i++) - { - retlist[i] = multidimlist[i][0]; - } - return retlist; - } + public static String getlongestArrayItem(String[] StringArray) { @@ -199,23 +154,7 @@ public class JavaTools return retvalue; } - public static int FieldInList(String[] SearchList, String SearchString, int StartIndex) - { - int FieldLen = SearchList.length; - int retvalue = -1; - if (StartIndex < FieldLen) - { - for (int i = StartIndex; i < FieldLen; i++) - { - if (SearchList[i].equals(SearchString)) - { - retvalue = i; - break; - } - } - } - return retvalue; - } + public static int FieldInTable(String[][] SearchList, String SearchString) { @@ -378,17 +317,7 @@ public class JavaTools return Hierarchy[Hierarchy.length - 1]; } - public static String getFileDescription(String sPath) - { - String sFilename = getFilenameOutOfPath(sPath); - String[] FilenameList = ArrayoutofString(sFilename, "."); - StringBuilder FileDescription = new StringBuilder(PropertyNames.EMPTY_STRING); - for (int i = 0; i < FilenameList.length - 1; i++) - { - FileDescription.append(FilenameList[i]); - } - return FileDescription.toString(); - } + public static String convertfromURLNotation(String _sURLPath) { @@ -406,20 +335,7 @@ public class JavaTools return sPath; } - public static DateTime getDateTime(long timeMillis) - { - java.util.Calendar cal = java.util.Calendar.getInstance(); - setTimeInMillis(cal, timeMillis); - DateTime dt = new DateTime(); - dt.Year = (short) cal.get(Calendar.YEAR); - dt.Day = (short) cal.get(Calendar.DAY_OF_MONTH); - dt.Month = (short) (cal.get(Calendar.MONTH) + 1); - dt.Hours = (short) cal.get(Calendar.HOUR); - dt.Minutes = (short) cal.get(Calendar.MINUTE); - dt.Seconds = (short) cal.get(Calendar.SECOND); - dt.NanoSeconds = cal.get(Calendar.MILLISECOND)*1000000; - return dt; - } + private static long getTimeInMillis(Calendar _calendar) { @@ -434,12 +350,7 @@ public class JavaTools _calendar.setTime(dDate); } - public static long getMillis(DateTime time) - { - java.util.Calendar cal = java.util.Calendar.getInstance(); - cal.set(time.Year, time.Month, time.Day, time.Hours, time.Minutes, time.Seconds); - return getTimeInMillis(cal); - } + public static String[] removeOutdatedFields(String[] baselist, String[] _complist) { diff --git a/wizards/com/sun/star/wizards/common/NamedValueCollection.java b/wizards/com/sun/star/wizards/common/NamedValueCollection.java index 2813b22647ea..32cc0cd80deb 100644 --- a/wizards/com/sun/star/wizards/common/NamedValueCollection.java +++ b/wizards/com/sun/star/wizards/common/NamedValueCollection.java @@ -45,20 +45,7 @@ public class NamedValueCollection m_values.put( i_name, i_value ); } - @SuppressWarnings("unchecked") - public final < T > T getOrDefault( final String i_key, final T i_default ) - { - if ( m_values.containsKey( i_key ) ) - { - final Object value = m_values.get( i_key ); - try - { - return (T)value; - } - catch ( ClassCastException e ) { } - } - return i_default; - } + public final < T extends XInterface > T queryOrDefault( final String i_key, final T i_default, Class<T> i_interfaceClass ) { @@ -70,11 +57,6 @@ public class NamedValueCollection return i_default; } - public final boolean has( final String i_key ) - { - return m_values.containsKey( i_key ); - } - public final PropertyValue[] getPropertyValues() { PropertyValue[] values = new PropertyValue[ m_values.size() ]; diff --git a/wizards/com/sun/star/wizards/common/NumberFormatter.java b/wizards/com/sun/star/wizards/common/NumberFormatter.java index 273af7def411..d3dd3b5df1d3 100644 --- a/wizards/com/sun/star/wizards/common/NumberFormatter.java +++ b/wizards/com/sun/star/wizards/common/NumberFormatter.java @@ -108,10 +108,7 @@ public class NumberFormatter } - public static String convertNumberToString(XNumberFormatter _xNumberFormatter, int _nkey, double _dblValue) - { - return _xNumberFormatter.convertNumberToString(_nkey, _dblValue); - } + public double convertStringToNumber(int _nkey, String _sString)throws Exception diff --git a/wizards/com/sun/star/wizards/common/NumericalHelper.java b/wizards/com/sun/star/wizards/common/NumericalHelper.java index f8dfbc163d3a..3e9778d48925 100644 --- a/wizards/com/sun/star/wizards/common/NumericalHelper.java +++ b/wizards/com/sun/star/wizards/common/NumericalHelper.java @@ -59,25 +59,7 @@ public class NumericalHelper // private c'tor, so no one can instantiate } - /** - * get the type of an object: returns all types that can possibly converted - * with this class. - * @param obj an object that is checked for conversion - * @return the type of the object - */ - public static int getType(Object obj) - { - try - { - TypeObject aTypeObject = getTypeObject(obj); - return aTypeObject.iType; - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - // ignore this one; just return unknown type - } - return UNKNOWN_TYPE; - } + /** * get a byte value from the object @@ -135,68 +117,7 @@ public class NumericalHelper return retValue; } - /** - * get a char value from the object - * @return a char - * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted - */ - public static char toChar(Object aValue) - throws com.sun.star.lang.IllegalArgumentException - { - char retValue = 0; - TypeObject aTypeObject = getTypeObject(aValue); - switch (aTypeObject.iType) - { - case CHAR_TYPE: - retValue = getChar(aTypeObject); - break; - case BYTE_TYPE: - retValue = (char) getByte(aTypeObject); - break; - case SHORT_TYPE: - retValue = (char) getShort(aTypeObject); - break; - case INT_TYPE: - retValue = (char) getInt(aTypeObject); - break; - case LONG_TYPE: - retValue = (char) getLong(aTypeObject); - break; - case FLOAT_TYPE: - retValue = (char) getFloat(aTypeObject); - break; - case DOUBLE_TYPE: - retValue = (char) getDouble(aTypeObject); - break; - case STRING_TYPE: - try - { - String s = (String) aTypeObject.aValue; - if (s.length() > 0) - { - retValue = s.charAt(0); - } - else - { - retValue = (char) 0; - } - } - catch (java.lang.NumberFormatException e) - { - throw new com.sun.star.lang.IllegalArgumentException( - "Cannot convert to char: " + aTypeObject.aValue); - } - break; - case BOOLEAN_TYPE: - retValue = getBool(aTypeObject) ? (char) -1 : (char) 0; - break; - default: - throw new com.sun.star.lang.IllegalArgumentException( - "Cannot convert this type: " + aValue.getClass().getName()); - } - return retValue; - } /** * get a short value from the object @@ -253,42 +174,11 @@ public class NumericalHelper return retValue; } - public static boolean isValidAndNumerical(Object aValue) throws com.sun.star.lang.IllegalArgumentException - { - if (aValue != null) - { - if (!AnyConverter.isVoid(aValue)) - { - return (NumericalHelper.isNumerical(aValue)); - } - } - return false; - } - public static boolean isValidAndBoolean(Object aValue) throws com.sun.star.lang.IllegalArgumentException - { - if (aValue != null) - { - if (!AnyConverter.isVoid(aValue)) - { - int nType = AnyConverter.getType(aValue).getTypeClass().getValue(); - return (nType == TypeClass.BOOLEAN_value); - } - } - return false; - } - public static boolean isValid(Object aValue) - { - if (aValue != null) - { - if (!AnyConverter.isVoid(aValue)) - { - return true; - } - } - return false; - } + + + /** @param aValue a object this can contain anything @@ -320,16 +210,7 @@ public class NumericalHelper } } - /** - @param _aValue a object this can contain anything - @return true, if the parameter aValue is type of real numbers - see also http://en.wikipedia.org/wiki/Mathematics - */ - public static boolean isRealNumber(Object _aValue) - { - return isNumerical(_aValue); - } /** @param aValue a object this can contain anything @@ -351,43 +232,9 @@ public class NumericalHelper } } - /** - * Can a given object be converted to a String array? - * @param aValue the object to test - * @return true, if the object can be converted to a String array. - */ - public static boolean isStringArray(Object aValue) - { - try - { - toStringArray(aValue); - return true; - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - // ignore - } - return false; - } - /** - * Can a given object be converted to an int array? - * @param aValue the object to test - * @return true, if the object can be converted to an Integer array. - */ - public static boolean isIntegerArray(Object aValue) - { - try - { - toIntArray(aValue); - return true; - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - // ignore - } - return false; - } + + /** * get an int value from the object @@ -829,198 +676,25 @@ public class NumericalHelper return retValue; } - /** - * get an int from an object - * @param _aValue a value that is constructed into an int - * @param _ndefaultValue the value that is returned, if conversion fails, or if 'aValue' is null - * @return an int value - */ - public static int toInt(Object _aValue, int _ndefaultValue) throws Exception - { - int nreturn = _ndefaultValue; - try - { - if ((_aValue != null) && (!(AnyConverter.isVoid(_aValue)))) - { - if (isInteger(_aValue)) - { - nreturn = toInt(_aValue); - } - else - { - DebugHelper.exception(1/* BasicErrorCode.SbERR_CONVERSION*/, PropertyNames.EMPTY_STRING); - } - } - } - catch (com.sun.star.uno.Exception e) - { - DebugHelper.exception(1 /*BasicErrorCode.SbERR_METHOD_FAILED*/, PropertyNames.EMPTY_STRING); - } - return nreturn; - } - /** - * get a long from an object - * @param aValue a value that is constructed into a long - * @param defaultValue the value that is returned, if conversion fails - * @return a long value - */ - public static long toLong(Object aValue, long defaultValue) - { - try - { - return toLong(aValue); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - // ignore exception - } - return defaultValue; - } - /** - * get a float from an object - * @param aValue a value that is constructed into a float - * @param defaultValue the value that is returned, if conversion fails - * @return a long value - */ - public static float toFloat(Object aValue, float defaultValue) - { - try - { - return toFloat(aValue); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - // ignore exception - } - return defaultValue; - } - /** - * get a double from an object - * @param aValue a value that is constructed into a double - * @param defaultValue the value that is returned, if conversion fails - * @return a double value - */ - public static double toDouble(Object aValue, double defaultValue) - { - try - { - return toDouble(aValue); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - // ignore exception - } - return defaultValue; - } - /** - * get a string from an object - * @param aValue a value that is constructed into a string - * @param defaultValue the value that is returned, if conversion fails - * @return a string value - */ - public static String toString(Object aValue, String defaultValue) - { - try - { - return toString(aValue); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - // ignore exception - } - return defaultValue; - } - /** - * get a boolean from an object - * @param aValue a value that is constructed into a boolean - * @param defaultValue the value that is returned, if conversion fails - * @return a boolean value - */ - public static boolean toBoolean(Object aValue, boolean defaultValue) - { - try - { - return toBoolean(aValue); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - // ignore exception - } - return defaultValue; - } - /** - * get a int array from an object - * @param anArrayValue a value that is constructed into an int array - * @param defaultValue the value that is returned, if conversion fails - * @return an int array - */ - public static int[] toIntArray(Object anArrayValue, int[] defaultValue) - { - try - { - return toIntArray(anArrayValue); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - // ignore exception - } - return defaultValue; - } - /** - * get a short array from an object - * @param anArrayValue a value that is constructed into a short array - * @param defaultValue the value that is returned, if conversion fails - * @return a short array - */ - public static short[] toShortArray(Object anArrayValue, short[] defaultValue) - { - try - { - return toShortArray(anArrayValue); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - // ignore exception - } - return defaultValue; - } - /** - * get a string array from an object - * @param anArrayValue a value that is constructed into a string array - * @param defaultValue the value that is returned, if conversion fails - * @return a string array - */ - public static String[] toStringArray(Object anArrayValue, String[] defaultValue) - { - try - { - return toStringArray(anArrayValue); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - // ignore exception - } - return defaultValue; - } - /** - * get a hexadecimal representation from a number - * @param number the number to transform - * @return a String with the hex code of the number - */ - public static String getHexStringFromNumber(long number) - { - TransformNumToHex num = new TransformNumToHex(number); - return num.getResult(); - } + + + + + + + + + + /** * get the type object from the given object @@ -1337,16 +1011,9 @@ public class NumericalHelper return aShortVal; } - public static boolean representsIntegerNumber(double _dblvalue) - { - double dblsecvalue = ((int) _dblvalue); - return Double.compare(_dblvalue, dblsecvalue) == 0; - } - public static double roundDouble(Double _Dblvalue, int _ndecimals) - { - return roundDouble(_Dblvalue.doubleValue(), _ndecimals); - } + + private static double roundDouble(double _dblvalue, int _ndecimals) { diff --git a/wizards/com/sun/star/wizards/common/PropertySetHelper.java b/wizards/com/sun/star/wizards/common/PropertySetHelper.java index f319000cd9c9..660d4906f690 100644 --- a/wizards/com/sun/star/wizards/common/PropertySetHelper.java +++ b/wizards/com/sun/star/wizards/common/PropertySetHelper.java @@ -143,45 +143,7 @@ public class PropertySetHelper return nValue; } - /** - get a property and convert it to a short value - @param _sName the string name of the property - @param _nDefault if an error occur, return this value - @return the int value of the property - */ - public short getPropertyValueAsShort(String _sName, short _nDefault) - { - Object aObject = null; - short nValue = _nDefault; - if (m_xPropertySet != null) - { - try - { - aObject = m_xPropertySet.getPropertyValue(_sName); - } - catch (com.sun.star.beans.UnknownPropertyException e) - { - DebugHelper.writeInfo(e.getMessage()); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - DebugHelper.writeInfo(e.getMessage()); - } - } - if (aObject != null) - { - try - { - nValue = NumericalHelper.toShort(aObject); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - DebugHelper.writeInfo("can't convert a object to short."); - } - } - return nValue; - } /** get a property and convert it to a double value @@ -230,46 +192,7 @@ public class PropertySetHelper return nValue; } - /** - get a property and convert it to a boolean value - @param _sName the string name of the property - @param _bDefault if an error occur, return this value - @return the boolean value of the property - */ - public boolean getPropertyValueAsBoolean(String _sName, boolean _bDefault) - { - Object aObject = null; - boolean bValue = _bDefault; - if (m_xPropertySet != null) - { - try - { - aObject = m_xPropertySet.getPropertyValue(_sName); - } - catch (com.sun.star.beans.UnknownPropertyException e) - { - DebugHelper.writeInfo(e.getMessage()); - DebugHelper.writeInfo("UnknownPropertyException caught: Name:=" + _sName); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - DebugHelper.writeInfo(e.getMessage()); - } - } - if (aObject != null) - { - try - { - bValue = NumericalHelper.toBoolean(aObject); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - DebugHelper.writeInfo("can't convert a object to boolean."); - } - } - return bValue; - } /** get a property and convert it to a string value @@ -338,15 +261,7 @@ public class PropertySetHelper return aObject; } - /** - * Debug helper, to show all properties which are available in the given object. - * @param _xObj the object of which the properties should shown - */ - public static void showProperties(Object _xObj) - { - PropertySetHelper aHelper = new PropertySetHelper(_xObj); - aHelper.showProperties(); - } + /** Debug helper, to show all properties which are available in the current object. diff --git a/wizards/com/sun/star/wizards/common/Resource.java b/wizards/com/sun/star/wizards/common/Resource.java index 33e3557ac263..14e3a1a88e52 100644 --- a/wizards/com/sun/star/wizards/common/Resource.java +++ b/wizards/com/sun/star/wizards/common/Resource.java @@ -84,18 +84,7 @@ public class Resource } } - public PropertyValue[] getStringList(int nID) - { - try - { - return (PropertyValue[])this.xStringListIndexAccess.getByIndex(nID); - } - catch (Exception exception) - { - exception.printStackTrace(); - throw new java.lang.IllegalArgumentException("Resource with ID not " + String.valueOf(nID) + "not found"); - } - } + public String[] getResArray(int nID, int iCount) { diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.java b/wizards/com/sun/star/wizards/common/SystemDialog.java index 49674b243e5d..8ed3804f6069 100644 --- a/wizards/com/sun/star/wizards/common/SystemDialog.java +++ b/wizards/com/sun/star/wizards/common/SystemDialog.java @@ -84,20 +84,11 @@ public class SystemDialog return new SystemDialog(xmsf, "com.sun.star.ui.dialogs.FilePicker", TemplateDescription.FILESAVE_AUTOEXTENSION); } - public static SystemDialog createOpenDialog(XMultiServiceFactory xmsf) - { - return new SystemDialog(xmsf, "com.sun.star.ui.dialogs.FilePicker", TemplateDescription.FILEOPEN_SIMPLE); - } - public static SystemDialog createFolderDialog(XMultiServiceFactory xmsf) - { - return new SystemDialog(xmsf, "com.sun.star.ui.dialogs.FolderPicker", (short) 0); - } - public static SystemDialog createOfficeFolderDialog(XMultiServiceFactory xmsf) - { - return new SystemDialog(xmsf, "com.sun.star.ui.dialogs.OfficeFolderPicker", (short) 0); - } + + + private String subst(String path) { @@ -149,52 +140,14 @@ public class SystemDialog return sStorePath; } - public String callFolderDialog(String title, String description, String displayDir) - { - try - { - xFolderPicker.setDisplayDirectory(subst(displayDir)); - } - catch (com.sun.star.lang.IllegalArgumentException iae) - { - iae.printStackTrace(); - throw new IllegalArgumentException(iae.getMessage()); - } - xFolderPicker.setTitle(title); - xFolderPicker.setDescription(description); - if (execute(xFolderPicker)) - { - return xFolderPicker.getDirectory(); - } - else - { - return null; - } - } + private boolean execute(XExecutableDialog execDialog) { return execDialog.execute() == 1; } - public String[] callOpenDialog(boolean multiSelect, String displayDirectory) - { - try - { - xFilePicker.setMultiSelectionMode(multiSelect); - xFilePicker.setDisplayDirectory(subst(displayDirectory)); - if (execute(xExecutable)) - { - return xFilePicker.getFiles(); - } - } - catch (com.sun.star.lang.IllegalArgumentException exception) - { - exception.printStackTrace(); - } - return null; - } //("writer_StarOffice_XML_Writer_Template") 'StarOffice XML (Writer) private void addFilterToDialog(String sExtension, String filterName, boolean setToDefault) diff --git a/wizards/com/sun/star/wizards/common/TemplateElement.java b/wizards/com/sun/star/wizards/common/TemplateElement.java index caa40f0e2db3..07fc84f41fdd 100644 --- a/wizards/com/sun/star/wizards/common/TemplateElement.java +++ b/wizards/com/sun/star/wizards/common/TemplateElement.java @@ -20,5 +20,5 @@ package com.sun.star.wizards.common; interface TemplateElement { - void write(Object any) throws Exception; + } diff --git a/wizards/com/sun/star/wizards/db/CommandMetaData.java b/wizards/com/sun/star/wizards/db/CommandMetaData.java index 304f4d610c4b..a8b34dde0a94 100644 --- a/wizards/com/sun/star/wizards/db/CommandMetaData.java +++ b/wizards/com/sun/star/wizards/db/CommandMetaData.java @@ -312,20 +312,7 @@ public class CommandMetaData extends DBMetaData return false; } - public String[] getOrderableColumns(String[] _fieldnames) - { - ArrayList<String> aOrderableColumns = new ArrayList<String>(); - for (int i = 0; i < _fieldnames.length; i++) - { - FieldColumn ofieldcolumn = getFieldColumnByFieldName(_fieldnames[i]); - if (getDBDataTypeInspector().isColumnOrderable(ofieldcolumn.getXColumnPropertySet())) - { - aOrderableColumns.add(_fieldnames[i]); - } - } - String[] sretfieldnames = new String[aOrderableColumns.size()]; - return aOrderableColumns.toArray(sretfieldnames); - } + /** * @return Returns the command. @@ -468,23 +455,7 @@ public class CommandMetaData extends DBMetaData } } - /** - * the fieldnames passed over are not necessarily the ones that are defined in the class - */ - public boolean hasNumericalFields(String[] _DisplayFieldNames) - { - if (_DisplayFieldNames != null && _DisplayFieldNames.length > 0) - { - for (int i = 0; i < _DisplayFieldNames.length; i++) - { - if (isnumeric(getFieldColumnByDisplayName(_DisplayFieldNames[i]))) - { - return true; - } - } - } - return false; - } + public String getFieldTitle(String FieldName) { @@ -568,89 +539,9 @@ public class CommandMetaData extends DBMetaData return RecordFieldNames[i]; } - /**@deprecated use 'RelationController' class instead - * - */ - public String[] getReferencedTables(String _stablename, int _ncommandtype) - { - String[] sTotReferencedTables = new String[] - { - }; - try - { - if (_ncommandtype == com.sun.star.sdb.CommandType.TABLE && xDBMetaData.supportsIntegrityEnhancementFacility()) - { - java.util.ArrayList<String> TableVector = new java.util.ArrayList<String>(); - Object oTable = getTableNamesAsNameAccess().getByName(_stablename); - XKeysSupplier xKeysSupplier = UnoRuntime.queryInterface(XKeysSupplier.class, oTable); - xIndexKeys = xKeysSupplier.getKeys(); - for (int i = 0; i < xIndexKeys.getCount(); i++) - { - XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xIndexKeys.getByIndex(i)); - int curtype = AnyConverter.toInt(xPropertySet.getPropertyValue("Type")); - if (curtype == KeyType.FOREIGN) - { - String sreftablename = AnyConverter.toString(xPropertySet.getPropertyValue("ReferencedTable")); - if (getTableNamesAsNameAccess().hasByName(sreftablename)) - { - TableVector.add(sreftablename); - } - } - } - if (TableVector.size() > 0) - { - sTotReferencedTables = new String[TableVector.size()]; - TableVector.toArray(sTotReferencedTables); - } - } - } - catch (Exception e) - { - e.printStackTrace(System.err); - } - return sTotReferencedTables; - } - /**@deprecated use 'RelationController' class instead - */ - public String[][] getKeyColumns(String _sreferencedtablename) - { - String[][] skeycolumnnames = null; - try - { - for (int i = 0; i < xIndexKeys.getCount(); i++) - { - XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xIndexKeys.getByIndex(i)); - int curtype = AnyConverter.toInt(xPropertySet.getPropertyValue("Type")); - if (curtype == KeyType.FOREIGN) - { - String scurreftablename = AnyConverter.toString(xPropertySet.getPropertyValue("ReferencedTable")); - if (getTableNamesAsNameAccess().hasByName(scurreftablename)) - { - if (scurreftablename.equals(_sreferencedtablename)) - { - XColumnsSupplier xColumnsSupplier = UnoRuntime.queryInterface(XColumnsSupplier.class, xPropertySet); - String[] smastercolnames = xColumnsSupplier.getColumns().getElementNames(); - skeycolumnnames = new String[2][smastercolnames.length]; - skeycolumnnames[0] = smastercolnames; - skeycolumnnames[1] = new String[smastercolnames.length]; - for (int n = 0; n < smastercolnames.length; n++) - { - XPropertySet xcolPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xColumnsSupplier.getColumns().getByName(smastercolnames[n])); - skeycolumnnames[1][n] = AnyConverter.toString(xcolPropertySet.getPropertyValue("RelatedColumn")); - } - return skeycolumnnames; - } - } - } - } - } - catch (Exception e) - { - e.printStackTrace(); - } - return skeycolumnnames; - } + + private void setCommandComposingAttributes() { diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java index d05d0aef0daf..b788f84eb2be 100644 --- a/wizards/com/sun/star/wizards/db/DBMetaData.java +++ b/wizards/com/sun/star/wizards/db/DBMetaData.java @@ -208,31 +208,7 @@ public class DBMetaData } } - public void setCommandTypes() - { - int TableCount; - int QueryCount; - int CommandCount; - int i; - int a; - TableCount = JavaTools.getArraylength(TableNames); - QueryCount = JavaTools.getArraylength(QueryNames); - CommandCount = TableCount + QueryCount; - CommandTypes = new int[CommandCount]; - if (TableCount > 0) - { - for (i = 0; i < TableCount; i++) - { - CommandTypes[i] = com.sun.star.sdb.CommandType.TABLE; - } - a = i; - for (i = 0; i < QueryCount; i++) - { - CommandTypes[a] = com.sun.star.sdb.CommandType.QUERY; - a += 1; - } - } - } + public boolean hasTableByName(String _stablename) { @@ -516,18 +492,7 @@ public class DBMetaData return isSQL92CheckEnabled; } - public String verifyName(String _sname, int _maxlen) - { - if (_sname.length() > _maxlen) - { - return _sname.substring(0, _maxlen); - } - if (this.isSQL92CheckEnabled()) - { - return Desktop.removeSpecialCharacters(xMSF, Configuration.getLocale(xMSF), _sname); - } - return _sname; - } + public XDataSource getDataSource() { @@ -797,10 +762,7 @@ public class DBMetaData } } - public boolean supportsAutoIncrementation() - { - return false; - } + public boolean supportsQueriesInFrom() { diff --git a/wizards/com/sun/star/wizards/db/FieldColumn.java b/wizards/com/sun/star/wizards/db/FieldColumn.java index a2c0b090359a..f0d55d3859bb 100644 --- a/wizards/com/sun/star/wizards/db/FieldColumn.java +++ b/wizards/com/sun/star/wizards/db/FieldColumn.java @@ -214,17 +214,7 @@ public class FieldColumn FieldTitle = _sTitle; } - public static String getCommandName(String _DisplayName) - { - String locCommandName = null; - String[] sFieldMetaData = JavaTools.ArrayoutofString(_DisplayName, "."); - if (sFieldMetaData.length >= 2) - { - String locfieldname = sFieldMetaData[sFieldMetaData.length - 1]; - locCommandName = _DisplayName.substring(0, _DisplayName.length() - locfieldname.length() - 1); - } - return locCommandName; - } + public boolean isBoolean() { diff --git a/wizards/com/sun/star/wizards/db/QueryMetaData.java b/wizards/com/sun/star/wizards/db/QueryMetaData.java index 8987d254d88e..04852ae5c80e 100644 --- a/wizards/com/sun/star/wizards/db/QueryMetaData.java +++ b/wizards/com/sun/star/wizards/db/QueryMetaData.java @@ -134,24 +134,7 @@ public class QueryMetaData extends CommandMetaData oRemainingFieldColumns.toArray(FieldColumns); } - public void removeFieldColumn(String _sFieldName, String _sCommandName) - { - FieldColumn oFieldColumn = getFieldColumn(_sFieldName, _sCommandName); - int a = 0; - if (oFieldColumn != null) - { - FieldColumn[] LocFieldColumns = new FieldColumn[FieldColumns.length - 1]; - for (int i = 0; i < FieldColumns.length; i++) - { - if (!FieldColumns[i].getFieldName().equals(_sFieldName) && !FieldColumns[i].getCommandName().equals(_sCommandName)) - { - LocFieldColumns[a] = FieldColumns[i]; - a++; - } - } - FieldColumns = LocFieldColumns; - } - } + public String[] getIncludedCommandNames() { @@ -194,11 +177,7 @@ public class QueryMetaData extends CommandMetaData return sIncludedCommandNames; } - public String[] getFieldNamesOfCommand(String _sCommandName) - { - CommandObject oTable = getTableByName(_sCommandName); - return oTable.getColumns().getElementNames(); - } + public void initializeFieldTitleSet() { diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java index 2423cc11ceba..24f1072fe305 100644 --- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java +++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java @@ -122,20 +122,7 @@ public class SQLQueryComposer } } - public void appendFilterConditions() - { - try - { - for (int i = 0; i < CurDBMetaData.getFilterConditions().length; i++) - { - m_queryComposer.setStructuredFilter(CurDBMetaData.getFilterConditions()); - } - } - catch (Exception exception) - { - exception.printStackTrace(System.err); - } - } + public void prependSortingCriteria() throws SQLException { diff --git a/wizards/com/sun/star/wizards/db/TableDescriptor.java b/wizards/com/sun/star/wizards/db/TableDescriptor.java index 77c46538902b..a430d93cbd0f 100644 --- a/wizards/com/sun/star/wizards/db/TableDescriptor.java +++ b/wizards/com/sun/star/wizards/db/TableDescriptor.java @@ -640,32 +640,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen } } - public boolean addColumn(String _columnname, XPropertySet _xNewColPropertySet) - { - try - { - if (!hasByName(_columnname)) - { - if (_columnname.equals(PropertyNames.EMPTY_STRING)) - { - return false; - } - else - { - ColumnPropertySet oPropertySet = new ColumnPropertySet(oTypeInspector, xColumnDataDescriptorFactory.createDataDescriptor()); - oPropertySet.assignNewPropertySet(_columnname, _xNewColPropertySet); - ColumnDescriptor oColumnDescriptor = new ColumnDescriptor(oPropertySet.xPropertySet, _columnname); - columncontainer.add(oColumnDescriptor); - return true; - } - } - } - catch (Exception e) - { - e.printStackTrace(System.err); - } - return false; - } + private XPropertySet addPrimaryKeyColumn(String _columnname) { diff --git a/wizards/com/sun/star/wizards/db/TypeInspector.java b/wizards/com/sun/star/wizards/db/TypeInspector.java index 75f4f82ad837..8811d0c98c3b 100644 --- a/wizards/com/sun/star/wizards/db/TypeInspector.java +++ b/wizards/com/sun/star/wizards/db/TypeInspector.java @@ -145,28 +145,7 @@ public class TypeInspector return _nNullable; } - public int getNullability(XPropertySet _xColPropertySet) - { - try - { - int i = getDataTypeIndex(_xColPropertySet, false); - if (i == -1) - { - return ColumnValue.NO_NULLS; - } - int nNullable = AnyConverter.toInt(_xColPropertySet.getPropertyValue("IsNullable")); - if (nNullable == ColumnValue.NULLABLE) - { - return nNullableInfos[i]; - } - return nNullable; - } - catch (Exception e) - { - e.printStackTrace(System.err); - } - return ColumnValue.NO_NULLS; - } + public boolean isColumnOrderable(XPropertySet _xColPropertySet) { diff --git a/wizards/com/sun/star/wizards/document/DatabaseControl.java b/wizards/com/sun/star/wizards/document/DatabaseControl.java index d896560c8775..07513eb3d38e 100644 --- a/wizards/com/sun/star/wizards/document/DatabaseControl.java +++ b/wizards/com/sun/star/wizards/document/DatabaseControl.java @@ -176,13 +176,7 @@ public class DatabaseControl extends Control } private static long m_nLongMax = 0; - public static long getLongMax() - { - if (m_nLongMax == 0) - { - } - return m_nLongMax; - } + private void setNumericLimits() { try diff --git a/wizards/com/sun/star/wizards/document/FormHandler.java b/wizards/com/sun/star/wizards/document/FormHandler.java index 7c675a2c141b..2626cf5bc528 100644 --- a/wizards/com/sun/star/wizards/document/FormHandler.java +++ b/wizards/com/sun/star/wizards/document/FormHandler.java @@ -159,23 +159,9 @@ public class FormHandler return -1; } - public void setglobalMultiServiceFactory(XMultiServiceFactory _xMSF) - { - xMSF = _xMSF; - } - public String getModelServiceName(int _fieldtype) - { - int icontroltype = getControlType(_fieldtype); - if (icontroltype > -1) - { - return sModelServices[icontroltype]; - } - else - { - return null; - } - } + + private void initializeBasicControlValues() { @@ -252,21 +238,7 @@ public class FormHandler return xNamedForms.hasByName(_FormName); } - public void removeFormByName(String _FormName) - { - try - { - if (hasFormByName(_FormName)) - { - removeControlsofForm(_FormName); - xNamedFormContainer.removeByName(_FormName); - } - } - catch (com.sun.star.uno.Exception ex) - { - Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, ex); - } - } + public void removeControlsofForm(String _FormName) { @@ -347,10 +319,7 @@ public class FormHandler } } - public XNameContainer insertSubFormbyName(String _FormName, XNameContainer _xNamedFormContainer) - { - return insertFormbyName(_FormName, _xNamedFormContainer); - } + public XNameContainer insertFormbyName(String _FormName) { @@ -427,30 +396,9 @@ public class FormHandler } } - public void moveShapesToNirwana() - { - try - { - for (int i = 0; i < this.xDrawPage.getCount(); i++) - { - XShape xShape = UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i)); - xShape.setPosition(new Point(this.iXNirwanaPos, this.iYNirwanaPos)); - } - } - catch (Exception e) - { - Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e); - } - } - public void removeAllShapes() throws Exception - { - for (int i = this.xDrawPage.getCount(); i > -1; i--) - { - XShape xShape = UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i)); - removeShape(xShape); - } - } + + /** * By removing the shape the whole control is disposed too @@ -462,18 +410,7 @@ public class FormHandler XComponent xComponent = UnoRuntime.queryInterface(XComponent.class, _xShape); xComponent.dispose(); } - // Destroy all Shapes in Nirwana - public void removeNirwanaShapes() throws Exception - { - for (int i = this.xDrawPage.getCount(); i > -1; i--) - { - XShape xShape = UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i)); - if (xShape.getPosition().Y < this.iYNirwanaPos) - { - xDrawPage.remove(xShape); - } - } - } + public XShape groupShapesTogether(XMultiServiceFactory _xMSF, XShape _xLabelShape, XShape _xControlShape) { diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.java b/wizards/com/sun/star/wizards/document/OfficeDocument.java index 69051833078e..3e19628a0557 100644 --- a/wizards/com/sun/star/wizards/document/OfficeDocument.java +++ b/wizards/com/sun/star/wizards/document/OfficeDocument.java @@ -66,25 +66,7 @@ public class OfficeDocument { } - public static void attachEventCall(XComponent xComponent, String EventName, String EventType, String EventURL) - { - try - { - XEventsSupplier xEventssSuppl = 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"; //PropertyNames.URL; - oEventProperties[1].Value = EventURL; - xEventssSuppl.getEvents().replaceByName(EventName, oEventProperties); - } - catch (Exception exception) - { - exception.printStackTrace(System.err); - } - } + public static void dispose(XMultiServiceFactory xMSF, XComponent xComponent) { @@ -108,51 +90,7 @@ public class OfficeDocument } } - /** - * Create a new office document, attached to the given frame. - * @param sDocumentType e.g. swriter, scalc, ( simpress, scalc : not tested) - * @return the document Component (implements XComponent) object ( XTextDocument, or XSpreadsheedDocument ) - */ - public static Object createNewDocument(XFrame frame, String sDocumentType, boolean preview, boolean readonly) - { - PropertyValue[] loadValues = new PropertyValue[2]; - loadValues[0] = new PropertyValue(); - loadValues[0].Name = PropertyNames.READ_ONLY; - loadValues[0].Value = readonly ? Boolean.TRUE : Boolean.FALSE; - loadValues[1] = new PropertyValue(); - loadValues[1].Name = "Preview"; - loadValues[1].Value = preview ? Boolean.TRUE : Boolean.FALSE; - - Object oDocument = null; - com.sun.star.frame.XComponentLoader xComponentLoader = null; - String sURL = "private:factory/" + sDocumentType; - - try - { - 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.equals("swriter")) - { - oDocument = UnoRuntime.queryInterface(XTextDocument.class, xComponent); - } - else if (sDocumentType.equals("scalc")) - { - oDocument = UnoRuntime.queryInterface(XSpreadsheetDocument.class, xComponent); - //TODO: - // else if (sDocumentType == "simpress") - // else if (sDocumentType == "sdraw") - } - } - catch (Exception exception) - { - exception.printStackTrace(System.err); - } - return oDocument; - } public static XFrame createNewFrame(XMultiServiceFactory xMSF, XTerminateListener listener) { @@ -273,43 +211,7 @@ public class OfficeDocument return oDocument; } - public static boolean store(XMultiServiceFactory xMSF, XComponent xComponent, String StorePath, String FilterName, boolean bStoreToUrl) - { - try - { - XStorable xStoreable = UnoRuntime.queryInterface(XStorable.class, xComponent); - PropertyValue[] oStoreProperties; - if (FilterName.length() > 0) - { - oStoreProperties = new PropertyValue[2]; - oStoreProperties[0] = new PropertyValue(); - oStoreProperties[0].Name = "FilterName"; - oStoreProperties[0].Value = FilterName; - oStoreProperties[1] = new PropertyValue(); - oStoreProperties[1].Name = "InteractionHandler"; - oStoreProperties[1].Value = UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler")); - } - else - { - oStoreProperties = new PropertyValue[0]; - } - if (bStoreToUrl) - { - xStoreable.storeToURL(StorePath, oStoreProperties); - } - else - { - xStoreable.storeAsURL(StorePath, oStoreProperties); - } - return true; - } - catch (Exception exception) - { - exception.printStackTrace(System.err); - return false; - } - } public static boolean close(XComponent xComponent) { @@ -366,59 +268,15 @@ public class OfficeDocument } } - public static PropertyValue[] getFileMediaDecriptor(XMultiServiceFactory xmsf, String url) - throws Exception - { - Object typeDetect = xmsf.createInstance("com.sun.star.document.TypeDetection"); - PropertyValue[][] mediaDescr = new PropertyValue[1][1]; - mediaDescr[0][0] = new PropertyValue(); - mediaDescr[0][0].Name = PropertyNames.URL; - mediaDescr[0][0].Value = url; - String type = UnoRuntime.queryInterface(XTypeDetection.class, typeDetect).queryTypeByDescriptor(mediaDescr, true); - XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, typeDetect); - if (type.equals(PropertyNames.EMPTY_STRING)) - { - return null; - } - else - { - return (PropertyValue[]) xNameAccess.getByName(type); - } - } - public static PropertyValue[] getTypeMediaDescriptor(XMultiServiceFactory xmsf, String type) - throws Exception - { - Object typeDetect = xmsf.createInstance("com.sun.star.document.TypeDetection"); - XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, typeDetect); - return (PropertyValue[]) xNameAccess.getByName(type); - } - /** - * returns the count of slides in a presentation, - * or the count of pages in a draw document. - * @param model a presentation or a draw document - * @return the number of slides/pages in the given document. - */ - public static int getSlideCount(Object model) - { - XDrawPagesSupplier xDrawPagesSupplier = UnoRuntime.queryInterface(XDrawPagesSupplier.class, model); - return xDrawPagesSupplier.getDrawPages().getCount(); - } - public static XDocumentProperties getDocumentProperties(Object document) - { - XDocumentPropertiesSupplier xDocumentPropertiesSupplier = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, document); - return xDocumentPropertiesSupplier.getDocumentProperties(); - } - public static int showMessageBox(XMultiServiceFactory xMSF, String windowServiceName, int windowAttribute, String MessageText) - { - return SystemDialog.showMessageBox(xMSF, windowServiceName, windowAttribute, MessageText); - } + + /** * @return Returns the xWindowPeer. diff --git a/wizards/com/sun/star/wizards/form/DataEntrySetter.java b/wizards/com/sun/star/wizards/form/DataEntrySetter.java index 29cb69f244f9..4663a1d268c1 100644 --- a/wizards/com/sun/star/wizards/form/DataEntrySetter.java +++ b/wizards/com/sun/star/wizards/form/DataEntrySetter.java @@ -129,11 +129,4 @@ public class DataEntrySetter } - public void toggleCheckBoxes() - { - boolean bdisplayalldata = optDisplayAllData.getState(); - 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/Finalizer.java b/wizards/com/sun/star/wizards/form/Finalizer.java index 19a8044c4729..e49bbe14efc7 100644 --- a/wizards/com/sun/star/wizards/form/Finalizer.java +++ b/wizards/com/sun/star/wizards/form/Finalizer.java @@ -106,10 +106,7 @@ public class Finalizer } } - public void toggleFinishButton() - { - CurUnoDialog.enableFinishButton(txtFormName.getText().length() > 0); - } + public String getName() { diff --git a/wizards/com/sun/star/wizards/form/FormConfiguration.java b/wizards/com/sun/star/wizards/form/FormConfiguration.java index c478745fb810..3ef163cd6b6b 100644 --- a/wizards/com/sun/star/wizards/form/FormConfiguration.java +++ b/wizards/com/sun/star/wizards/form/FormConfiguration.java @@ -132,13 +132,7 @@ public class FormConfiguration return ((chkcreateSubForm.getState() == 1) && (optOnExistingRelation.getState())); } - public void toggleSubFormMode() - { - boolean bdoEnable = (this.chkcreateSubForm.getState() == 1); - Helper.setUnoPropertyValue(UnoDialog.getModel(optOnExistingRelation), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoEnable && bsupportsRelations)); - Helper.setUnoPropertyValue(UnoDialog.getModel(optSelectManually), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoEnable)); - toggleSteps(); - } + public void initialize(CommandFieldSelection _CurSubFormFieldSelection, RelationController _oRelationController) { diff --git a/wizards/com/sun/star/wizards/form/FormControlArranger.java b/wizards/com/sun/star/wizards/form/FormControlArranger.java index d5ddf3f7daee..2257bd7bd79d 100644 --- a/wizards/com/sun/star/wizards/form/FormControlArranger.java +++ b/wizards/com/sun/star/wizards/form/FormControlArranger.java @@ -661,18 +661,7 @@ public class FormControlArranger cYOffset = _aPoint.Y; } - public void adjustYPositions(int _diffY) - { - for (int i = 0; i < DBControlList.length; i++) - { - Point aPoint = DBControlList[i].getPosition(); - DBControlList[i].setPosition(new Point(aPoint.X, aPoint.Y - _diffY)); - aPoint = LabelControlList[i].getPosition(); - LabelControlList[i].setPosition(new Point(aPoint.X, aPoint.Y - _diffY)); - } - m_controlMaxPosY = -_diffY; - cYOffset = -_diffY; - } + public void setFormSize(Size _FormSize) { diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java index bcb01d7bfea9..c860d3af7841 100644 --- a/wizards/com/sun/star/wizards/form/StyleApplier.java +++ b/wizards/com/sun/star/wizards/form/StyleApplier.java @@ -200,85 +200,11 @@ public class StyleApplier } } - public void changeLayout() - { - short iPos = lstStyles.getSelectedItemPos(); - if (iPos != iOldLayoutPos) - { - iOldLayoutPos = iPos; - String sFileName = FileNames[iPos]; - int[] iStyles = getStyleColors(sFileName); - applyDBControlProperties(iStyles); - } - curFormDocument.unlockallControllers(); - } - public Short getBorderType() { return IBorderValue; } - public void changeBorderLayouts() - { - try - { - curFormDocument.xTextDocument.lockControllers(); - - if (optNoBorder.getState()) - { - IBorderValue = new Short((short) 0); - } - else if (opt3DLook.getState()) - { - IBorderValue = new Short((short) 1); - } - else - { - IBorderValue = new Short((short) 2); - } - for (int m = 0; m < curFormDocument.oControlForms.size(); m++) - { - FormDocument.ControlForm curControlForm = curFormDocument.oControlForms.get(m); - if (curControlForm.getArrangemode() == FormWizard.AS_GRID) - { - GridControl oGridControl = curControlForm.getGridControl(); - oGridControl.xPropertySet.setPropertyValue(PropertyNames.PROPERTY_BORDER, IBorderValue); - } - else - { - DatabaseControl[] DBControls = curControlForm.getDatabaseControls(); - for (int n = 0; n < DBControls.length; n++) - { - if (DBControls[n].xServiceInfo.supportsService("com.sun.star.drawing.ShapeCollection")) - { - TimeStampControl oTimeStampControl = (TimeStampControl) DBControls[n]; - for (int i = 0; i < 2; i++) - { - XPropertySet xPropertySet = oTimeStampControl.getControlofGroupShapeByIndex(i); - if (xPropertySet.getPropertySetInfo().hasPropertyByName(PropertyNames.PROPERTY_BORDER)) - { - xPropertySet.setPropertyValue(PropertyNames.PROPERTY_BORDER, IBorderValue); - } - } - } - else - { - if (DBControls[n].xPropertySet.getPropertySetInfo().hasPropertyByName(PropertyNames.PROPERTY_BORDER)) - { - DBControls[n].xPropertySet.setPropertyValue(PropertyNames.PROPERTY_BORDER, IBorderValue); - } - } - } - } - } - } - catch (Exception e) - { - e.printStackTrace(System.err); - } - curFormDocument.unlockallControllers(); - } - private int getStyleColor(String[] _sDataList, String _sHeader, String _sPropertyDescription) { int index = JavaTools.FieldInList(_sDataList, _sHeader); diff --git a/wizards/com/sun/star/wizards/form/UIControlArranger.java b/wizards/com/sun/star/wizards/form/UIControlArranger.java index ff92792e64cc..727e40b0a6a1 100644 --- a/wizards/com/sun/star/wizards/form/UIControlArranger.java +++ b/wizards/com/sun/star/wizards/form/UIControlArranger.java @@ -149,29 +149,7 @@ public class UIControlArranger return optAlignLeft.getState() ? (short)0 : (short)2; } - public void alignLabelControls() - { - try - { - short iAlignValue = getAlignValue(); - for (int m = 0; m < curFormDocument.oControlForms.size(); m++) - { - FormDocument.ControlForm curControlForm = curFormDocument.oControlForms.get(m); - if (curControlForm.getArrangemode() == FormWizard.COLUMNAR_LEFT) - { - Control[] LabelControls = curControlForm.getLabelControls(); - for (int n = 0; n < LabelControls.length; n++) - { - LabelControls[n].xPropertySet.setPropertyValue(PropertyNames.PROPERTY_ALIGN, new Short(iAlignValue)); - } - } - } - } - catch (Exception e) - { - e.printStackTrace(System.err); - } - } + private void enableAlignControlGroup(boolean _bEnableAlignControlGroup) { diff --git a/wizards/com/sun/star/wizards/query/Finalizer.java b/wizards/com/sun/star/wizards/query/Finalizer.java index 844c06bb8c37..853d478cb4f9 100644 --- a/wizards/com/sun/star/wizards/query/Finalizer.java +++ b/wizards/com/sun/star/wizards/query/Finalizer.java @@ -117,11 +117,7 @@ public class Finalizer }); } - public void changeTitle() - { - final String TitleName = m_aTxtTitle.getText(); - m_queryWizard.enableFinishButton( TitleName.length() > 0 ); - } + /* TODO: The title textbox always has to be updated when a new Table has been selected if it is clear that the user has not made any input meanwhile diff --git a/wizards/com/sun/star/wizards/report/CallReportWizard.java b/wizards/com/sun/star/wizards/report/CallReportWizard.java index df934cd1eb9c..7141da9e6ffd 100644 --- a/wizards/com/sun/star/wizards/report/CallReportWizard.java +++ b/wizards/com/sun/star/wizards/report/CallReportWizard.java @@ -35,30 +35,7 @@ public class CallReportWizard private static boolean bWizardstartedalready; - /** Gives a factory for creating the service. - * This method is called by the <code>JavaLoader</code> - * <p> - * @return Returns a <code>XSingleServiceFactory</code> for creating the component. - * @see com.sun.star.comp.loader.JavaLoader - * @param stringImplementationName The implementation name of the component. - * @param xMSF The service manager, who gives access to every known service. - * @param xregistrykey Makes structural information (except regarding treestructures) of a single - * registry key accessible. - */ - public static com.sun.star.lang.XSingleServiceFactory __getServiceFactory(String stringImplementationName, com.sun.star.lang.XMultiServiceFactory xMSF, com.sun.star.registry.XRegistryKey xregistrykey) - { - com.sun.star.lang.XSingleServiceFactory xsingleservicefactory = null; - if (stringImplementationName.equals( - ReportWizardImplementation.class.getName())) - { - xsingleservicefactory = com.sun.star.comp.loader.FactoryHelper.getServiceFactory( - ReportWizardImplementation.class, - ReportWizardImplementation.__serviceName, - xMSF, - xregistrykey); - } - return xsingleservicefactory; - } + /** This class implements the component. At least the interfaces XServiceInfo, * XTypeProvider, and XInitialization should be provided by the service. diff --git a/wizards/com/sun/star/wizards/report/DBColumn.java b/wizards/com/sun/star/wizards/report/DBColumn.java index 169f66bdcd93..7f49db1a9f0b 100644 --- a/wizards/com/sun/star/wizards/report/DBColumn.java +++ b/wizards/com/sun/star/wizards/report/DBColumn.java @@ -250,14 +250,7 @@ public class DBColumn oTextFieldHandler.insertUserField(xTextCursor, CurDBField.getFieldName(), CurDBField.getFieldTitle()); } - public void insertUserFieldToTableCell(TextFieldHandler oTextFieldHandler, XCell xCell) - { - XTextCursor xTextCursor = TextDocument.createTextCursor(xCell); - xTextCursor.gotoStart(false); - xTextCursor.gotoEnd(true); - xTextCursor.setString(PropertyNames.EMPTY_STRING); - oTextFieldHandler.insertUserField(xTextCursor, CurDBField.getFieldName(), CurDBField.getFieldTitle()); - } + public void formatValueCell() { diff --git a/wizards/com/sun/star/wizards/report/ReportFinalizer.java b/wizards/com/sun/star/wizards/report/ReportFinalizer.java index 68356b39d271..63c15a434280 100644 --- a/wizards/com/sun/star/wizards/report/ReportFinalizer.java +++ b/wizards/com/sun/star/wizards/report/ReportFinalizer.java @@ -146,22 +146,7 @@ public class ReportFinalizer } - /* - * This function is called if one of the radio buttons is pressed - */ - public void toggleSubTemplateControls() - { - // 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, bDoTemplateEnable); - CurUnoDialog.setControlProperty("optUseTemplate", PropertyNames.PROPERTY_ENABLED, bDoTemplateEnable); - CurUnoDialog.setControlProperty("lblHowProceed", PropertyNames.PROPERTY_ENABLED, bDoTemplateEnable); - String sTitle = xTitleTextBox.getText(); - boolean bDoEnable = sTitle.equals(PropertyNames.EMPTY_STRING); - CurUnoDialog.enableFinishButton(!bDoEnable); - } public void initialize(RecordParser _CurDBMetaData) { String FirstCommandName = (_CurDBMetaData.getIncludedCommandNames())[0]; @@ -204,12 +189,7 @@ public class ReportFinalizer } } - public void changeReportTitle() - { - final String TitleName = xTitleTextBox.getText(); - CurReportDocument.liveupdate_updateReportTitle(TitleName); - CurUnoDialog.enableFinishButton(!PropertyNames.EMPTY_STRING.equals(TitleName)); - } + public int getReportOpenMode() { diff --git a/wizards/com/sun/star/wizards/report/ReportTextDocument.java b/wizards/com/sun/star/wizards/report/ReportTextDocument.java index 73b249da895c..f052ce219dce 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextDocument.java +++ b/wizards/com/sun/star/wizards/report/ReportTextDocument.java @@ -119,29 +119,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen return oNumberFormatter; } - public boolean checkReportLayoutMode(String[] GroupFieldNames) - { - try - { - XNameAccess xTextSections = oTextSectionHandler.xTextSectionsSupplier.getTextSections(); - Object oTextSection; - if (GroupFieldNames.length > 0) - { - oTextSection = xTextSections.getByName(GROUPSECTION + String.valueOf(1)); - } - else - { - oTextSection = xTextSections.getByName(RECORDSECTION); - } - return AnyConverter.toBoolean(Helper.getUnoPropertyValue(oTextSection, ISVISIBLE)); - } - catch (Exception e) - { - Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e); - // In doubt we rather suggest this is LayoutMode... - return true; - } - } + public void swapContentTemplate(String ContentTemplatePath) { @@ -211,10 +189,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "RecordFieldNames", JavaTools.ArraytoString(CurDBMetaData.getRecordFieldNames())); } - public void updateReportTitle(String _sTitleName) - { - m_xDocProps.setTitle(_sTitleName); - } + private void getReportPageStyles() { @@ -335,15 +310,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen } } - public void replaceFieldValueInRecordSection() - { - int GroupCount = CurDBMetaData.GroupFieldNames.length; - int FieldCount = CurDBMetaData.getFieldNames().length; - for (int i = GroupCount; i < FieldCount; i++) - { - DBColumnsVector.get(i).insertColumnData(oTextFieldHandler, this.bIsCurLandscape); - } - } + private void updateTextSections(String[] SelGroupNames) { @@ -376,21 +343,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen CurDBColumn.setCellFont(); } - public void replaceFieldValueInRecordTable() - { - String TableName = TBLRECORDSECTION; - String OldTableName = CurRecordTable.xTableName.getName(); - if (OldTableName.compareTo(TableName) != 0) - { - CurRecordTable.xTableName.setName(TableName); - } - int GroupCount = CurDBMetaData.GroupFieldNames.length; - int RecordCount = CurDBMetaData.getRecordFieldNames().length; - for (int i = GroupCount; i < RecordCount; i++) - { - DBColumnsVector.get(i).insertColumnData(oTextFieldHandler, this.bIsCurLandscape); - } - } + private void insertColumnstoRecordTable() { diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java index 0524e42c894c..bef28fae4032 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java @@ -843,10 +843,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter } - protected Rectangle insertVerticalLine(XSection _xSection, Rectangle _aRect, int _nWidth, int _nHeight) - { - return insertLine(_xSection, _aRect, _nWidth, _nHeight, 1); - } + private Rectangle insertHorizontalLine(XSection _xSection, Rectangle _aRect, int _nWidth, int _nHeight) { diff --git a/wizards/com/sun/star/wizards/table/FieldFormatter.java b/wizards/com/sun/star/wizards/table/FieldFormatter.java index da89154bf025..c320cd618082 100644 --- a/wizards/com/sun/star/wizards/table/FieldFormatter.java +++ b/wizards/com/sun/star/wizards/table/FieldFormatter.java @@ -230,130 +230,15 @@ public class FieldFormatter implements XItemListener CurUnoDialog.setcompleted(TableWizard.SOFIELDSFORMATPAGE, blistispopulated); } - public void addFieldName() - { - 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), PropertyNames.SELECTED_ITEMS, new short[] - { - icount - }); - toggleButtons(); - FieldDescription curfielddescription = new FieldDescription(snewfieldname); - CurUnoDialog.fielditems.put(snewfieldname, curfielddescription); - curTableDescriptor.addColumn(curfielddescription.getPropertyValues()); - updateColumnDescriptor(snewfieldname, curTableDescriptor.getByName(snewfieldname)); - CurUnoDialog.setControlVisible("oColumnDescriptor", true); - CurUnoDialog.repaintDialogStep(); - } - } - public void removeFieldName() - { - 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); - CurUnoDialog.fielditems.remove(fieldname); - int ilistcount = /* xlstFieldNames.getItemCount();*/ UnoDialog.getListBoxItemCount(xlstFieldNames); - if ((ipos) < ilistcount) - { - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[] - { - ipos - }); - } - else - { - if (ilistcount > -1) - { - ipos = (short) ((short) ilistcount - (short) 1); - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[] - { - ipos - }); - } - } - curTableDescriptor.dropColumnbyName(fieldname); - fieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST); - boolean benable = ((ipos > -1) && (ipos < fieldnames.length)); - if (benable) - { - String snewfieldname = fieldnames[ipos]; - updateColumnDescriptor(snewfieldname, curTableDescriptor.getByName(snewfieldname)); - toggleButtons(); - } - else - { - 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, Boolean.valueOf(benable)); - CurUnoDialog.setControlVisible("oColumnDescriptor", benable); - CurUnoDialog.repaintDialogStep(); - } - public void modifyFieldName() - { - String newfieldname = txtfieldname.getText(); - String oldfieldname = xlstFieldNames.getSelectedItem(); - if (!newfieldname.equals(oldfieldname)) - { - if (curTableDescriptor.modifyColumnName(oldfieldname, newfieldname)) - { - Object oColumn = Helper.getUnoPropertyValue(oColumnDescriptorModel, "Column"); - Helper.setUnoPropertyValue(oColumn, PropertyNames.PROPERTY_NAME, newfieldname); - FieldDescription curfielddescription = CurUnoDialog.fielditems.get(oldfieldname); - CurUnoDialog.fielditems.remove(oldfieldname); - curfielddescription.setName(newfieldname); - CurUnoDialog.fielditems.put(newfieldname, curfielddescription); - String[] fieldnames = xlstFieldNames.getItems(); - short ipos = xlstFieldNames.getSelectedItemPos(); - fieldnames[ipos] = newfieldname; - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST, fieldnames); - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[] - { - ipos - }); - } - } - } - public void shiftFieldNameUp() - { - short ipos = xlstFieldNames.getSelectedItemPos(); - String[] snewlist = shiftArrayItem(xlstFieldNames.getItems(), ipos, -1); - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST, snewlist); - if ((ipos - 1) > -1) - { - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[] - { - (short) (ipos - 1) - }); - curTableDescriptor.moveColumn(ipos, ipos - 1); - } - toggleButtons(); - } - public void shiftFieldNameDown() - { - short ipos = xlstFieldNames.getSelectedItemPos(); - String[] snewlist = shiftArrayItem(xlstFieldNames.getItems(), ipos, 1); - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST, snewlist); - if ((ipos + 1) < xlstFieldNames.getItemCount()) - { - Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[] - { - (short) (ipos + 1) - }); - curTableDescriptor.moveColumn(ipos, ipos + 1); - } - toggleButtons(); - } + + + + + private String[] shiftArrayItem(String[] _slist, int _oldindex, int _shiftcount) { diff --git a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java index 946b71b9e34f..be154da43d26 100644 --- a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java +++ b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java @@ -333,30 +333,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener return bischecked; } - public void onPrimeKeySelected() - { - try - { - String selfieldname = lstSinglePrimeKey.getSelectedItem(); - boolean bdoenable = isAutoIncrementatable(selfieldname); - CurUnoDialog.setcompleted(TableWizard.SOPRIMARYKEYPAGE, lstSinglePrimeKey.getSelectedItemPos() != -1); - 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) - { - Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_STATE, new Short((short) 1)); - } - else - { - Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_STATE, new Short((short) 0)); - } - } - catch (Exception e) - { - e.printStackTrace(System.err); - } - } + private void toggleAutomaticAutoValueCheckBox() { diff --git a/wizards/com/sun/star/wizards/table/ScenarioSelector.java b/wizards/com/sun/star/wizards/table/ScenarioSelector.java index 458f95612844..6b60f063929f 100644 --- a/wizards/com/sun/star/wizards/table/ScenarioSelector.java +++ b/wizards/com/sun/star/wizards/table/ScenarioSelector.java @@ -152,18 +152,6 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X initializeCategory(BUSINESS); } - public void selectCategory() - { - if (optBusiness.getState()) - { - initializeCategory(BUSINESS); - } - else - { - initializeCategory(PRIVATE); - } - } - private void initializeCategory(int _iCategory) { try @@ -268,16 +256,6 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X return smytable; } - public void fillupTables() - { - } - - public void fillupFieldsListbox() - { - super.emptyFieldsListBoxes(); - } - - /* (non-Javadoc) * @see com.sun.star.awt.XItemListener#itemStateChanged(com.sun.star.awt.ItemEvent) */ diff --git a/wizards/com/sun/star/wizards/text/TextDocument.java b/wizards/com/sun/star/wizards/text/TextDocument.java index 7db7ea59a0d8..a604f2f29e86 100644 --- a/wizards/com/sun/star/wizards/text/TextDocument.java +++ b/wizards/com/sun/star/wizards/text/TextDocument.java @@ -333,29 +333,7 @@ public class TextDocument // to make it really safe you must acquire the Tablenames before the insertion and after the insertion of the new Table. By comparing the // two sequences of tablenames you can find out the tablename of the last inserted Table - // Todo: This method is unsecure because the last index is not necessarily the last section - public int getCharWidth(String ScaleString) - { - int iScale = 200; - xTextDocument.lockControllers(); - int iScaleLen = ScaleString.length(); - com.sun.star.text.XTextCursor xTextCursor = createTextCursor(xTextDocument.getText()); - xTextCursor.gotoStart(false); - com.sun.star.wizards.common.Helper.setUnoPropertyValue(xTextCursor, "PageDescName", "First Page"); - xTextCursor.setString(ScaleString); - XTextViewCursorSupplier xViewCursor = UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xTextDocument.getCurrentController()); - XTextViewCursor xTextViewCursor = xViewCursor.getViewCursor(); - xTextViewCursor.gotoStart(false); - int iFirstPos = xTextViewCursor.getPosition().X; - xTextViewCursor.gotoEnd(false); - int iLastPos = xTextViewCursor.getPosition().X; - iScale = (iLastPos - iFirstPos) / iScaleLen; - xTextCursor.gotoStart(false); - xTextCursor.gotoEnd(true); - xTextCursor.setString(PropertyNames.EMPTY_STRING); - unlockallControllers(); - return iScale; - } + public void unlockallControllers() { @@ -365,102 +343,13 @@ public class TextDocument } } - public void refresh() - { - XRefreshable xRefreshable = UnoRuntime.queryInterface(XRefreshable.class, xTextDocument); - xRefreshable.refresh(); - } - /** - * This method sets the Author of a Wizard-generated template correctly - * and adds a explanatory sentence to the template description. - * @param WizardName The name of the Wizard. - * @param TemplateDescription The old Description which is being appended with another sentence. - */ - public void setWizardTemplateDocInfo(String WizardName, String TemplateDescription) - { - try - { - Object uD = Configuration.getConfigurationRoot(xMSF, "/org.openoffice.UserProfile/Data", false); - XNameAccess xNA = UnoRuntime.queryInterface(XNameAccess.class, uD); - Object gn = xNA.getByName("givenname"); - Object sn = xNA.getByName("sn"); - String fullname = gn + PropertyNames.SPACE + sn; - - Calendar cal = new GregorianCalendar(); - int year = cal.get(Calendar.YEAR); - int month = cal.get(Calendar.MONTH); - int day = cal.get(Calendar.DAY_OF_MONTH); - DateTime currentDate = new DateTime(); - currentDate.Day = (short) day; - currentDate.Month = (short) month; - currentDate.Year = (short) year; - DateUtils du = new DateUtils(xMSF, this.xTextDocument); - int ff = du.getFormat(NumberFormatIndex.DATE_SYS_DDMMYY); - String myDate = du.format(ff, currentDate); - - XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument); - XDocumentProperties xDocProps2 = xDocPropsSuppl.getDocumentProperties(); - xDocProps2.setAuthor(fullname); - xDocProps2.setModifiedBy(fullname); - String description = xDocProps2.getDescription(); - description = description + PropertyNames.SPACE + TemplateDescription; - description = JavaTools.replaceSubString(description, WizardName, "<wizard_name>"); - description = JavaTools.replaceSubString(description, myDate, "<current_date>"); - xDocProps2.setDescription(description); - } - catch (NoSuchElementException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - catch (WrappedTargetException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - catch (Exception e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - /** - * removes an arbitrary Object which supports the 'XTextContent' interface - */ - public boolean removeTextContent(Object oTextContent) - { - try - { - XTextContent xTextContent = UnoRuntime.queryInterface(XTextContent.class, oTextContent); - xText.removeTextContent(xTextContent); - return true; - } - catch (NoSuchElementException e) - { - e.printStackTrace(System.err); - return false; - } - } - /** - * Apparently there is no other way to get the - * page count of a text document other than using a cursor and - * making it jump to the last page... - * @param model the document model. - * @return the page count of the document. - */ - public static int getPageCount(Object model) - { - XModel xModel = UnoRuntime.queryInterface(XModel.class, model); - XController xController = xModel.getCurrentController(); - XTextViewCursorSupplier xTextVCS = UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController); - XTextViewCursor xTextVC = xTextVCS.getViewCursor(); - XPageCursor xPC = UnoRuntime.queryInterface(XPageCursor.class, xTextVC); - xPC.jumpToLastPage(); - return xPC.getPage(); - } + + + + /* Possible Values for "OptionString" are: "LoadCellStyles", "LoadTextStyles", "LoadFrameStyles", "LoadPageStyles", "LoadNumberingStyles", "OverwriteStyles" */ diff --git a/wizards/com/sun/star/wizards/text/TextFieldHandler.java b/wizards/com/sun/star/wizards/text/TextFieldHandler.java index d3ab23a51651..ab6d018f86bc 100644 --- a/wizards/com/sun/star/wizards/text/TextFieldHandler.java +++ b/wizards/com/sun/star/wizards/text/TextFieldHandler.java @@ -281,35 +281,7 @@ public class TextFieldHandler } } - public void removeUserFieldByContent(String _FieldContent) - { - XDependentTextField[] xDependentTextFields = getTextFieldsByProperty("Content", _FieldContent, "String"); - if (xDependentTextFields != null) - { - for (int i = 0; i < xDependentTextFields.length; i++) - { - xDependentTextFields[i].dispose(); - } - } - } - public void changeExtendedUserFieldContent(short UserDataPart, String _FieldContent) - { - try - { - XDependentTextField[] xDependentTextFields = getTextFieldsByProperty("UserDataType", new Short(UserDataPart), "Short"); - if (xDependentTextFields != null) - { - for (int i = 0; i < xDependentTextFields.length; i++) - { - xDependentTextFields[i].getTextFieldMaster().setPropertyValue("Content", _FieldContent); - } - } - refreshTextFields(); - } - catch (Exception e) - { - e.printStackTrace(System.err); - } - } + + } diff --git a/wizards/com/sun/star/wizards/text/TextSectionHandler.java b/wizards/com/sun/star/wizards/text/TextSectionHandler.java index 44642f5c4f00..4c4a9ff10b48 100644 --- a/wizards/com/sun/star/wizards/text/TextSectionHandler.java +++ b/wizards/com/sun/star/wizards/text/TextSectionHandler.java @@ -68,11 +68,7 @@ public class TextSectionHandler } } - public boolean hasTextSectionByName(String SectionName) - { - com.sun.star.container.XNameAccess xAllTextSections = xTextSectionsSupplier.getTextSections(); - return xAllTextSections.hasByName(SectionName); - } + public void removeLastTextSection() { @@ -170,18 +166,7 @@ public class TextSectionHandler } } - public void breakLinkOfTextSection(Object oTextSection) - { - SectionFileLink oSectionLink = new SectionFileLink(); - oSectionLink.FileURL = PropertyNames.EMPTY_STRING; - Helper.setUnoPropertyValues(oTextSection, new String[] - { - "FileLink", "LinkRegion" - }, new Object[] - { - oSectionLink, PropertyNames.EMPTY_STRING - }); - } + public void linkSectiontoTemplate(String TemplateName, String SectionName) { diff --git a/wizards/com/sun/star/wizards/text/TextTableHandler.java b/wizards/com/sun/star/wizards/text/TextTableHandler.java index c04d3b513415..cbd573ea1418 100644 --- a/wizards/com/sun/star/wizards/text/TextTableHandler.java +++ b/wizards/com/sun/star/wizards/text/TextTableHandler.java @@ -109,24 +109,7 @@ public class TextTableHandler } } - public void insertTextTable(com.sun.star.text.XTextCursor xTextCursor) - { - try - { - com.sun.star.uno.XInterface xTextTable = (XInterface) xMSFDoc.createInstance("com.sun.star.text.TextTable"); - XTextContent xTextContentTable = UnoRuntime.queryInterface(XTextContent.class, xTextTable); - if (xTextCursor == null) - { - xTextCursor = xTextDocument.getText().createTextCursor(); - xTextCursor.gotoEnd(false); - } - xTextCursor.getText().insertTextContent(xTextCursor, xTextContentTable, false); - } - catch (Exception exception) - { - exception.printStackTrace(System.err); - } - } + public void removeAllTextTables() { @@ -206,12 +189,7 @@ public class TextTableHandler } } - public static BreakType resetBreakTypeofTextTable(Object oTextTable) - { - BreakType BreakValue = (BreakType) com.sun.star.wizards.common.Helper.getUnoStructValue(oTextTable, "BreakType"); - Helper.setUnoPropertyValue(oTextTable, "BreakType", BreakType.NONE); - return BreakType.NONE; - } + public void adjustOptimalTableWidths(XMultiServiceFactory _xMSF, XTextTable xTextTable) { diff --git a/wizards/com/sun/star/wizards/ui/ButtonList.java b/wizards/com/sun/star/wizards/ui/ButtonList.java index d9e005043f8b..06e4f9bceec4 100644 --- a/wizards/com/sun/star/wizards/ui/ButtonList.java +++ b/wizards/com/sun/star/wizards/ui/ButtonList.java @@ -357,20 +357,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener return pageStart + i; } - public void intervalAdded(ListDataEvent event) - { - if (event.getIndex0() <= m_nCurrentSelection) - { - if (event.getIndex1() <= m_nCurrentSelection) - { - m_nCurrentSelection += event.getIndex1() - event.getIndex0() + 1; - } - } - if (event.getIndex0() < pageStart || event.getIndex1() < (pageStart + getRows() + getCols())) - { - refreshImages(); - } - } + /** Registers ItemListener to receive events. * @param listener The listener to register. @@ -553,27 +540,9 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener showButtons = b; } - public void nextPage() - { - if (pageStart < getListModel().getSize() - rows * cols) - { - setPageStart(pageStart + rows * cols); - } - } - public void prevPage() - { - if (pageStart == 0) - { - return; - } - int i = pageStart - rows * cols; - if (i < 0) - { - i = 0; - } - setPageStart(i); - } + + private void enableButtons() { @@ -649,16 +618,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener } - /** - * jump to the given item (display the screen - * that contains the given item). - */ - public void display(int i) - { - int is = (getCols() * getRows()); - int ps = (listModel.getSize() / is) * is; - setPageStart(ps); - } + public boolean isenabled() { diff --git a/wizards/com/sun/star/wizards/ui/ControlScroller.java b/wizards/com/sun/star/wizards/ui/ControlScroller.java index b738b4af2d8e..9fe81b84c2ce 100644 --- a/wizards/com/sun/star/wizards/ui/ControlScroller.java +++ b/wizards/com/sun/star/wizards/ui/ControlScroller.java @@ -116,10 +116,7 @@ public abstract class ControlScroller } } - protected void setScrollBarOrientationHorizontal() - { - Helper.setUnoPropertyValue(xScrollBar, PropertyNames.ORIENTATION, new Integer(ScrollBarOrientation.HORIZONTAL)); - } + /** * @param _ntotfieldcount The number of fields that are to be administered by the ControlScroller @@ -278,29 +275,11 @@ public abstract class ControlScroller return nscrollvalue; } - protected void setLineIncrementation(int _nlineincrement) - { - this.nlineincrement = _nlineincrement; - Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), "LineIncrement", new Integer(nlineincrement)); - } - protected int getLineIncrementation() - { - return nlineincrement; - } - protected void setBlockIncrementation(int _nblockincrement) - { - this.nblockincrement = _nblockincrement; - Helper.setUnoPropertyValues(UnoDialog.getModel(xScrollBar), new String[] - { - PropertyNames.PROPERTY_ENABLED, "BlockIncrement", "ScrollValueMax" - }, new Object[] - { - Boolean.valueOf(ntotfieldcount > nblockincrement), new Integer(nblockincrement), new Integer(ntotfieldcount - nblockincrement) - }); - } + + protected int getBlockIncrementation() { @@ -396,10 +375,7 @@ public abstract class ControlScroller } } - protected PropertyValue[] getControlGroupInfo(int _i) - { - return scrollfields.get(_i); - } + private void setControlData(String controlname, Object newvalue) { diff --git a/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java b/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java index 81119688b061..66b70426873f 100644 --- a/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java @@ -124,14 +124,6 @@ public abstract class DBLimitedFieldSelection } - protected void initializeListBox(XListBox xListBox, String[] _AllFieldNames, String _SelFieldName) - { - 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), PropertyNames.SELECTED_ITEMS, SelList); - } } diff --git a/wizards/com/sun/star/wizards/ui/FieldSelection.java b/wizards/com/sun/star/wizards/ui/FieldSelection.java index 7a7047c44038..ba3d83e261a2 100644 --- a/wizards/com/sun/star/wizards/ui/FieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/FieldSelection.java @@ -491,11 +491,7 @@ public class FieldSelection } } - public void mergeList(String[] AllFieldNames) - { - xFieldsListBox.addItems(AllFieldNames, (short) 0); - toggleListboxButtons((short) - 1, (short) - 1); - } + public void intializeSelectedFields(String[] _SelectedFieldNames) { @@ -521,15 +517,7 @@ public class FieldSelection toggleListboxControls(Boolean.TRUE); } - public void initialize(String[][] _AllFieldNamesTable, boolean _AppendMode, int _maxfieldcount) - { - String[] AllFieldNames_ = new String[_AllFieldNamesTable.length]; - for (int i = 0; i < _AllFieldNamesTable.length; i++) - { - AllFieldNames_[i] = _AllFieldNamesTable[i][0]; - } - initialize(AllFieldNames_, _AppendMode, _maxfieldcount); - } + public void initialize(String[] _AllFieldNames, boolean _AppendMode, int _maxfieldcount) { diff --git a/wizards/com/sun/star/wizards/ui/FilterComponent.java b/wizards/com/sun/star/wizards/ui/FilterComponent.java index 7bfcc765fc6b..9c416f02df8f 100644 --- a/wizards/com/sun/star/wizards/ui/FilterComponent.java +++ b/wizards/com/sun/star/wizards/ui/FilterComponent.java @@ -923,16 +923,8 @@ public class FilterComponent return (Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue")); } - protected Object getText() - { - return (Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "Text")); - } - protected String getDateTimeString() - { - double dblValue = ((Double) getValue()).doubleValue(); - NumberFormatter oNumberFormatter = oQueryMetaData.getNumberFormatter(); - return oNumberFormatter.convertNumberToString(iDateTimeFormat, dblValue); - } + + } } diff --git a/wizards/com/sun/star/wizards/ui/PeerConfig.java b/wizards/com/sun/star/wizards/ui/PeerConfig.java index 89a10f04f5ce..36bc2f4a5af4 100644 --- a/wizards/com/sun/star/wizards/ui/PeerConfig.java +++ b/wizards/com/sun/star/wizards/ui/PeerConfig.java @@ -163,25 +163,9 @@ public class PeerConfig implements XWindowListener }); } - public void setAccessibleName(XControl _xControl, String _saccessname) - { - setPeerProperties(_xControl, new String[] - { - "AccessibleName" - }, new String[] - { - _saccessname - }); - } - /** - * @param oAPIControl an API control that the interface XControl can be derived from - */ - public void setPeerProperties(Object oAPIControl, String[] _propnames, Object[] _propvalues) - { - XControl xControl = UnoRuntime.queryInterface(XControl.class, oAPIControl); - setPeerProperties(xControl, _propnames, _propvalues); - } + + public void setPeerProperties(XControl _xControl, String[] propnames, Object[] propvalues) { @@ -189,15 +173,7 @@ public class PeerConfig implements XWindowListener this.m_aPeerTasks.add(oPeerTask); } - /** - * assigns an arbitrary property to a control as soon as the peer is created - * Note: The property 'ImageUrl' should better be assigned with 'setImageurl(...)', to consider the High Contrast Mode - */ - public void setControlProperty(Object _ocontrolmodel, String _spropname, Object _propvalue) - { - ControlTask oControlTask = new ControlTask(_ocontrolmodel, _spropname, _propvalue); - this.aControlTasks.add(oControlTask); - } + /** * Assigns an image to the property 'ImageUrl' of a dialog control. The image id must be assigned in a resource file diff --git a/wizards/com/sun/star/wizards/ui/SortingComponent.java b/wizards/com/sun/star/wizards/ui/SortingComponent.java index 67db72753d47..93687627c64c 100644 --- a/wizards/com/sun/star/wizards/ui/SortingComponent.java +++ b/wizards/com/sun/star/wizards/ui/SortingComponent.java @@ -273,26 +273,7 @@ public class SortingComponent } } - public void disableListBoxesfromIndex(int CurIndex) - { - if (CurIndex < MAXSORTCRITERIAINDEX) - { - for (int i = CurIndex + 1; i <= MAXSORTCRITERIAINDEX; i++) - { - toggleSortListBox(i, (false)); - if (i < MaxSortIndex) - { - CurUnoDialog.setControlProperty("lstSort" + Integer.toString(i + 2), PropertyNames.SELECTED_ITEMS, new short[] - { - 0 - }); - } - // xSortListBox[i+1].selectItemPos((short)0, true); - } - CurUnoDialog.setFocus("lblSort" + new Integer(CurIndex + 1)); - MaxSortIndex = CurIndex - 1; - } - } + // The following code can be reactivated in a future version when task #100799 will be fixed private void moveupSortItems(int CurIndex, boolean bDoEnable) diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.java b/wizards/com/sun/star/wizards/ui/UnoDialog.java index 6f184f1cea30..a0b4c13f819b 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog.java +++ b/wizards/com/sun/star/wizards/ui/UnoDialog.java @@ -198,24 +198,7 @@ public class UnoDialog implements EventNames } } - public void printControlProperties(String ControlName) - { - try - { - Object xControlModel = getDlgNameAccess().getByName(ControlName); - XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xControlModel); - Property[] allProps = xPSet.getPropertySetInfo().getProperties(); - for (int i = 0; i < allProps.length; i++) - { - String sName = allProps[i].Name; - System.out.println(sName); - } - } - catch (com.sun.star.uno.Exception exception) - { // com.sun.star.container.NoSuchElementException, com.sun.star.beans.UnknownPropertyException, - exception.printStackTrace(System.err); // com.sun.star.lang.WrappedTargetException, com.sun.star.beans.PropertyVetoException - } - } + public double getMAPConversionFactor(String ControlName) { @@ -269,14 +252,7 @@ public class UnoDialog implements EventNames return ipos.length > 0; } - public void addSingleItemtoListbox(XListBox xListBox, String ListItem, short iSelIndex) - { - xListBox.addItem(ListItem, xListBox.getItemCount()); - if (iSelIndex != -1) - { - xListBox.selectItemPos(iSelIndex, true); - } - } + public XFixedText insertLabel(String sName, String[] sPropNames, Object[] oPropValues) { @@ -314,41 +290,9 @@ public class UnoDialog implements EventNames return xButton; } - 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 = UnoRuntime.queryInterface(XPropertySet.class, oButtonModel); - xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); - Object objectCheckBox = xDlgContainer.getControl(sName); - XCheckBox xCheckBox = UnoRuntime.queryInterface(XCheckBox.class, objectCheckBox); - if (xItemListener != null) - { - xCheckBox.addItemListener(xItemListener); - } - Integer ControlKey = new Integer(iControlKey); - if (ControlList != null) - { - ControlList.put(sName, ControlKey); - } - } - 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 = UnoRuntime.queryInterface(XPropertySet.class, oNumericFieldModel); - xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); - Object objectNumericField = xDlgContainer.getControl(sName); - XTextComponent xNumericField = UnoRuntime.queryInterface(XTextComponent.class, objectNumericField); - if (xTextListener != null) - { - xNumericField.addTextListener(xTextListener); - } - Integer ControlKey = new Integer(iControlKey); - if (ControlList != null) - { - ControlList.put(sName, ControlKey); - } - } + + public XScrollBar insertScrollBar(String sName, int iControlKey, XAdjustmentListener xAdjustmentListener, String[] sProperties, Object[] sValues) { @@ -431,30 +375,7 @@ public class UnoDialog implements EventNames return xListBox; } - 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 = UnoRuntime.queryInterface(XPropertySet.class, xComboBoxModel); - xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName); - XControl xControlComboBox = xDlgContainer.getControl(sName); - XComboBox xComboBox = UnoRuntime.queryInterface(XComboBox.class, xControlComboBox); - if (xItemListener != null) - { - xComboBox.addItemListener(xItemListener); - } - if (xTextListener != null) - { - XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, xComboBox); - xTextComponent.addTextListener(xTextListener); - } - if (xActionListener != null) - { - xComboBox.addActionListener(xActionListener); - } - Integer ControlKey = new Integer(iControlKey); - ControlList.put(sName, ControlKey); - return xComboBox; - } + public XRadioButton insertRadioButton(String sName, int iControlKey, XItemListener xItemListener, String[] sProperties, Object[] sValues) { @@ -572,25 +493,7 @@ public class UnoDialog implements EventNames xWindow.setFocus(); } - public static String[] combineListboxList(String sFirstEntry, String[] MainList) - { - try - { - String[] FirstList = new String[] - { - sFirstEntry - }; - String[] ResultList = new String[MainList.length + 1]; - System.arraycopy(FirstList, 0, ResultList, 0, 1); - System.arraycopy(MainList, 0, ResultList, 1, MainList.length); - return ResultList; - } - catch (java.lang.Exception jexception) - { - jexception.printStackTrace(System.err); - return null; - } - } + public void selectListBoxItem(XListBox xListBox, short iFieldsSelIndex) { @@ -670,14 +573,7 @@ public class UnoDialog implements EventNames this.xWindow.setVisible(true); } - /** - * @return 0 for cancel, 1 for ok. - */ - public short executeDialog(UnoDialog parent) - throws com.sun.star.uno.Exception - { - return executeDialog(parent.xWindow.getPosSize()); - } + /** * @return 0 for cancel, 1 for ok. @@ -708,14 +604,7 @@ public class UnoDialog implements EventNames return executeDialog(Desktop.getActiveFrame(xMSF)); } - public void setAutoMnemonic(String ControlName, boolean bValue) - { - Object oControl = xDlgContainer.getControl(ControlName); - xControl = UnoRuntime.queryInterface(XControl.class, oControl); - XWindowPeer xWindowPeer = xControl.getPeer(); - XVclWindowPeer xVclWindowPeer = UnoRuntime.queryInterface(XVclWindowPeer.class, xWindowPeer); - xVclWindowPeer.setProperty("AutoMnemonics", Boolean.valueOf(bValue)); - } + public void modifyFontWeight(String ControlName, float FontWeight) { @@ -755,33 +644,9 @@ public class UnoDialog implements EventNames return createWindowPeer(null); } - // deletes the first entry when this is equal to "DelEntryName" - // returns true when a new item is selected - public void deletefirstListboxEntry(String ListBoxName, String DelEntryName) - { - XControl xListControl = xDlgContainer.getControl(ListBoxName); - XListBox xListBox = UnoRuntime.queryInterface(XListBox.class, xListControl); - String FirstItem = xListBox.getItem((short) 0); - if (FirstItem.equals(DelEntryName)) - { - short SelPos = xListBox.getSelectedItemPos(); - xListBox.removeItems((short) 0, (short) 1); - if (SelPos > 0) - { - setControlProperty(ListBoxName, PropertyNames.SELECTED_ITEMS, new short[SelPos]); - xListBox.selectItemPos((short) (SelPos - 1), true); - } - } - } - public void setPeerProperty(String ControlName, String PropertyName, Object PropertyValue) - { - Object oControl = xDlgContainer.getControl(ControlName); - XControl xControl = UnoRuntime.queryInterface(XControl.class, oControl); - XWindowPeer xControlPeer = xControl.getPeer(); - XVclWindowPeer xVclWindowPeer = UnoRuntime.queryInterface(XVclWindowPeer.class, xControlPeer); - xVclWindowPeer.setProperty(PropertyName, PropertyValue); - } + + public static Object getModel(Object control) { diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.java b/wizards/com/sun/star/wizards/ui/UnoDialog2.java index 9d0d65badc4a..2d1ecbc70c0f 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog2.java +++ b/wizards/com/sun/star/wizards/ui/UnoDialog2.java @@ -127,10 +127,7 @@ public class UnoDialog2 extends UnoDialog return xComboBox; } - public XComboBox insertComboBox(String sName, String actionPerformed, String itemChanged, String textChanged, String[] sPropNames, Object[] oPropValues) - { - return insertComboBox(sName, actionPerformed, textChanged, itemChanged, this, sPropNames, oPropValues); - } + public XListBox insertListBox(String sName, String actionPerformed, String itemChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) { @@ -169,21 +166,14 @@ public class UnoDialog2 extends UnoDialog return insertRadioButton(sName, itemChanged, this, sPropNames, oPropValues); } - public XControl insertTitledBox(String sName, String[] sPropNames, Object[] oPropValues) - { - Object oTitledBox = insertControlModel2("com.sun.star.awt.UnoControlGroupBoxModel", sName, sPropNames, oPropValues); - return UnoRuntime.queryInterface(XControl.class, oTitledBox); - } + public XTextComponent insertTextField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) { return (XTextComponent) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlEditModel", sPropNames, oPropValues, XTextComponent.class); } - public XTextComponent insertTextField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) - { - return insertTextField(sName, sTextChanged, this, sPropNames, oPropValues); - } + public XControl insertImage(String sName, String[] sPropNames, Object[] oPropValues) { @@ -225,70 +215,49 @@ public class UnoDialog2 extends UnoDialog return (XControl) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlFileControlModel", sPropNames, oPropValues, XControl.class); } - public XControl insertFileControl(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) - { - return insertFileControl(sName, sTextChanged, this, sPropNames, oPropValues); - } + private XCurrencyField insertCurrencyField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) { return (XCurrencyField) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlCurrencyFieldModel", sPropNames, oPropValues, XCurrencyField.class); } - public XCurrencyField insertCurrencyField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) - { - return insertCurrencyField(sName, sTextChanged, this, sPropNames, oPropValues); - } + private XDateField insertDateField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) { return (XDateField) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlDateFieldModel", sPropNames, oPropValues, XDateField.class); } - public XDateField insertDateField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) - { - return insertDateField(sName, sTextChanged, this, sPropNames, oPropValues); - } + private XNumericField insertNumericField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) { return (XNumericField) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlNumericFieldModel", sPropNames, oPropValues, XNumericField.class); } - public XNumericField insertNumericField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) - { - return insertNumericField(sName, sTextChanged, this, sPropNames, oPropValues); - } + private XTimeField insertTimeField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) { return (XTimeField) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlTimeFieldModel", sPropNames, oPropValues, XTimeField.class); } - public XTimeField insertTimeField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) - { - return insertTimeField(sName, sTextChanged, this, sPropNames, oPropValues); - } + private XPatternField insertPatternField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) { return (XPatternField) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlPatternFieldModel", sPropNames, oPropValues, XPatternField.class); } - public XPatternField insertPatternField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) - { - return insertPatternField(sName, sTextChanged, this, sPropNames, oPropValues); - } + private XTextComponent insertFormattedField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) { return (XTextComponent) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlFormattedFieldModel", sPropNames, oPropValues, XTextComponent.class); } - public XTextComponent insertFormattedField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) - { - return insertFormattedField(sName, sTextChanged, this, sPropNames, oPropValues); - } + public XControl insertFixedLine(String sName, String[] sPropNames, Object[] oPropValues) { @@ -296,23 +265,11 @@ public class UnoDialog2 extends UnoDialog 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 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 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 UnoRuntime.queryInterface(XControl.class, oGroupBox); - } + + + private Object insertControlModel2(String serviceName, String componentName, String[] sPropNames, Object[] oPropValues) { @@ -338,10 +295,7 @@ public class UnoDialog2 extends UnoDialog return UnoRuntime.queryInterface(type, insertControlModel2(serviceName, componentName, sPropNames, oPropValues)); } - public static Object getControlModel(Object unoControl) - { - 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 825eecba647d..aac598d1c532 100644 --- a/wizards/com/sun/star/wizards/ui/WizardDialog.java +++ b/wizards/com/sun/star/wizards/ui/WizardDialog.java @@ -144,22 +144,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL nNewStep = nOldStep; } - public void itemStateChanged(com.sun.star.awt.ItemEvent itemEvent) - { - try - { - nNewStep = itemEvent.ItemId; - nOldStep = AnyConverter.toInt(Helper.getUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_STEP)); - if (nNewStep != nOldStep) - { - switchToStep(); - } - } - catch (com.sun.star.lang.IllegalArgumentException exception) - { - exception.printStackTrace(System.err); - } - } + public void setRoadmapInteractive(boolean _bInteractive) { @@ -494,25 +479,9 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL } } - protected void insertRoadMapItems(String[] items, int[] steps, boolean[] enabled) - { - for (int i = 0; i < items.length; i++) - { - insertRoadmapItem(i, enabled[i], items[i], steps[i]); - } - } - /** This method also enables and disables the "next" button, - * if the step currently dis/enabled is the one of the next steps. - */ - public void setStepEnabled(int _nStep, boolean bEnabled, boolean enableNextButton) - { - setStepEnabled(_nStep, bEnabled); - if (getNextAvailableStep() > 0) - { - enableNextButton(bEnabled); - } - } + + public void enableNavigationButtons(boolean _bEnableBack, boolean _bEnableNext, boolean _bEnableFinish) { @@ -586,29 +555,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL } } - public synchronized void gotoPreviousAvailableStep() - { - boolean bIsEnabled; - if (nNewStep > 1) - { - nOldStep = nNewStep; - nNewStep--; - while (nNewStep > 0) - { - bIsEnabled = isStepEnabled(nNewStep); - if (bIsEnabled) - { - break; - } - nNewStep--; - } - if (nNewStep == 0) // Exception??? - { - nNewStep = nOldStep; - } - switchToStep(); - } - } + //TODO discuss with rp private int getNextAvailableStep() @@ -626,37 +573,11 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL return -1; } - public synchronized void gotoNextAvailableStep() - { - nOldStep = nNewStep; - nNewStep = getNextAvailableStep(); - if (nNewStep > -1) - { - switchToStep(); - } - } + public abstract boolean finishWizard(); - /** - * This function will call if the finish button is pressed on the UI. - */ - public void finishWizard_1() - { - enableFinishButton(false); - boolean success = false; - try - { - success = finishWizard(); - } - finally - { - if ( !success ) - enableFinishButton( true ); - } - if ( success ) - removeTerminateListener(); - } + public int getMaximalStep() { @@ -715,10 +636,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL xDialog.endExecute(); } - public void callHelp() - { - //should be overwritten by extending class - } + private void removeTerminateListener() { @@ -741,10 +659,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL removeTerminateListener(); } - public void windowHidden() - { - cancelWizard_1(); - } + public void notifyTermination(EventObject arg0) { diff --git a/wizards/com/sun/star/wizards/ui/XCompletion.java b/wizards/com/sun/star/wizards/ui/XCompletion.java index af444f72cc16..fbcfd5670269 100644 --- a/wizards/com/sun/star/wizards/ui/XCompletion.java +++ b/wizards/com/sun/star/wizards/ui/XCompletion.java @@ -24,7 +24,7 @@ public interface XCompletion public boolean iscompleted(int _ndialogpage); - public void setmodified(int _ndialogpage, Object ooldValue, Object onewValue); - public boolean ismodified(int _ndialogpage); + + } diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.java b/wizards/com/sun/star/wizards/ui/event/DataAware.java index 10d7d58fe147..7e45396f4fcc 100644 --- a/wizards/com/sun/star/wizards/ui/event/DataAware.java +++ b/wizards/com/sun/star/wizards/ui/event/DataAware.java @@ -178,33 +178,11 @@ public abstract class DataAware { return a.equals(b); } - /** - * given a collection containing DataAware objects, - * calls updateUI() on each memebr of the collection. - * @param dataAwares a collection containing DataAware objects. - */ - public static void updateUI(Collection<DataAware> dataAwares) { - for (Iterator<DataAware> i = dataAwares.iterator(); i.hasNext();) - i.next().updateUI(); - } - public static void updateData(Collection<DataAware> dataAwares) { - for (Iterator<DataAware> i = dataAwares.iterator(); i.hasNext();) - i.next().updateData(); - } - /** - * /** - * Given a collection containing DataAware objects, - * sets the given DataObject to each DataAware object - * in the given collection - * @param dataAwares a collection of DataAware objects. - * @param dataObject new data object to set to the DataAware objects in the given collection. - * @param updateUI if true, calls updateUI() on each DataAware object. - */public static void setDataObject(Collection<DataAware> dataAwares, Object dataObject, boolean updateUI) { - for (Iterator<DataAware> i = dataAwares.iterator(); i.hasNext();) - i.next().setDataObject(dataObject, updateUI); - } + + + /** * Value objects read and write a value from and diff --git a/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java b/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java index b7e8209ea8a3..ab9e78f7b9e5 100644 --- a/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java +++ b/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java @@ -77,12 +77,5 @@ public class MethodInvocation } } - /** - * This method is a convenience method. - * It is the same as calling invoke(null); - */ - public Object invoke() throws IllegalAccessException, InvocationTargetException - { - return invoke(null); - } + } diff --git a/wizards/com/sun/star/wizards/ui/event/Task.java b/wizards/com/sun/star/wizards/ui/event/Task.java index c0440ee5d74c..75608d9ffcaf 100644 --- a/wizards/com/sun/star/wizards/ui/event/Task.java +++ b/wizards/com/sun/star/wizards/ui/event/Task.java @@ -37,15 +37,9 @@ public class Task max = max_; } - public void start() - { - fireTaskStarted(); - } - public void fail() - { - fireTaskFailed(); - } + + public int getMax() { @@ -75,26 +69,16 @@ public class Task } } - public void advance(boolean success_, String nextSubtaskName) - { - advance(success_); - setSubtaskName(nextSubtaskName); - } + public int getStatus() { return successful + failed; } - public void addTaskListener(TaskListener tl) - { - listeners.add(tl); - } - public void removeTaskListener(TaskListener tl) - { - listeners.remove(tl); - } + + private void fireTaskStatusChanged() { diff --git a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java index 8130fc5c8d76..310c83ec0a28 100644 --- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java +++ b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java @@ -112,10 +112,7 @@ public class UnoDataAware extends DataAware } } - public void disableControls(Object[] controls) - { - disableObjects = controls; - } + @Override protected Object getFromUI() @@ -150,37 +147,15 @@ public class UnoDataAware extends DataAware return uda; } - public static UnoDataAware attachEditControl(Object data, String prop, Object unoControl, Listener listener, boolean 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) - { - return attachTextControl(data, prop, unoControl, listener, "Date", field, 0); - } - public static UnoDataAware attachTimeControl(Object data, String prop, Object unoControl, Listener listener, boolean field) - { - return attachTextControl(data, prop, unoControl, listener, "Time", field, 0); - } - public static UnoDataAware attachNumericControl(Object data, String prop, Object unoControl, Listener listener, boolean field) - { - return attachTextControl(data, prop, unoControl, listener, "Value", field, new Double(0)); - } - public static UnoDataAware attachCheckBox(Object data, String prop, Object checkBox, final Listener listener, boolean field) - { - XCheckBox xcheckBox = UnoRuntime.queryInterface(XCheckBox.class, checkBox); - final UnoDataAware uda = new UnoDataAware(data, - field - ? DataAwareFields.getFieldValueFor(data, prop, new Short((short) 0)) - : new DataAware.PropertyValue(prop, data), - checkBox, PropertyNames.PROPERTY_STATE); - xcheckBox.addItemListener(itemListener(uda, listener)); - return uda; - } + + + + + static XItemListener itemListener(final DataAware da, final Listener listener) { @@ -202,35 +177,16 @@ public class UnoDataAware extends DataAware }; } - public static UnoDataAware attachLabel(Object data, String prop, Object label, boolean field) - { - return new UnoDataAware(data, - 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 = 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, PropertyNames.SELECTED_ITEMS); - xListBox.addItemListener(itemListener(uda, listener)); - return uda; - } + + public static Object getModel(Object control) { return UnoRuntime.queryInterface(XControl.class, control).getModel(); } - public static void setEnabled(Object control, boolean enabled) - { - setEnabled(control, enabled ? Boolean.TRUE : Boolean.FALSE); - } + private static void setEnabled(Object control, Boolean enabled) { |