diff options
author | Noel Grandin <noel@peralex.com> | 2014-11-27 10:40:37 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-11-27 14:19:27 +0200 |
commit | 4b919338931678aa43e24d65fe5d4524971aa045 (patch) | |
tree | 89964130ed1339ac5139354e2183b3729a8e91dd /wizards | |
parent | 1102540516f0aa804463455d4cebd093b5844479 (diff) |
java,wizards: remove unused methods
found by UCDetector
Change-Id: If7d7f7b271f48f82d823a3d7b175adcae91180e3
Diffstat (limited to 'wizards')
57 files changed, 57 insertions, 3482 deletions
diff --git a/wizards/com/sun/star/wizards/common/Configuration.java b/wizards/com/sun/star/wizards/common/Configuration.java index 6b04d8784473..54ec1cfa3bec 100644 --- a/wizards/com/sun/star/wizards/common/Configuration.java +++ b/wizards/com/sun/star/wizards/common/Configuration.java @@ -26,7 +26,6 @@ import com.sun.star.uno.AnyConverter; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; import com.sun.star.lang.Locale; -import com.sun.star.util.XChangesBatch; /** * This class gives access to the OO configuration API. @@ -112,28 +111,6 @@ public abstract class Configuration set(Integer.valueOf(value), name, parent); } - public static void set(short value, String name, Object parent) throws Exception - { - set(Short.valueOf(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 { UnoRuntime.queryInterface(XHierarchicalPropertySet.class, parent).setHierarchicalPropertyValue(name, value); @@ -233,21 +210,6 @@ 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 * to the given view. Note that if a node with the given name @@ -290,29 +252,6 @@ 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) { return getNodeChildNames(_xNameAccessNode, PropertyNames.PROPERTY_NAME); @@ -377,33 +316,6 @@ public abstract class Configuration return null; } - public static XNameAccess getChildNodebyDisplayName(XNameAccess _xNameAccessNode, String _displayname) - { - return getChildNodebyDisplayName(_xNameAccessNode, _displayname, PropertyNames.PROPERTY_NAME); - } - - public static XNameAccess getChildNodebyDisplayName(XNameAccess _xNameAccessNode, String _displayname, String _nodename) - { - String[] snames = null; - try - { - snames = _xNameAccessNode.getElementNames(); - for (int i = 0; i < snames.length; i++) - { - String curdisplayname = (String) Helper.getUnoPropertyValue(_xNameAccessNode.getByName(snames[i]), _nodename); - if (curdisplayname.equals(_displayname)) - { - return UnoRuntime.queryInterface(XNameAccess.class, _xNameAccessNode.getByName(snames[i])); - } - } - } - catch (Exception e) - { - e.printStackTrace(System.err); - } - return null; - } - public static XNameAccess getChildNodebyDisplayName(XMultiServiceFactory _xMSF, Locale _aLocale, XNameAccess _xNameAccessNode, String _displayname, String _nodename, int _nmaxcharcount) { String[] snames = null; diff --git a/wizards/com/sun/star/wizards/common/DebugHelper.java b/wizards/com/sun/star/wizards/common/DebugHelper.java index 16c39fb53286..6f172a2dc0ee 100644 --- a/wizards/com/sun/star/wizards/common/DebugHelper.java +++ b/wizards/com/sun/star/wizards/common/DebugHelper.java @@ -21,16 +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 - { -// throw new UnsupportedOperationException("Not supported yet."); - } public static void exception(Exception ex) 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 70ef5a725708..1bf5905eee89 100644 --- a/wizards/com/sun/star/wizards/common/Desktop.java +++ b/wizards/com/sun/star/wizards/common/Desktop.java @@ -18,25 +18,16 @@ package com.sun.star.wizards.common; import com.sun.star.beans.PropertyValue; -import com.sun.star.lang.WrappedTargetException; -import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiComponentFactory; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.sheet.XSpreadsheetDocument; -import com.sun.star.text.XTextDocument; -import com.sun.star.uno.Any; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; import com.sun.star.util.XURLTransformer; import com.sun.star.lang.Locale; -import com.sun.star.uno.XInterface; import com.sun.star.bridge.XUnoUrlResolver; import com.sun.star.comp.helper.Bootstrap; -import com.sun.star.container.NoSuchElementException; -import com.sun.star.container.XEnumeration; import com.sun.star.container.XHierarchicalNameAccess; import com.sun.star.container.XNameAccess; -import com.sun.star.util.XStringSubstitution; import com.sun.star.frame.*; import com.sun.star.i18n.KParseType; import com.sun.star.i18n.ParseResult; @@ -75,24 +66,6 @@ public class Desktop return xFrameSuppl.getActiveFrame(); } - public static XComponent getActiveComponent(XMultiServiceFactory _xMSF) - { - XFrame xFrame = getActiveFrame(_xMSF); - 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); - } - public static XDispatch getDispatcher(XFrame xFrame, String _stargetframe, com.sun.star.util.URL oURL) { try @@ -292,35 +265,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; - } - } + /** * @deprecated used to retrieve the most common paths used in the office application @@ -360,17 +305,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) { @@ -384,77 +319,8 @@ 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 3afc8ec3f394..11efe3ce1d85 100644 --- a/wizards/com/sun/star/wizards/common/FileAccess.java +++ b/wizards/com/sun/star/wizards/common/FileAccess.java @@ -26,7 +26,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Vector; -import com.sun.star.awt.VclWindowPeerAttribute; import com.sun.star.io.XActiveDataSink; import com.sun.star.io.XInputStream; import com.sun.star.io.XTextInputStream; @@ -34,7 +33,6 @@ import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.ucb.*; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; -import com.sun.star.util.DateTime; import com.sun.star.beans.PropertyValue; import com.sun.star.document.XDocumentProperties; @@ -52,28 +50,6 @@ import com.sun.star.document.XDocumentProperties; public class FileAccess { - public static void addOfficePath(XMultiServiceFactory xMSF, String sPath, String sAddPath) - { - String ResultPath = getOfficePath(xMSF, sPath); - // 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; - } - public static String deleteLastSlashfromUrl(String _sPath) { if (_sPath.endsWith("/")) @@ -360,182 +336,6 @@ public class FileAccess return ReturnPath; } - public static boolean createSubDirectory(XMultiServiceFactory xMSF, XSimpleFileAccess xSimpleFileAccess, String Path) - { - String sNoDirCreation = PropertyNames.EMPTY_STRING; - try - { - Resource oResource = new Resource(xMSF, "imp"); - sNoDirCreation = oResource.getResText(1050); - String sMsgDirNotThere = oResource.getResText(1051); - String sQueryForNewCreation = oResource.getResText(1052); - String OSPath = JavaTools.convertfromURLNotation(Path); - String sQueryMessage = JavaTools.replaceSubString(sMsgDirNotThere, OSPath, "%1"); - sQueryMessage = sQueryMessage + (char) 13 + sQueryForNewCreation; - int icreate = SystemDialog.showMessageBox(xMSF, "QueryBox", VclWindowPeerAttribute.YES_NO, sQueryMessage); - if (icreate == 2) - { - xSimpleFileAccess.createFolder(Path); - return true; - } - return false; - } - catch (com.sun.star.ucb.CommandAbortedException exception) - { - String sMsgNoDir = JavaTools.replaceSubString(sNoDirCreation, Path, "%1"); - SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMsgNoDir); - return false; - } - catch (com.sun.star.uno.Exception unoexception) - { - String sMsgNoDir = JavaTools.replaceSubString(sNoDirCreation, Path, "%1"); - SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMsgNoDir); - return false; - } - } - - // 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, "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 */ @@ -702,12 +502,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))); @@ -734,24 +528,6 @@ public class FileAccess return filename; } - public boolean mkdir(String s) - { - try - { - fileAccess.createFolder(s); - return true; - } - catch (CommandAbortedException cax) - { - cax.printStackTrace(); - } - catch (com.sun.star.uno.Exception ex) - { - ex.printStackTrace(); - } - return false; - } - /** * @param def what to return in case of an exception * @return true if the given file exists or not. @@ -773,73 +549,11 @@ 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); - } - public static String getFilename(String path, String pathSeparator) { String[] s = JavaTools.ArrayoutofString(path, pathSeparator); @@ -853,38 +567,6 @@ 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. * if the path points to file, gives the directory in which the file is. @@ -904,51 +586,6 @@ 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; - } - } - - public String getNewFile(String parentDir, String name, String extension) - { - - int i = 0; - String url; - do - { - String filename = filename(name, extension, i++); - url = getURL(parentDir, filename); - } - while (exists(url, true)); - - return url; - } - - private static String filename(String name, String ext, int i) - { - 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 : "/") + @@ -987,33 +624,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 556d750b184d..6f73b3206fdb 100644 --- a/wizards/com/sun/star/wizards/common/Helper.java +++ b/wizards/com/sun/star/wizards/common/Helper.java @@ -21,7 +21,6 @@ import com.sun.star.uno.XComponentContext; import com.sun.star.util.XMacroExpander; import java.util.Calendar; -import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertySet; import com.sun.star.lang.Locale; import com.sun.star.lang.XMultiServiceFactory; @@ -85,21 +84,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) { @@ -127,53 +112,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) { @@ -375,20 +316,13 @@ 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 cca608ab7808..591001bb9a62 100644 --- a/wizards/com/sun/star/wizards/common/JavaTools.java +++ b/wizards/com/sun/star/wizards/common/JavaTools.java @@ -17,7 +17,6 @@ */ package com.sun.star.wizards.common; -import com.sun.star.util.DateTime; import com.sun.star.beans.PropertyValue; import java.util.*; import java.io.File; @@ -29,38 +28,6 @@ import java.net.URL; 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) { String[] sRetArray = null; @@ -75,16 +42,6 @@ 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 */ public static int[] IntegerTointList(java.util.List<Integer> _aIntegerVector) @@ -115,19 +72,6 @@ public class JavaTools return bbooleanValues; } - 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) { String sLongestItem = PropertyNames.EMPTY_STRING; @@ -175,24 +119,6 @@ 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) { int retvalue = -1; @@ -339,24 +265,6 @@ public class JavaTools } } - public static String getFilenameOutOfPath(String sPath) - { - String[] Hierarchy = ArrayoutofString(sPath, "/"); - 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) { String sPath = PropertyNames.EMPTY_STRING; @@ -373,27 +281,6 @@ 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; - } - - public static long getTimeInMillis(Calendar _calendar) - { - java.util.Date dDate = _calendar.getTime(); - return dDate.getTime(); - } - public static void setTimeInMillis(Calendar _calendar, long _timemillis) { java.util.Date dDate = new java.util.Date(); @@ -401,13 +288,6 @@ 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) { String[] retarray = new String[] 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 b906eedabf98..6a7cefe5c5c1 100644 --- a/wizards/com/sun/star/wizards/common/NumberFormatter.java +++ b/wizards/com/sun/star/wizards/common/NumberFormatter.java @@ -102,18 +102,6 @@ public class NumberFormatter } - public String convertNumberToString(int _nkey, double _dblValue) - { - return xNumberFormatter.convertNumberToString(_nkey, _dblValue); - } - - - public static String convertNumberToString(XNumberFormatter _xNumberFormatter, int _nkey, double _dblValue) - { - return _xNumberFormatter.convertNumberToString(_nkey, _dblValue); - } - - public double convertStringToNumber(int _nkey, String _sString)throws Exception { return xNumberFormatter.convertStringToNumber(_nkey, _sString); diff --git a/wizards/com/sun/star/wizards/common/NumericalHelper.java b/wizards/com/sun/star/wizards/common/NumericalHelper.java index 557b31bb377c..61dbdd3e320a 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 @@ -133,256 +115,7 @@ public class NumericalHelper return retValue; } - /** - * get a char value from the object - * @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(e, - "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 - * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted - */ - public static short toShort(Object aValue) - throws com.sun.star.lang.IllegalArgumentException - { - short retValue = 0; - TypeObject aTypeObject = getTypeObject(aValue); - switch (aTypeObject.iType) - { - case BYTE_TYPE: - retValue = getByte(aTypeObject); - break; - case CHAR_TYPE: - retValue = (byte) getChar(aTypeObject); - break; - case SHORT_TYPE: - retValue = getShort(aTypeObject); - break; - case INT_TYPE: - retValue = (short) getInt(aTypeObject); - break; - case LONG_TYPE: - retValue = (short) getLong(aTypeObject); - break; - case FLOAT_TYPE: - retValue = (short) getFloat(aTypeObject); - break; - case DOUBLE_TYPE: - retValue = (short) getDouble(aTypeObject); - break; - case STRING_TYPE: - try - { - retValue = Short.parseShort((String) aTypeObject.aValue); - } - catch (java.lang.NumberFormatException e) - { - throw new com.sun.star.lang.IllegalArgumentException(e, - "Cannot convert to short: " + aTypeObject.aValue); - } - break; - case BOOLEAN_TYPE: - retValue = getBool(aTypeObject) ? (short) -1 : (short) 0; - break; - default: - throw new com.sun.star.lang.IllegalArgumentException( - "Cannot convert this type: " + aValue.getClass().getName()); - } - 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 - @return true, if the parameter aValue is type of real numbers - @deprecate, use isRealNumber() instead. - */ - public static boolean isNumerical(Object aValue) - { - try - { - TypeObject aTypeObject = getTypeObject(aValue); - switch (aTypeObject.iType) - { - case BYTE_TYPE: - case CHAR_TYPE: - case SHORT_TYPE: - case INT_TYPE: - case LONG_TYPE: - case DOUBLE_TYPE: - case FLOAT_TYPE: - return true; - default: - return false; - } - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - return false; - } - } - - /** - @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 - * @return true, if the value is type of any integer values. double / float are not(!) integer values - */ - public static boolean isInteger(Object aValue) throws com.sun.star.lang.IllegalArgumentException - { - TypeObject aTypeObject = getTypeObject(aValue); - switch (aTypeObject.iType) - { - case BYTE_TYPE: - case CHAR_TYPE: - case SHORT_TYPE: - case INT_TYPE: - case LONG_TYPE: - return true; - default: - return false; - } - } - - /** - * 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 @@ -438,112 +171,6 @@ public class NumericalHelper } /** - * get a long value from the object - * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted - */ - public static long toLong(Object aValue) - throws com.sun.star.lang.IllegalArgumentException - { - long retValue = 0; - TypeObject aTypeObject = getTypeObject(aValue); - switch (aTypeObject.iType) - { - case BYTE_TYPE: - retValue = getByte(aTypeObject); - break; - case CHAR_TYPE: - retValue = getChar(aTypeObject); - break; - case SHORT_TYPE: - retValue = getShort(aTypeObject); - break; - case INT_TYPE: - retValue = getInt(aTypeObject); - break; - case LONG_TYPE: - retValue = getLong(aTypeObject); - break; - case FLOAT_TYPE: - retValue = (long) getFloat(aTypeObject); - break; - case DOUBLE_TYPE: - retValue = (long) getDouble(aTypeObject); - break; - case STRING_TYPE: - try - { - retValue = Long.parseLong((String) aTypeObject.aValue); - } - catch (java.lang.NumberFormatException e) - { - throw new com.sun.star.lang.IllegalArgumentException(e, - "Cannot convert to short: " + aTypeObject.aValue); - } - break; - case BOOLEAN_TYPE: - retValue = getBool(aTypeObject) ? -1 : 0; - break; - default: - throw new com.sun.star.lang.IllegalArgumentException( - "Cannot convert this type: " + aValue.getClass().getName()); - } - return retValue; - } - - /** - * get a float value from the object - * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted - */ - public static float toFloat(Object aValue) - throws com.sun.star.lang.IllegalArgumentException - { - float retValue = (float) 0.0; - TypeObject aTypeObject = getTypeObject(aValue); - switch (aTypeObject.iType) - { - case BYTE_TYPE: - retValue = getByte(aTypeObject); - break; - case CHAR_TYPE: - retValue = getChar(aTypeObject); - break; - case SHORT_TYPE: - retValue = getShort(aTypeObject); - break; - case INT_TYPE: - retValue = getInt(aTypeObject); - break; - case LONG_TYPE: - retValue = getLong(aTypeObject); - break; - case FLOAT_TYPE: - retValue = getFloat(aTypeObject); - break; - case DOUBLE_TYPE: - retValue = (float) getDouble(aTypeObject); - break; - case STRING_TYPE: - try - { - retValue = Float.parseFloat((String) aTypeObject.aValue); - } - catch (java.lang.NumberFormatException e) - { - throw new com.sun.star.lang.IllegalArgumentException(e, - "Cannot convert to short: " + aTypeObject.aValue); - } - break; - case BOOLEAN_TYPE: - retValue = getBool(aTypeObject) ? (float) -1 : (float) 0; - break; - default: - throw new com.sun.star.lang.IllegalArgumentException( - "Cannot convert this type: " + aValue.getClass().getName()); - } - return retValue; - } - - /** * get a double value from the object * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted */ @@ -597,402 +224,6 @@ public class NumericalHelper } /** - * get a String value from the object - * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted - */ - public static String toString(Object aValue) - throws com.sun.star.lang.IllegalArgumentException - { - String retValue = null; - TypeObject aTypeObject = getTypeObject(aValue); - switch (aTypeObject.iType) - { - case BYTE_TYPE: - case CHAR_TYPE: - case SHORT_TYPE: - case INT_TYPE: - case LONG_TYPE: - case FLOAT_TYPE: - case DOUBLE_TYPE: - case BOOLEAN_TYPE: - retValue = aTypeObject.aValue.toString(); - break; - case STRING_TYPE: - retValue = (String) aTypeObject.aValue; - break; - case SEQUENCE_TYPE: - retValue = new String(toByteArray((aValue))); - break; - default: - throw new com.sun.star.lang.IllegalArgumentException( - "Cannot convert this type: " + aValue.getClass().getName()); - } - return retValue; - } - - /** - * get a boolean value from the object - * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted - */ - public static boolean toBoolean(Object aValue) - throws com.sun.star.lang.IllegalArgumentException - { - boolean retValue = true; - TypeObject aTypeObject = getTypeObject(aValue); - switch (aTypeObject.iType) - { - case BYTE_TYPE: - retValue = (((Byte) aTypeObject.aValue).byteValue() != 0); - break; - case CHAR_TYPE: - retValue = (((Character) aTypeObject.aValue).charValue() != 0); - break; - case SHORT_TYPE: - retValue = (((Short) aTypeObject.aValue).shortValue() != 0); - break; - case INT_TYPE: - retValue = (((Integer) aTypeObject.aValue).intValue() != 0); - break; - case LONG_TYPE: - retValue = (((Long) aTypeObject.aValue).longValue() != 0); - break; - case FLOAT_TYPE: - retValue = (((Float) aTypeObject.aValue).floatValue() != 0); - break; - case DOUBLE_TYPE: - retValue = (((Double) aTypeObject.aValue).doubleValue() != 0); - break; - case STRING_TYPE: - try - { - retValue = Boolean.parseBoolean((String) aTypeObject.aValue); - } - catch (java.lang.NumberFormatException e) - { - throw new com.sun.star.lang.IllegalArgumentException(e, - "Cannot convert to short: " + aTypeObject.aValue); - } - break; - case BOOLEAN_TYPE: - retValue = ((Boolean) aTypeObject.aValue).booleanValue(); - break; - default: - throw new com.sun.star.lang.IllegalArgumentException( - "Cannot convert this type: " + aValue.getClass().getName()); - } - return retValue; - } - - /** - * get an int array from an object - * @param anArrayValue a value that is constructed into an array - * @return an integer array - */ - public static int[] toIntArray(Object anArrayValue) - throws com.sun.star.lang.IllegalArgumentException - { - int[] retValue = null; - TypeObject aTypeObject = getTypeObject(anArrayValue); - if (aTypeObject.iType == SEQUENCE_TYPE) - { - Object[] obj = convertSequenceToObjectArray(aTypeObject); - retValue = new int[obj.length]; - for (int i = 0; i < obj.length; i++) - { - retValue[i] = toInt(obj[i]); - } - } - else - { // object is not really an array - retValue = new int[] - { - toInt(anArrayValue) - }; - } - return retValue; - } - - /** - * get an byte array from an object - * @param anArrayValue a value that is constructed into an array - * @return a byte array - */ - public static byte[] toByteArray(Object anArrayValue) - throws com.sun.star.lang.IllegalArgumentException - { - byte[] retValue = null; - TypeObject aTypeObject = getTypeObject(anArrayValue); - if (aTypeObject.iType == SEQUENCE_TYPE) - { - Object[] obj = convertSequenceToObjectArray(aTypeObject); - retValue = new byte[obj.length]; - for (int i = 0; i < obj.length; i++) - { - retValue[i] = toByte(obj[i]); - } - } - else - { // object is not really an array - retValue = new byte[] - { - toByte(anArrayValue) - }; - } - return retValue; - } - - /** - * get a short array from an object - * @param anArrayValue a value that is constructed into an array - * @return a short array - */ - public static short[] toShortArray(Object anArrayValue) - throws com.sun.star.lang.IllegalArgumentException - { - short[] retValue = null; - TypeObject aTypeObject = getTypeObject(anArrayValue); - if (aTypeObject.iType == SEQUENCE_TYPE) - { - Object[] obj = convertSequenceToObjectArray(aTypeObject); - retValue = new short[obj.length]; - for (int i = 0; i < obj.length; i++) - { - retValue[i] = toShort(obj[i]); - } - } - else - { // object is not really an array - retValue = new short[] - { - toShort(anArrayValue) - }; - } - return retValue; - } - - /** - * get a string array from an object - * @param anArrayValue a value that is constructed into an array - * @return a short array - */ - public static String[] toStringArray(Object anArrayValue) - throws com.sun.star.lang.IllegalArgumentException - { - String[] retValue = null; - TypeObject aTypeObject = getTypeObject(anArrayValue); - if (aTypeObject.iType == SEQUENCE_TYPE) - { - Object[] obj = convertSequenceToObjectArray(aTypeObject); - retValue = new String[obj.length]; - for (int i = 0; i < obj.length; i++) - { - retValue[i] = toString(obj[i]); - } - } - else - { // object is not really an array - retValue = new String[] - { - toString(anArrayValue) - }; - } - 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 * @param aValue an object representing a (numerical) value; can also be an 'any' * @return a type object: the object together with the its type information @@ -1214,113 +445,6 @@ public class NumericalHelper } } - public String getResult() - { - return val.toString(); - } - } - - private static Object[] convertSequenceToObjectArray( - TypeObject sourceObject) - throws com.sun.star.lang.IllegalArgumentException - { - Object array = sourceObject.aValue; - Class<?> c = array.getClass(); - Object[] aShortVal = null; - if (c.equals(byte[].class)) - { - byte[] vals = (byte[]) array; - aShortVal = new Object[vals.length]; - for (int i = 0; i < vals.length; i++) - { - aShortVal[i] = Byte.valueOf(vals[i]); - } - } - else if (c.equals(short[].class)) - { - short[] vals = (short[]) array; - aShortVal = new Object[vals.length]; - for (int i = 0; i < vals.length; i++) - { - aShortVal[i] = Short.valueOf(vals[i]); - } - } - else if (c.equals(int[].class)) - { - int[] vals = (int[]) array; - aShortVal = new Object[vals.length]; - for (int i = 0; i < vals.length; i++) - { - aShortVal[i] = Integer.valueOf(vals[i]); - } - } - else if (c.equals(long[].class)) - { - long[] vals = (long[]) array; - aShortVal = new Object[vals.length]; - for (int i = 0; i < vals.length; i++) - { - aShortVal[i] = Long.valueOf(vals[i]); - } - } - else if (c.equals(float[].class)) - { - float[] vals = (float[]) array; - aShortVal = new Object[vals.length]; - for (int i = 0; i < vals.length; i++) - { - aShortVal[i] = new Float(vals[i]); - } - } - else if (c.equals(double[].class)) - { - double[] vals = (double[]) array; - aShortVal = new Object[vals.length]; - for (int i = 0; i < vals.length; i++) - { - aShortVal[i] = new Double(vals[i]); - } - } - else if (c.equals(boolean[].class)) - { - boolean[] vals = (boolean[]) array; - aShortVal = new Object[vals.length]; - for (int i = 0; i < vals.length; i++) - { - aShortVal[i] = Boolean.valueOf(vals[i]); - } - } - // if nothing did match, try this - if (aShortVal == null) - { - try - { - aShortVal = (Object[]) array; - } - catch (java.lang.ClassCastException e) - { - // unknown type cannot be converted - throw new com.sun.star.lang.IllegalArgumentException(e, - "Cannot convert unknown type " +array.getClass()); - } - } - 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); } - public static double roundDouble(double _dblvalue, int _ndecimals) - { - double dblfactor = java.lang.Math.pow(10.0, _ndecimals); - return ((int) (_dblvalue * dblfactor)) / dblfactor; - } } diff --git a/wizards/com/sun/star/wizards/common/PlaceholderTextElement.java b/wizards/com/sun/star/wizards/common/PlaceholderTextElement.java index b1b9cb6828ef..a7b5d2af9d45 100644 --- a/wizards/com/sun/star/wizards/common/PlaceholderTextElement.java +++ b/wizards/com/sun/star/wizards/common/PlaceholderTextElement.java @@ -22,7 +22,6 @@ import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.text.*; -import com.sun.star.wizards.text.*; public class PlaceholderTextElement extends TextElement { @@ -39,14 +38,6 @@ public class PlaceholderTextElement extends TextElement xmsf = xmsf_; } - public PlaceholderTextElement(String text, String paraStyle, String placeHolderText_, String hint_, XMultiServiceFactory xmsf_) - { - super(text, paraStyle); - placeHolderText = placeHolderText_; - hint = hint_; - xmsf = xmsf_; - } - public void write(Object textRange) { super.write(textRange); diff --git a/wizards/com/sun/star/wizards/common/PropertySetHelper.java b/wizards/com/sun/star/wizards/common/PropertySetHelper.java index 5862300ea316..15c7f447d062 100644 --- a/wizards/com/sun/star/wizards/common/PropertySetHelper.java +++ b/wizards/com/sun/star/wizards/common/PropertySetHelper.java @@ -17,13 +17,9 @@ */ package com.sun.star.wizards.common; -import com.sun.star.beans.Property; import com.sun.star.uno.UnoRuntime; import com.sun.star.beans.XPropertySet; -import com.sun.star.beans.XPropertySetInfo; import com.sun.star.uno.AnyConverter; -import com.sun.star.lang.XServiceInfo; - import java.util.HashMap; public class PropertySetHelper @@ -143,45 +139,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 +188,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,41 +257,4 @@ 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. - */ - public void showProperties() - { - String sName = PropertyNames.EMPTY_STRING; - - if (m_xPropertySet != null) - { - XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, m_xPropertySet); - if (xServiceInfo != null) - { - sName = xServiceInfo.getImplementationName(); - } - XPropertySetInfo xInfo = m_xPropertySet.getPropertySetInfo(); - Property[] aAllProperties = xInfo.getProperties(); - DebugHelper.writeInfo("Show all properties of Implementation of :'" + sName + "'"); - for (int i = 0; i < aAllProperties.length; i++) - { - DebugHelper.writeInfo(" - " + aAllProperties[i].Name); - } - } - else - { - DebugHelper.writeInfo("The given object don't support XPropertySet interface."); - } - } } diff --git a/wizards/com/sun/star/wizards/common/Resource.java b/wizards/com/sun/star/wizards/common/Resource.java index c54cb3f2a2ae..64a1526673f9 100644 --- a/wizards/com/sun/star/wizards/common/Resource.java +++ b/wizards/com/sun/star/wizards/common/Resource.java @@ -18,7 +18,6 @@ package com.sun.star.wizards.common; -import com.sun.star.beans.PropertyValue; import com.sun.star.container.XIndexAccess; import com.sun.star.container.XNameAccess; import com.sun.star.lang.XMultiServiceFactory; @@ -83,17 +82,7 @@ public class Resource } } - public PropertyValue[] getStringList(int nID) - { - try - { - return (PropertyValue[])this.xStringListIndexAccess.getByIndex(nID); - } - catch (Exception exception) - { - throw new java.lang.IllegalArgumentException("Resource with ID not " + nID + "not found", exception); - } - } + 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 2486db840915..cd22200b2cbb 100644 --- a/wizards/com/sun/star/wizards/common/SystemDialog.java +++ b/wizards/com/sun/star/wizards/common/SystemDialog.java @@ -84,21 +84,6 @@ 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) { try @@ -145,52 +130,11 @@ 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) - { - throw new IllegalArgumentException(iae); - } - 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) public 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/ColumnPropertySet.java b/wizards/com/sun/star/wizards/db/ColumnPropertySet.java index e9e2a95947ac..98f0ea983e32 100644 --- a/wizards/com/sun/star/wizards/db/ColumnPropertySet.java +++ b/wizards/com/sun/star/wizards/db/ColumnPropertySet.java @@ -38,20 +38,6 @@ public class ColumnPropertySet oTypeInspector = _oTypeInspector; } - private PropertyValue[] propertySet2PropertyValueArray(XPropertySet _xNewPropertySet) throws com.sun.star.uno.Exception - { - Property[] props = _xNewPropertySet.getPropertySetInfo().getProperties(); - PropertyValue[] ret = new PropertyValue[props.length]; - for (int i = 0; i < props.length; i++) - { - PropertyValue val = new PropertyValue(); - val.Name = props[i].Name; - val.Value = _xNewPropertySet.getPropertyValue(val.Name); - ret[i] = val; - } - return ret; - } - private void assignPropertyValues(String _sNewName, PropertyValue[] _aNewColPropertyValues, boolean _bsetDefaultProperties) { try @@ -111,19 +97,6 @@ public class ColumnPropertySet assignPropertyValues(null /* dont change the name */, _aNewColPropertyValues, _bsetDefaultProperties); } - public void assignNewPropertySet(String _sNewName, XPropertySet _xNewPropertySet) - { - try - { - assignPropertyValues( - _sNewName, propertySet2PropertyValueArray(_xNewPropertySet), false /*setDefaultProperties*/); - } - catch (Exception e) - { - e.printStackTrace(System.err); - } - } - private void setType(int _nType, String _sTypeName, Integer precision) { if (_sTypeName.equals(PropertyNames.EMPTY_STRING)) diff --git a/wizards/com/sun/star/wizards/db/CommandMetaData.java b/wizards/com/sun/star/wizards/db/CommandMetaData.java index 02929b973ff0..21446f5d3c79 100644 --- a/wizards/com/sun/star/wizards/db/CommandMetaData.java +++ b/wizards/com/sun/star/wizards/db/CommandMetaData.java @@ -19,9 +19,6 @@ package com.sun.star.wizards.db; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.sdbc.SQLException; -import com.sun.star.sdbcx.KeyType; -import com.sun.star.sdbcx.XColumnsSupplier; -import com.sun.star.sdbcx.XKeysSupplier; import com.sun.star.uno.AnyConverter; import com.sun.star.awt.VclWindowPeerAttribute; import com.sun.star.uno.UnoRuntime; @@ -312,21 +309,6 @@ 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,24 +450,6 @@ 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) { String FieldTitle = FieldName; @@ -568,93 +532,6 @@ 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; - } - - public void openFormDocument(boolean _bReadOnly) - { - } - public void setCommandComposingAttributes() { try diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java index 2a8ee9c38311..684c75c0ae24 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,19 +492,6 @@ 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() { if (m_dataSource == null) @@ -797,11 +760,6 @@ public class DBMetaData } } - public boolean supportsAutoIncrementation() - { - return false; - } - public boolean supportsQueriesInFrom() throws SQLException { return m_connectionTools.getDataSourceMetaData().supportsQueriesInFrom(); diff --git a/wizards/com/sun/star/wizards/db/FieldColumn.java b/wizards/com/sun/star/wizards/db/FieldColumn.java index c7925144e423..c5fcfc2bd6e2 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 c5695e515bb3..f59e16791ff3 100644 --- a/wizards/com/sun/star/wizards/db/QueryMetaData.java +++ b/wizards/com/sun/star/wizards/db/QueryMetaData.java @@ -132,24 +132,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() { @@ -192,11 +175,7 @@ public class QueryMetaData extends CommandMetaData return sIncludedCommandNames; } - public String[] getFieldNamesOfCommand(String _sCommandName) - { - CommandObject oTable = getTableByName(_sCommandName); - return oTable.getColumns().getElementNames(); - } + public void initializeFieldTitleSet(boolean _bAppendMode) { diff --git a/wizards/com/sun/star/wizards/db/RecordParser.java b/wizards/com/sun/star/wizards/db/RecordParser.java index 4c11a9b00352..5e6f19d22d29 100644 --- a/wizards/com/sun/star/wizards/db/RecordParser.java +++ b/wizards/com/sun/star/wizards/db/RecordParser.java @@ -29,10 +29,8 @@ import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; import com.sun.star.wizards.common.Helper; import com.sun.star.sdb.XCompletedExecution; -import com.sun.star.lang.Locale; import com.sun.star.wizards.common.InvalidQueryException; import com.sun.star.wizards.common.JavaTools; -import com.sun.star.wizards.common.NumberFormatter; import com.sun.star.sdbc.XResultSet; import com.sun.star.task.XInteractionHandler; import com.sun.star.wizards.common.PropertyNames; @@ -51,12 +49,6 @@ public class RecordParser extends QueryMetaData public FieldColumn[] GroupFieldColumns; public FieldColumn[] RecordFieldColumns; - public RecordParser(XMultiServiceFactory _xMSF, Locale _aLocale, NumberFormatter _oNumberFormatter) - { - super(_xMSF, _aLocale, _oNumberFormatter); - getInterfaces(); - } - /** Creates a new instance of RecordParser */ public RecordParser(XMultiServiceFactory _xMSF) { diff --git a/wizards/com/sun/star/wizards/db/RelationController.java b/wizards/com/sun/star/wizards/db/RelationController.java index 1a2922615fec..639338047d15 100644 --- a/wizards/com/sun/star/wizards/db/RelationController.java +++ b/wizards/com/sun/star/wizards/db/RelationController.java @@ -42,11 +42,6 @@ public class RelationController extends CommandName private static final int FKTABLE_NAME = 7; private static final int FKCOLUMN_NAME = 8; - public RelationController(CommandMetaData _CommandMetaData, String _CatalogName, String _SchemaName, String _TableName, boolean _baddQuotation) - { - super(_CommandMetaData, _CatalogName, _SchemaName, _TableName, _baddQuotation); - } - public RelationController(CommandMetaData _CommandMetaData, String _DisplayName) { super(_CommandMetaData, _DisplayName); diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java index da08c290cad0..de387166800a 100644 --- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java +++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java @@ -21,7 +21,6 @@ package com.sun.star.wizards.db; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.beans.*; import com.sun.star.container.XIndexAccess; -import com.sun.star.sdbcx.XColumnsSupplier; import com.sun.star.sdb.XSingleSelectQueryComposer; import com.sun.star.sdb.XSingleSelectQueryAnalyzer; import com.sun.star.ui.dialogs.XExecutableDialog; @@ -120,20 +119,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 5439663699c4..10cc6345f68f 100644 --- a/wizards/com/sun/star/wizards/db/TableDescriptor.java +++ b/wizards/com/sun/star/wizards/db/TableDescriptor.java @@ -29,7 +29,6 @@ import com.sun.star.beans.XPropertySet; import com.sun.star.container.ContainerEvent; import com.sun.star.container.XContainer; import com.sun.star.container.XContainerListener; -import com.sun.star.container.XHierarchicalNameAccess; import com.sun.star.container.XIndexAccess; import com.sun.star.container.XNameAccess; import com.sun.star.lang.EventObject; @@ -639,32 +638,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; - } + public 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 d992d3477dcc..c76e326af28d 100644 --- a/wizards/com/sun/star/wizards/db/TypeInspector.java +++ b/wizards/com/sun/star/wizards/db/TypeInspector.java @@ -20,7 +20,6 @@ package com.sun.star.wizards.db; import java.util.ArrayList; import com.sun.star.beans.XPropertySet; -import com.sun.star.sdbc.ColumnSearch; import com.sun.star.sdbc.ColumnValue; import com.sun.star.sdbc.DataType; import com.sun.star.sdbc.SQLException; @@ -150,41 +149,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) - { - int i = getDataTypeIndex(_xColPropertySet, false); - if (i > -1) - { - return (nSearchables[i] != ColumnSearch.NONE); - } - else - { - return false; - } - } public int isNullable(XPropertySet _xColPropertySet) { diff --git a/wizards/com/sun/star/wizards/document/Control.java b/wizards/com/sun/star/wizards/document/Control.java index 6c0e1c9873e0..8c25fff86ed0 100644 --- a/wizards/com/sun/star/wizards/document/Control.java +++ b/wizards/com/sun/star/wizards/document/Control.java @@ -27,7 +27,6 @@ import com.sun.star.beans.XPropertySet; import com.sun.star.beans.XPropertySetInfo; import com.sun.star.container.XNameAccess; import com.sun.star.container.XNameContainer; -import com.sun.star.container.XNamed; import com.sun.star.wizards.common.*; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; diff --git a/wizards/com/sun/star/wizards/document/DatabaseControl.java b/wizards/com/sun/star/wizards/document/DatabaseControl.java index f3a728852355..f70f8347fee5 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; - } + public void setNumericLimits() { try diff --git a/wizards/com/sun/star/wizards/document/FormHandler.java b/wizards/com/sun/star/wizards/document/FormHandler.java index b07f45a2a762..7b6c016457b3 100644 --- a/wizards/com/sun/star/wizards/document/FormHandler.java +++ b/wizards/com/sun/star/wizards/document/FormHandler.java @@ -158,24 +158,6 @@ 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; - } - } - public void initializeBasicControlValues() { Control oLabelControl = new Control(this, SOLABEL, new Point(), new Size()); @@ -253,22 +235,6 @@ 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) { try @@ -348,11 +314,6 @@ public class FormHandler } } - public XNameContainer insertSubFormbyName(String _FormName, XNameContainer _xNamedFormContainer) - { - return insertFormbyName(_FormName, _xNamedFormContainer); - } - public XNameContainer insertFormbyName(String _FormName) { return insertFormbyName(_FormName, getDocumentForms()); @@ -429,31 +390,6 @@ 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 * @@ -464,18 +400,6 @@ 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 a66cdcfa392b..b577a04f2afe 100644 --- a/wizards/com/sun/star/wizards/document/OfficeDocument.java +++ b/wizards/com/sun/star/wizards/document/OfficeDocument.java @@ -20,12 +20,6 @@ package com.sun.star.wizards.document; import com.sun.star.lang.IllegalArgumentException; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.container.XNameAccess; -import com.sun.star.document.XDocumentProperties; -import com.sun.star.document.XDocumentPropertiesSupplier; -import com.sun.star.document.XEventsSupplier; -import com.sun.star.document.XTypeDetection; -import com.sun.star.drawing.XDrawPagesSupplier; import com.sun.star.wizards.common.*; import com.sun.star.awt.Rectangle; import com.sun.star.awt.VclWindowPeerAttribute; @@ -37,9 +31,7 @@ import com.sun.star.awt.XWindowPeer; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.PropertyVetoException; import com.sun.star.sheet.XCellRangeData; -import com.sun.star.sheet.XSpreadsheetDocument; import com.sun.star.table.XCellRange; -import com.sun.star.task.XInteractionHandler; import com.sun.star.text.XTextDocument; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; @@ -51,7 +43,6 @@ import com.sun.star.frame.XFrame; import com.sun.star.frame.XFrames; import com.sun.star.frame.XFramesSupplier; import com.sun.star.frame.XModel; -import com.sun.star.frame.XStorable; import com.sun.star.frame.XTerminateListener; import com.sun.star.util.XCloseable; import com.sun.star.util.XModifiable; @@ -61,31 +52,6 @@ public class OfficeDocument private XWindowPeer xWindowPeer; - /** Creates a new instance of OfficeDocument */ - public OfficeDocument(XMultiServiceFactory _xMSF) - { - } - - 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) { try @@ -108,52 +74,6 @@ 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) { return createNewFrame(xMSF, listener, "_blank"); @@ -273,44 +193,6 @@ 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) { boolean bState = false; @@ -366,60 +248,6 @@ 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/document/TimeStampControl.java b/wizards/com/sun/star/wizards/document/TimeStampControl.java index 5bac092cd946..c00263171a49 100644 --- a/wizards/com/sun/star/wizards/document/TimeStampControl.java +++ b/wizards/com/sun/star/wizards/document/TimeStampControl.java @@ -30,7 +30,6 @@ import com.sun.star.uno.UnoRuntime; import com.sun.star.container.XNameContainer; import com.sun.star.drawing.XControlShape; import com.sun.star.drawing.XShape; -import com.sun.star.drawing.XShapes; public class TimeStampControl extends DatabaseControl { diff --git a/wizards/com/sun/star/wizards/form/FormControlArranger.java b/wizards/com/sun/star/wizards/form/FormControlArranger.java index 4e2613498dd1..8c3fc796b25d 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 17abf915cea9..55386e750802 100644 --- a/wizards/com/sun/star/wizards/form/StyleApplier.java +++ b/wizards/com/sun/star/wizards/form/StyleApplier.java @@ -22,7 +22,6 @@ import com.sun.star.awt.XListBox; import com.sun.star.awt.XRadioButton; import com.sun.star.beans.XPropertySet; import com.sun.star.container.XNameAccess; -import com.sun.star.lang.EventObject; import com.sun.star.lang.IllegalArgumentException; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.AnyConverter; @@ -297,9 +296,7 @@ public class StyleApplier curFormDocument.unlockallControllers(); } - public void disposing(EventObject eventObject) - { - } + private int getStyleColor(String[] _sDataList, String _sHeader, String _sPropertyDescription) { diff --git a/wizards/com/sun/star/wizards/report/DBColumn.java b/wizards/com/sun/star/wizards/report/DBColumn.java index d0a039fdd830..a3fd4c158b37 100644 --- a/wizards/com/sun/star/wizards/report/DBColumn.java +++ b/wizards/com/sun/star/wizards/report/DBColumn.java @@ -34,7 +34,6 @@ import com.sun.star.text.XTextTable; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; -import com.sun.star.util.XNumberFormats; import com.sun.star.wizards.db.*; import com.sun.star.wizards.common.*; import com.sun.star.wizards.text.TextDocument; @@ -64,12 +63,6 @@ public class DBColumn RecordTable CurRecordTable; TextTableHandler oTextTableHandler; - public DBColumn(TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i) - { - CurRecordTable = new RecordTable(_oTextTableHandler); - initializeRecordTableMembers(CurRecordTable, _oTextTableHandler, _CurDBMetaData, i, false); - } - public DBColumn(RecordTable _CurRecordTable, TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i, boolean _bforce) { initializeRecordTableMembers(_CurRecordTable, _oTextTableHandler, _CurDBMetaData, i, _bforce); @@ -246,14 +239,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/ReportTextDocument.java b/wizards/com/sun/star/wizards/report/ReportTextDocument.java index 7582da8cfbaf..5daa5e549f53 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextDocument.java +++ b/wizards/com/sun/star/wizards/report/ReportTextDocument.java @@ -115,29 +115,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) { @@ -207,11 +185,6 @@ 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); - } - public void getReportPageStyles() { try @@ -332,16 +305,6 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen } } - public void replaceFieldValueInRecordSection(int RecordCount) - { - int GroupCount = CurDBMetaData.GroupFieldNames.length; - int FieldCount = CurDBMetaData.getFieldNames().length; - for (int i = GroupCount; i < FieldCount; i++) - { - DBColumnsVector.get(i).insertColumnData(oTextFieldHandler, this.bIsCurLandscape); - } - } - public void updateTextSections(String[] SelGroupNames) { String TableName; @@ -373,22 +336,6 @@ 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); - } - } - public void insertColumnstoRecordTable() { int GroupCount = CurDBMetaData.GroupFieldNames.length; diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java index 60d14dd68b9a..8b0aef149f67 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java +++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java @@ -844,10 +844,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); - } + protected 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 fdeaed608b7b..d47b868c46bf 100644 --- a/wizards/com/sun/star/wizards/table/FieldFormatter.java +++ b/wizards/com/sun/star/wizards/table/FieldFormatter.java @@ -414,10 +414,7 @@ public class FieldFormatter implements XItemListener txtfieldname.setText(_ColumnName); } - public XPropertySet clonePropertySet(XPropertySet _xPropertySet) - { - return null; - } + public void itemStateChanged(ItemEvent arg0) { diff --git a/wizards/com/sun/star/wizards/table/ScenarioSelector.java b/wizards/com/sun/star/wizards/table/ScenarioSelector.java index 505d9e443850..77bad43d6ec1 100644 --- a/wizards/com/sun/star/wizards/table/ScenarioSelector.java +++ b/wizards/com/sun/star/wizards/table/ScenarioSelector.java @@ -274,14 +274,9 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X return smytable; } - public void fillupTables() - { - } - public void fillupFieldsListbox() - { - super.emptyFieldsListBoxes(); - } + + /* (non-Javadoc) diff --git a/wizards/com/sun/star/wizards/text/TextDocument.java b/wizards/com/sun/star/wizards/text/TextDocument.java index 8f4bb374387e..e4979265fc81 100644 --- a/wizards/com/sun/star/wizards/text/TextDocument.java +++ b/wizards/com/sun/star/wizards/text/TextDocument.java @@ -17,53 +17,32 @@ */ package com.sun.star.wizards.text; -import java.util.Calendar; -import java.util.GregorianCalendar; - -import com.sun.star.container.NoSuchElementException; -import com.sun.star.container.XNameAccess; -import com.sun.star.document.XDocumentProperties; import com.sun.star.document.XDocumentPropertiesSupplier; -import com.sun.star.frame.XController; import com.sun.star.frame.XComponentLoader; import com.sun.star.frame.XDesktop; -import com.sun.star.frame.XFramesSupplier; import com.sun.star.frame.XLoadable; -import com.sun.star.frame.XModel; import com.sun.star.frame.XModule; import com.sun.star.frame.XTerminateListener; import com.sun.star.frame.XStorable; -import com.sun.star.i18n.NumberFormatIndex; import com.sun.star.awt.Size; -import com.sun.star.awt.XWindow; import com.sun.star.awt.XWindowPeer; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.PropertyVetoException; import com.sun.star.lang.Locale; -import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.style.XStyle; import com.sun.star.style.XStyleFamiliesSupplier; import com.sun.star.task.XStatusIndicatorFactory; -import com.sun.star.text.XPageCursor; import com.sun.star.text.XSimpleText; import com.sun.star.text.XText; -import com.sun.star.text.XTextContent; import com.sun.star.text.XTextCursor; import com.sun.star.text.XTextDocument; -import com.sun.star.text.XTextViewCursor; -import com.sun.star.text.XTextViewCursorSupplier; import com.sun.star.uno.UnoRuntime; -import com.sun.star.util.DateTime; import com.sun.star.util.XModifiable; import com.sun.star.util.XNumberFormatsSupplier; -import com.sun.star.util.XRefreshable; -import com.sun.star.wizards.common.Configuration; import com.sun.star.wizards.common.Desktop; import com.sun.star.wizards.common.Helper; -import com.sun.star.wizards.common.JavaTools; -import com.sun.star.wizards.common.Helper.DateUtils; import com.sun.star.wizards.common.PropertyNames; import com.sun.star.wizards.document.OfficeDocument; @@ -85,13 +64,6 @@ public class TextDocument public com.sun.star.lang.Locale CharLocale; public XStorable xStorable; - // creates an instance of TextDocument and creates a named frame. No document is actually loaded into this frame. - public TextDocument(XMultiServiceFactory xMSF, XTerminateListener listener, String FrameName) - { - this.xMSF = xMSF; - xFrame = OfficeDocument.createNewFrame(xMSF, listener, FrameName); - } - // creates an instance of TextDocument by loading a given URL as preview public TextDocument(XMultiServiceFactory xMSF, String _sPreviewURL, boolean bShowStatusIndicator, XTerminateListener listener) { @@ -108,24 +80,6 @@ public class TextDocument init(); } - // creates an instance of TextDocument from the desktop's current frame - public TextDocument(XMultiServiceFactory xMSF, boolean bShowStatusIndicator, XTerminateListener listener) - { - this.xMSF = xMSF; - - XDesktop xDesktop = Desktop.getDesktop(xMSF); - XFramesSupplier xFrameSupplier = UnoRuntime.queryInterface(XFramesSupplier.class, xDesktop); - xFrame = xFrameSupplier.getActiveFrame(); - xComponent = UnoRuntime.queryInterface(XComponent.class, xFrame.getController().getModel()); - xTextDocument = UnoRuntime.queryInterface(XTextDocument.class, xComponent); - - if (bShowStatusIndicator) - { - showStatusIndicator(); - } - init(); - } - public static class ModuleIdentifier { @@ -300,26 +254,6 @@ public class TextDocument } } - //creates an instance of TextDocument and creates a frame and loads a document - public TextDocument(XMultiServiceFactory xMSF, String URL, PropertyValue[] xArgs, XTerminateListener listener) - { - this.xMSF = xMSF; - - xFrame = OfficeDocument.createNewFrame(xMSF, listener); - Object oDoc = OfficeDocument.load(xFrame, URL, "_self", xArgs); - xTextDocument = (XTextDocument) oDoc; - xComponent = UnoRuntime.queryInterface(XComponent.class, xTextDocument); - XWindow xWindow = xFrame.getComponentWindow(); - - xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xWindow); - xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument); - xNumberFormatsSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument); - - XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument); - m_xDocProps = xDocPropsSuppl.getDocumentProperties(); - CharLocale = (Locale) Helper.getUnoStructValue(xComponent, "CharLocale"); - } - public static XTextCursor createTextCursor(Object oCursorContainer) { XSimpleText xText = UnoRuntime.queryInterface(XSimpleText.class, oCursorContainer); @@ -332,29 +266,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() { @@ -364,103 +276,4 @@ 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 f98e37abcf55..28e0ef9e9aae 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", Short.valueOf(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 dfc3485312ad..527e705486c5 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() { @@ -169,18 +165,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 1be1e6717ccb..91a12677aa73 100644 --- a/wizards/com/sun/star/wizards/text/TextTableHandler.java +++ b/wizards/com/sun/star/wizards/text/TextTableHandler.java @@ -23,7 +23,6 @@ import com.sun.star.container.XNamed; import com.sun.star.frame.XFrame; import com.sun.star.lang.Locale; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.style.BreakType; import com.sun.star.table.XCellRange; import com.sun.star.text.XSimpleText; import com.sun.star.text.XTextContent; @@ -33,7 +32,6 @@ import com.sun.star.text.XTextTablesSupplier; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XInterface; import com.sun.star.util.XNumberFormatsSupplier; import com.sun.star.view.XSelectionSupplier; import com.sun.star.wizards.common.Desktop; @@ -108,24 +106,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() { @@ -205,12 +186,6 @@ public class TextTableHandler } } - public static BreakType resetBreakTypeofTextTable(Object oTextTable) - { - Helper.setUnoPropertyValue(oTextTable, "BreakType", BreakType.NONE); - return BreakType.NONE; - } - public void adjustOptimalTableWidths(XMultiServiceFactory _xMSF, XTextTable xTextTable) { try diff --git a/wizards/com/sun/star/wizards/ui/ButtonList.java b/wizards/com/sun/star/wizards/ui/ButtonList.java index ea6aa95a1fab..3ae9bc8832f5 100644 --- a/wizards/com/sun/star/wizards/ui/ButtonList.java +++ b/wizards/com/sun/star/wizards/ui/ButtonList.java @@ -18,8 +18,6 @@ package com.sun.star.wizards.ui; import javax.swing.ListModel; -import javax.swing.event.ListDataEvent; - import com.sun.star.awt.ActionEvent; import com.sun.star.awt.Size; import com.sun.star.awt.XActionListener; @@ -369,29 +367,6 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener return pageStart + i; } - public void contentsChanged(ListDataEvent event) - { - } - - 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(); - } - } - - public void intervalRemoved(ListDataEvent event) - { - } - /** Registers ItemListener to receive events. * @param listener The listener to register. */ @@ -669,17 +644,6 @@ 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() { return benabled; diff --git a/wizards/com/sun/star/wizards/ui/ControlScroller.java b/wizards/com/sun/star/wizards/ui/ControlScroller.java index 67349aace9ce..fc4873abde7c 100644 --- a/wizards/com/sun/star/wizards/ui/ControlScroller.java +++ b/wizards/com/sun/star/wizards/ui/ControlScroller.java @@ -118,10 +118,7 @@ public abstract class ControlScroller } } - protected void setScrollBarOrientationHorizontal() - { - Helper.setUnoPropertyValue(xScrollBar, PropertyNames.ORIENTATION, Integer.valueOf(ScrollBarOrientation.HORIZONTAL)); - } + /** * @param _ntotfieldcount The number of fields that are to be administered by the ControlScroller @@ -280,29 +277,11 @@ public abstract class ControlScroller return nscrollvalue; } - protected void setLineIncrementation(int _nlineincrement) - { - this.nlineincrement = _nlineincrement; - Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), "LineIncrement", Integer.valueOf(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), Integer.valueOf(nblockincrement), Integer.valueOf(ntotfieldcount - nblockincrement) - }); - } + + protected int getBlockIncrementation() { @@ -398,10 +377,7 @@ public abstract class ControlScroller } } - protected PropertyValue[] getControlGroupInfo(int _i) - { - return scrollfields.get(_i); - } + protected 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 355b8776e29e..291f1b41d33e 100644 --- a/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java @@ -128,14 +128,7 @@ 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 9f43570e3276..b4998fdedc46 100644 --- a/wizards/com/sun/star/wizards/ui/FieldSelection.java +++ b/wizards/com/sun/star/wizards/ui/FieldSelection.java @@ -481,11 +481,7 @@ public class FieldSelection } } - public void mergeList(String[] AllFieldNames, String[] SecondList) - { - xFieldsListBox.addItems(AllFieldNames, (short) 0); - toggleListboxButtons((short) - 1, (short) - 1); - } + public void intializeSelectedFields(String[] _SelectedFieldNames) { @@ -511,15 +507,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 baa1728e85ab..bb57351fa044 100644 --- a/wizards/com/sun/star/wizards/ui/FilterComponent.java +++ b/wizards/com/sun/star/wizards/ui/FilterComponent.java @@ -173,10 +173,7 @@ public class FilterComponent { } - public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent) - { - getfilterstate(); - } + } public static String getIndexNumber(String _sStr) @@ -927,16 +924,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(boolean bgetDate) - { - 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 e82e287170d3..b25ebe6a6a1f 100644 --- a/wizards/com/sun/star/wizards/ui/PeerConfig.java +++ b/wizards/com/sun/star/wizards/ui/PeerConfig.java @@ -65,12 +65,6 @@ public class PeerConfig implements XWindowListener String propname; Object propvalue; - public ControlTask(Object _oModel, String _propName, Object _propValue) - { - propname = _propName; - propvalue = _propValue; - oModel = _oModel; - } } class ImageUrlTask @@ -163,25 +157,7 @@ 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) { @@ -190,27 +166,6 @@ public class PeerConfig implements XWindowListener } /** - * 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 - * within the wizards project - * wizards project - */ - public void setImageUrl(Object _ocontrolmodel, int _nResId, int _nhcResId) - { - ImageUrlTask oImageUrlTask = new ImageUrlTask(_ocontrolmodel, Integer.valueOf(_nResId), Integer.valueOf(_nhcResId)); - this.aImageUrlTasks.add(oImageUrlTask); - } - - /** * Assigns an image to the property 'ImageUrl' of a dialog control. The image ids that the Resource urls point to * may be assigned in a Resource file outside the wizards project */ diff --git a/wizards/com/sun/star/wizards/ui/SortingComponent.java b/wizards/com/sun/star/wizards/ui/SortingComponent.java index 9e6df49c6c3e..d0816fd5adc6 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" + Integer.valueOf(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 07266709f4f8..d652b519c1dd 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog.java +++ b/wizards/com/sun/star/wizards/ui/UnoDialog.java @@ -18,7 +18,6 @@ package com.sun.star.wizards.ui; import com.sun.star.awt.*; -import com.sun.star.beans.Property; import com.sun.star.beans.XMultiPropertySet; import com.sun.star.beans.XPropertySet; import com.sun.star.container.XNameAccess; @@ -30,8 +29,6 @@ import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.*; import com.sun.star.wizards.common.*; -import com.sun.star.wizards.ui.event.*; - import java.util.HashMap; public class UnoDialog @@ -191,24 +188,7 @@ public class UnoDialog } } - 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) { @@ -262,14 +242,7 @@ public class UnoDialog 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) { @@ -307,42 +280,6 @@ public class UnoDialog 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 = Integer.valueOf(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 = Integer.valueOf(iControlKey); - if (ControlList != null) - { - ControlList.put(sName, ControlKey); - } - } - public XScrollBar insertScrollBar(String sName, int iControlKey, XAdjustmentListener xAdjustmentListener, String[] sProperties, Object[] sValues) { try @@ -424,31 +361,6 @@ public class UnoDialog 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 = Integer.valueOf(iControlKey); - ControlList.put(sName, ControlKey); - return xComboBox; - } - public XRadioButton insertRadioButton(String sName, int iControlKey, XItemListener xItemListener, String[] sProperties, Object[] sValues) { XRadioButton xRadioButton = insertRadioButton(sName, iControlKey, sProperties, sValues); @@ -564,26 +476,6 @@ public class UnoDialog 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) { if (iFieldsSelIndex > -1) @@ -664,15 +556,6 @@ public class UnoDialog /** * @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. - */ public short executeDialog(XInterface xComponent) throws com.sun.star.uno.Exception { XFrame frame = UnoRuntime.queryInterface(XFrame.class, xComponent); @@ -699,15 +582,6 @@ public class UnoDialog 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) { FontDescriptor oFontDesc = new FontDescriptor(); @@ -742,34 +616,6 @@ public class UnoDialog 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) { XControl xControl = UnoRuntime.queryInterface(XControl.class, control); diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.java b/wizards/com/sun/star/wizards/ui/UnoDialog2.java index f91fbf93a151..59fa0bc5a456 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog2.java +++ b/wizards/com/sun/star/wizards/ui/UnoDialog2.java @@ -23,9 +23,7 @@ import com.sun.star.awt.XCheckBox; import com.sun.star.awt.XControl; import com.sun.star.awt.XItemListener; import com.sun.star.awt.XListBox; -import com.sun.star.awt.XProgressBar; import com.sun.star.awt.XRadioButton; -import com.sun.star.awt.XScrollBar; import com.sun.star.awt.XTextComponent; import com.sun.star.awt.XTextListener; import com.sun.star.lang.XMultiServiceFactory; @@ -109,11 +107,7 @@ public class UnoDialog2 extends UnoDialog return xRadioButton; } - 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, XTextListener textListener, String[] sPropNames, Object[] oPropValues) { @@ -160,23 +154,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); - } + + + public Object insertControlModel2(String serviceName, String componentName, String[] sPropNames, Object[] oPropValues) { @@ -202,15 +184,9 @@ public class UnoDialog2 extends UnoDialog return UnoRuntime.queryInterface(type, insertControlModel2(serviceName, componentName, sPropNames, oPropValues)); } - public String translateURL(String relativeURL) - { - return PropertyNames.EMPTY_STRING; - } - 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 fb698318d126..04b477affec3 100644 --- a/wizards/com/sun/star/wizards/ui/WizardDialog.java +++ b/wizards/com/sun/star/wizards/ui/WizardDialog.java @@ -18,14 +18,11 @@ package com.sun.star.wizards.ui; import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; - import com.sun.star.awt.ActionEvent; import com.sun.star.awt.FontDescriptor; import com.sun.star.awt.PushButtonType; import com.sun.star.awt.XControl; import com.sun.star.awt.XItemEventBroadcaster; -import com.sun.star.awt.XItemListener; import com.sun.star.awt.XTopWindow; import com.sun.star.beans.XPropertySet; import com.sun.star.container.XIndexContainer; @@ -372,14 +369,6 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL } /* (non-Javadoc) - * @see com.sun.star.wizards.ui.XCompletion#ismodified(int) - */ - public boolean ismodified(int _ndialogpage) - { - return false; - } - - /* (non-Javadoc) * @see com.sun.star.wizards.ui.XCompletion#setcompleted(int, boolean) */ public void setcompleted(int _ndialogpage, boolean _biscompleted) @@ -512,25 +501,7 @@ 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) { diff --git a/wizards/com/sun/star/wizards/ui/XCompletion.java b/wizards/com/sun/star/wizards/ui/XCompletion.java index 6239d2621316..f51f096a81ef 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 boolean iscompleted(int _ndialogpage); - void setmodified(int _ndialogpage, Object ooldValue, Object onewValue); - boolean ismodified(int _ndialogpage); + + } diff --git a/wizards/com/sun/star/wizards/ui/XFieldSelectionListener.java b/wizards/com/sun/star/wizards/ui/XFieldSelectionListener.java index a0c3714b22af..4a592b3a7aa0 100644 --- a/wizards/com/sun/star/wizards/ui/XFieldSelectionListener.java +++ b/wizards/com/sun/star/wizards/ui/XFieldSelectionListener.java @@ -31,5 +31,5 @@ public interface XFieldSelectionListener void setID(String sIncSuffix); - int getID(); + } diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.java b/wizards/com/sun/star/wizards/ui/event/DataAware.java index b7cf05eed905..55fa01f1840b 100644 --- a/wizards/com/sun/star/wizards/ui/event/DataAware.java +++ b/wizards/com/sun/star/wizards/ui/event/DataAware.java @@ -20,9 +20,6 @@ package com.sun.star.wizards.ui.event; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Arrays; -import java.util.Collection; -import java.util.Iterator; - import com.sun.star.wizards.common.PropertyNames; /** @@ -69,24 +66,6 @@ public abstract class DataAware { } /** - * sets a new data object. Optionally - * update the UI. - * @param obj the new data object. - * @param updateUI if true updateUI() will be called. - */ - public void setDataObject(Object obj, boolean updateUI) { - - if (obj != null && !value.isAssignable(obj.getClass())) - throw new ClassCastException("can not cast new DataObject to original Class"); - - dataObject = obj; - - if (updateUI) - updateUI(); - - } - - /** * Sets the given value to the data object. * this method delegates the job to the * Value object, but can be overwritten if @@ -120,23 +99,6 @@ public abstract class DataAware { protected abstract Object getFromUI(); /** - * updates the UI control according to the - * current state of the data object. - */ - public void updateUI() { - Object data = getFromData(); - Object ui = getFromUI(); - if (!equals(data, ui)) - try { - setToUI(data); - } catch (Exception ex) { - ex.printStackTrace(); - //TODO tell user... - } - enableControls(data); - } - - /** * enables * @param currentValue */ @@ -181,33 +143,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 @@ -232,14 +172,6 @@ public abstract class DataAware { * @param target the object to set the value to. */ void set(Object value, Object target); - /** - * checks if this Value object can handle - * the given object type as a target. - * @param type the type of a target to check - * @return true if the given class is acceptable for - * the Value object. False if not. - */ - boolean isAssignable(Class<?> type); } /** @@ -337,12 +269,5 @@ public abstract class DataAware { } } - /* (non-Javadoc) - * @see com.sun.star.wizards.ui.event.DataAware.Value#isAssignable(java.lang.Class) - */ - public boolean isAssignable(Class<?> type) { - return getMethod.getDeclaringClass().isAssignableFrom(type) && - setMethod.getDeclaringClass().isAssignableFrom(type); - } } } diff --git a/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java b/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java index f10df1748420..ee5ba4df539c 100644 --- a/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java +++ b/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java @@ -89,10 +89,6 @@ public class DataAwareFields field = field_; } - public boolean isAssignable(Class<?> type) - { - return field.getDeclaringClass().isAssignableFrom(type); - } } private static class BooleanFieldValue extends FieldValue diff --git a/wizards/com/sun/star/wizards/ui/event/Task.java b/wizards/com/sun/star/wizards/ui/event/Task.java index 50ba5d6a158b..5ff9aa4bef84 100644 --- a/wizards/com/sun/star/wizards/ui/event/Task.java +++ b/wizards/com/sun/star/wizards/ui/event/Task.java @@ -37,16 +37,6 @@ public class Task max = max_; } - public void start() - { - fireTaskStarted(); - } - - public void fail() - { - fireTaskFailed(); - } - public int getMax() { return max; @@ -58,44 +48,11 @@ public class Task fireTaskStatusChanged(); } - public void advance(boolean success_) - { - if (success_) - { - successful++; - } - else - { - failed++; - } - fireTaskStatusChanged(); - if (failed + successful == max) - { - fireTaskFinished(); - } - } - - 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); - } - protected void fireTaskStatusChanged() { TaskEvent te = new TaskEvent(this, TaskEvent.TASK_STATUS_CHANGED); @@ -106,36 +63,6 @@ public class Task } } - protected void fireTaskStarted() - { - TaskEvent te = new TaskEvent(this, TaskEvent.TASK_STARTED); - - for (int i = 0; i < listeners.size(); i++) - { - listeners.get(i).taskStarted(te); - } - } - - protected void fireTaskFailed() - { - TaskEvent te = new TaskEvent(this, TaskEvent.TASK_FAILED); - - for (int i = 0; i < listeners.size(); i++) - { - listeners.get(i).taskFinished(te); - } - } - - protected void fireTaskFinished() - { - TaskEvent te = new TaskEvent(this, TaskEvent.TASK_FINISHED); - - for (int i = 0; i < listeners.size(); i++) - { - listeners.get(i).taskFinished(te); - } - } - protected void fireSubtaskNameChanged() { TaskEvent te = new TaskEvent(this, TaskEvent.SUBTASK_NAME_CHANGED); diff --git a/wizards/com/sun/star/wizards/ui/event/TaskListener.java b/wizards/com/sun/star/wizards/ui/event/TaskListener.java index 61c8b2bfd0d0..4db9ec92ee1e 100644 --- a/wizards/com/sun/star/wizards/ui/event/TaskListener.java +++ b/wizards/com/sun/star/wizards/ui/event/TaskListener.java @@ -22,8 +22,6 @@ import java.util.EventListener; public interface TaskListener extends EventListener { - void taskStarted(TaskEvent te); - void taskFinished(TaskEvent te); /** diff --git a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java index 609cc4275325..50e753f96d0d 100644 --- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java +++ b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java @@ -110,75 +110,13 @@ public class UnoDataAware extends DataAware } } - public void disableControls(Object[] controls) - { - disableObjects = controls; - } + protected Object getFromUI() { return Helper.getUnoPropertyValue(unoModel, unoPropName); } - private static UnoDataAware attachTextControl(Object data, String prop, Object unoText, final Listener listener, String unoProperty, boolean field, Object value) - { - XTextComponent text = UnoRuntime.queryInterface(XTextComponent.class, unoText); - final UnoDataAware uda = new UnoDataAware(data, - field - ? DataAwareFields.getFieldValueFor(data, prop, value) - : new DataAware.PropertyValue(prop, data), - text, unoProperty); - text.addTextListener(new XTextListener() - { - - public void textChanged(TextEvent te) - { - uda.updateData(); - if (listener != null) - { - listener.eventPerformed(te); - } - } - - public void disposing(EventObject eo) - { - } - }); - 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, Short.valueOf((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) { return new XItemListener() @@ -199,36 +137,11 @@ public class UnoDataAware extends DataAware }; } - public static UnoDataAware attachLabel(Object data, String prop, Object label, final Listener listener, boolean field) - { - return new UnoDataAware(data, - field ? DataAwareFields.getFieldValueFor(data, prop, 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); - } - public static void setEnabled(Object control, Boolean enabled) { Helper.setUnoPropertyValue(getModel(control), PropertyNames.PROPERTY_ENABLED, enabled); |