summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-11-27 11:45:23 +0200
committerNoel Grandin <noel@peralex.com>2014-11-27 14:19:30 +0200
commit5c6d6c7c35be1f1d7299c9d3e74c143f79712aa8 (patch)
tree3e1ec72c5913755d6553935a09ec78a3434ec5b9 /wizards
parent4b919338931678aa43e24d65fe5d4524971aa045 (diff)
java,wizards: remove unused classes
found by UCDetector Change-Id: I7993f781a9e195d7d591e8a9e94a72ee86d77826
Diffstat (limited to 'wizards')
-rw-r--r--wizards/Jar_commonwizards.mk22
-rw-r--r--wizards/com/sun/star/wizards/common/ConfigGroup.java166
-rw-r--r--wizards/com/sun/star/wizards/common/ConfigNode.java43
-rw-r--r--wizards/com/sun/star/wizards/common/ConfigSet.java428
-rw-r--r--wizards/com/sun/star/wizards/common/Configuration.java132
-rw-r--r--wizards/com/sun/star/wizards/common/Desktop.java26
-rw-r--r--wizards/com/sun/star/wizards/common/FileAccess.java38
-rw-r--r--wizards/com/sun/star/wizards/common/Helper.java103
-rw-r--r--wizards/com/sun/star/wizards/common/Indexable.java24
-rw-r--r--wizards/com/sun/star/wizards/common/JavaTools.java7
-rw-r--r--wizards/com/sun/star/wizards/common/NumberFormatter.java30
-rw-r--r--wizards/com/sun/star/wizards/common/NumericalHelper.java90
-rw-r--r--wizards/com/sun/star/wizards/common/SystemDialog.java197
-rw-r--r--wizards/com/sun/star/wizards/common/UCB.java239
-rw-r--r--wizards/com/sun/star/wizards/common/XMLHelper.java54
-rw-r--r--wizards/com/sun/star/wizards/common/XMLProvider.java26
-rw-r--r--wizards/com/sun/star/wizards/db/ColumnPropertySet.java1
-rw-r--r--wizards/com/sun/star/wizards/db/CommandMetaData.java7
-rw-r--r--wizards/com/sun/star/wizards/db/DBMetaData.java8
-rw-r--r--wizards/com/sun/star/wizards/db/QueryMetaData.java6
-rw-r--r--wizards/com/sun/star/wizards/document/Control.java7
-rw-r--r--wizards/com/sun/star/wizards/document/DatabaseControl.java16
-rw-r--r--wizards/com/sun/star/wizards/text/TextFrameHandler.java40
-rw-r--r--wizards/com/sun/star/wizards/ui/DocumentPreview.java160
-rw-r--r--wizards/com/sun/star/wizards/ui/ImageList.java983
-rw-r--r--wizards/com/sun/star/wizards/ui/PathSelection.java192
-rw-r--r--wizards/com/sun/star/wizards/ui/XPathSelectionListener.java25
-rw-r--r--wizards/com/sun/star/wizards/ui/event/DataAware.java99
-rw-r--r--wizards/com/sun/star/wizards/ui/event/EventNames.java38
-rw-r--r--wizards/com/sun/star/wizards/ui/event/ListModelBinder.java172
-rw-r--r--wizards/com/sun/star/wizards/ui/event/MethodInvocation.java74
-rw-r--r--wizards/com/sun/star/wizards/ui/event/RadioDataAware.java86
-rw-r--r--wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java75
-rw-r--r--wizards/com/sun/star/wizards/ui/event/Task.java101
-rw-r--r--wizards/com/sun/star/wizards/ui/event/TaskEvent.java42
-rw-r--r--wizards/com/sun/star/wizards/ui/event/TaskListener.java33
-rw-r--r--wizards/com/sun/star/wizards/ui/event/UnoDataAware.java149
-rw-r--r--wizards/com/sun/star/wizards/ui/event/XMouseListenerAdapter.java39
38 files changed, 0 insertions, 3978 deletions
diff --git a/wizards/Jar_commonwizards.mk b/wizards/Jar_commonwizards.mk
index 5ced27e633ed..0e5ac5f08cc5 100644
--- a/wizards/Jar_commonwizards.mk
+++ b/wizards/Jar_commonwizards.mk
@@ -45,15 +45,8 @@ $(eval $(call gb_Jar_add_sourcefiles,commonwizards,\
wizards/com/sun/star/wizards/common/Resource \
wizards/com/sun/star/wizards/common/SystemDialog \
wizards/com/sun/star/wizards/common/Configuration \
- wizards/com/sun/star/wizards/common/ConfigNode \
- wizards/com/sun/star/wizards/common/ConfigGroup \
- wizards/com/sun/star/wizards/common/ConfigSet \
- wizards/com/sun/star/wizards/common/XMLProvider \
- wizards/com/sun/star/wizards/common/XMLHelper \
wizards/com/sun/star/wizards/common/IRenderer \
- wizards/com/sun/star/wizards/common/Indexable \
wizards/com/sun/star/wizards/common/TerminateWizardException \
- wizards/com/sun/star/wizards/common/UCB \
wizards/com/sun/star/wizards/common/DebugHelper \
wizards/com/sun/star/wizards/common/PropertySetHelper \
wizards/com/sun/star/wizards/common/NumericalHelper \
@@ -77,30 +70,17 @@ $(eval $(call gb_Jar_add_sourcefiles,commonwizards,\
wizards/com/sun/star/wizards/db/DatabaseObjectWizard \
wizards/com/sun/star/wizards/ui/event/DataAware \
wizards/com/sun/star/wizards/ui/event/DataAwareFields \
- wizards/com/sun/star/wizards/ui/event/EventNames \
- wizards/com/sun/star/wizards/ui/event/ListModelBinder \
- wizards/com/sun/star/wizards/ui/event/MethodInvocation \
- wizards/com/sun/star/wizards/ui/event/RadioDataAware \
- wizards/com/sun/star/wizards/ui/event/SimpleDataAware \
- wizards/com/sun/star/wizards/ui/event/Task \
- wizards/com/sun/star/wizards/ui/event/TaskEvent \
- wizards/com/sun/star/wizards/ui/event/TaskListener \
- wizards/com/sun/star/wizards/ui/event/UnoDataAware \
wizards/com/sun/star/wizards/ui/event/XActionListenerAdapter \
wizards/com/sun/star/wizards/ui/event/XItemListenerAdapter \
- wizards/com/sun/star/wizards/ui/event/XMouseListenerAdapter \
wizards/com/sun/star/wizards/ui/event/XTextListenerAdapter \
wizards/com/sun/star/wizards/ui/event/XWindowListenerAdapter \
wizards/com/sun/star/wizards/ui/AggregateComponent \
wizards/com/sun/star/wizards/ui/CommandFieldSelection \
wizards/com/sun/star/wizards/ui/ControlScroller \
wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection \
- wizards/com/sun/star/wizards/ui/DocumentPreview \
wizards/com/sun/star/wizards/ui/FilterComponent \
wizards/com/sun/star/wizards/ui/FieldSelection \
- wizards/com/sun/star/wizards/ui/ImageList \
wizards/com/sun/star/wizards/ui/ButtonList \
- wizards/com/sun/star/wizards/ui/PathSelection \
wizards/com/sun/star/wizards/ui/PeerConfig \
wizards/com/sun/star/wizards/ui/SortingComponent \
wizards/com/sun/star/wizards/ui/TitlesComponent \
@@ -109,7 +89,6 @@ $(eval $(call gb_Jar_add_sourcefiles,commonwizards,\
wizards/com/sun/star/wizards/ui/UnoDialog \
wizards/com/sun/star/wizards/ui/UnoDialog2 \
wizards/com/sun/star/wizards/ui/XFieldSelectionListener \
- wizards/com/sun/star/wizards/ui/XPathSelectionListener \
wizards/com/sun/star/wizards/ui/XCompletion \
wizards/com/sun/star/wizards/document/Control \
wizards/com/sun/star/wizards/document/DatabaseControl \
@@ -120,7 +99,6 @@ $(eval $(call gb_Jar_add_sourcefiles,commonwizards,\
wizards/com/sun/star/wizards/document/TimeStampControl \
wizards/com/sun/star/wizards/text/TextDocument \
wizards/com/sun/star/wizards/text/TextFieldHandler \
- wizards/com/sun/star/wizards/text/TextFrameHandler \
wizards/com/sun/star/wizards/text/TextSectionHandler \
wizards/com/sun/star/wizards/text/TextStyleHandler \
wizards/com/sun/star/wizards/text/TextTableHandler \
diff --git a/wizards/com/sun/star/wizards/common/ConfigGroup.java b/wizards/com/sun/star/wizards/common/ConfigGroup.java
deleted file mode 100644
index 0790c1a7045e..000000000000
--- a/wizards/com/sun/star/wizards/common/ConfigGroup.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.common;
-
-import java.lang.reflect.Field;
-
-public class ConfigGroup implements ConfigNode
-{
-
- public Object root;
-
- public void writeConfiguration(Object configurationView, Object param)
- {
- Field[] fields = getClass().getFields();
- for (int i = 0; i < fields.length; i++)
- {
- if (fields[i].getName().startsWith((String) param))
- {
- try
- {
- writeField(fields[i], configurationView, (String) param);
- }
- catch (Exception ex)
- {
- System.out.println("Error writing field: " + fields[i].getName());
- ex.printStackTrace();
- }
- }
- }
- }
-
- private void writeField(Field field, Object configView, String prefix) throws Exception
- {
- String propertyName = field.getName().substring(prefix.length());
- Class<?> fieldType = field.getType();
- if (ConfigNode.class.isAssignableFrom(fieldType))
- {
- Object childView = Configuration.addConfigNode(configView, propertyName);
- ConfigNode child = (ConfigNode) field.get(this);
- child.writeConfiguration(childView, prefix);
- }
- else if (fieldType.isPrimitive())
- {
- Configuration.set(convertValue(field), propertyName, configView);
- }
- else if (fieldType.equals(String.class))
- {
- Configuration.set(field.get(this), propertyName, configView);
- }
- }
-
- /**
- * Convert the primitive type value of the
- * given Field object to the corresponding
- * Java Object value.
- * @return the value of the field as a Object.
- */
- public Object convertValue(Field field) throws IllegalAccessException
- {
- if (field.getType().equals(Boolean.TYPE))
- {
- return (field.getBoolean(this) ? Boolean.TRUE : Boolean.FALSE);
- }
- if (field.getType().equals(Integer.TYPE))
- {
- return Integer.valueOf(field.getInt(this));
- }
- if (field.getType().equals(Short.TYPE))
- {
- return Short.valueOf(field.getShort(this));
- }
- if (field.getType().equals(Float.TYPE))
- {
- return new Double(field.getFloat(this));
- }
- if (field.getType().equals(Double.TYPE))
- {
- return new Double(field.getDouble(this));
- }
- return null; //and good luck with it :-) ...
- }
-
- public void readConfiguration(Object configurationView, Object param)
- {
- Field[] fields = getClass().getFields();
- for (int i = 0; i < fields.length; i++)
- {
- if (fields[i].getName().startsWith((String) param))
- {
- try
- {
- readField(fields[i], configurationView, (String) param);
- }
- catch (Exception ex)
- {
- System.out.println("Error reading field: " + fields[i].getName());
- ex.printStackTrace();
- }
- }
- }
- }
-
- private void readField(Field field, Object configView, String prefix) throws Exception
- {
- String propertyName = field.getName().substring(prefix.length());
-
- Class<?> fieldType = field.getType();
- if (ConfigNode.class.isAssignableFrom(fieldType))
- {
- ConfigNode child = (ConfigNode) field.get(this);
- child.setRoot(root);
- child.readConfiguration(Configuration.getNode(propertyName, configView), prefix);
- }
- else if (fieldType.isPrimitive())
- {
- if (fieldType.equals(Boolean.TYPE))
- {
- field.setBoolean(this, Configuration.getBoolean(propertyName, configView));
- }
- else if (fieldType.equals(Integer.TYPE))
- {
- field.setInt(this, Configuration.getInt(propertyName, configView));
- }
- else if (fieldType.equals(Short.TYPE))
- {
- field.setShort(this, Configuration.getShort(propertyName, configView));
- }
- else if (fieldType.equals(Float.TYPE))
- {
- field.setFloat(this, Configuration.getFloat(propertyName, configView));
- }
- else if (fieldType.equals(Double.TYPE))
- {
- field.setDouble(this, Configuration.getDouble(propertyName, configView));
- }
- }
- else if (fieldType.equals(String.class))
- {
- field.set(this, Configuration.getString(propertyName, configView));
- }
- }
-
- public void setRoot(Object newRoot)
- {
- root = newRoot;
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.wizards.common.ConfigNode#writeConfiguration(java.lang.Object, java.lang.Object)
- */
-}
diff --git a/wizards/com/sun/star/wizards/common/ConfigNode.java b/wizards/com/sun/star/wizards/common/ConfigNode.java
deleted file mode 100644
index 0d2abd84c966..000000000000
--- a/wizards/com/sun/star/wizards/common/ConfigNode.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.common;
-
-/**
- * This Interface specifies a method of an object which is
- * capable of reading and writing its data out of the
- * OO Configuration.
- * <p>There are 2 direct implementations: ConfigGroup and ConfigSet.
- * The root is the first Java Object in the configuration hierarchies.</p>
- */
-public interface ConfigNode
-{
-
- /**
- * reads the object data out of the configuration.
- * @param configurationView is a ::com::sun::star::configuration::HierarchyElement
- * which represents the node corresponding to the Object.
- * @param param a free parameter. Since the intension of this interface is
- * to be used in a tree like way, reading objects and subobjects and so on,
- * it might be practical to be able to pass an extra parameter, for a free use.
- */
- void readConfiguration(Object configurationView, Object param);
-
- void writeConfiguration(Object configurationView, Object param);
-
- void setRoot(Object root);
-}
diff --git a/wizards/com/sun/star/wizards/common/ConfigSet.java b/wizards/com/sun/star/wizards/common/ConfigSet.java
deleted file mode 100644
index 75705c09fd21..000000000000
--- a/wizards/com/sun/star/wizards/common/ConfigSet.java
+++ /dev/null
@@ -1,428 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.common;
-
-import java.util.*;
-
-import javax.swing.ListModel;
-import javax.swing.event.ListDataEvent;
-
-
-import org.w3c.dom.*;
-
-public class ConfigSet implements ConfigNode, XMLProvider, ListModel
-{
-
- private final Class<?> childClass;
- private final Map<String, Object> childrenMap = new HashMap<String, Object>();
- private final List<Object> childrenList = new ArrayList<Object>();
- public Object root;
- /**
- * After reading the configuration set items,
- * the ConfigSet checks this field.
- * If it is true, it will remove any nulls from
- * the vector.
- * subclasses can change this field in the constructor
- * to avoid this "deletion" of nulls.
- */
- protected boolean noNulls = true;
- /** Utility field used by event firing mechanism. */
- private javax.swing.event.EventListenerList listenerList = null;
-
- public ConfigSet(Class<?> childType)
- {
- childClass = childType;
- }
-
- public void add(String name, Object child)
- {
- childrenMap.put(name, child);
- try
- {
- int i = ((Indexable) child).getIndex();
- int oldSize = getSize();
- while (getSize() <= i)
- {
- childrenList.add(null);
- }
- childrenList.set(i, child);
- if (oldSize > i)
- {
- oldSize = i;
- }
- fireListDataListenerIntervalAdded(oldSize, i);
- }
- catch (ClassCastException cce)
- {
- childrenList.add(child);
- fireListDataListenerIntervalAdded(getSize() - 1, getSize() - 1);
- }
- }
-
- public void add(int i, Object o)
- {
- int name = i;
- while (getElement(PropertyNames.EMPTY_STRING + name) != null)
- {
- name++;
- }
- childrenMap.put(PropertyNames.EMPTY_STRING + name, o);
- childrenList.add(i, o);
-
- fireListDataListenerIntervalAdded(i, i);
- }
-
- protected Object createChild() throws InstantiationException, IllegalAccessException
- {
- return childClass.newInstance();
- }
-
- public void writeConfiguration(Object configView, Object param)
- {
- Object[] names = childrenMap.keySet().toArray();
-
- if (ConfigNode.class.isAssignableFrom(childClass))
- {
- //first I remove all the children from the configuration.
- String children[] = Configuration.getChildrenNames(configView);
- for (int i = 0; i < children.length; i++)
- {
- try
- {
- Configuration.removeNode(configView, children[i]);
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- } // and add them new.
- }
- for (int i = 0; i < names.length; i++)
- {
- try
- {
- ConfigNode child = (ConfigNode) getElement(names[i]);
- Object childView = Configuration.addConfigNode(configView, (String) names[i]);
- child.writeConfiguration(childView, param);
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
- }
- //for a set of primitive / String type.
- else
- {
- throw new IllegalArgumentException("Unable to write primitive sets to configuration (not implemented)");
- }
- }
-
- public void readConfiguration(Object configurationView, Object param)
- {
- String[] names = Configuration.getChildrenNames(configurationView);
- if (ConfigNode.class.isAssignableFrom(childClass))
- {
-
- for (int i = 0; i < names.length; i++)
- {
- try
- {
- ConfigNode child = (ConfigNode) createChild();
- child.setRoot(root);
- child.readConfiguration(Configuration.getNode(names[i], configurationView), param);
- add(names[i], child);
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
- //remove any nulls from the list
- if (noNulls)
- {
- for (int i = 0; i < childrenList.size(); i++)
- {
- if (childrenList.get(i) == null)
- {
- childrenList.remove(i--);
- }
- }
- }
- }
- //for a set of primitive / String type.
- else
- {
- for (int i = 0; i < names.length; i++)
- {
- try
- {
- Object child = Configuration.getNode(names[i], configurationView);
- add(names[i], child);
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
- }
- }
-
- public void remove(Object obj)
- {
- Object key = getKey(obj);
- childrenMap.remove(key);
- int i = childrenList.indexOf(obj);
- childrenList.remove(obj);
- fireListDataListenerIntervalRemoved(i, i);
- }
-
- public void remove(int i)
- {
- Object o = getElementAt(i);
- remove(o);
- }
-
- public void clear()
- {
- childrenMap.clear();
- childrenList.clear();
- }
-
- public void update(int i)
- {
- fireListDataListenerContentsChanged(i, i);
- }
-
- public Node createDOM(Node parent)
- {
-
- Object[] items = items();
-
- for (int i = 0; i < items.length; i++)
- {
- Object item = items[i];
- if (item instanceof XMLProvider)
- {
- ((XMLProvider) item).createDOM(parent);
- }
- }
- return parent;
- }
-
- public Object[] items()
- {
- return childrenList.toArray();
- }
-
- public Object getKey(Object object)
- {
- for (Iterator<Map.Entry<String,Object>> i = childrenMap.entrySet().iterator(); i.hasNext();)
- {
-
- Map.Entry<String,Object> me = i.next();
- if (me.getValue() == object)
- {
- return me.getKey();
- }
- }
- return null;
- }
-
- public Object getKey(int i)
- {
- int c = 0;
- while (i > -1)
- {
- if (getElementAt(c) != null)
- {
- i--;
- }
- c++;
- }
- if (c == 0)
- {
- return null;
- }
- else
- {
- return getKey(getElementAt(c - 1));
- }
- }
-
- public void setRoot(Object newRoot)
- {
- root = newRoot;
- }
-
- /** Registers ListDataListener to receive events.
- * @param listener The listener to register.
- *
- */
- public synchronized void addListDataListener(javax.swing.event.ListDataListener listener)
- {
- if (listenerList == null)
- {
- listenerList = new javax.swing.event.EventListenerList();
- }
- listenerList.add(javax.swing.event.ListDataListener.class, listener);
- }
-
- /** Removes ListDataListener from the list of listeners.
- * @param listener The listener to remove.
- *
- */
- public synchronized void removeListDataListener(javax.swing.event.ListDataListener listener)
- {
- listenerList.remove(javax.swing.event.ListDataListener.class, listener);
- }
-
- /** Notifies all registered listeners about the event.
- *
- */
- private void fireListDataListenerIntervalAdded(int i0, int i1)
- {
- ListDataEvent event = new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, i0, i1);
- if (listenerList == null)
- {
- return;
- }
- Object[] listeners = listenerList.getListenerList();
- for (int i = listeners.length - 2; i >= 0; i -= 2)
- {
- if (listeners[i] == javax.swing.event.ListDataListener.class)
- {
- ((javax.swing.event.ListDataListener) listeners[i + 1]).intervalAdded(event);
- }
- }
- }
-
- /** Notifies all registered listeners about the event.
- *
- */
- private void fireListDataListenerIntervalRemoved(int i0, int i1)
- {
- ListDataEvent event = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, i0, i1);
- if (listenerList == null)
- {
- return;
- }
- Object[] listeners = listenerList.getListenerList();
- for (int i = listeners.length - 2; i >= 0; i -= 2)
- {
- if (listeners[i] == javax.swing.event.ListDataListener.class)
- {
- ((javax.swing.event.ListDataListener) listeners[i + 1]).intervalRemoved(event);
- }
- }
- }
-
- /** Notifies all registered listeners about the event.
- *
- */
- private void fireListDataListenerContentsChanged(int i0, int i1)
- {
- ListDataEvent event = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, i0, i1);
- if (listenerList == null)
- {
- return;
- }
- Object[] listeners = listenerList.getListenerList();
- for (int i = listeners.length - 2; i >= 0; i -= 2)
- {
- if (listeners[i] == javax.swing.event.ListDataListener.class)
- {
- ((javax.swing.event.ListDataListener) listeners[i + 1]).contentsChanged(event);
- }
- }
- }
-
- public Object getElementAt(int i)
- {
- return childrenList.get(i);
- }
-
- public Object getElement(Object o)
- {
- return childrenMap.get(o);
- }
-
- public int getSize()
- {
- return childrenList.size();
- }
-
- public Set<String> keys()
- {
- return childrenMap.keySet();
- }
-
- public int getIndexOf(Object item)
- {
- return childrenList.indexOf(item);
- }
-
- /**
- * Set members might include a property which orders them.
- * This method reindexes the given member to b the index number 0.
- * Do not forget to call commit() after calling this method.
- */
- public void reindexSet(Object confView, String memberName, String indexPropertyName) throws Exception
- {
- /*
- * First I read all members of the set,
- * except the one that should be number 0
- * to a vector, ordered by there index property
- */
- String[] names = Configuration.getChildrenNames(confView);
- ArrayList<Object> v = new ArrayList<Object>(names.length);
- Object member = null;
- int index = 0;
- for (int i = 0; i < names.length; i++)
- {
- if (!names[i].equals(memberName))
- {
- member = Configuration.getConfigurationNode(names[i], confView);
- index = Configuration.getInt(indexPropertyName, member);
- while (index >= v.size())
- {
- v.add(null);
- }
- v.set(index, member);
-
- }
- /**
- * Now I reindex them
- */
- }
- index = 1;
- for (int i = 0; i < v.size(); i++)
- {
- member = v.get(i);
- if (member != null)
- {
- Configuration.set(index++, indexPropertyName, member);
- }
- }
-
- }
-
- public void sort(Comparator<Object> comparator)
- {
- Collections.sort(this.childrenList, comparator);
- }
-}
diff --git a/wizards/com/sun/star/wizards/common/Configuration.java b/wizards/com/sun/star/wizards/common/Configuration.java
index 54ec1cfa3bec..3a48692e3adb 100644
--- a/wizards/com/sun/star/wizards/common/Configuration.java
+++ b/wizards/com/sun/star/wizards/common/Configuration.java
@@ -19,9 +19,7 @@ package com.sun.star.wizards.common;
import com.sun.star.beans.*;
import com.sun.star.container.*;
-import com.sun.star.lang.WrappedTargetException;
import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.lang.XSingleServiceFactory;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
@@ -41,88 +39,6 @@ import com.sun.star.lang.Locale;
public abstract class Configuration
{
- public static int getInt(String name, Object parent) throws Exception
- {
- Object o = getNode(name, parent);
- if (AnyConverter.isVoid(o))
- {
- return 0;
- }
- return AnyConverter.toInt(o);
- }
-
- public static short getShort(String name, Object parent) throws Exception
- {
- Object o = getNode(name, parent);
- if (AnyConverter.isVoid(o))
- {
- return (short) 0;
- }
- return AnyConverter.toShort(o);
- }
-
- public static float getFloat(String name, Object parent) throws Exception
- {
- Object o = getNode(name, parent);
- if (AnyConverter.isVoid(o))
- {
- return 0;
- }
- return AnyConverter.toFloat(o);
- }
-
- public static double getDouble(String name, Object parent) throws Exception
- {
- Object o = getNode(name, parent);
- if (AnyConverter.isVoid(o))
- {
- return 0;
- }
- return AnyConverter.toDouble(o);
- }
-
- public static String getString(String name, Object parent) throws Exception
- {
- Object o = getNode(name, parent);
- if (AnyConverter.isVoid(o))
- {
- return PropertyNames.EMPTY_STRING;
- }
- return (String) o;
- }
-
- public static boolean getBoolean(String name, Object parent) throws Exception
- {
- Object o = getNode(name, parent);
- if (AnyConverter.isVoid(o))
- {
- return false;
- }
- return AnyConverter.toBoolean(o);
- }
-
- public static Object getNode(String name, Object parent) throws Exception
- {
- return UnoRuntime.queryInterface(XNameAccess.class, parent).getByName(name);
- }
-
- public static void set(int value, String name, Object parent) throws Exception
- {
- set(Integer.valueOf(value), 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);
- }
-
- /** Creates a new instance of RegistryEntry
- */
- public static Object getConfigurationNode(String name, Object parent) throws Exception
- {
- return UnoRuntime.queryInterface(XNameAccess.class, parent).getByName(name);
- }
-
public static Object getConfigurationRoot(XMultiServiceFactory xmsf, String sPath, boolean updateable) throws com.sun.star.uno.Exception
{
@@ -153,12 +69,6 @@ public abstract class Configuration
return confMsf.createInstanceWithArguments(sView, args);
}
- public static String[] getChildrenNames(Object configView)
- {
- XNameAccess nameAccess = UnoRuntime.queryInterface(XNameAccess.class, configView);
- return nameAccess.getElementNames();
- }
-
public static String getProductName(XMultiServiceFactory xMSF)
{
try
@@ -210,48 +120,6 @@ public abstract class Configuration
return getLocale(xMSF, "org.openoffice.Setup/L10N/", "ooSetupSystemLocale");
}
- /**
- * This method creates a new configuration node and adds it
- * to the given view. Note that if a node with the given name
- * already exists it will be completely removed from
- * the configuration.
- * @return the new created configuration node.
- */
- public static Object addConfigNode(Object configView, String name) throws com.sun.star.lang.WrappedTargetException, ElementExistException, NoSuchElementException, com.sun.star.uno.Exception
- {
-
- XNameContainer xNameContainer = UnoRuntime.queryInterface(XNameContainer.class, configView);
-
- if (xNameContainer == null)
- {
- XNameReplace xNameReplace = UnoRuntime.queryInterface(XNameReplace.class, configView);
- return xNameReplace.getByName(name);
- }
- else
- {
-
- // create a new detached set element (instance of DataSourceDescription)
- XSingleServiceFactory xElementFactory = UnoRuntime.queryInterface(XSingleServiceFactory.class, configView);
-
- // the new element is the result !
- Object newNode = xElementFactory.createInstance();
- // insert it - this also names the element
- xNameContainer.insertByName(name, newNode);
-
- return newNode;
- }
- }
-
- public static void removeNode(Object configView, String name) throws NoSuchElementException, WrappedTargetException
- {
- XNameContainer xNameContainer = UnoRuntime.queryInterface(XNameContainer.class, configView);
-
- if (xNameContainer.hasByName(name))
- {
- xNameContainer.removeByName(name);
- }
- }
-
public static String[] getNodeDisplayNames(XNameAccess _xNameAccessNode)
{
return getNodeChildNames(_xNameAccessNode, PropertyNames.PROPERTY_NAME);
diff --git a/wizards/com/sun/star/wizards/common/Desktop.java b/wizards/com/sun/star/wizards/common/Desktop.java
index 1bf5905eee89..3093e8a74415 100644
--- a/wizards/com/sun/star/wizards/common/Desktop.java
+++ b/wizards/com/sun/star/wizards/common/Desktop.java
@@ -267,32 +267,6 @@ public class Desktop
- /**
- * @deprecated used to retrieve the most common paths used in the office application
- */
- public class OfficePathRetriever
- {
-
- public String TemplatePath;
- public String BitmapPath;
- public String UserTemplatePath;
- public String WorkPath;
-
- public OfficePathRetriever(XMultiServiceFactory xMSF)
- {
- try
- {
- TemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard");
- UserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", PropertyNames.EMPTY_STRING);
- BitmapPath = FileAccess.combinePaths(xMSF, TemplatePath, "/../wizard/bitmap");
- WorkPath = FileAccess.getOfficePath(xMSF, "Work", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING);
- }
- catch (NoValidPathException nopathexception)
- {
- }
- }
- }
-
public static String getTemplatePath(XMultiServiceFactory _xMSF)
{
try
diff --git a/wizards/com/sun/star/wizards/common/FileAccess.java b/wizards/com/sun/star/wizards/common/FileAccess.java
index 11efe3ce1d85..ee82635007e1 100644
--- a/wizards/com/sun/star/wizards/common/FileAccess.java
+++ b/wizards/com/sun/star/wizards/common/FileAccess.java
@@ -21,7 +21,6 @@ import com.sun.star.beans.XPropertySet;
import com.sun.star.lang.Locale;
import com.sun.star.uno.Exception;
import com.sun.star.util.XMacroExpander;
-import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Vector;
@@ -495,18 +494,6 @@ public class FileAccess
filenameConverter = UnoRuntime.queryInterface(XFileIdentifierConverter.class, fcv);
}
- public String getURL(String parentPath, String childPath)
- {
- String parent = filenameConverter.getSystemPathFromFileURL(parentPath);
- File f = new File(parent, childPath);
- return filenameConverter.getFileURLFromSystemPath(parentPath, f.getAbsolutePath());
- }
-
- public String getPath(String parentURL, String childURL)
- {
- return filenameConverter.getSystemPathFromFileURL(parentURL + (((childURL == null || childURL.equals(PropertyNames.EMPTY_STRING)) ? PropertyNames.EMPTY_STRING : "/" + childURL)));
- }
-
/**
* @return the extension of the given filename.
*/
@@ -567,31 +554,6 @@ public class FileAccess
return filename.substring(0, filename.length() - (sExtension.length() + 1));
}
- /**
- * @return the parent dir of the given url.
- * if the path points to file, gives the directory in which the file is.
- */
- public static String getParentDir(String url)
- {
- if (url.endsWith("/"))
- {
- return getParentDir(url.substring(0, url.length() - 1));
- }
- int pos = -1;
- int lastPos = 0;
- while ((pos = url.indexOf('/', pos + 1)) > -1)
- {
- lastPos = pos;
- }
- return url.substring(0, lastPos);
- }
-
- public static String connectURLs(String urlFolder, String urlFilename)
- {
- return urlFolder + (urlFolder.endsWith("/") ? PropertyNames.EMPTY_STRING : "/") +
- (urlFilename.startsWith("/") ? urlFilename.substring(1) : urlFilename);
- }
-
public static String[] getDataFromTextFile(XMultiServiceFactory _xMSF, String _filepath)
{
String[] sFileData = null;
diff --git a/wizards/com/sun/star/wizards/common/Helper.java b/wizards/com/sun/star/wizards/common/Helper.java
index 6f73b3206fdb..61b7c3b7bad2 100644
--- a/wizards/com/sun/star/wizards/common/Helper.java
+++ b/wizards/com/sun/star/wizards/common/Helper.java
@@ -19,17 +19,12 @@ package com.sun.star.wizards.common;
import com.sun.star.uno.XComponentContext;
import com.sun.star.util.XMacroExpander;
-import java.util.Calendar;
import com.sun.star.beans.XPropertySet;
-import com.sun.star.lang.Locale;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.RuntimeException;
import com.sun.star.uno.UnoRuntime;
-import com.sun.star.util.DateTime;
-import com.sun.star.util.XNumberFormatsSupplier;
-import com.sun.star.util.XNumberFormatter;
public class Helper
{
@@ -227,104 +222,6 @@ public class Helper
}
private static long DAY_IN_MILLIS = (24 * 60 * 60 * 1000);
- public static class DateUtils
- {
-
- private final long docNullTime;
- private final XNumberFormatter formatter;
- private final XNumberFormatsSupplier formatSupplier;
- private final Calendar calendar;
-
- public DateUtils(XMultiServiceFactory xmsf, Object document) throws Exception
- {
- XMultiServiceFactory docMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
-
- Object defaults = docMSF.createInstance("com.sun.star.text.Defaults");
- Locale l = (Locale) Helper.getUnoStructValue(defaults, "CharLocale");
-
- java.util.Locale jl = new java.util.Locale(
- l.Language, l.Country, l.Variant);
-
- calendar = Calendar.getInstance(jl);
-
- formatSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, document);
-
- Object formatSettings = formatSupplier.getNumberFormatSettings();
- com.sun.star.util.Date date = (com.sun.star.util.Date) Helper.getUnoPropertyValue(formatSettings, "NullDate");
-
- calendar.set(date.Year, date.Month - 1, date.Day);
- docNullTime = getTimeInMillis();
-
- formatter = NumberFormatter.createNumberFormatter(xmsf, formatSupplier);
- }
-
- /**
- * @param format a constant of the enumeration NumberFormatIndex
- */
- public int getFormat(short format)
- {
- return NumberFormatter.getNumberFormatterKey(formatSupplier, format);
- }
-
- public XNumberFormatter getFormatter()
- {
- return formatter;
- }
-
- private long getTimeInMillis()
- {
- java.util.Date dDate = calendar.getTime();
- return dDate.getTime();
- }
-
- /**
- * @param date a VCL date in form of 20041231
- * @return a document relative date
- */
- public synchronized double getDocumentDateAsDouble(int date)
- {
- calendar.clear();
- calendar.set(date / 10000,
- (date % 10000) / 100 - 1,
- date % 100);
-
- long date1 = getTimeInMillis();
- /*
- * docNullTime and date1 are in millis, but
- * I need a day...
- */
- return (date1 - docNullTime) / DAY_IN_MILLIS + 1;
- }
-
- public double getDocumentDateAsDouble(DateTime date)
- {
- return getDocumentDateAsDouble(date.Year * 10000 + date.Month * 100 + date.Day);
- }
-
- public synchronized double getDocumentDateAsDouble(long javaTimeInMillis)
- {
- calendar.clear();
- JavaTools.setTimeInMillis(calendar, javaTimeInMillis);
-
- long date1 = getTimeInMillis();
-
- /*
- * docNullTime and date1 are in millis, but
- * I need a day...
- */
- return (date1 - docNullTime) / DAY_IN_MILLIS + 1;
-
- }
-
-
-
- public String format(int formatIndex, DateTime date)
- {
- return formatter.convertNumberToString(formatIndex, getDocumentDateAsDouble(date));
- }
-
- }
-
public static XComponentContext getComponentContext(XMultiServiceFactory _xMSF)
{
// Get the path to the extension and try to add the path to the class loader
diff --git a/wizards/com/sun/star/wizards/common/Indexable.java b/wizards/com/sun/star/wizards/common/Indexable.java
deleted file mode 100644
index 9bf62552ebaf..000000000000
--- a/wizards/com/sun/star/wizards/common/Indexable.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.common;
-
-public interface Indexable {
-
- int getIndex();
-
-}
diff --git a/wizards/com/sun/star/wizards/common/JavaTools.java b/wizards/com/sun/star/wizards/common/JavaTools.java
index 591001bb9a62..df7bfe11152e 100644
--- a/wizards/com/sun/star/wizards/common/JavaTools.java
+++ b/wizards/com/sun/star/wizards/common/JavaTools.java
@@ -281,13 +281,6 @@ public class JavaTools
return sPath;
}
- public static void setTimeInMillis(Calendar _calendar, long _timemillis)
- {
- java.util.Date dDate = new java.util.Date();
- dDate.setTime(_timemillis);
- _calendar.setTime(dDate);
- }
-
public static String[] removeOutdatedFields(String[] baselist, String[] _complist)
{
String[] retarray = new String[]
diff --git a/wizards/com/sun/star/wizards/common/NumberFormatter.java b/wizards/com/sun/star/wizards/common/NumberFormatter.java
index 6a7cefe5c5c1..1a7338e735a7 100644
--- a/wizards/com/sun/star/wizards/common/NumberFormatter.java
+++ b/wizards/com/sun/star/wizards/common/NumberFormatter.java
@@ -72,36 +72,6 @@ public class NumberFormatter
}
- public static XNumberFormatter createNumberFormatter(XMultiServiceFactory _xMSF, XNumberFormatsSupplier _xNumberFormatsSupplier) throws Exception
- {
- Object oNumberFormatter = _xMSF.createInstance("com.sun.star.util.NumberFormatter");
- XNumberFormatter xNumberFormatter = UnoRuntime.queryInterface(XNumberFormatter.class, oNumberFormatter);
- xNumberFormatter.attachNumberFormatsSupplier(_xNumberFormatsSupplier);
- return xNumberFormatter;
- }
-
-
- /**
- * gives a key to pass to a NumberFormat object.
- * <p>example:</p>
- * <pre>
- * XNumberFormatsSupplier nsf = (XNumberFormatsSupplier)UnoRuntime.queryInterface(...,document);
- * int key = Desktop.getNumberFormatterKey( nsf, ...star.i18n.NumberFormatIndex.DATE...);
- * XNumberFormatter nf = Desktop.createNumberFormatter(xmsf, nsf);
- * nf.convertNumberToString( key, 1972 );
- * </pre>
- * @param type - a constant out of i18n.NumberFormatIndex enumeration.
- * @return a key to use with a util.NumberFormat instance.
- *
- */
- public static int getNumberFormatterKey( Object numberFormatsSupplier, short type)
- {
- Object numberFormatTypes = UnoRuntime.queryInterface(XNumberFormatsSupplier.class,numberFormatsSupplier).getNumberFormats();
- Locale l = new Locale();
- return UnoRuntime.queryInterface(XNumberFormatTypes.class,numberFormatTypes).getFormatIndex(type, l);
- }
-
-
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 61dbdd3e320a..77002caac430 100644
--- a/wizards/com/sun/star/wizards/common/NumericalHelper.java
+++ b/wizards/com/sun/star/wizards/common/NumericalHelper.java
@@ -62,62 +62,6 @@ public class NumericalHelper
/**
- * get a byte value from the object
- * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
- */
- public static byte toByte(Object aValue)
- throws com.sun.star.lang.IllegalArgumentException
- {
-
- byte 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 = (byte) getShort(aTypeObject);
- break;
- case INT_TYPE:
- retValue = (byte) getInt(aTypeObject);
- break;
- case LONG_TYPE:
- retValue = (byte) getLong(aTypeObject);
- break;
- case FLOAT_TYPE:
- retValue = (byte) getFloat(aTypeObject);
- break;
- case DOUBLE_TYPE:
- retValue = (byte) getDouble(aTypeObject);
- break;
- case STRING_TYPE:
- try
- {
- retValue = Byte.parseByte((String) aTypeObject.aValue);
- }
- catch (java.lang.NumberFormatException e)
- {
- throw new com.sun.star.lang.IllegalArgumentException(e,
- "Cannot convert to byte: " + aTypeObject.aValue);
- }
- break;
- case BOOLEAN_TYPE:
- retValue = getBool(aTypeObject) ? (byte) -1 : (byte) 0;
- break;
- default:
- throw new com.sun.star.lang.IllegalArgumentException(
- "Cannot convert this type: " + aValue.getClass().getName());
- }
- return retValue;
- }
-
-
-
- /**
* get an int value from the object
* @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
*/
@@ -413,38 +357,4 @@ public class NumericalHelper
public Object aValue;
}
- /**
- * simple class to construct a hexadecimal value from a long number
- */
- private static class TransformNumToHex
- {
-
- private final StringBuffer val;
-
- public TransformNumToHex(long number)
- {
- val = new StringBuffer();
- transform(number);
- }
-
- private void transform(long number)
- {
- int index = (int) (number % HEX_BASE);
- number = number / HEX_BASE;
- if (index < DEC_BASE)
- {
- val.insert(0, index);
- }
- else
- {
- val.insert(0, (char) (ASCII_LETTER_A_OFFSET + index));
- }
- if (number > 0)
- {
- transform(number);
- }
- }
-
- }
-
}
diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.java b/wizards/com/sun/star/wizards/common/SystemDialog.java
index cd22200b2cbb..300bcdcd1aa4 100644
--- a/wizards/com/sun/star/wizards/common/SystemDialog.java
+++ b/wizards/com/sun/star/wizards/common/SystemDialog.java
@@ -21,7 +21,6 @@ import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.ui.dialogs.*;
import com.sun.star.uno.XInterface;
import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.AnyConverter;
import com.sun.star.util.XStringSubstitution;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XInitialization;
@@ -29,7 +28,6 @@ import com.sun.star.frame.XFrame;
import com.sun.star.awt.XWindowPeer;
import com.sun.star.awt.XToolkit;
import com.sun.star.awt.XMessageBox;
-import com.sun.star.beans.PropertyValue;
public class SystemDialog
{
@@ -46,179 +44,6 @@ public class SystemDialog
public XStringSubstitution xStringSubstitution;
public String sStorePath;
- /**
- *
- * @param type according to com.sun.star.ui.dialogs.TemplateDescription
- */
- public SystemDialog(XMultiServiceFactory xMSF, String ServiceName, short type)
- {
- try
- {
- this.xMSF = xMSF;
- systemDialog = xMSF.createInstance(ServiceName);
- xFilePicker = UnoRuntime.queryInterface(XFilePicker.class, systemDialog);
- xFolderPicker = UnoRuntime.queryInterface(XFolderPicker2.class, systemDialog);
- xFilterManager = UnoRuntime.queryInterface(XFilterManager.class, systemDialog);
- xInitialize = UnoRuntime.queryInterface(XInitialization.class, systemDialog);
- xExecutable = UnoRuntime.queryInterface(XExecutableDialog.class, systemDialog);
- xComponent = UnoRuntime.queryInterface(XComponent.class, systemDialog);
- xFilePickerControlAccess = UnoRuntime.queryInterface(XFilePickerControlAccess.class, systemDialog);
- xStringSubstitution = createStringSubstitution(xMSF);
- Short[] listAny = new Short[]
- {
- Short.valueOf(type)
- };
- if (xInitialize != null)
- {
- xInitialize.initialize(listAny);
- }
- }
- catch (com.sun.star.uno.Exception exception)
- {
- exception.printStackTrace();
- }
- }
-
- public static SystemDialog createStoreDialog(XMultiServiceFactory xmsf)
- {
- return new SystemDialog(xmsf, "com.sun.star.ui.dialogs.FilePicker", TemplateDescription.FILESAVE_AUTOEXTENSION);
- }
-
- private String subst(String path)
- {
- try
- {
- return xStringSubstitution.substituteVariables(path, false);
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- return path;
- }
- }
-
- /**
- * ATTENTION a BUG : The extension calculated
- * here gives the last 3 chars of the filename - what
- * if the extension is of 4 or more chars?
- */
- public String callStoreDialog(String DisplayDirectory, String DefaultName, String sDocuType)
- {
- String sExtension = DefaultName.substring(DefaultName.length() - 3, DefaultName.length());
- addFilterToDialog(sExtension, sDocuType, true);
- return callStoreDialog(DisplayDirectory, DefaultName);
- }
-
- public String callStoreDialog(String displayDir, String defaultName)
- {
- sStorePath = null;
- try
- {
- xFilePickerControlAccess.setValue(com.sun.star.ui.dialogs.ExtendedFilePickerElementIds.CHECKBOX_AUTOEXTENSION, (short) 0, Boolean.TRUE);
- xFilePicker.setDefaultName(defaultName);
- xFilePicker.setDisplayDirectory(subst(displayDir));
- if (execute(xExecutable))
- {
- String[] sPathList = xFilePicker.getFiles();
- sStorePath = sPathList[0];
- }
- }
- catch (com.sun.star.lang.IllegalArgumentException exception)
- {
- exception.printStackTrace();
- }
- return sStorePath;
- }
-
- private boolean execute(XExecutableDialog execDialog)
- {
- return execDialog.execute() == 1;
- }
-
- //("writer_StarOffice_XML_Writer_Template") 'StarOffice XML (Writer)
- public void addFilterToDialog(String sExtension, String filterName, boolean setToDefault)
- {
- try
- {
- //get the localized filtername
- String uiName = getFilterUIName(filterName);
- String pattern = "*." + sExtension;
-
- //add the filter
- addFilter(uiName, pattern, setToDefault);
- }
- catch (Exception exception)
- {
- exception.printStackTrace(System.err);
- }
- }
-
- public void addFilter(String uiName, String pattern, boolean setToDefault)
- {
- try
- {
- xFilterManager.appendFilter(uiName, pattern);
- if (setToDefault)
- {
- xFilterManager.setCurrentFilter(uiName);
- }
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
- /**
- * converts the name returned from getFilterUIName_(...) so the
- * product name is correct.
- * @param filterName
- * @return
- */
- private String getFilterUIName(String filterName)
- {
- String prodName = Configuration.getProductName(xMSF);
- String[][] s = new String[][]
- {
- {
- getFilterUIName_(filterName)
- }
- };
- s[0][0] = JavaTools.replaceSubString(s[0][0], prodName, "%productname%");
- return s[0][0];
- }
-
- /**
- * note the result should go through conversion of the product name.
- * @param filterName
- * @return the UI localized name of the given filter name.
- */
- private String getFilterUIName_(String filterName)
- {
- try
- {
- Object oFactory = xMSF.createInstance("com.sun.star.document.FilterFactory");
- Object oObject = Helper.getUnoObjectbyName(oFactory, filterName);
- Object oArrayObject = AnyConverter.toArray(oObject);
- PropertyValue[] xPropertyValue = (PropertyValue[]) oArrayObject; //UnoRuntime.queryInterface(XPropertyValue.class, oObject);
- int MaxCount = xPropertyValue.length;
- for (int i = 0; i < MaxCount; i++)
- {
- PropertyValue aValue = xPropertyValue[i];
- if (aValue != null && aValue.Name.equals("UIName"))
- {
- return AnyConverter.toString(aValue.Value);
- }
- }
- throw new NullPointerException("UIName property not found for Filter " + filterName);
- }
- catch (com.sun.star.uno.Exception exception)
- {
- exception.printStackTrace(System.err);
- return null;
- }
- }
-
public static int showErrorBox(XMultiServiceFactory xMSF, String ResName, String ResPrefix, int ResID, String AddTag, String AddString)
{
Resource oResource;
@@ -312,26 +137,4 @@ public class SystemDialog
return iMessage;
}
- 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;
- }
- }
}
diff --git a/wizards/com/sun/star/wizards/common/UCB.java b/wizards/com/sun/star/wizards/common/UCB.java
deleted file mode 100644
index c73eee6b6dee..000000000000
--- a/wizards/com/sun/star/wizards/common/UCB.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package com.sun.star.wizards.common;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.sun.star.beans.Property;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.sdbc.XResultSet;
-import com.sun.star.sdbc.XRow;
-import com.sun.star.ucb.Command;
-import com.sun.star.ucb.GlobalTransferCommandArgument;
-import com.sun.star.ucb.NameClash;
-import com.sun.star.ucb.OpenCommandArgument2;
-import com.sun.star.ucb.OpenMode;
-import com.sun.star.ucb.TransferCommandOperation;
-import com.sun.star.ucb.XCommandProcessor;
-import com.sun.star.ucb.XContentIdentifier;
-import com.sun.star.ucb.XContentIdentifierFactory;
-import com.sun.star.ucb.XContentProvider;
-import com.sun.star.ucb.XDynamicResultSet;
-import com.sun.star.uno.UnoRuntime;
-
-/**
- * This class is used to copy the content of a folder to
- * another folder.
- * There is an incosistency with argument order.
- * It should be always: dir,filename.
- */
-public class UCB
-{
-
- private final Object ucb;
- private final FileAccess fa;
-
- public UCB(XMultiServiceFactory xmsf) throws Exception
- {
- ucb = xmsf.createInstanceWithArguments(
- "com.sun.star.ucb.UniversalContentBroker", new Object[0] );
- fa = new FileAccess(xmsf);
- }
-
- public void deleteDirContent(String dir)
- throws Exception
- {
- if (!fa.exists(dir,true))
- {
- return;
- }
- List<String> l = listFiles(dir,null);
- for (int i = 0; i<l.size(); i++)
- {
- delete(FileAccess.connectURLs(dir ,l.get(i)));
- }
- }
-
- public void delete(String filename) throws Exception
- {
- executeCommand( getContent(filename),"delete",Boolean.TRUE);
- }
-
- public void copy(String sourceDir, String targetDir) throws Exception
- {
- copy(sourceDir,targetDir,(Verifier)null);
- }
-
- public void copy(String sourceDir, String targetDir, Verifier verifier) throws Exception
- {
- List<String> files = listFiles(sourceDir,verifier);
- for (int i = 0; i<files.size(); i++)
- {
- copy(sourceDir, files.get(i), targetDir);
- }
-
- }
-
- public void copy(String sourceDir, String filename, String targetDir, String targetName) throws Exception
- {
- if (!fa.exists(targetDir,true))
- {
- fa.fileAccess.createFolder(targetDir);
- }
- executeCommand(ucb, "globalTransfer", copyArg(sourceDir,filename, targetDir,targetName));
- }
-
- @Deprecated
- public void copy(String sourceDir, String filename, String targetDir) throws Exception
- {
- copy(sourceDir,filename, targetDir, PropertyNames.EMPTY_STRING);
- }
-
- /**
- * target name can be PropertyNames.EMPTY_STRING, in which case the name stays lige the source name
- */
- public GlobalTransferCommandArgument copyArg(String sourceDir, String sourceFilename, String targetDir, String targetFilename)
- {
-
- GlobalTransferCommandArgument aArg = new GlobalTransferCommandArgument();
- aArg.Operation = TransferCommandOperation.COPY;
- aArg.SourceURL = fa.getURL(sourceDir,sourceFilename);
- aArg.TargetURL = targetDir;
- aArg.NewTitle = targetFilename;
- // fail, if object with same name exists in target folder
- aArg.NameClash = NameClash.OVERWRITE;
- return aArg;
- }
-
- public Object executeCommand(Object xContent, String aCommandName, Object aArgument)
- throws com.sun.star.ucb.CommandAbortedException,
- com.sun.star.uno.Exception
- {
- XCommandProcessor xCmdProcessor = UnoRuntime.queryInterface(
- XCommandProcessor.class, xContent);
- Command aCommand = new Command();
- aCommand.Name = aCommandName;
- aCommand.Handle = -1; // not available
- aCommand.Argument = aArgument;
- return xCmdProcessor.execute(aCommand, 0, null);
- }
-
- public List<String> listFiles(String path, Verifier verifier) throws Exception
- {
- Object xContent = getContent(path);
-
- OpenCommandArgument2 aArg = new OpenCommandArgument2();
- aArg.Mode = OpenMode.ALL;
- aArg.Priority = 32768;
-
- // Fill info for the properties wanted.
- aArg.Properties = new Property[] {new Property()};
-
- aArg.Properties[0].Name = PropertyNames.PROPERTY_TITLE;
- aArg.Properties[0].Handle = -1;
-
- XDynamicResultSet xSet;
-
- xSet = UnoRuntime.queryInterface(
- XDynamicResultSet.class,executeCommand(xContent, "open", aArg));
-
- XResultSet xResultSet = xSet.getStaticResultSet();
-
- List<String> files = new ArrayList<String>();
-
- if (xResultSet.first())
- {
- XRow xRow = UnoRuntime.queryInterface(XRow.class, xResultSet);
- do
- {
- // First column: Title (column numbers are 1-based!)
- String aTitle = xRow.getString(1);
- if (aTitle.length() == 0 && xRow.wasNull())
- {
- //ignore
- }
- else
- {
- files.add(aTitle);
- }
- }
- while (xResultSet.next()); // next child
- }
-
- if (verifier != null)
- {
- for (int i = 0; i<files.size(); i++)
- {
- if (!verifier.verify(files.get(i)))
- {
- files.remove(i--);
- }
- }
- }
-
- return files;
- }
-
- public Object getContentProperty(Object content, String propName, Class<?> type)
- throws Exception
- {
- Property[] pv = new Property[1];
- pv[0] = new Property();
- pv[0].Name = propName;
- pv[0].Handle = -1;
-
- Object row = executeCommand(content,"getPropertyValues",pv);
- XRow xrow = UnoRuntime.queryInterface(XRow.class,row);
- if (type.equals(String.class))
- {
- return xrow.getString(1);
- }
- else if (type.equals(Boolean.class))
- {
- return xrow.getBoolean(1) ? Boolean.TRUE : Boolean.FALSE;
- }
- else if (type.equals(Integer.class))
- {
- return Integer.valueOf(xrow.getInt(1));
- }
- else if (type.equals(Short.class))
- {
- return Short.valueOf(xrow.getShort(1));
- }
- else
- {
- return null;
- }
-
- }
-
- public Object getContent(String path) throws Exception
- {
- XContentIdentifier id = UnoRuntime.queryInterface(XContentIdentifierFactory.class, ucb).createContentIdentifier(path);
-
- return UnoRuntime.queryInterface(
- XContentProvider.class,ucb).queryContent(id);
- }
-
- public interface Verifier
- {
- boolean verify(Object object);
- }
-}
diff --git a/wizards/com/sun/star/wizards/common/XMLHelper.java b/wizards/com/sun/star/wizards/common/XMLHelper.java
deleted file mode 100644
index 10bc417ccfb6..000000000000
--- a/wizards/com/sun/star/wizards/common/XMLHelper.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.common;
-
-import org.w3c.dom.*;
-
-public class XMLHelper
-{
-
- public static Node addElement(Node parent, String name, String[] attNames, String[] attValues)
- {
- Document doc = parent.getOwnerDocument();
- if (doc == null)
- {
- doc = (Document) parent;
- }
- Element e = doc.createElement(name);
- for (int i = 0; i < attNames.length; i++)
- {
- if (attValues[i] != null && (!attValues[i].equals(PropertyNames.EMPTY_STRING)))
- {
- e.setAttribute(attNames[i], attValues[i]);
- }
- }
- parent.appendChild(e);
- return e;
- }
-
- public static Node addElement(Node parent, String name, String attNames, String attValues)
- {
- return addElement(parent, name, new String[]
- {
- attNames
- }, new String[]
- {
- attValues
- });
- }
-}
diff --git a/wizards/com/sun/star/wizards/common/XMLProvider.java b/wizards/com/sun/star/wizards/common/XMLProvider.java
deleted file mode 100644
index 86eef1d8849b..000000000000
--- a/wizards/com/sun/star/wizards/common/XMLProvider.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.common;
-
-import org.w3c.dom.Node;
-
-public interface XMLProvider
-{
-
- Node createDOM(Node parent);
-}
diff --git a/wizards/com/sun/star/wizards/db/ColumnPropertySet.java b/wizards/com/sun/star/wizards/db/ColumnPropertySet.java
index 98f0ea983e32..4797c5af505d 100644
--- a/wizards/com/sun/star/wizards/db/ColumnPropertySet.java
+++ b/wizards/com/sun/star/wizards/db/ColumnPropertySet.java
@@ -17,7 +17,6 @@
*/
package com.sun.star.wizards.db;
-import com.sun.star.beans.Property;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
import com.sun.star.sdbc.DataType;
diff --git a/wizards/com/sun/star/wizards/db/CommandMetaData.java b/wizards/com/sun/star/wizards/db/CommandMetaData.java
index 21446f5d3c79..61534651031c 100644
--- a/wizards/com/sun/star/wizards/db/CommandMetaData.java
+++ b/wizards/com/sun/star/wizards/db/CommandMetaData.java
@@ -22,13 +22,11 @@ import com.sun.star.sdbc.SQLException;
import com.sun.star.uno.AnyConverter;
import com.sun.star.awt.VclWindowPeerAttribute;
import com.sun.star.uno.UnoRuntime;
-import com.sun.star.lang.Locale;
import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XIndexAccess;
import com.sun.star.container.XNameAccess;
import com.sun.star.wizards.common.Helper;
import com.sun.star.wizards.common.JavaTools;
-import com.sun.star.wizards.common.NumberFormatter;
import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.common.Resource;
import java.util.ArrayList;
@@ -69,11 +67,6 @@ public class CommandMetaData extends DBMetaData
boolean bCommandComposerAttributesalreadyRetrieved = false;
private XIndexAccess xIndexKeys;
- public CommandMetaData(XMultiServiceFactory xMSF, Locale _aLocale, NumberFormatter oNumberFormatter)
- {
- super(xMSF, _aLocale, oNumberFormatter);
- }
-
public CommandMetaData(XMultiServiceFactory xMSF)
{
super(xMSF);
diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java
index 684c75c0ae24..7782c84129dc 100644
--- a/wizards/com/sun/star/wizards/db/DBMetaData.java
+++ b/wizards/com/sun/star/wizards/db/DBMetaData.java
@@ -152,14 +152,6 @@ public class DBMetaData
InitializeWidthList();
}
- public DBMetaData(XMultiServiceFactory xMSF, Locale _aLocale, NumberFormatter _oNumberFormatter)
- {
- oNumberFormatter = _oNumberFormatter;
- aLocale = _aLocale;
- getInterfaces(xMSF);
- InitializeWidthList();
- }
-
public NumberFormatter getNumberFormatter()
{
if (oNumberFormatter == null)
diff --git a/wizards/com/sun/star/wizards/db/QueryMetaData.java b/wizards/com/sun/star/wizards/db/QueryMetaData.java
index f59e16791ff3..31b7efd54a5f 100644
--- a/wizards/com/sun/star/wizards/db/QueryMetaData.java
+++ b/wizards/com/sun/star/wizards/db/QueryMetaData.java
@@ -21,7 +21,6 @@ import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.beans.PropertyValue;
import java.util.*;
-import com.sun.star.lang.Locale;
import com.sun.star.wizards.common.*;
public class QueryMetaData extends CommandMetaData
@@ -46,11 +45,6 @@ public class QueryMetaData extends CommandMetaData
int SODETAILQUERY = 1;
}
- public QueryMetaData(XMultiServiceFactory xMSF, Locale CharLocale, NumberFormatter oNumberFormatter)
- {
- super(xMSF, CharLocale, oNumberFormatter);
- }
-
public QueryMetaData(XMultiServiceFactory _xMSF)
{
super(_xMSF);
diff --git a/wizards/com/sun/star/wizards/document/Control.java b/wizards/com/sun/star/wizards/document/Control.java
index 8c25fff86ed0..de4aa3d0d5c3 100644
--- a/wizards/com/sun/star/wizards/document/Control.java
+++ b/wizards/com/sun/star/wizards/document/Control.java
@@ -66,13 +66,6 @@ public class Control extends Shape
createControl(_icontroltype, _aPoint, _aSize, null, _FieldName);
}
- public Control(FormHandler _oFormHandler, XShapes _xGroupShapes, XNameContainer _xFormName, int _icontroltype, Point _aPoint, Size _aSize)
- {
- super(_oFormHandler, _aPoint, _aSize);
- xFormName = _xFormName;
- createControl(_icontroltype, _aPoint, _aSize, _xGroupShapes, null);
- }
-
public Control(FormHandler _oFormHandler, int _icontroltype, Point _aPoint, Size _aSize)
{
super(_oFormHandler, _aPoint, _aSize);
diff --git a/wizards/com/sun/star/wizards/document/DatabaseControl.java b/wizards/com/sun/star/wizards/document/DatabaseControl.java
index f70f8347fee5..1b1e07efd2f6 100644
--- a/wizards/com/sun/star/wizards/document/DatabaseControl.java
+++ b/wizards/com/sun/star/wizards/document/DatabaseControl.java
@@ -22,7 +22,6 @@ import com.sun.star.awt.Point;
import com.sun.star.beans.XPropertySet;
import com.sun.star.beans.XPropertySetInfo;
import com.sun.star.container.XNameContainer;
-import com.sun.star.drawing.XShapes;
import com.sun.star.sdbc.DataType;
import com.sun.star.wizards.common.Desktop;
import com.sun.star.wizards.common.Helper;
@@ -112,21 +111,6 @@ public class DatabaseControl extends Control
}
}
- public DatabaseControl(FormHandler _oFormHandler, XShapes _xGroupShapes, XNameContainer _xFormName, String _curFieldName, int _fieldtype, Point _aPoint)
- {
- super(_oFormHandler, _xGroupShapes, _xFormName, _oFormHandler.getControlType(_fieldtype), _aPoint, null);
- try
- {
- m_nFieldType = _fieldtype;
- Helper.setUnoPropertyValue(xControlModel, "DataField", _curFieldName);
- setNumericLimits();
- }
- catch (Exception e)
- {
- e.printStackTrace(System.err);
- }
- }
-
private String getGridColumnName()
{
for (int i = 0; i < FormHandler.oControlData.length; i++)
diff --git a/wizards/com/sun/star/wizards/text/TextFrameHandler.java b/wizards/com/sun/star/wizards/text/TextFrameHandler.java
deleted file mode 100644
index 2cc4cc868e44..000000000000
--- a/wizards/com/sun/star/wizards/text/TextFrameHandler.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.text;
-
-import com.sun.star.container.NoSuchElementException;
-import com.sun.star.lang.WrappedTargetException;
-import com.sun.star.text.XTextDocument;
-import com.sun.star.text.XTextFrame;
-import com.sun.star.text.XTextFramesSupplier;
-import com.sun.star.uno.UnoRuntime;
-
-public class TextFrameHandler
-{
-
- public static XTextFrame getFrameByName(String sFrameName, XTextDocument xTD) throws NoSuchElementException, WrappedTargetException
- {
- XTextFramesSupplier xFrameSupplier = UnoRuntime.queryInterface(XTextFramesSupplier.class, xTD);
- if (xFrameSupplier.getTextFrames().hasByName(sFrameName))
- {
- Object oTextFrame = xFrameSupplier.getTextFrames().getByName(sFrameName);
- return UnoRuntime.queryInterface(XTextFrame.class, oTextFrame);
- }
- return null;
- }
-}
diff --git a/wizards/com/sun/star/wizards/ui/DocumentPreview.java b/wizards/com/sun/star/wizards/ui/DocumentPreview.java
deleted file mode 100644
index 4d7cfeb90427..000000000000
--- a/wizards/com/sun/star/wizards/ui/DocumentPreview.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.ui;
-
-import com.sun.star.awt.*;
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.frame.XComponentLoader;
-import com.sun.star.frame.XFrame;
-import com.sun.star.io.IOException;
-import com.sun.star.lang.XComponent;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.util.CloseVetoException;
-import com.sun.star.util.XCloseable;
-import com.sun.star.wizards.common.Properties;
-import com.sun.star.wizards.common.PropertyNames;
-
-public class DocumentPreview
-{
-
- /**
- * The frame service which is used to show the preview
- */
- private XFrame xFrame;
- private final XControl xControl;
- private PropertyValue[] loadArgs;
- private String url;
- public static final int PREVIEW_MODE = 1;
-
- /*********************************************************************
- main
-
- - create new frame with window inside
- - load a component as preview into this frame
- */
- public DocumentPreview(XMultiServiceFactory xmsf, Object control) throws Exception
- {
-
- xControl = UnoRuntime.queryInterface(XControl.class, control);
-
- createPreviewFrame(xmsf, xControl);
- }
-
- protected XComponent setDocument(String url_, String[] propNames, Object[] propValues) throws com.sun.star.lang.IllegalArgumentException, IOException
- {
- url = url_;
-
- Properties ps = new Properties();
-
- for (int i = 0; i < propNames.length; i++)
- {
- ps.put(propNames[i], propValues[i]);
- }
- return setDocument(url, ps.getProperties());
- }
-
- protected XComponent setDocument(String url, PropertyValue[] lArgs) throws com.sun.star.lang.IllegalArgumentException, IOException
- {
- loadArgs = lArgs;
- XComponentLoader xCompLoader = UnoRuntime.queryInterface(XComponentLoader.class, xFrame);
- xFrame.activate();
- return xCompLoader.loadComponentFromURL(url, "_self", 0, loadArgs);
- }
-
- public void reload(XMultiServiceFactory xmsf) throws com.sun.star.lang.IllegalArgumentException, IOException, CloseVetoException, com.sun.star.uno.Exception
- {
- closeFrame();
- createPreviewFrame(xmsf, xControl);
- setDocument(url, loadArgs);
- }
-
- private void closeFrame() throws CloseVetoException
- {
- if (xFrame != null)
- {
- UnoRuntime.queryInterface(XCloseable.class, xFrame).close(false);
- }
- }
-
- public XComponent setDocument(String url, int mode) throws com.sun.star.lang.IllegalArgumentException, IOException
- {
- switch (mode)
- {
- case PREVIEW_MODE:
- return setDocument(url, new String[]
- {
- "Preview", PropertyNames.READ_ONLY
- }, new Object[]
- {
- Boolean.TRUE, Boolean.TRUE
- });
- }
- return null;
- }
-
- /*********************************************************************
- create a new frame with a new container window inside,
- which isn't part of the global frame tree.
-
- Attention:
- a) This frame wont be destroyed by the office. It must be closed by you!
- Do so - please call XCloseable::close().
- b) The container window is part of the frame. Dont hold it alive - nor try to kill it.
- It will be destroyed inside close().
- */
- public void createPreviewFrame(XMultiServiceFactory xmsf, XControl xControl) throws com.sun.star.uno.Exception, com.sun.star.lang.IllegalArgumentException
- {
- XWindowPeer controlPeer = xControl.getPeer();
- XWindow controlWindow = UnoRuntime.queryInterface(XWindow.class, xControl);
- Rectangle r = controlWindow.getPosSize();
-
- Object toolkit = xmsf.createInstance("com.sun.star.awt.Toolkit");
- XToolkit xToolkit = UnoRuntime.queryInterface(XToolkit.class, toolkit);
-
- WindowDescriptor aDescriptor = new WindowDescriptor();
- aDescriptor.Type = WindowClass.SIMPLE;
- aDescriptor.WindowServiceName = "window";
- aDescriptor.ParentIndex = -1;
- aDescriptor.Parent = controlPeer; //xWindowPeer; //argument !
- aDescriptor.Bounds = new Rectangle(0, 0, r.Width, r.Height);
- aDescriptor.WindowAttributes = VclWindowPeerAttribute.CLIPCHILDREN | WindowAttribute.SHOW;
-
- XWindowPeer xPeer = xToolkit.createWindow(aDescriptor);
- /*
- * The window in which the preview is showed.
- */
- XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, xPeer);
- Object frame = xmsf.createInstance("com.sun.star.frame.Frame");
- xFrame = UnoRuntime.queryInterface(XFrame.class, frame);
- xFrame.initialize(xWindow);
- xWindow.setVisible(true);
- }
-
- public void dispose()
- {
- try
- {
- closeFrame();
- }
- catch (CloseVetoException ex)
- {
- ex.printStackTrace();
- }
- }
-}
diff --git a/wizards/com/sun/star/wizards/ui/ImageList.java b/wizards/com/sun/star/wizards/ui/ImageList.java
deleted file mode 100644
index c9a50d94ebf7..000000000000
--- a/wizards/com/sun/star/wizards/ui/ImageList.java
+++ /dev/null
@@ -1,983 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.ui;
-
-import com.sun.star.awt.ActionEvent;
-import com.sun.star.awt.Key;
-import com.sun.star.awt.KeyEvent;
-import com.sun.star.awt.MouseEvent;
-import com.sun.star.awt.Size;
-import com.sun.star.awt.XButton;
-import com.sun.star.awt.XControl;
-import com.sun.star.awt.XFixedText;
-import com.sun.star.awt.XItemEventBroadcaster;
-import com.sun.star.awt.XItemListener;
-import com.sun.star.awt.XKeyListener;
-import com.sun.star.awt.XMouseListener;
-import com.sun.star.awt.XWindow;
-import com.sun.star.lang.EventObject;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.wizards.common.Helper;
-import com.sun.star.wizards.common.HelpIds;
-import com.sun.star.wizards.common.IRenderer;
-import com.sun.star.wizards.common.PropertyNames;
-import com.sun.star.wizards.ui.event.*;
-
-import javax.swing.ListModel;
-import javax.swing.event.ListDataEvent;
-import javax.swing.event.ListDataListener;
-
-public class ImageList implements XItemEventBroadcaster, ListDataListener
-{
-
- private XFixedText lblImageText;
- private XFixedText grbxSelectedImage;
- private XButton btnBack;
- private XButton btnNext;
- private XFixedText lblCounter;
- private XControl m_aImages[];
- private boolean benabled = true;
- private UnoDialog2 oUnoDialog;
- private Size gap = new Size(4, 4);
- private int cols = 4;
- private int rows = 3;
- private Size imageSize = new Size(20, 20);
- private Size pos;
- private Size selectionGap = new Size(2, 2);
- private boolean showButtons = true;
- private Short step;
- private final static Short NO_BORDER = Short.valueOf((short) 0);
- private static final boolean refreshOverNull = true;
- private static final int imageTextLines = 1;
- private boolean rowSelect = false;
- public int tabIndex;
- public Boolean scaleImages = Boolean.TRUE;
- public String name = "il";
- private int selected = -1;
- private int pageStart = 0;
- public int helpURL = 0;
- private IImageRenderer renderer;
- private ListModel listModel;
- public IRenderer counterRenderer = new SimpleCounterRenderer();
- private Object dialogModel;
- private ImageKeyListener imageKeyListener;
- private static final Integer BACKGROUND_COLOR = 16777216;
- private final static Short HIDE_PAGE = Short.valueOf((short) 99);
- private final static Integer TRANSPARENT = Integer.valueOf(-1);
- private final static int LINE_HEIGHT = 8;
-
- /** Getter for property imageSize.
- * @return Value of property imageSize.
- *
- */
- public Size getImageSize()
- {
- return this.imageSize;
- }
-
- /** Setter for property imageSize.
- * @param imageSize New value of property imageSize.
- *
- */
- public void setImageSize(Size imageSize)
- {
- this.imageSize = imageSize;
- }
-
- class OMouseListener implements XMouseListener
- {
- public void mousePressed(MouseEvent arg0)
- {
- focus(getImageIndexFor(getSelected()));
- }
-
- public void mouseReleased(MouseEvent arg0)
- {
- }
-
- public void mouseEntered(MouseEvent arg0)
- {
- }
-
- public void mouseExited(MouseEvent arg0)
- {
- }
-
- public void disposing(EventObject arg0)
- {
- }
- }
-
- public void create(UnoDialog2 dialog)
- {
- oUnoDialog = dialog;
- dialogModel = dialog.xDialogModel;
-
- int imageTextHeight = imageTextLines * LINE_HEIGHT;
-
- PeerConfig opeerConfig = new PeerConfig(dialog);
-
- MOVE_SELECTION_VALS[2] = step;
-
- XControl imgContainer = dialog.insertImage(name + "lblContainer",
- new String[]
- {
- "BackgroundColor",
- PropertyNames.PROPERTY_BORDER,
- PropertyNames.PROPERTY_HEIGHT,
- PropertyNames.PROPERTY_POSITION_X,
- PropertyNames.PROPERTY_POSITION_Y,
- PropertyNames.PROPERTY_STEP,
- PropertyNames.PROPERTY_WIDTH
- },
- new Object[]
- {
- BACKGROUND_COLOR,
- Short.valueOf((short) 1),
- Integer.valueOf((imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1),
- Integer.valueOf(pos.Width),
- Integer.valueOf(pos.Height),
- step,
- Integer.valueOf((imageSize.Width + gap.Width) * cols + gap.Width)
- });
-
- opeerConfig.setPeerProperties(imgContainer, new String[]
- {
- "MouseTransparent"
- }, new Object[]
- {
- Boolean.TRUE
- });
-
- int selectionWidth = rowSelect ?
- (imageSize.Width + gap.Width) * cols - gap.Width + (selectionGap.Width * 2) :
- imageSize.Width + (selectionGap.Width * 2);
-
- grbxSelectedImage = dialog.insertLabel(name + "_grbxSelected", new String[]
- {
- "BackgroundColor",
- PropertyNames.PROPERTY_BORDER,
- PropertyNames.PROPERTY_HEIGHT,
- PropertyNames.PROPERTY_POSITION_X,
- PropertyNames.PROPERTY_POSITION_Y,
- PropertyNames.PROPERTY_STEP,
- "Tabstop",
- PropertyNames.PROPERTY_WIDTH
- }, new Object[]
- {
- TRANSPARENT,
- Short.valueOf((short) 1),
- Integer.valueOf(imageSize.Height + (selectionGap.Height * 2)),
- //height
- 0, //posx
- 0, //posy
- step,
- Boolean.TRUE,
- Integer.valueOf(selectionWidth)
- });
-
- XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, grbxSelectedImage);
- xWindow.addMouseListener(new OMouseListener());
-
- final String[] pNames1 = new String[]
- {
- PropertyNames.PROPERTY_HEIGHT,
- PropertyNames.PROPERTY_HELPURL,
- PropertyNames.PROPERTY_POSITION_X,
- PropertyNames.PROPERTY_POSITION_Y,
- PropertyNames.PROPERTY_STEP,
- PropertyNames.PROPERTY_TABINDEX,
- "Tabstop",
- PropertyNames.PROPERTY_WIDTH
- };
-
- lblImageText = dialog.insertLabel(name + "_imageText", pNames1, new Object[]
- {
- Integer.valueOf(imageTextHeight),
- PropertyNames.EMPTY_STRING,
- Integer.valueOf(pos.Width + 1),
- Integer.valueOf(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height),
- step,
- Short.valueOf((short) 0),
- Boolean.FALSE,
- Integer.valueOf(cols * (imageSize.Width + gap.Width) + gap.Width - 2)
- });
-
-
- if (showButtons)
- {
- final Integer btnSize = 14;
-
- btnBack = dialog.insertButton(name + "_btnBack", new XActionListenerAdapter() {
- @Override
- public void actionPerformed(ActionEvent event) {
- prevPage();
- }
- }, pNames1, new Object[]
- {
- btnSize,
- HelpIds.getHelpIdString(helpURL++),
- Integer.valueOf(pos.Width),
- Integer.valueOf(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1),
- step,
- Short.valueOf((short) (tabIndex + 1)),
- Boolean.TRUE,
- btnSize
- });
-
- btnNext = dialog.insertButton(name + "_btnNext", new XActionListenerAdapter() {
- @Override
- public void actionPerformed(ActionEvent event) {
- nextPage();
- }
- }, pNames1, new Object[]
- {
- btnSize,
- HelpIds.getHelpIdString(helpURL++),
- Integer.valueOf(pos.Width + (imageSize.Width + gap.Width) * cols + gap.Width - btnSize.intValue() + 1),
- Integer.valueOf(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1),
- step,
- Short.valueOf((short) (tabIndex + 2)),
- Boolean.TRUE,
- btnSize
- });
-
- lblCounter = dialog.insertLabel(name + "_lblCounter", pNames1, new Object[]
- {
- Integer.valueOf(LINE_HEIGHT),
- PropertyNames.EMPTY_STRING,
- Integer.valueOf(pos.Width + btnSize.intValue() + 1),
- Integer.valueOf(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + ((btnSize.intValue() - LINE_HEIGHT) / 2)),
- step,
- Short.valueOf((short) 0),
- Boolean.FALSE,
- Integer.valueOf(cols * (imageSize.Width + gap.Width) + gap.Width - 2 * btnSize.intValue() - 1)
- });
-
- Helper.setUnoPropertyValue(getModel(lblCounter), PropertyNames.PROPERTY_ALIGN, Short.valueOf((short) 1));
- Helper.setUnoPropertyValue(getModel(btnBack), PropertyNames.PROPERTY_LABEL, "<");
- Helper.setUnoPropertyValue(getModel(btnNext), PropertyNames.PROPERTY_LABEL, ">");
-
-
- }
-
- imageKeyListener = new ImageKeyListener();
- m_tabIndex = Short.valueOf((short) tabIndex);
-
- m_aImages = new XControl[rows * cols];
-
- m_imageHeight = Integer.valueOf(imageSize.Height);
- m_imageWidth = Integer.valueOf(imageSize.Width);
-
- for (int r = 0; r < rows; r++)
- {
- for (int c = 0; c < cols; c++)
- {
- m_aImages[r * cols + c] = createImage(dialog, r, c);
- }
- }
- refreshImages();
-
- listModel.addListDataListener(this);
-
- }
- private Integer m_imageHeight, m_imageWidth;
- private final static String[] IMAGE_PROPS = new String[]
- {
- PropertyNames.PROPERTY_BORDER,
- "BackgroundColor",
- PropertyNames.PROPERTY_HEIGHT,
- PropertyNames.PROPERTY_HELPURL,
- PropertyNames.PROPERTY_POSITION_X,
- PropertyNames.PROPERTY_POSITION_Y,
- "ScaleImage",
- PropertyNames.PROPERTY_STEP,
- PropertyNames.PROPERTY_TABINDEX,
- "Tabstop",
- PropertyNames.PROPERTY_WIDTH
- };
- //used for optimization
- private Short m_tabIndex;
-
- private XControl createImage(UnoDialog2 dialog, int _row, int _col)
- {
- String imageName = name + "_image" + (_row * cols + _col);
- XControl image = dialog.insertImage(imageName,
- IMAGE_PROPS,
- new Object[]
- {
- NO_BORDER,
- BACKGROUND_COLOR,
- m_imageHeight,
- HelpIds.getHelpIdString(helpURL++),
- Integer.valueOf(getImagePosX(_col)),
- Integer.valueOf(getImagePosY(_row)),
- scaleImages,
- step,
- m_tabIndex,
- Boolean.FALSE,
- m_imageWidth
- });
-
- XWindow win = UnoRuntime.queryInterface(XWindow.class, image);
- win.addMouseListener(new XMouseListenerAdapter() {
- public void mousePressed(MouseEvent event) {
- int image = getImageFromEvent(event);
- int index = getIndexFor(image);
- if (index < listModel.getSize())
- {
- focus(image);
- setSelected(index);
- }
- }
- });
- win.addKeyListener(imageKeyListener);
-
- return image;
- }
-
- private int getImagePosX(int col)
- {
- return pos.Width + col * (imageSize.Width + gap.Width) + gap.Width;
- }
-
- private int getImagePosY(int row)
- {
- return pos.Height + row * (imageSize.Height + gap.Height) + gap.Height;
- }
-
- private void refreshImages()
- {
- if (showButtons)
- {
- refreshCounterText();
- }
- hideSelection();
- if (refreshOverNull)
- {
- for (int i = 0; i < m_aImages.length; i++)
- {
- setVisible(m_aImages[i], false);
- }
- }
- boolean focusable = true;
- for (int i = 0; i < m_aImages.length; i++)
- {
- Object[] oResources = renderer.getImageUrls(getObjectFor(i));
- if (oResources != null)
- {
- if (oResources.length == 1)
- {
- Helper.setUnoPropertyValue(m_aImages[i].getModel(), PropertyNames.PROPERTY_IMAGEURL, oResources[0]);
- }
- else if (oResources.length == 2)
- {
- oUnoDialog.getPeerConfiguration().setImageUrl(m_aImages[i].getModel(), oResources[0], oResources[1]);
- }
- Helper.setUnoPropertyValue(m_aImages[i].getModel(), "Tabstop", focusable ? Boolean.TRUE : Boolean.FALSE);
- if (refreshOverNull)
- {
- setVisible(m_aImages[i], true);
- }
- focusable = false;
- }
- }
- refreshSelection();
- }
-
- private void refreshCounterText()
- {
- Helper.setUnoPropertyValue(getModel(lblCounter), PropertyNames.PROPERTY_LABEL, counterRenderer.render(new Counter(pageStart + 1, pageEnd(), listModel.getSize())));
- }
-
- private int pageEnd()
- {
- int i = pageStart + cols * rows;
- if (i > listModel.getSize() - 1)
- {
- return listModel.getSize();
- }
- else
- {
- return i;
- }
- }
-
- private void refreshSelection()
- {
- if (selected < pageStart || selected >= (pageStart + rows * cols))
- {
- hideSelection();
- }
- else
- {
- moveSelection(getImageIndexFor(selected));
- }
- }
-
- private void hideSelection()
- {
- Helper.setUnoPropertyValue(getModel(grbxSelectedImage), PropertyNames.PROPERTY_STEP, HIDE_PAGE);
- setVisible(grbxSelectedImage, false);
- }
- private final static String[] MOVE_SELECTION = new String[]
- {
- PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP
- };
- private Object[] MOVE_SELECTION_VALS = new Object[3];
- /** Utility field holding list of ItemListeners. */
- private transient java.util.ArrayList<XItemListener> itemListenerList;
-
- private void moveSelection(int image)
- {
- setVisible(grbxSelectedImage, false);
-
- int row = image / cols;
- int col = rowSelect ? 0 : image - (row * cols);
-
- MOVE_SELECTION_VALS[0] = Integer.valueOf(getImagePosX(col) - selectionGap.Width);
- MOVE_SELECTION_VALS[1] = Integer.valueOf(getImagePosY(row) - selectionGap.Height);
-
- Helper.setUnoPropertyValues(getModel(grbxSelectedImage), MOVE_SELECTION, MOVE_SELECTION_VALS);
-
- if (((Number) Helper.getUnoPropertyValue(dialogModel, PropertyNames.PROPERTY_STEP)).shortValue() == step.shortValue())
- {
- setVisible(grbxSelectedImage, true); //now focus...
- }
- for (int i = 0; i < m_aImages.length; i++)
- {
- if (i != image)
- {
- defocus(i);
- }
- else
- {
- Helper.setUnoPropertyValue(m_aImages[image].getModel(), "Tabstop", Boolean.TRUE);
- }
- }
- }
-
- private void setVisible(Object control, boolean visible)
- {
- UnoRuntime.queryInterface(XWindow.class, control).setVisible(visible);
- }
-
- /**
- *
- * @param i
- * @return the Object in the list model corresponding to the given image index.
- */
- private Object getObjectFor(int i)
- {
- int ii = getIndexFor(i);
- if (listModel.getSize() <= ii)
- {
- return null;
- }
- else
- {
- return listModel.getElementAt(ii);
- }
- }
-
- /**
- *
- * @param i
- * @return the index in the listModel for the given image index.
- */
- private int getIndexFor(int i)
- {
- return pageStart + i;
- }
-
- private int getImageIndexFor(int i)
- {
- return i - pageStart;
- }
-
- public void contentsChanged(ListDataEvent event)
- {
- }
-
- public void intervalAdded(ListDataEvent event)
- {
- if (event.getIndex0() <= selected)
- {
- if (event.getIndex1() <= selected)
- {
- selected += event.getIndex1() - event.getIndex0() + 1;
- }
- }
- if (event.getIndex0() < pageStart || event.getIndex1() < (pageStart + getRows() + getCols()))
- {
- refreshImages();
- }
- }
-
- public void intervalRemoved(ListDataEvent event)
- {
- //contentsChanged(event);
- }
-
- /** Registers ItemListener to receive events.
- * @param listener The listener to register.
- *
- */
- public synchronized void addItemListener(XItemListener listener)
- {
- if (itemListenerList == null)
- {
- itemListenerList = new java.util.ArrayList<XItemListener>();
- }
- itemListenerList.add(listener);
- }
-
- /** Removes ItemListener from the list of listeners.
- * @param listener The listener to remove.
- *
- */
- public synchronized void removeItemListener(XItemListener listener)
- {
- if (itemListenerList != null)
- {
- itemListenerList.remove(listener);
- }
- }
-
- /** Notifies all registered listeners about the event.
- */
- private void fireItemSelected()
- {
- java.util.ArrayList<XItemListener> list;
- synchronized(this)
- {
- if (itemListenerList == null)
- {
- return;
- }
- list = (java.util.ArrayList<XItemListener>) itemListenerList.clone();
- }
- for (int i = 0; i < list.size(); i++)
- {
- list.get(i).itemStateChanged(null);
- }
- }
-
- public int getCols()
- {
- return cols;
- }
-
- public Size getGap()
- {
- return gap;
- }
-
- public ListModel getListModel()
- {
- return listModel;
- }
-
- public Short getStep()
- {
- return step;
- }
-
- public int getPageStart()
- {
- return pageStart;
- }
-
- public Size getPos()
- {
- return pos;
- }
-
- public IImageRenderer getRenderer()
- {
- return renderer;
- }
-
- public int getRows()
- {
- return rows;
- }
-
- public int getSelected()
- {
- return selected;
- }
-
- public Size getSelectionGap()
- {
- return selectionGap;
- }
-
- public boolean isShowButtons()
- {
- return showButtons;
- }
-
- public void setCols(int i)
- {
- cols = i;
- }
-
- public void setGap(Size size)
- {
- gap = size;
- }
-
- public void setListModel(ListModel model)
- {
- listModel = model;
- }
-
- public void setStep(Short short1)
- {
- step = short1;
- }
-
- public void setPageStart(int i)
- {
- if (i == pageStart)
- {
- return;
- }
- pageStart = i;
- enableButtons();
- refreshImages();
- }
-
- public void setPos(Size size)
- {
- pos = size;
- }
-
- public void setRenderer(IImageRenderer renderer)
- {
- this.renderer = renderer;
- }
-
- public void setRows(int i)
- {
- rows = i;
- }
-
- public void setSelected(int i)
- {
- if (rowSelect && (i >= 0))
- {
- i = (i / cols) * cols;
- }
- if (selected == i)
- {
- return;
- }
- selected = i;
- refreshImageText();
- refreshSelection();
- fireItemSelected();
- }
-
- public void setSelected(Object object)
- {
- if (object == null)
- {
- setSelected(-1);
- }
- else
- {
- for (int i = 0; i < getListModel().getSize(); i++)
- {
- if (getListModel().getElementAt(i).equals(object))
- {
- setSelected(i);
- return;
- }
- }
- }
- setSelected(-1);
-
- }
-
- private void refreshImageText()
- {
- Object item = selected >= 0 ? getListModel().getElementAt(selected) : null;
- Helper.setUnoPropertyValue(getModel(lblImageText), PropertyNames.PROPERTY_LABEL, PropertyNames.SPACE + renderer.render(item));
- }
-
- public void setSelectionGap(Size size)
- {
- selectionGap = size;
- }
-
- public void setShowButtons(boolean b)
- {
- showButtons = b;
- }
-
- private void nextPage()
- {
- if (pageStart < getListModel().getSize() - rows * cols)
- {
- setPageStart(pageStart + rows * cols);
- }
- }
-
- private void prevPage()
- {
- if (pageStart == 0)
- {
- return;
- }
- int i = pageStart - rows * cols;
- if (i < 0)
- {
- i = 0;
- }
- setPageStart(i);
- }
-
- private void enableButtons()
- {
- enable(btnNext, Boolean.valueOf(pageStart + rows * cols < listModel.getSize()));
- enable(btnBack, Boolean.valueOf(pageStart > 0));
- }
-
- private void enable(Object control, Boolean enable)
- {
- Helper.setUnoPropertyValue(getModel(control), PropertyNames.PROPERTY_ENABLED, enable);
- }
-
- private Object getModel(Object control)
- {
- return UnoRuntime.queryInterface(XControl.class, control).getModel();
- }
-
- private int getImageFromEvent(Object event)
- {
- Object image = ((EventObject) event).Source;
- String controlName = (String) Helper.getUnoPropertyValue(getModel(image), PropertyNames.PROPERTY_NAME);
- return Integer.parseInt(controlName.substring(6 + name.length()));
-
- }
-
- public Object[] getSelectedObjects()
- {
- return new Object[]
- {
- getListModel().getElementAt(selected)
- };
- }
-
- public interface IImageRenderer extends IRenderer
- {
-
- /**
- * @return two resource ids for an image referenced in the imaglist resourcefile of the
- * wizards project; The second one of them is designed to be used for High Contrast Mode.
- */
- Object[] getImageUrls(Object listItem);
- }
-
- private static class SimpleCounterRenderer implements IRenderer
- {
-
- public String render(Object counter)
- {
- return PropertyNames.EMPTY_STRING + ((Counter) counter).start + ".." + ((Counter) counter).end + "/" + ((Counter) counter).max;
- }
- }
-
- public static class Counter
- {
-
- public int start, end, max;
-
- public Counter(int start_, int end_, int max_)
- {
- start = start_;
- end = end_;
- max = max_;
- }
- }
-
- public Object getSelectedObject()
- {
- return selected >= 0 ? getListModel().getElementAt(selected) : null;
- }
-
- public void showSelected()
- {
- int oldPageStart = pageStart;
- if (selected == -1)
- {
- pageStart += 0;
- }
- else
- {
- pageStart = (selected / m_aImages.length) * m_aImages.length;
- }
- if (oldPageStart != pageStart)
- {
- enableButtons();
- refreshImages();
- }
- }
-
- public void setRowSelect(boolean b)
- {
- rowSelect = b;
- }
-
- public boolean isRowSelect()
- {
- return rowSelect;
- }
-
- private class ImageKeyListener implements XKeyListener
- {
-
- /* (non-Javadoc)
- * @see com.sun.star.awt.XKeyListener#keyPressed(com.sun.star.awt.KeyEvent)
- */
- public void keyPressed(KeyEvent ke)
- {
- int image = getImageFromEvent(ke);
- int r = image / getCols();
- int c = image - (r * getCols());
- int d = getKeyMove(ke, r, c);
- int newImage = image + d;
- if (newImage == image)
- {
- return;
- }
- if (isFocusable(newImage))
- {
- changeFocus(image, newImage);
- }
- }
-
- private boolean isFocusable(int image)
- {
- return (image >= 0) && (getIndexFor(image) < listModel.getSize());
- }
-
- private void changeFocus(int oldFocusImage, int newFocusImage)
- {
- focus(newFocusImage);
- defocus(oldFocusImage);
- }
-
- private final int getKeyMove(KeyEvent ke, int row, int col)
- {
- switch (ke.KeyCode)
- {
- case Key.UP:
- if (row > 0)
- {
- return 0 - getCols();
- }
- break;
- case Key.DOWN:
- if (row < getRows() - 1)
- {
- return getCols();
- }
- break;
- case Key.LEFT:
- if (col > 0)
- {
- return -1;
- }
- break;
- case Key.RIGHT:
- if (col < getCols() - 1)
- {
- return 1;
- }
- break;
- case Key.SPACE:
- select(ke);
- }
- return 0;
- }
-
- private void select(KeyEvent ke)
- {
- setSelected(getIndexFor(getImageFromEvent(ke)));
- }
-
- public void keyReleased(KeyEvent ke)
- {
- }
-
- public void disposing(EventObject arg0)
- {
- }
- }
-
- private final void focus(int image)
- {
- Helper.setUnoPropertyValue(m_aImages[image].getModel(), "Tabstop",
- Boolean.TRUE);
- XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, m_aImages[image]);
- xWindow.setFocus();
- }
-
- private final void defocus(int image)
- {
- Helper.setUnoPropertyValue(UnoDialog.getModel(m_aImages[image]), "Tabstop",
- Boolean.FALSE);
-
- }
-
- /**
- * 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;
- }
-
- public void setenabled(boolean b)
- {
-
- for (int i = 0; i < m_aImages.length; i++)
- {
- UnoDialog2.setEnabled(m_aImages[i], b);
- }
- UnoDialog2.setEnabled(grbxSelectedImage, b);
- UnoDialog2.setEnabled(lblImageText, b);
- if (showButtons)
- {
- UnoDialog2.setEnabled(btnBack, b);
- UnoDialog2.setEnabled(btnNext, b);
- UnoDialog2.setEnabled(lblCounter, b);
- }
- benabled = b;
- }
-}
diff --git a/wizards/com/sun/star/wizards/ui/PathSelection.java b/wizards/com/sun/star/wizards/ui/PathSelection.java
deleted file mode 100644
index 7fa09c5d6269..000000000000
--- a/wizards/com/sun/star/wizards/ui/PathSelection.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.ui;
-
-import com.sun.star.awt.ActionEvent;
-import com.sun.star.awt.TextEvent;
-import com.sun.star.awt.XTextComponent;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.uno.Exception;
-import com.sun.star.wizards.common.FileAccess;
-import com.sun.star.wizards.common.PropertyNames;
-import com.sun.star.wizards.common.SystemDialog;
-import com.sun.star.wizards.ui.event.XActionListenerAdapter;
-import com.sun.star.wizards.ui.event.XTextListenerAdapter;
-
-public class PathSelection
-{
-
- UnoDialog2 CurUnoDialog;
- XMultiServiceFactory xMSF;
- int iDialogType;
- int iTransferMode;
- public String sDefaultDirectory = PropertyNames.EMPTY_STRING;
- public String sDefaultName = PropertyNames.EMPTY_STRING;
- public String sDefaultFilter = PropertyNames.EMPTY_STRING;
- public boolean usedPathPicker = false;
- public XPathSelectionListener xAction;
- public XTextComponent xSaveTextBox;
-
- public static class DialogTypes
- {
-
- public static final int FOLDER = 0;
- public static final int FILE = 1;
- }
-
- public static class TransferMode
- {
-
- public static final int SAVE = 0;
- public static final int LOAD = 1;
- }
-
- public PathSelection(XMultiServiceFactory xMSF, UnoDialog2 CurUnoDialog, int TransferMode, int DialogType)
- {
- this.CurUnoDialog = CurUnoDialog;
- this.xMSF = xMSF;
- this.iDialogType = DialogType;
- this.iTransferMode = TransferMode;
-
- }
-
- public void insert(int DialogStep, int XPos, int YPos, int Width, short CurTabIndex, String LabelText, boolean Enabled, String TxtHelpURL, String BtnHelpURL)
- {
-
- CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblSaveAs", new String[]
- {
- PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
- }, new Object[]
- {
- Boolean.valueOf(Enabled), 8, LabelText, Integer.valueOf(XPos), Integer.valueOf(YPos), Integer.valueOf(DialogStep), Short.valueOf(CurTabIndex), Integer.valueOf(Width)
- });
-
- xSaveTextBox = CurUnoDialog.insertTextField("txtSavePath", new XTextListenerAdapter() {
- @Override
- public void textChanged(TextEvent arg0) {
- callXPathSelectionListener();
- }
- },
- new String[]
- {
- PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
- }, new Object[]
- {
- Boolean.valueOf(Enabled), 12, TxtHelpURL, Integer.valueOf(XPos), Integer.valueOf(YPos + 10), Integer.valueOf(DialogStep), Short.valueOf((short) (CurTabIndex + 1)), Integer.valueOf(Width - 26)
- });
- //CurUnoDialog.setControlProperty("txtSavePath", PropertyNames.READ_ONLY, Boolean.TRUE);
- CurUnoDialog.setControlProperty("txtSavePath", PropertyNames.PROPERTY_ENABLED, Boolean.FALSE);
- CurUnoDialog.insertButton("cmdSelectPath", new XActionListenerAdapter() {
- @Override
- public void actionPerformed(ActionEvent event) {
- triggerPathPicker();
- }
- }, new String[]
- {
- PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
- }, new Object[]
- {
- Boolean.valueOf(Enabled), 14, BtnHelpURL, "...", Integer.valueOf(XPos + Width - 16), Integer.valueOf(YPos + 9), Integer.valueOf(DialogStep), Short.valueOf((short) (CurTabIndex + 2)), 16
- });
-
- }
-
- public void addSelectionListener(XPathSelectionListener xAction)
- {
- this.xAction = xAction;
- }
-
- public String getSelectedPath()
- {
- return xSaveTextBox.getText();
- }
-
- public void initializePath()
- {
- try
- {
- FileAccess myFA = new FileAccess(xMSF);
- xSaveTextBox.setText(myFA.getPath(sDefaultDirectory + "/" + sDefaultName, null));
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- private void triggerPathPicker()
- {
- try
- {
- switch (iTransferMode)
- {
- case TransferMode.SAVE:
- switch (iDialogType)
- {
- case DialogTypes.FOLDER:
- //TODO: write code for picking a folder for saving
- break;
- case DialogTypes.FILE:
- usedPathPicker = true;
- SystemDialog myFilePickerDialog = SystemDialog.createStoreDialog(xMSF);
- myFilePickerDialog.callStoreDialog(sDefaultDirectory, sDefaultName, sDefaultFilter);
- String sStorePath = myFilePickerDialog.sStorePath;
- if (sStorePath != null)
- {
- FileAccess myFA = new FileAccess(xMSF);
- xSaveTextBox.setText(myFA.getPath(sStorePath, null));
- sDefaultDirectory = FileAccess.getParentDir(sStorePath);
- sDefaultName = FileAccess.getFilename(sStorePath);
- }
- break;
- default:
- break;
- }
- break;
- case TransferMode.LOAD:
- switch (iDialogType)
- {
- case DialogTypes.FOLDER:
- //TODO: write code for picking a folder for loading
- break;
- case DialogTypes.FILE:
- //TODO: write code for picking a file for loading
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
- }
- catch (Exception e)
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- private void callXPathSelectionListener()
- {
- if (xAction != null)
- {
- xAction.validatePath();
- }
- }
-}
diff --git a/wizards/com/sun/star/wizards/ui/XPathSelectionListener.java b/wizards/com/sun/star/wizards/ui/XPathSelectionListener.java
deleted file mode 100644
index 6a9d4ad9e7af..000000000000
--- a/wizards/com/sun/star/wizards/ui/XPathSelectionListener.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package com.sun.star.wizards.ui;
-
-public interface XPathSelectionListener
-{
-
- void validatePath();
-}
diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.java b/wizards/com/sun/star/wizards/ui/event/DataAware.java
index 55fa01f1840b..5b9ad62a537f 100644
--- a/wizards/com/sun/star/wizards/ui/event/DataAware.java
+++ b/wizards/com/sun/star/wizards/ui/event/DataAware.java
@@ -17,10 +17,7 @@
*/
package com.sun.star.wizards.ui.event;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
import java.util.Arrays;
-import com.sun.star.wizards.common.PropertyNames;
/**
* DataAware objects are used to live-synchronize UI and DataModel/DataObject.
@@ -174,100 +171,4 @@ public abstract class DataAware {
void set(Object value, Object target);
}
- /**
- * implementation of Value, handling JavaBeans properties through
- * reflection.
- * This Object gets and sets a value a specific
- * (JavaBean-style) property on a given object.
- */
- public static class PropertyValue implements Value {
- /**
- * the get method of the JavaBean-style property
- */
- private final Method getMethod;
- /**
- * the set method of the JavaBean-style property
- */
- private final Method setMethod;
-
- /**
- * creates a PropertyValue for the property with
- * the given name, of the given JavaBean object.
- * @param propertyName the property to access. Must be a Cup letter (e.g. PropertyNames.PROPERTY_NAME for getName() and setName("..."). )
- * @param propertyOwner the object which "own" or "contains" the property.
- */
- public PropertyValue(String propertyName, Object propertyOwner) {
- getMethod = createGetMethod(propertyName, propertyOwner);
- setMethod = createSetMethod(propertyName, propertyOwner, getMethod.getReturnType());
- }
-
- /**
- * called from the constructor, and creates a get method reflection object
- * for the given property and object.
- * @param propName the property name0
- * @param obj the object which contains the property.
- * @return the get method reflection object.
- */
- protected Method createGetMethod(String propName, Object obj)
- {
- Method m = null;
- try
- { //try to get a "get" method.
-
- m = obj.getClass().getMethod("get" + propName);
- }
- catch (NoSuchMethodException ex1)
- {
- throw new IllegalArgumentException("get" + propName + "() method does not exist on " + obj.getClass().getName());
- }
- return m;
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.wizards.ui.event.DataAware.Value#get(java.lang.Object)
- */
- public Object get(Object target) {
- try {
- return getMethod.invoke(target);
- } catch (IllegalAccessException ex1) {
- ex1.printStackTrace();
- } catch (InvocationTargetException ex2) {
- ex2.printStackTrace();
- } catch (NullPointerException npe) {
- if (getMethod.getReturnType().equals(String.class))
- return PropertyNames.EMPTY_STRING;
- if (getMethod.getReturnType().equals(Short.class))
- return Short.valueOf((short) 0);
- if (getMethod.getReturnType().equals(Integer.class))
- return 0;
- if (getMethod.getReturnType().equals(short[].class))
- return new short[0];
- }
- return null;
- }
-
- protected Method createSetMethod(String propName, Object obj, Class<?> paramClass) {
- Method m = null;
- try {
- m = obj.getClass().getMethod("set" + propName, paramClass);
- } catch (NoSuchMethodException ex1) {
- throw new IllegalArgumentException("set" + propName + "(" + getMethod.getReturnType().getName() + ") method does not exist on " + obj.getClass().getName());
- }
- return m;
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.wizards.ui.event.DataAware.Value#set(java.lang.Object, java.lang.Object)
- */
- public void set(Object value, Object target) {
- try {
- setMethod.invoke(target, value);
- } catch (IllegalAccessException ex1) {
- ex1.printStackTrace();
- } catch (InvocationTargetException ex2) {
- ex2.printStackTrace();
- }
- }
-
- }
}
diff --git a/wizards/com/sun/star/wizards/ui/event/EventNames.java b/wizards/com/sun/star/wizards/ui/event/EventNames.java
deleted file mode 100644
index 301e763c20cd..000000000000
--- a/wizards/com/sun/star/wizards/ui/event/EventNames.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.ui.event;
-
-public enum EventNames
-{
- //common listener events
- ACTION_PERFORMED,
- ITEM_CHANGED,
- TEXT_CHANGED, //window events (XWindow)
- WINDOW_RESIZED,
- WINDOW_MOVED,
- WINDOW_SHOWN,
- WINDOW_HIDDEN, //focus events (XWindow)
- FOCUS_GAINED,
- FOCUS_LOST, //keyboard events
- KEY_PRESSED,
- KEY_RELEASED, //mouse events
- MOUSE_PRESSED,
- MOUSE_RELEASED,
- MOUSE_ENTERED,
- MOUSE_EXITED //other events
-}
diff --git a/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java b/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java
deleted file mode 100644
index f290312abd9b..000000000000
--- a/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.ui.event;
-
-import javax.swing.ListModel;
-import javax.swing.event.ListDataEvent;
-import javax.swing.event.ListDataListener;
-
-import com.sun.star.awt.XComboBox;
-import com.sun.star.awt.XListBox;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.wizards.common.Helper;
-import com.sun.star.wizards.common.PropertyNames;
-
-public class ListModelBinder implements ListDataListener
-{
-
- private final XListBox unoList;
- private final Object unoListModel;
- private ListModel listModel;
- private final Renderer renderer = new Renderer()
- {
-
- public String render(Object item)
- {
- if (item == null)
- {
- return PropertyNames.EMPTY_STRING;
- }
- else
- {
- return item.toString();
- }
- }
- };
-
- public ListModelBinder(Object unoListBox, ListModel listModel_)
- {
- unoList = UnoRuntime.queryInterface(XListBox.class, unoListBox);
- unoListModel = UnoDataAware.getModel(unoListBox);
- setListModel(listModel_);
- }
-
- public void setListModel(ListModel newListModel)
- {
- if (listModel != null)
- {
- listModel.removeListDataListener(this);
- }
- listModel = newListModel;
- listModel.addListDataListener(this);
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListDataListener#contentsChanged(javax.swing.event.ListDataEvent)
- */
- public void contentsChanged(ListDataEvent lde)
- {
- short[] selected = getSelectedItems();
- for (short i = (short) lde.getIndex0(); i <= lde.getIndex1(); i++)
- {
- update(i);
- }
- setSelectedItems(selected);
- }
-
- protected void update(short i)
- {
- remove(i, i);
- insert(i);
- }
-
- protected void remove(short i1, short i2)
- {
- unoList.removeItems(i1, (short) (i2 - i1 + 1));
- }
-
- protected void insert(short i)
- {
- unoList.addItem(getItemString(i), i);
- }
-
- protected String getItemString(short i)
- {
- return getItemString(listModel.getElementAt(i));
- }
-
- protected String getItemString(Object item)
- {
- return renderer.render(item);
- }
-
- protected short[] getSelectedItems()
- {
- return (short[]) Helper.getUnoPropertyValue(unoListModel, PropertyNames.SELECTED_ITEMS);
- }
-
- protected void setSelectedItems(short[] selected)
- {
- Helper.setUnoPropertyValue(unoListModel, PropertyNames.SELECTED_ITEMS, selected);
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListDataListener#intervalAdded(javax.swing.event.ListDataEvent)
- */
- public void intervalAdded(ListDataEvent lde)
- {
- for (short i = (short) lde.getIndex0(); i <= lde.getIndex1(); i++)
- {
- insert(i);
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListDataListener#intervalRemoved(javax.swing.event.ListDataEvent)
- */
- public void intervalRemoved(ListDataEvent lde)
- {
- remove((short) lde.getIndex0(), (short) lde.getIndex1());
- }
-
- public interface Renderer
- {
-
- String render(Object item);
- }
-
- public static void fillList(Object list, Object[] items, Renderer renderer)
- {
- XListBox xlist = UnoRuntime.queryInterface(XListBox.class, list);
- Helper.setUnoPropertyValue(UnoDataAware.getModel(list), PropertyNames.STRING_ITEM_LIST, new String[]
- {
- });
- for (short i = 0; i < items.length; i++)
- {
- if (items[i] != null)
- {
- xlist.addItem((renderer != null ? renderer.render(items[i]) : items[i].toString()), i);
- }
- }
- }
-
- public static void fillComboBox(Object list, Object[] items, Renderer renderer)
- {
- XComboBox xComboBox = UnoRuntime.queryInterface(XComboBox.class, list);
- Helper.setUnoPropertyValue(UnoDataAware.getModel(list), PropertyNames.STRING_ITEM_LIST, new String[]
- {
- });
- for (short i = 0; i < items.length; i++)
- {
- if (items[i] != null)
- {
- xComboBox.addItem((renderer != null ? renderer.render(items[i]) : items[i].toString()), i);
- }
- }
- }
-}
diff --git a/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java b/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java
deleted file mode 100644
index fb834b45d1d3..000000000000
--- a/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.ui.event;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-/**
- * Encapsulate a Method invocation.
- * <p>In the constructor one defines a method, a target object and an optional
- * Parameter.</p>
- * <p>Then one calls "invoke", with or without a parameter.</p>
- * <p>Limitations: I do not check anything myself. If the param is not ok, from the
- * wrong type, or the method does not exist on the given object.
- * You can trick this class how much you want: it will all throw exceptions
- * on the java level. i throw no error warnings or my own exceptions...</p>
- */
-final class MethodInvocation
-{
- //the method to invoke.
- private final Method mMethod;
- //the object to invoke the method on.
- private final Object mTargetObject;
- //with one Parameter / without
- private final boolean mWithParam;
-
- /** Creates a new instance of MethodInvokation */
- public MethodInvocation(String methodName, Object target) throws NoSuchMethodException
- {
- this(methodName, target, null);
- }
-
- public MethodInvocation(String methodName, Object target, Class<?> paramClass) throws NoSuchMethodException
- {
- if (paramClass == null) {
- mMethod = target.getClass().getMethod(methodName);
- } else {
- mMethod = target.getClass().getMethod(methodName, paramClass);
- }
- mTargetObject = target;
- mWithParam = paramClass != null;
- }
-
- /**
- * Returns the result of calling the method on the object, or null, if no result.
- */
- public Object invoke(Object param) throws IllegalAccessException, InvocationTargetException
- {
- if (mWithParam)
- {
- return mMethod.invoke(mTargetObject, param);
- }
- else
- {
- return mMethod.invoke(mTargetObject);
- }
- }
-
-}
diff --git a/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java b/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java
deleted file mode 100644
index 550470e5c341..000000000000
--- a/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.ui.event;
-
-import com.sun.star.awt.XItemListener;
-import com.sun.star.awt.XRadioButton;
-import com.sun.star.uno.UnoRuntime;
-
-public class RadioDataAware extends DataAware
-{
-
- protected XRadioButton[] radioButtons;
-
- public RadioDataAware(Object data, Value value, Object[] radioButs)
- {
- super(data, value);
- radioButtons = new XRadioButton[radioButs.length];
- for (int i = 0; i < radioButs.length; i++)
- {
- radioButtons[i] = UnoRuntime.queryInterface(XRadioButton.class, radioButs[i]);
- }
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.wizards.ui.DataAware#setToUI(java.lang.Object)
- */
- protected void setToUI(Object value)
- {
- int selected = ((Number) value).intValue();
- if (selected == -1)
- {
- for (int i = 0; i < radioButtons.length; i++)
- {
- radioButtons[i].setState(false);
- }
- }
- else
- {
- radioButtons[selected].setState(true);
- }
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.wizards.ui.DataAware#getFromUI()
- */
- protected Object getFromUI()
- {
- for (int i = 0; i < radioButtons.length; i++)
- {
- if (radioButtons[i].getState())
- {
- return Integer.valueOf(i);
- }
- }
- return Integer.valueOf(-1);
- }
-
- public static DataAware attachRadioButtons(Object data, String dataProp, Object[] buttons, final Listener listener, boolean field)
- {
- final RadioDataAware da = new RadioDataAware(data,
- field
- ? DataAwareFields.getFieldValueFor(data, dataProp, 0)
- : new DataAware.PropertyValue(dataProp, data), buttons);
- XItemListener xil = UnoDataAware.itemListener(da, listener);
- for (int i = 0; i < da.radioButtons.length; i++)
- {
- da.radioButtons[i].addItemListener(xil);
- }
- return da;
- }
-}
diff --git a/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java b/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java
deleted file mode 100644
index 96d8451de81b..000000000000
--- a/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.ui.event;
-
-public class SimpleDataAware extends DataAware
-{
-
- protected Object control;
- protected Object[] disableObjects = new Object[0];
- protected Value controlValue;
-
- public SimpleDataAware(Object dataObject, Value value, Object control_, Value controlValue_)
- {
- super(dataObject, value);
- control = control_;
- controlValue = controlValue_;
- }
-
- /*
- protected void enableControls(Object value) {
- Boolean b = getBoolean(value);
- for (int i = 0; i<disableObjects.length; i++)
- UIHelper.setEnabled(disableObjects[i],b);
- }
- */
- protected void setToUI(Object value)
- {
- controlValue.set(value, control);
- }
-
- /**
- * Try to get from an arbitrary object a boolean value.
- * Null returns Boolean.FALSE;
- * A Boolean object returns itself.
- * An Array returns true if it not empty.
- * An Empty String returns Boolean.FALSE.
- * everything else returns a Boolean.TRUE.
- * @param value
- * @return
- */
- /*protected Boolean getBoolean(Object value) {
- if (value==null)
- return Boolean.FALSE;
- if (value instanceof Boolean)
- return (Boolean)value;
- else if (value.getClass().isArray())
- return ((short[])value).length != 0 ? Boolean.TRUE : Boolean.FALSE;
- else if (value.equals(PropertyNames.EMPTY_STRING)) return Boolean.FALSE;
- else return Boolean.TRUE;
- }
-
- public void disableControls(Object[] controls) {
- disableObjects = controls;
- }
- */
- protected Object getFromUI()
- {
- return controlValue.get(control);
- }
-}
diff --git a/wizards/com/sun/star/wizards/ui/event/Task.java b/wizards/com/sun/star/wizards/ui/event/Task.java
deleted file mode 100644
index 5ff9aa4bef84..000000000000
--- a/wizards/com/sun/star/wizards/ui/event/Task.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.ui.event;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class Task
-{
-
- private int successful = 0;
- private int failed = 0;
- private int max = 0;
- private final String taskName;
- private final List<TaskListener> listeners = new ArrayList<TaskListener>();
- private String subtaskName;
-
- public Task(String taskName_, String subtaskName_, int max_)
- {
- taskName = taskName_;
- subtaskName = subtaskName_;
- max = max_;
- }
-
- public int getMax()
- {
- return max;
- }
-
- public void setMax(int max_)
- {
- max = max_;
- fireTaskStatusChanged();
- }
-
- public int getStatus()
- {
- return successful + failed;
- }
-
- protected void fireTaskStatusChanged()
- {
- TaskEvent te = new TaskEvent(this, TaskEvent.TASK_STATUS_CHANGED);
-
- for (int i = 0; i < listeners.size(); i++)
- {
- listeners.get(i).taskStatusChanged(te);
- }
- }
-
- protected void fireSubtaskNameChanged()
- {
- TaskEvent te = new TaskEvent(this, TaskEvent.SUBTASK_NAME_CHANGED);
-
- for (int i = 0; i < listeners.size(); i++)
- {
- listeners.get(i).subtaskNameChanged(te);
- }
- }
-
- public String getSubtaskName()
- {
- return subtaskName;
- }
-
- public String getTaskName()
- {
- return taskName;
- }
-
- public void setSubtaskName(String string)
- {
- subtaskName = string;
- fireSubtaskNameChanged();
- }
-
- public int getFailed()
- {
- return failed;
- }
-
- public int getSuccessfull()
- {
- return successful;
- }
-}
diff --git a/wizards/com/sun/star/wizards/ui/event/TaskEvent.java b/wizards/com/sun/star/wizards/ui/event/TaskEvent.java
deleted file mode 100644
index 40f6f5d49e78..000000000000
--- a/wizards/com/sun/star/wizards/ui/event/TaskEvent.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.ui.event;
-
-import java.util.EventObject;
-
-public class TaskEvent extends EventObject
-{
-
- public static final int TASK_STARTED = 1;
- public static final int TASK_FINISHED = 2;
- public static final int TASK_STATUS_CHANGED = 3;
- public static final int SUBTASK_NAME_CHANGED = 4;
- public static final int TASK_FAILED = 5;
- private final int type;
-
- public TaskEvent(Task source, int type_)
- {
- super(source);
- type = type_;
- }
-
- public Task getTask()
- {
- return (Task) getSource();
- }
-}
diff --git a/wizards/com/sun/star/wizards/ui/event/TaskListener.java b/wizards/com/sun/star/wizards/ui/event/TaskListener.java
deleted file mode 100644
index 4db9ec92ee1e..000000000000
--- a/wizards/com/sun/star/wizards/ui/event/TaskListener.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.ui.event;
-
-import java.util.EventListener;
-
-public interface TaskListener extends EventListener
-{
-
- void taskFinished(TaskEvent te);
-
- /**
- * is called when the status of the task has advanced.
- */
- void taskStatusChanged(TaskEvent te);
-
- void subtaskNameChanged(TaskEvent te);
-}
diff --git a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java
deleted file mode 100644
index 50e753f96d0d..000000000000
--- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.ui.event;
-
-import com.sun.star.awt.*;
-import com.sun.star.lang.EventObject;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.wizards.common.Helper;
-import com.sun.star.wizards.common.PropertyNames;
-
-/**
- * This class suppoprts imple cases where a UI control can
- * be directly synchronized with a data property.
- * Such controls are: the different text controls
- * (synchronizing the "Text" , "Value", "Date", "Time" property),
- * Checkbox controls, Dropdown listbox controls (synchronizing the
- * SelectedItems[] property.
- * For those controls, static convenience methods are offered, to simplify use.
- */
-public class UnoDataAware extends DataAware
-{
-
- protected Object unoControl;
- protected Object unoModel;
- protected String unoPropName;
- protected Object[] disableObjects = new Object[0];
- protected boolean inverse = false;
-
- protected UnoDataAware(Object dataObject, Value value, Object unoObject_, String unoPropName_)
- {
- super(dataObject, value);
- unoControl = unoObject_;
- unoModel = getModel(unoControl);
- unoPropName = unoPropName_;
- }
-
- public void setInverse(boolean i)
- {
- inverse = i;
- }
-
- protected void enableControls(Object value)
- {
- Boolean b = getBoolean(value);
- if (inverse)
- {
- b = b.booleanValue() ? Boolean.FALSE : Boolean.TRUE;
- }
- for (int i = 0; i < disableObjects.length; i++)
- {
- setEnabled(disableObjects[i], b);
- }
- }
-
- protected void setToUI(Object value)
- {
- Helper.setUnoPropertyValue(unoModel, unoPropName, value);
- }
-
- /**
- * Try to get from an arbitrary object a boolean value.
- * Null returns Boolean.FALSE;
- * A Boolean object returns itself.
- * An Array returns true if it not empty.
- * An Empty String returns Boolean.FALSE.
- * everything else returns a Boolean.TRUE.
- * @param value
- * @return
- */
- protected Boolean getBoolean(Object value)
- {
- if (value == null)
- {
- return Boolean.FALSE;
- }
- if (value instanceof Boolean)
- {
- return (Boolean) value;
- }
- else if (value.getClass().isArray())
- {
- return ((short[]) value).length != 0 ? Boolean.TRUE : Boolean.FALSE;
- }
- else if (value.equals(PropertyNames.EMPTY_STRING))
- {
- return Boolean.FALSE;
- }
- else if (value instanceof Number)
- {
- return ((Number) value).intValue() == 0 ? Boolean.TRUE : Boolean.FALSE;
- }
- else
- {
- return Boolean.TRUE;
- }
- }
-
-
-
- protected Object getFromUI()
- {
- return Helper.getUnoPropertyValue(unoModel, unoPropName);
- }
-
- static XItemListener itemListener(final DataAware da, final Listener listener)
- {
- return new XItemListener()
- {
-
- public void itemStateChanged(ItemEvent ie)
- {
- da.updateData();
- if (listener != null)
- {
- listener.eventPerformed(ie);
- }
- }
-
- public void disposing(EventObject eo)
- {
- }
- };
- }
-
- public static Object getModel(Object control)
- {
- return UnoRuntime.queryInterface(XControl.class, control).getModel();
- }
-
- public static void setEnabled(Object control, Boolean enabled)
- {
- Helper.setUnoPropertyValue(getModel(control), PropertyNames.PROPERTY_ENABLED, enabled);
- }
-}
diff --git a/wizards/com/sun/star/wizards/ui/event/XMouseListenerAdapter.java b/wizards/com/sun/star/wizards/ui/event/XMouseListenerAdapter.java
deleted file mode 100644
index 8d89c4a263e4..000000000000
--- a/wizards/com/sun/star/wizards/ui/event/XMouseListenerAdapter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package com.sun.star.wizards.ui.event;
-
-import com.sun.star.awt.MouseEvent;
-import com.sun.star.awt.XMouseListener;
-
-public class XMouseListenerAdapter implements XMouseListener {
-
- public void disposing(com.sun.star.lang.EventObject event) {
- }
-
- public void mouseEntered(MouseEvent event) {
- }
-
- public void mouseExited(MouseEvent event) {
- }
-
- public void mousePressed(MouseEvent event) {
- }
-
- public void mouseReleased(MouseEvent event) {
- }
-}