summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-09-22 12:23:28 +0200
committerNoel Grandin <noel@peralex.com>2014-09-22 14:28:35 +0200
commit04f43cd6a0159da29a0df4bf8e27387156f321e5 (patch)
treeaa323aaab3f91503006113217187f67fc523fe14
parent3c6da8e49a96513eda73656f3f6212f980a74b51 (diff)
84059 - form wizard : files required could not be found
I've essentially unwound most the Java changes I made te wizards module in the last few months. I will revisit my changes at a later date and make them more carefully :-) Change-Id: I9221a825dc8de6edc96d6db07072aefcd1a37107
-rw-r--r--wizards/Jar_commonwizards.mk1
-rw-r--r--wizards/com/sun/star/wizards/common/ConfigGroup.java6
-rw-r--r--wizards/com/sun/star/wizards/common/ConfigNode.java6
-rw-r--r--wizards/com/sun/star/wizards/common/ConfigSet.java2
-rw-r--r--wizards/com/sun/star/wizards/common/Configuration.java102
-rw-r--r--wizards/com/sun/star/wizards/common/DebugHelper.java6
-rw-r--r--wizards/com/sun/star/wizards/common/Desktop.java201
-rw-r--r--wizards/com/sun/star/wizards/common/FileAccess.java464
-rw-r--r--wizards/com/sun/star/wizards/common/Helper.java102
-rw-r--r--wizards/com/sun/star/wizards/common/IRenderer.java2
-rw-r--r--wizards/com/sun/star/wizards/common/Indexable.java2
-rw-r--r--wizards/com/sun/star/wizards/common/JavaTools.java163
-rw-r--r--wizards/com/sun/star/wizards/common/NamedValueCollection.java20
-rw-r--r--wizards/com/sun/star/wizards/common/NumberFormatter.java47
-rw-r--r--wizards/com/sun/star/wizards/common/NumericalHelper.java956
-rw-r--r--wizards/com/sun/star/wizards/common/ParaStyled.java4
-rw-r--r--wizards/com/sun/star/wizards/common/PlaceholderTextElement.java14
-rw-r--r--wizards/com/sun/star/wizards/common/Properties.java4
-rw-r--r--wizards/com/sun/star/wizards/common/PropertyNames.java2
-rw-r--r--wizards/com/sun/star/wizards/common/PropertySetHelper.java124
-rw-r--r--wizards/com/sun/star/wizards/common/Resource.java25
-rw-r--r--wizards/com/sun/star/wizards/common/SystemDialog.java105
-rw-r--r--wizards/com/sun/star/wizards/common/TemplateElement.java2
-rw-r--r--wizards/com/sun/star/wizards/common/TextElement.java1
-rw-r--r--wizards/com/sun/star/wizards/common/UCB.java17
-rw-r--r--wizards/com/sun/star/wizards/common/XMLProvider.java2
-rw-r--r--wizards/com/sun/star/wizards/db/BlindtextCreator.java12
-rw-r--r--wizards/com/sun/star/wizards/db/ColumnPropertySet.java16
-rw-r--r--wizards/com/sun/star/wizards/db/CommandMetaData.java146
-rw-r--r--wizards/com/sun/star/wizards/db/CommandName.java27
-rw-r--r--wizards/com/sun/star/wizards/db/DBMetaData.java69
-rw-r--r--wizards/com/sun/star/wizards/db/FieldColumn.java18
-rw-r--r--wizards/com/sun/star/wizards/db/QueryMetaData.java38
-rw-r--r--wizards/com/sun/star/wizards/db/RecordParser.java23
-rw-r--r--wizards/com/sun/star/wizards/db/SQLQueryComposer.java43
-rw-r--r--wizards/com/sun/star/wizards/db/TableDescriptor.java71
-rw-r--r--wizards/com/sun/star/wizards/db/TypeInspector.java48
-rw-r--r--wizards/com/sun/star/wizards/document/Control.java42
-rw-r--r--wizards/com/sun/star/wizards/document/DatabaseControl.java14
-rw-r--r--wizards/com/sun/star/wizards/document/FormHandler.java147
-rw-r--r--wizards/com/sun/star/wizards/document/GridControl.java7
-rw-r--r--wizards/com/sun/star/wizards/document/OfficeDocument.java165
-rw-r--r--wizards/com/sun/star/wizards/document/Shape.java4
-rw-r--r--wizards/com/sun/star/wizards/document/TimeStampControl.java28
-rw-r--r--wizards/com/sun/star/wizards/form/CallFormWizard.java31
-rw-r--r--wizards/com/sun/star/wizards/form/DataEntrySetter.java21
-rw-r--r--wizards/com/sun/star/wizards/form/FieldLinker.java19
-rw-r--r--wizards/com/sun/star/wizards/form/Finalizer.java27
-rw-r--r--wizards/com/sun/star/wizards/form/FormConfiguration.java98
-rw-r--r--wizards/com/sun/star/wizards/form/FormControlArranger.java25
-rw-r--r--wizards/com/sun/star/wizards/form/FormDocument.java65
-rw-r--r--wizards/com/sun/star/wizards/form/FormWizard.java26
-rw-r--r--wizards/com/sun/star/wizards/form/StyleApplier.java108
-rw-r--r--wizards/com/sun/star/wizards/form/UIControlArranger.java41
-rw-r--r--wizards/com/sun/star/wizards/query/CallQueryWizard.java12
-rw-r--r--wizards/com/sun/star/wizards/query/Finalizer.java20
-rw-r--r--wizards/com/sun/star/wizards/query/QuerySummary.java16
-rw-r--r--wizards/com/sun/star/wizards/query/QueryWizard.java21
-rw-r--r--wizards/com/sun/star/wizards/report/CallReportWizard.java6
-rw-r--r--wizards/com/sun/star/wizards/report/DBColumn.java58
-rw-r--r--wizards/com/sun/star/wizards/report/Dataimport.java25
-rw-r--r--wizards/com/sun/star/wizards/report/GroupFieldHandler.java9
-rw-r--r--wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java37
-rw-r--r--wizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java7
-rw-r--r--wizards/com/sun/star/wizards/report/IReportDocument.java106
-rw-r--r--wizards/com/sun/star/wizards/report/RecordTable.java9
-rw-r--r--wizards/com/sun/star/wizards/report/ReportFinalizer.java61
-rw-r--r--wizards/com/sun/star/wizards/report/ReportImplementationHelper.java4
-rw-r--r--wizards/com/sun/star/wizards/report/ReportLayouter.java57
-rw-r--r--wizards/com/sun/star/wizards/report/ReportTextDocument.java96
-rw-r--r--wizards/com/sun/star/wizards/report/ReportTextImplementation.java25
-rw-r--r--wizards/com/sun/star/wizards/report/ReportWizard.java30
-rw-r--r--wizards/com/sun/star/wizards/report/report.component2
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java5
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java2
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java3
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java2
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java10
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java4
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java4
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java101
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java1
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java4
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java2
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java3
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java3
-rw-r--r--wizards/com/sun/star/wizards/table/CGCategory.java10
-rw-r--r--wizards/com/sun/star/wizards/table/CGTable.java8
-rw-r--r--wizards/com/sun/star/wizards/table/CallTableWizard.java19
-rw-r--r--wizards/com/sun/star/wizards/table/FieldDescription.java2
-rw-r--r--wizards/com/sun/star/wizards/table/FieldFormatter.java203
-rw-r--r--wizards/com/sun/star/wizards/table/Finalizer.java48
-rw-r--r--wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java49
-rw-r--r--wizards/com/sun/star/wizards/table/ScenarioSelector.java47
-rw-r--r--wizards/com/sun/star/wizards/table/TableWizard.java72
-rw-r--r--wizards/com/sun/star/wizards/text/TextDocument.java184
-rw-r--r--wizards/com/sun/star/wizards/text/TextFieldHandler.java40
-rw-r--r--wizards/com/sun/star/wizards/text/TextSectionHandler.java26
-rw-r--r--wizards/com/sun/star/wizards/text/TextStyleHandler.java2
-rw-r--r--wizards/com/sun/star/wizards/text/TextTableHandler.java40
-rw-r--r--wizards/com/sun/star/wizards/text/ViewHandler.java3
-rw-r--r--wizards/com/sun/star/wizards/ui/AggregateComponent.java94
-rw-r--r--wizards/com/sun/star/wizards/ui/ButtonList.java111
-rw-r--r--wizards/com/sun/star/wizards/ui/CommandFieldSelection.java37
-rw-r--r--wizards/com/sun/star/wizards/ui/ControlScroller.java100
-rw-r--r--wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java29
-rw-r--r--wizards/com/sun/star/wizards/ui/FieldSelection.java72
-rw-r--r--wizards/com/sun/star/wizards/ui/FilterComponent.java125
-rw-r--r--wizards/com/sun/star/wizards/ui/ImageList.java90
-rw-r--r--wizards/com/sun/star/wizards/ui/PathSelection.java19
-rw-r--r--wizards/com/sun/star/wizards/ui/PeerConfig.java83
-rw-r--r--wizards/com/sun/star/wizards/ui/SortingComponent.java90
-rw-r--r--wizards/com/sun/star/wizards/ui/TitlesComponent.java41
-rw-r--r--wizards/com/sun/star/wizards/ui/UIConsts.java88
-rw-r--r--wizards/com/sun/star/wizards/ui/UnoDialog.java209
-rw-r--r--wizards/com/sun/star/wizards/ui/UnoDialog2.java149
-rw-r--r--wizards/com/sun/star/wizards/ui/WizardDialog.java201
-rw-r--r--wizards/com/sun/star/wizards/ui/XCommandSelectionListener.java24
-rw-r--r--wizards/com/sun/star/wizards/ui/XCompletion.java7
-rw-r--r--wizards/com/sun/star/wizards/ui/XFieldSelectionListener.java12
-rw-r--r--wizards/com/sun/star/wizards/ui/XPathSelectionListener.java2
-rw-r--r--wizards/com/sun/star/wizards/ui/event/AbstractListener.java7
-rw-r--r--wizards/com/sun/star/wizards/ui/event/CommonListener.java5
-rw-r--r--wizards/com/sun/star/wizards/ui/event/DataAware.java92
-rw-r--r--wizards/com/sun/star/wizards/ui/event/DataAwareFields.java13
-rw-r--r--wizards/com/sun/star/wizards/ui/event/EventNames.java30
-rw-r--r--wizards/com/sun/star/wizards/ui/event/ListModelBinder.java5
-rw-r--r--wizards/com/sun/star/wizards/ui/event/MethodInvocation.java17
-rw-r--r--wizards/com/sun/star/wizards/ui/event/RadioDataAware.java6
-rw-r--r--wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java34
-rw-r--r--wizards/com/sun/star/wizards/ui/event/Task.java77
-rw-r--r--wizards/com/sun/star/wizards/ui/event/TaskEvent.java5
-rw-r--r--wizards/com/sun/star/wizards/ui/event/TaskListener.java9
-rw-r--r--wizards/com/sun/star/wizards/ui/event/UnoDataAware.java108
134 files changed, 5786 insertions, 1462 deletions
diff --git a/wizards/Jar_commonwizards.mk b/wizards/Jar_commonwizards.mk
index 3932223eb923..a13a114162ff 100644
--- a/wizards/Jar_commonwizards.mk
+++ b/wizards/Jar_commonwizards.mk
@@ -105,6 +105,7 @@ $(eval $(call gb_Jar_add_sourcefiles,commonwizards,\
wizards/com/sun/star/wizards/ui/UIConsts \
wizards/com/sun/star/wizards/ui/UnoDialog \
wizards/com/sun/star/wizards/ui/UnoDialog2 \
+ wizards/com/sun/star/wizards/ui/XCommandSelectionListener \
wizards/com/sun/star/wizards/ui/XFieldSelectionListener \
wizards/com/sun/star/wizards/ui/XPathSelectionListener \
wizards/com/sun/star/wizards/ui/XCompletion \
diff --git a/wizards/com/sun/star/wizards/common/ConfigGroup.java b/wizards/com/sun/star/wizards/common/ConfigGroup.java
index 238e3fb99921..0a71af2011d7 100644
--- a/wizards/com/sun/star/wizards/common/ConfigGroup.java
+++ b/wizards/com/sun/star/wizards/common/ConfigGroup.java
@@ -68,7 +68,9 @@ public class ConfigGroup implements ConfigNode
* convert the primitive type value of the
* given Field object to the corresponding
* Java Object value.
+ * @param field
* @return the value of the field as a Object.
+ * @throws IllegalAccessException
*/
public Object convertValue(Field field) throws IllegalAccessException
{
@@ -78,11 +80,11 @@ public class ConfigGroup implements ConfigNode
}
if (field.getType().equals(Integer.TYPE))
{
- return Integer.valueOf(field.getInt(this));
+ return new Integer(field.getInt(this));
}
if (field.getType().equals(Short.TYPE))
{
- return Short.valueOf(field.getShort(this));
+ return new Short(field.getShort(this));
}
if (field.getType().equals(Float.TYPE))
{
diff --git a/wizards/com/sun/star/wizards/common/ConfigNode.java b/wizards/com/sun/star/wizards/common/ConfigNode.java
index 0d2abd84c966..4803ec1ef810 100644
--- a/wizards/com/sun/star/wizards/common/ConfigNode.java
+++ b/wizards/com/sun/star/wizards/common/ConfigNode.java
@@ -35,9 +35,9 @@ public interface ConfigNode
* 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);
+ public void readConfiguration(Object configurationView, Object param);
- void writeConfiguration(Object configurationView, Object param);
+ public void writeConfiguration(Object configurationView, Object param);
- void setRoot(Object root);
+ public void setRoot(Object root);
}
diff --git a/wizards/com/sun/star/wizards/common/ConfigSet.java b/wizards/com/sun/star/wizards/common/ConfigSet.java
index 75aaa512b368..2e979841005a 100644
--- a/wizards/com/sun/star/wizards/common/ConfigSet.java
+++ b/wizards/com/sun/star/wizards/common/ConfigSet.java
@@ -382,6 +382,8 @@ public class ConfigSet implements ConfigNode, XMLProvider, ListModel
* This method reindexes the given member to be
* the index number 0
* Do not forget to call commit() after calling this method.
+ * @param confView
+ * @param memberName
*/
public void reindexSet(Object confView, String memberName, String indexPropertyName) throws Exception
{
diff --git a/wizards/com/sun/star/wizards/common/Configuration.java b/wizards/com/sun/star/wizards/common/Configuration.java
index bed4b9cb05d4..2eb3827d03f2 100644
--- a/wizards/com/sun/star/wizards/common/Configuration.java
+++ b/wizards/com/sun/star/wizards/common/Configuration.java
@@ -26,6 +26,7 @@ import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.lang.Locale;
+import com.sun.star.util.XChangesBatch;
/**
* This class gives access to the OO configuration API.
@@ -108,14 +109,30 @@ public abstract class Configuration
public static void set(int value, String name, Object parent) throws Exception
{
- set(Integer.valueOf(value), name, parent);
+ set(new Integer(value), name, parent);
}
+ public static void set(short value, String name, Object parent) throws Exception
+ {
+ set(new Short(value), name, parent);
+ }
+ public static void set(String value, String name, Object parent) throws Exception
+ {
+ set((Object) value, name, parent);
+ }
-
-
-
+ public static void set(boolean value, String name, Object parent) throws Exception
+ {
+ if (value)
+ {
+ set(Boolean.TRUE, name, parent);
+ }
+ else
+ {
+ set(Boolean.FALSE, name, parent);
+ }
+ }
public static void set(Object value, String name, Object parent) throws com.sun.star.lang.IllegalArgumentException, PropertyVetoException, UnknownPropertyException, WrappedTargetException
{
@@ -123,6 +140,10 @@ public abstract class Configuration
}
/** Creates a new instance of RegistryEntry
+ * @param name
+ * @param parent
+ * @return
+ * @throws Exception
*/
public static Object getConfigurationNode(String name, Object parent) throws Exception
{
@@ -179,7 +200,7 @@ public abstract class Configuration
}
}
- private static String getLocaleString(XMultiServiceFactory xMSF, String root, String key)
+ public static String getLocaleString(XMultiServiceFactory xMSF, String root, String key)
{
String sLocale = PropertyNames.EMPTY_STRING;
try
@@ -198,7 +219,7 @@ public abstract class Configuration
return sLocale;
}
- private static Locale getLocale(XMultiServiceFactory xMSF, String root, String key)
+ public static Locale getLocale(XMultiServiceFactory xMSF, String root, String key)
{
Locale aLocLocale = new Locale();
String sLocale = getLocaleString(xMSF, root, key);
@@ -216,18 +237,33 @@ public abstract class Configuration
return getLocale(xMSF, "org.openoffice.Setup/L10N/", "ooSetupSystemLocale");
}
+ public static Locale getUILocale(XMultiServiceFactory xMSF)
+ {
+ return getLocale(xMSF, "org.openoffice.Setup/L10N/", "ooLocale");
+ }
+ public static String getLocaleString(XMultiServiceFactory xMSF)
+ {
+ return getLocaleString(xMSF, "org.openoffice.Setup/L10N/", "ooSetupSystemLocale");
+ }
-
-
-
+ public static String getUILocaleString(XMultiServiceFactory xMSF)
+ {
+ return getLocaleString(xMSF, "org.openoffice.Setup/L10N/", "ooLocale");
+ }
/**
* This method creates a new configuration node and adds it
* to the given view. Note that if a node with the given name
* already exists it will be completely removed from
* the configuration.
+ * @param configView
+ * @param name
* @return the new created configuration node.
+ * @throws com.sun.star.lang.WrappedTargetException
+ * @throws ElementExistException
+ * @throws NoSuchElementException
+ * @throws com.sun.star.uno.Exception
*/
public static Object addConfigNode(Object configView, String name) throws com.sun.star.lang.WrappedTargetException, ElementExistException, NoSuchElementException, com.sun.star.uno.Exception
{
@@ -264,11 +300,28 @@ public abstract class Configuration
}
}
+ public static void commit(Object configView) throws WrappedTargetException
+ {
+ XChangesBatch xUpdateControl = UnoRuntime.queryInterface(XChangesBatch.class, configView);
+ xUpdateControl.commitChanges();
+ }
+ public static void updateConfiguration(XMultiServiceFactory xmsf, String path, String name, ConfigNode node, Object param) throws com.sun.star.uno.Exception, com.sun.star.container.ElementExistException, NoSuchElementException, WrappedTargetException
+ {
+ Object view = Configuration.getConfigurationRoot(xmsf, path, true);
+ addConfigNode(path, name);
+ node.writeConfiguration(view, param);
+ XChangesBatch xUpdateControl = UnoRuntime.queryInterface(XChangesBatch.class, view);
+ xUpdateControl.commitChanges();
+ }
-
-
-
+ public static void removeNode(XMultiServiceFactory xmsf, String path, String name) throws com.sun.star.uno.Exception, com.sun.star.container.ElementExistException, NoSuchElementException, WrappedTargetException
+ {
+ Object view = Configuration.getConfigurationRoot(xmsf, path, true);
+ removeNode(view, name);
+ XChangesBatch xUpdateControl = UnoRuntime.queryInterface(XChangesBatch.class, view);
+ xUpdateControl.commitChanges();
+ }
public static String[] getNodeDisplayNames(XNameAccess _xNameAccessNode)
{
@@ -334,7 +387,32 @@ public abstract class Configuration
return null;
}
+ public static XNameAccess getChildNodebyDisplayName(XNameAccess _xNameAccessNode, String _displayname)
+ {
+ return getChildNodebyDisplayName(_xNameAccessNode, _displayname, PropertyNames.PROPERTY_NAME);
+ }
+ public static XNameAccess getChildNodebyDisplayName(XNameAccess _xNameAccessNode, String _displayname, String _nodename)
+ {
+ String[] snames = null;
+ try
+ {
+ snames = _xNameAccessNode.getElementNames();
+ for (int i = 0; i < snames.length; i++)
+ {
+ String curdisplayname = (String) Helper.getUnoPropertyValue(_xNameAccessNode.getByName(snames[i]), _nodename);
+ if (curdisplayname.equals(_displayname))
+ {
+ return UnoRuntime.queryInterface(XNameAccess.class, _xNameAccessNode.getByName(snames[i]));
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ }
+ return null;
+ }
public static XNameAccess getChildNodebyDisplayName(XMultiServiceFactory _xMSF, Locale _aLocale, XNameAccess _xNameAccessNode, String _displayname, String _nodename, int _nmaxcharcount)
{
diff --git a/wizards/com/sun/star/wizards/common/DebugHelper.java b/wizards/com/sun/star/wizards/common/DebugHelper.java
index cc3bdf3e8742..16c39fb53286 100644
--- a/wizards/com/sun/star/wizards/common/DebugHelper.java
+++ b/wizards/com/sun/star/wizards/common/DebugHelper.java
@@ -21,7 +21,11 @@ import com.sun.star.uno.Exception;
public class DebugHelper
{
-
+//TODO - Verify these methods. Can not remove?
+ public static void exception(String DetailedMessage, Exception ex, int err, String additionalArgument) throws java.lang.Exception
+ {
+// throw new UnsupportedOperationException("Not supported yet.");
+ }
public static void exception(int err, String additionalArgument) throws java.lang.Exception
{
diff --git a/wizards/com/sun/star/wizards/common/Desktop.java b/wizards/com/sun/star/wizards/common/Desktop.java
index 5d71d92ba150..8b2c39a80a83 100644
--- a/wizards/com/sun/star/wizards/common/Desktop.java
+++ b/wizards/com/sun/star/wizards/common/Desktop.java
@@ -18,16 +18,25 @@
package com.sun.star.wizards.common;
import com.sun.star.beans.PropertyValue;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.uno.Any;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
import com.sun.star.util.XURLTransformer;
import com.sun.star.lang.Locale;
+import com.sun.star.uno.XInterface;
import com.sun.star.bridge.XUnoUrlResolver;
import com.sun.star.comp.helper.Bootstrap;
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.container.XEnumeration;
import com.sun.star.container.XHierarchicalNameAccess;
import com.sun.star.container.XNameAccess;
+import com.sun.star.util.XStringSubstitution;
import com.sun.star.frame.*;
import com.sun.star.i18n.KParseType;
import com.sun.star.i18n.ParseResult;
@@ -36,6 +45,11 @@ import com.sun.star.i18n.XCharacterClassification;
public class Desktop
{
+ /** Creates a new instance of Desktop */
+ public Desktop()
+ {
+ }
+
public static XDesktop getDesktop(XMultiServiceFactory xMSF)
{
com.sun.star.uno.XInterface xInterface = null;
@@ -66,7 +80,25 @@ public class Desktop
return xFrameSuppl.getActiveFrame();
}
- private static XDispatch getDispatcher(XFrame xFrame, String _stargetframe, com.sun.star.util.URL oURL)
+ public static XComponent getActiveComponent(XMultiServiceFactory _xMSF)
+ {
+ XFrame xFrame = getActiveFrame(_xMSF);
+ return UnoRuntime.queryInterface(XComponent.class, xFrame.getController().getModel());
+ }
+
+ public static XTextDocument getActiveTextDocument(XMultiServiceFactory _xMSF)
+ {
+ XComponent xComponent = getActiveComponent(_xMSF);
+ return UnoRuntime.queryInterface(XTextDocument.class, xComponent);
+ }
+
+ public static XSpreadsheetDocument getActiveSpreadsheetDocument(XMultiServiceFactory _xMSF)
+ {
+ XComponent xComponent = getActiveComponent(_xMSF);
+ return UnoRuntime.queryInterface(XSpreadsheetDocument.class, xComponent);
+ }
+
+ public static XDispatch getDispatcher(XMultiServiceFactory xMSF, XFrame xFrame, String _stargetframe, com.sun.star.util.URL oURL)
{
try
{
@@ -82,7 +114,7 @@ public class Desktop
return null;
}
- private static com.sun.star.util.URL getDispatchURL(XMultiServiceFactory xMSF, String _sURL)
+ public static com.sun.star.util.URL getDispatchURL(XMultiServiceFactory xMSF, String _sURL)
{
try
{
@@ -101,10 +133,10 @@ public class Desktop
return null;
}
- private static void dispatchURL(XMultiServiceFactory xMSF, String sURL, XFrame xFrame, String _stargetframe)
+ public static void dispatchURL(XMultiServiceFactory xMSF, String sURL, XFrame xFrame, String _stargetframe)
{
com.sun.star.util.URL oURL = getDispatchURL(xMSF, sURL);
- XDispatch xDispatch = getDispatcher(xFrame, _stargetframe, oURL);
+ XDispatch xDispatch = getDispatcher(xMSF, xFrame, _stargetframe, oURL);
dispatchURL(xDispatch, oURL);
}
@@ -113,13 +145,13 @@ public class Desktop
dispatchURL(xMSF, sURL, xFrame, PropertyNames.EMPTY_STRING);
}
- private static void dispatchURL(XDispatch _xDispatch, com.sun.star.util.URL oURL)
+ public static void dispatchURL(XDispatch _xDispatch, com.sun.star.util.URL oURL)
{
PropertyValue[] oArg = new PropertyValue[0];
_xDispatch.dispatch(oURL, oArg);
}
- private static XMultiComponentFactory getMultiComponentFactory() throws com.sun.star.uno.Exception, RuntimeException, java.lang.Exception
+ public static XMultiComponentFactory getMultiComponentFactory() throws com.sun.star.uno.Exception, RuntimeException, java.lang.Exception
{
XComponentContext xcomponentcontext = Bootstrap.createInitialComponentContext(null);
// initial serviceManager
@@ -156,7 +188,7 @@ public class Desktop
return sIncSuffix;
}
- private static String getIncrementSuffix(XHierarchicalNameAccess xElementContainer, String ElementName)
+ public static String getIncrementSuffix(XHierarchicalNameAccess xElementContainer, String ElementName)
{
boolean bElementexists = true;
int i = 1;
@@ -178,7 +210,7 @@ public class Desktop
return sIncSuffix;
}
- private static int checkforfirstSpecialCharacter(XMultiServiceFactory _xMSF, String _sString, Locale _aLocale)
+ public static int checkforfirstSpecialCharacter(XMultiServiceFactory _xMSF, String _sString, Locale _aLocale)
{
try
{
@@ -214,6 +246,8 @@ public class Desktop
/**
* Checks if the passed Element Name already exists in the ElementContainer. If yes it appends a
* suffix to make it unique
+ * @param xElementContainer
+ * @param sElementName
* @return a unique Name ready to be added to the container.
*/
public static String getUniqueName(XNameAccess xElementContainer, String sElementName)
@@ -225,6 +259,8 @@ public class Desktop
/**
* Checks if the passed Element Name already exists in the ElementContainer. If yes it appends a
* suffix to make it unique
+ * @param xElementContainer
+ * @param sElementName
* @return a unique Name ready to be added to the container.
*/
public static String getUniqueName(XHierarchicalNameAccess xElementContainer, String sElementName)
@@ -236,6 +272,9 @@ public class Desktop
/**
* Checks if the passed Element Name already exists in the list If yes it appends a
* suffix to make it unique
+ * @param _slist
+ * @param _sElementName
+ * @param _sSuffixSeparator
* @return a unique Name not being in the passed list.
*/
public static String getUniqueName(String[] _slist, String _sElementName, String _sSuffixSeparator)
@@ -265,9 +304,67 @@ public class Desktop
return PropertyNames.EMPTY_STRING;
}
+ /**
+ * @deprecated use Configuration.getConfigurationRoot() with the same parameters instead
+ * @param xMSF
+ * @param KeyName
+ * @param bForUpdate
+ * @return
+ */
+ public static XInterface getRegistryKeyContent(XMultiServiceFactory xMSF, String KeyName, boolean bForUpdate)
+ {
+ try
+ {
+ Object oConfigProvider;
+ PropertyValue[] aNodePath = new PropertyValue[1];
+ oConfigProvider = xMSF.createInstance("com.sun.star.configuration.ConfigurationProvider");
+ aNodePath[0] = new PropertyValue();
+ aNodePath[0].Name = "nodepath";
+ aNodePath[0].Value = KeyName;
+ XMultiServiceFactory xMSFConfig = UnoRuntime.queryInterface(XMultiServiceFactory.class, oConfigProvider);
+ if (bForUpdate)
+ {
+ return (XInterface) xMSFConfig.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", aNodePath);
+ }
+ else
+ {
+ return (XInterface) xMSFConfig.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", aNodePath);
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.err);
+ return null;
+ }
+ }
+
+ /**
+ * @deprecated used to retrieve the most common paths used in the office application
+ */
+ public class OfficePathRetriever
+ {
+ public String TemplatePath;
+ public String BitmapPath;
+ public String UserTemplatePath;
+ public String WorkPath;
- private static String getTemplatePath(XMultiServiceFactory _xMSF)
+ 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
{
@@ -279,7 +376,17 @@ public class Desktop
return PropertyNames.EMPTY_STRING;
}
-
+ public static String getUserTemplatePath(XMultiServiceFactory _xMSF)
+ {
+ try
+ {
+ return FileAccess.getOfficePath(_xMSF, "Template", "user", PropertyNames.EMPTY_STRING);
+ }
+ catch (NoValidPathException nopathexception)
+ {
+ }
+ return PropertyNames.EMPTY_STRING;
+ }
public static String getBitmapPath(XMultiServiceFactory _xMSF)
{
@@ -293,9 +400,83 @@ public class Desktop
return PropertyNames.EMPTY_STRING;
}
+ public static String getWorkPath(XMultiServiceFactory _xMSF)
+ {
+ try
+ {
+ return FileAccess.getOfficePath(_xMSF, "Work", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING);
+ }
+ catch (NoValidPathException nopathexception)
+ {
+ }
+ return PropertyNames.EMPTY_STRING;
+ }
+ public static XStringSubstitution createStringSubstitution(XMultiServiceFactory xMSF)
+ {
+ Object xPathSubst = null;
+ try
+ {
+ xPathSubst = xMSF.createInstance("com.sun.star.util.PathSubstitution");
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ e.printStackTrace();
+ }
+ if (xPathSubst != null)
+ {
+ return UnoRuntime.queryInterface(XStringSubstitution.class, xPathSubst);
+ }
+ else
+ {
+ return null;
+ }
+ }
+ /**
+ * This method searches (and hopefully finds...) a frame
+ * with a componentWindow.
+ * It does it in three phases:
+ * 1. Check if the given desktop argument has a componentWindow.
+ * If it is null, the myFrame argument is taken.
+ * 2. Go up the tree of frames and search a frame with a component window.
+ * 3. Get from the desktop all the components, and give the first one
+ * which has a frame.
+ * @param xMSF
+ * @param myFrame
+ * @param desktop
+ * @return
+ * @throws NoSuchElementException
+ * @throws WrappedTargetException
+ */
+ public static XFrame findAFrame(XMultiServiceFactory xMSF, XFrame myFrame, XFrame desktop)
+ throws NoSuchElementException,
+ WrappedTargetException
+ {
+ if (desktop == null)
+ {
+ desktop = myFrame; // we go up in the tree...
+ }
+ while (desktop != null && desktop.getComponentWindow() == null)
+ {
+ desktop = desktop.findFrame("_parent", FrameSearchFlag.PARENT);
+ }
+ if (desktop == null)
+ {
+ for (XEnumeration e = Desktop.getDesktop(xMSF).getComponents().createEnumeration(); e.hasMoreElements();)
+ {
+ Object comp = ((Any) e.nextElement()).getObject();
+ XModel xModel = UnoRuntime.queryInterface(XModel.class, comp);
+ XFrame xFrame = xModel.getCurrentController().getFrame();
+ if (xFrame != null && xFrame.getComponentWindow() != null)
+ {
+ return xFrame;
+ }
+ }
+ }
+ return desktop;
+ }
}
diff --git a/wizards/com/sun/star/wizards/common/FileAccess.java b/wizards/com/sun/star/wizards/common/FileAccess.java
index 58af791c254f..862f1b8c9c58 100644
--- a/wizards/com/sun/star/wizards/common/FileAccess.java
+++ b/wizards/com/sun/star/wizards/common/FileAccess.java
@@ -26,6 +26,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Vector;
+import com.sun.star.awt.VclWindowPeerAttribute;
import com.sun.star.io.XActiveDataSink;
import com.sun.star.io.XInputStream;
import com.sun.star.io.XTextInputStream;
@@ -33,6 +34,7 @@ import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.ucb.*;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XInterface;
+import com.sun.star.util.DateTime;
import com.sun.star.beans.PropertyValue;
import com.sun.star.document.XDocumentProperties;
@@ -50,9 +52,36 @@ import com.sun.star.document.XDocumentProperties;
public class FileAccess
{
+ /**
+ *
+ * @param xMSF
+ * @param sPath
+ * @param sAddPath
+ */
+ public static void addOfficePath(XMultiServiceFactory xMSF, String sPath, String sAddPath)
+ {
+ XSimpleFileAccess xSimpleFileAccess = null;
+ String ResultPath = getOfficePath(xMSF, sPath, xSimpleFileAccess);
+ // As there are several conventions about the look of Url (e.g. with " " or with "%20") you cannot make a
+ // simple String comparison to find out, if a path is already in "ResultPath"
+ String[] PathList = JavaTools.ArrayoutofString(ResultPath, PropertyNames.SEMI_COLON);
+ int MaxIndex = PathList.length - 1;
+ String CompCurPath;
+ String CompAddPath = JavaTools.replaceSubString(sAddPath, PropertyNames.EMPTY_STRING, "/");
+ String CurPath;
+ for (int i = 0; i <= MaxIndex; i++)
+ {
+ CurPath = JavaTools.convertfromURLNotation(PathList[i]);
+ CompCurPath = JavaTools.replaceSubString(CurPath, PropertyNames.EMPTY_STRING, "/");
+ if (CompCurPath.equals(CompAddPath))
+ {
+ return;
+ }
+ }
+ ResultPath += PropertyNames.SEMI_COLON + sAddPath;
+ }
-
- private static String deleteLastSlashfromUrl(String _sPath)
+ public static String deleteLastSlashfromUrl(String _sPath)
{
if (_sPath.endsWith("/"))
{
@@ -67,6 +96,9 @@ public class FileAccess
/**
* Further information on arguments value see in OO Developer Guide,
* chapter 6.2.7
+ * @param xMSF
+ * @param sPath
+ * @param xSimpleFileAccess
* @return the respective path of the office application. A probable following "/" at the end is trimmed.
*/
public static String getOfficePath(XMultiServiceFactory xMSF, String sPath, XSimpleFileAccess xSimpleFileAccess)
@@ -89,8 +121,13 @@ public class FileAccess
/**
* Further information on arguments value see in OO Developer Guide,
* chapter 6.2.7
+ * @param xMSF
+ * @param sPath
* @param sType use "share" or "user". Set to PropertyNames.EMPTY_STRING if not needed eg for the WorkPath;
* In the return Officepath a possible slash at the end is cut off
+ * @param sSearchDir
+ * @return
+ * @throws NoValidPathException
*/
public static String getOfficePath(XMultiServiceFactory xMSF, String sPath, String sType, String sSearchDir) throws NoValidPathException
{
@@ -164,7 +201,7 @@ public class FileAccess
return ResultPath;
}
- public static ArrayList<String> getOfficePaths(XMultiServiceFactory xMSF, String _sPath)
+ public static ArrayList<String> getOfficePaths(XMultiServiceFactory xMSF, String _sPath, String sType, String sSearchDir)
{
//This method currently only works with sPath="Template"
@@ -338,10 +375,190 @@ public class FileAccess
return ReturnPath;
}
+ public static boolean createSubDirectory(XMultiServiceFactory xMSF, XSimpleFileAccess xSimpleFileAccess, String Path)
+ {
+ String sNoDirCreation = PropertyNames.EMPTY_STRING;
+ try
+ {
+ Resource oResource = new Resource(xMSF, "ImportWizard", "imp");
+ sNoDirCreation = oResource.getResText(1050);
+ String sMsgDirNotThere = oResource.getResText(1051);
+ String sQueryForNewCreation = oResource.getResText(1052);
+ String OSPath = JavaTools.convertfromURLNotation(Path);
+ String sQueryMessage = JavaTools.replaceSubString(sMsgDirNotThere, OSPath, "%1");
+ sQueryMessage = sQueryMessage + (char) 13 + sQueryForNewCreation;
+ int icreate = SystemDialog.showMessageBox(xMSF, "QueryBox", VclWindowPeerAttribute.YES_NO, sQueryMessage);
+ if (icreate == 2)
+ {
+ xSimpleFileAccess.createFolder(Path);
+ return true;
+ }
+ return false;
+ }
+ catch (com.sun.star.ucb.CommandAbortedException exception)
+ {
+ String sMsgNoDir = JavaTools.replaceSubString(sNoDirCreation, Path, "%1");
+ SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMsgNoDir);
+ return false;
+ }
+ catch (com.sun.star.uno.Exception unoexception)
+ {
+ String sMsgNoDir = JavaTools.replaceSubString(sNoDirCreation, Path, "%1");
+ SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMsgNoDir);
+ return false;
+ }
+ }
+
+ // checks if the root of a path exists. if the parameter xWindowPeer is not null then also the directory is
+ // created when it does not exists and the user
+ public static boolean PathisValid(XMultiServiceFactory xMSF, String Path, String sMsgFilePathInvalid, boolean baskbeforeOverwrite)
+ {
+ try
+ {
+ String SubDir;
+ String SubDirPath = PropertyNames.EMPTY_STRING;
+ int SubLen;
+ int NewLen;
+ int RestLen;
+ boolean bexists;
+ boolean bSubDirexists = true;
+ String LowerCasePath;
+ String NewPath = Path;
+ XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
+ XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface);
+ if (baskbeforeOverwrite)
+ {
+ if (xSimpleFileAccess.exists(Path))
+ {
+ Resource oResource = new Resource(xMSF, "ImportWizard", "imp");
+ String sFileexists = oResource.getResText(1053);
+ String NewString = JavaTools.convertfromURLNotation(Path);
+ sFileexists = JavaTools.replaceSubString(sFileexists, NewString, "<1>");
+ sFileexists = JavaTools.replaceSubString(sFileexists, String.valueOf((char) 13), "<CR>");
+ int iLeave = SystemDialog.showMessageBox(xMSF, "QueryBox", VclWindowPeerAttribute.YES_NO, sFileexists);
+ if (iLeave == 3)
+ {
+ return false;
+ }
+ }
+ }
+ String[] DirArray = JavaTools.ArrayoutofString(Path, "/");
+ int MaxIndex = DirArray.length - 1;
+ if (MaxIndex > 0)
+ {
+ for (int i = MaxIndex; i >= 0; i--)
+ {
+ SubDir = DirArray[i];
+ SubLen = SubDir.length();
+ NewLen = NewPath.length();
+ RestLen = NewLen - SubLen;
+ if (RestLen > 0)
+ {
+ NewPath = NewPath.substring(0, NewLen - SubLen - 1);
+ if (i == MaxIndex)
+ {
+ SubDirPath = NewPath;
+ }
+ bexists = xSimpleFileAccess.exists(NewPath);
+ if (bexists)
+ {
+ LowerCasePath = NewPath.toLowerCase();
+ bexists = (!((LowerCasePath.equals("file:///")) || (LowerCasePath.equals("file://")) || (LowerCasePath.equals("file:/")) || (LowerCasePath.equals("file:"))));
+ }
+ if (bexists)
+ {
+ if (!bSubDirexists)
+ {
+ return createSubDirectory(xMSF, xSimpleFileAccess, SubDirPath);
+ }
+ return true;
+ }
+ else
+ {
+ bSubDirexists = false;
+ }
+ }
+ }
+ }
+ SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMsgFilePathInvalid);
+ return false;
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ exception.printStackTrace(System.err);
+ SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMsgFilePathInvalid);
+ return false;
+ }
+ }
+
+ /**
+ * searches a directory for files which start with a certain
+ * prefix, and returns their URLs and document-titles.
+ * @param xMSF
+ * @param FilterName the prefix of the filename. a "-" is added to the prefix !
+ * @param FolderName the folder (URL) to look for files...
+ * @return an array with two array members. The first one, with document titles,
+ * the second with the corresponding URLs.
+ * @deprecated please use the getFolderTitles() with ArrayList
+ */
+ public static String[][] getFolderTitles(com.sun.star.lang.XMultiServiceFactory xMSF, String FilterName, String FolderName)
+ {
+ String[][] LocLayoutFiles = new String[2][];
+ try
+ {
+ java.util.ArrayList<String> TitleVector = null;
+ java.util.ArrayList<String> NameVector = null;
+
+ XInterface xDocInterface = (XInterface) xMSF.createInstance("com.sun.star.document.DocumentProperties");
+ XDocumentProperties xDocProps = UnoRuntime.queryInterface(XDocumentProperties.class, xDocInterface);
+
+ XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
+ com.sun.star.ucb.XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface);
+
+ String[] nameList = xSimpleFileAccess.getFolderContents(FolderName, false);
+
+ TitleVector = new java.util.ArrayList<String>(/*nameList.length*/);
+ NameVector = new java.util.ArrayList<String>(nameList.length);
+
+ FilterName = FilterName == null || FilterName.equals(PropertyNames.EMPTY_STRING) ? null : FilterName + "-";
+
+ String fileName = PropertyNames.EMPTY_STRING;
+ PropertyValue[] noArgs = { };
+ for (int i = 0; i < nameList.length; i++)
+ {
+ fileName = getFilename(nameList[i]);
+
+ if (FilterName == null || fileName.startsWith(FilterName))
+ {
+ xDocProps.loadFromMedium(nameList[i], noArgs);
+ NameVector.add(nameList[i]);
+ TitleVector.add(xDocProps.getTitle());
+ }
+ }
+ String[] LocNameList = new String[NameVector.size()];
+ String[] LocTitleList = new String[TitleVector.size()];
+
+ NameVector.toArray(LocNameList);
+ TitleVector.toArray(LocTitleList);
+ LocLayoutFiles[1] = LocNameList;
+ LocLayoutFiles[0] = LocTitleList;
+
+ JavaTools.bubblesortList(LocLayoutFiles);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.err);
+ }
+ return LocLayoutFiles;
+ }
+
/**
* We search in all given path for a given file
+ * @param _sPath
+ * @param _sPath2
+ * @return
*/
- private static String addPath(String _sPath, String _sPath2)
+ public static String addPath(String _sPath, String _sPath2)
{
String sNewPath;
if (!_sPath.endsWith("/"))
@@ -380,6 +597,14 @@ public class FileAccess
return sFoundFile;
}
+ /**
+ *
+ * @param xMSF
+ * @param _sStartFilterName
+ * @param FolderNames
+ * @return
+ * @throws com.sun.star.wizards.common.NoValidPathException
+ */
public static String[][] getFolderTitles(com.sun.star.lang.XMultiServiceFactory xMSF, String _sStartFilterName, ArrayList<String> FolderNames)
throws NoValidPathException
{
@@ -486,7 +711,7 @@ public class FileAccess
return LocLayoutFiles;
}
public XSimpleFileAccess2 fileAccess;
- private XFileIdentifierConverter filenameConverter;
+ public XFileIdentifierConverter filenameConverter;
public FileAccess(XMultiServiceFactory xmsf) throws com.sun.star.uno.Exception
{
@@ -505,15 +730,22 @@ public class FileAccess
return filenameConverter.getFileURLFromSystemPath(parentPath, f.getAbsolutePath());
}
+ public String getURL(String path)
+ {
+ File f = new File(path);
+ return filenameConverter.getFileURLFromSystemPath(path, f.getAbsolutePath());
+ }
+
public String getPath(String parentURL, String childURL)
{
return filenameConverter.getSystemPathFromFileURL(parentURL + (((childURL == null || childURL.equals(PropertyNames.EMPTY_STRING)) ? PropertyNames.EMPTY_STRING : "/" + childURL)));
}
/**
+ * @param filename
* @return the extension of the given filename.
*/
- private static String getExtension(String filename)
+ public static String getExtension(String filename)
{
int p = filename.indexOf('.');
if (p == -1)
@@ -532,6 +764,29 @@ public class FileAccess
}
/**
+ * @param s
+ * @return
+ */
+ public boolean mkdir(String s)
+ {
+ try
+ {
+ fileAccess.createFolder(s);
+ return true;
+ }
+ catch (CommandAbortedException cax)
+ {
+ cax.printStackTrace();
+ }
+ catch (com.sun.star.uno.Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ return false;
+ }
+
+ /**
+ * @param filename
* @param def what to return in case of an exception
* @return true if the given file exists or not.
* if an exception accures, returns the def value.
@@ -552,14 +807,96 @@ public class FileAccess
return def;
}
+ /**
+ * @param filename
+ * @return
+ */
+ public boolean isDirectory(String filename)
+ {
+ try
+ {
+ return fileAccess.isFolder(filename);
+ }
+ catch (CommandAbortedException e)
+ {
+ }
+ catch (Exception e)
+ {
+ }
+
+ return false;
+ }
+
+ /**
+ * lists the files in a given directory
+ * @param dir
+ * @param includeFolders
+ * @return
+ */
+ public String[] listFiles(String dir, boolean includeFolders)
+ {
+ try
+ {
+ return fileAccess.getFolderContents(dir, includeFolders);
+ }
+ catch (CommandAbortedException e)
+ {
+ }
+ catch (Exception e)
+ {
+ }
+
+ return new String[0];
+ }
+
+ /**
+ * @param file
+ * @return
+ */
+ public boolean delete(String file)
+ {
+ try
+ {
+ fileAccess.kill(file);
+ return true;
+ }
+ catch (CommandAbortedException e)
+ {
+ e.printStackTrace(System.err);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ }
+
+ return false;
+ }
+
+ /**
+ * @param path
+ * @return
+ */
public static String getFilename(String path)
{
return getFilename(path, "/");
}
+ /**
+ * return the filename out of a system-dependent path
+ * @param path
+ * @return
+ */
+ public static String getPathFilename(String path)
+ {
+ return getFilename(path, File.separator);
+ }
-
- private static String getFilename(String path, String pathSeparator)
+ /**
+ * @param path
+ * @param pathSeparator
+ * @return
+ */
+ public static String getFilename(String path, String pathSeparator)
{
String[] s = JavaTools.ArrayoutofString(path, pathSeparator);
return s[s.length - 1];
@@ -572,11 +909,45 @@ public class FileAccess
return filename.substring(0, filename.length() - (sExtension.length() + 1));
}
+ /**
+ * @param source
+ * @param target
+ * @return
+ */
+ public boolean copy(String source, String target)
+ {
+ try
+ {
+ fileAccess.copy(source, target);
+ return true;
+ }
+ catch (CommandAbortedException e)
+ {
+ }
+ catch (Exception e)
+ {
+ }
+ return false;
+ }
-
+ public DateTime getLastModified(String url)
+ {
+ try
+ {
+ return fileAccess.getDateTimeModified(url);
+ }
+ catch (CommandAbortedException e)
+ {
+ }
+ catch (Exception e)
+ {
+ }
+ return null;
+ }
/**
+ * @param url
* @return the parent dir of the given url.
* if the path points to file, gives the directory in which the file is.
*/
@@ -595,7 +966,50 @@ public class FileAccess
return url.substring(0, lastPos);
}
+ public String createNewDir(String parentDir, String name)
+ {
+ String s = getNewFile(parentDir, name, PropertyNames.EMPTY_STRING);
+ if (mkdir(s))
+ {
+ return s;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public String getNewFile(String parentDir, String name, String extension)
+ {
+ int i = 0;
+ String url;
+ do
+ {
+ String filename = filename(name, extension, i++);
+ url = getURL(parentDir, filename);
+ }
+ while (exists(url, true));
+
+ return url;
+ }
+
+ private static String filename(String name, String ext, int i)
+ {
+ return name + (i == 0 ? PropertyNames.EMPTY_STRING : String.valueOf(i)) + (ext.equals(PropertyNames.EMPTY_STRING) ? PropertyNames.EMPTY_STRING : "." + ext);
+ }
+
+ public int getSize(String url)
+ {
+ try
+ {
+ return fileAccess.getSize(url);
+ }
+ catch (Exception ex)
+ {
+ return -1;
+ }
+ }
public static String connectURLs(String urlFolder, String urlFilename)
{
@@ -635,4 +1049,36 @@ public class FileAccess
return sFileData;
}
+ /**
+ * shortens a filename to a user displayable representation.
+ * @param path
+ * @param maxLength
+ * @return
+ */
+ public static String getShortFilename(String path, int maxLength)
+ {
+ int firstPart = 0;
+
+ if (path.length() > maxLength)
+ {
+ if (path.startsWith("/"))
+ { // unix
+ int nextSlash = path.indexOf("/", 1) + 1;
+ firstPart = Math.min(nextSlash, (maxLength - 3) / 2);
+ }
+ else
+ { //windows
+ firstPart = Math.min(10, (maxLength - 3) / 2);
+ }
+
+ String s1 = path.substring(0, firstPart);
+ String s2 = path.substring(path.length() - (maxLength - (3 + firstPart)));
+
+ return s1 + "..." + s2;
+ }
+ else
+ {
+ return path;
+ }
+ }
}
diff --git a/wizards/com/sun/star/wizards/common/Helper.java b/wizards/com/sun/star/wizards/common/Helper.java
index cc5c2434f3ba..3aa4628f6e20 100644
--- a/wizards/com/sun/star/wizards/common/Helper.java
+++ b/wizards/com/sun/star/wizards/common/Helper.java
@@ -22,6 +22,7 @@ import com.sun.star.util.XMacroExpander;
import java.util.Calendar;
import com.sun.star.beans.Property;
+import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
import com.sun.star.lang.Locale;
import com.sun.star.lang.XMultiServiceFactory;
@@ -35,6 +36,11 @@ import com.sun.star.util.XNumberFormatter;
public class Helper
{
+ /** Creates a new instance of Helper */
+ public Helper()
+ {
+ }
+
public static long convertUnoDatetoInteger(com.sun.star.util.Date DateValue)
{
java.util.Calendar oCal = java.util.Calendar.getInstance();
@@ -86,7 +92,21 @@ public class Helper
}
}
-
+ public static Object getPropertyValue(PropertyValue[] CurPropertyValue, String PropertyName)
+ {
+ int MaxCount = CurPropertyValue.length;
+ for (int i = 0; i < MaxCount; i++)
+ {
+ if (CurPropertyValue[i] != null)
+ {
+ if (CurPropertyValue[i].Name.equals(PropertyName))
+ {
+ return CurPropertyValue[i].Value;
+ }
+ }
+ }
+ throw new RuntimeException();
+ }
public static Object getUnoPropertyValue(Object oUnoObject, String PropertyName, java.lang.Class<?> xClass)
{
@@ -114,9 +134,53 @@ public class Helper
}
}
+ public static Object getPropertyValuefromAny(Object[] CurPropertyValue, String PropertyName)
+ {
+ if (CurPropertyValue != null)
+ {
+ int MaxCount = CurPropertyValue.length;
+ for (int i = 0; i < MaxCount; i++)
+ {
+ if (CurPropertyValue[i] != null)
+ {
+ PropertyValue aValue = (PropertyValue) CurPropertyValue[i];
+ if (aValue != null && aValue.Name.equals(PropertyName))
+ {
+ return aValue.Value;
+ }
+ }
+ }
+ }
+ return null;
+ }
-
-
+ public static Object getPropertyValuefromAny(Object[] CurPropertyValue, String PropertyName, java.lang.Class<?> xClass)
+ {
+ try
+ {
+ if (CurPropertyValue != null)
+ {
+ int MaxCount = CurPropertyValue.length;
+ for (int i = 0; i < MaxCount; i++)
+ {
+ if (CurPropertyValue[i] != null)
+ {
+ PropertyValue aValue = (PropertyValue) CurPropertyValue[i];
+ if (aValue != null && aValue.Name.equals(PropertyName))
+ {
+ return com.sun.star.uno.AnyConverter.toObject(new com.sun.star.uno.Type(xClass), aValue.Value);
+ }
+ }
+ }
+ }
+ return null;
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.err);
+ return null;
+ }
+ }
public static Object getUnoPropertyValue(Object oUnoObject, String PropertyName)
{
@@ -206,7 +270,7 @@ public class Helper
* @param oValue the parameter that has to represent an object
* @return a null reference if the array is empty
*/
- private static Object getArrayValue(Object oValue)
+ public static Object getArrayValue(Object oValue)
{
try
{
@@ -262,6 +326,7 @@ public class Helper
/**
* @param format a constant of the enumeration NumberFormatIndex
+ * @return
*/
public int getFormat(short format)
{
@@ -283,7 +348,7 @@ public class Helper
* @param date a VCL date in form of 20041231
* @return a document relative date
*/
- private synchronized double getDocumentDateAsDouble(int date)
+ public synchronized double getDocumentDateAsDouble(int date)
{
calendar.clear();
calendar.set(date / 10000,
@@ -298,17 +363,40 @@ public class Helper
return (date1 - docNullTime) / DAY_IN_MILLIS + 1;
}
- private double getDocumentDateAsDouble(DateTime date)
+ public double getDocumentDateAsDouble(DateTime date)
{
return getDocumentDateAsDouble(date.Year * 10000 + date.Month * 100 + date.Day);
}
- public String format(int formatIndex, DateTime date)
+ 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, int date)
{
return formatter.convertNumberToString(formatIndex, getDocumentDateAsDouble(date));
}
+ public String format(int formatIndex, DateTime date)
+ {
+ return formatter.convertNumberToString(formatIndex, getDocumentDateAsDouble(date));
+ }
+ public String format(int formatIndex, long javaTimeInMillis)
+ {
+ return formatter.convertNumberToString(formatIndex, getDocumentDateAsDouble(javaTimeInMillis));
+ }
}
public static XComponentContext getComponentContext(XMultiServiceFactory _xMSF)
diff --git a/wizards/com/sun/star/wizards/common/IRenderer.java b/wizards/com/sun/star/wizards/common/IRenderer.java
index c704ed6f49df..c4513ea75ab1 100644
--- a/wizards/com/sun/star/wizards/common/IRenderer.java
+++ b/wizards/com/sun/star/wizards/common/IRenderer.java
@@ -26,5 +26,5 @@ package com.sun.star.wizards.common;
public interface IRenderer
{
- String render(Object object);
+ public String render(Object object);
}
diff --git a/wizards/com/sun/star/wizards/common/Indexable.java b/wizards/com/sun/star/wizards/common/Indexable.java
index d838c35bbe07..b20fd174c7f6 100644
--- a/wizards/com/sun/star/wizards/common/Indexable.java
+++ b/wizards/com/sun/star/wizards/common/Indexable.java
@@ -25,6 +25,6 @@ package com.sun.star.wizards.common;
public interface Indexable {
- int getIndex();
+ public int getIndex();
}
diff --git a/wizards/com/sun/star/wizards/common/JavaTools.java b/wizards/com/sun/star/wizards/common/JavaTools.java
index 4f81e435f944..d7935b5a2066 100644
--- a/wizards/com/sun/star/wizards/common/JavaTools.java
+++ b/wizards/com/sun/star/wizards/common/JavaTools.java
@@ -17,6 +17,7 @@
*/
package com.sun.star.wizards.common;
+import com.sun.star.util.DateTime;
import com.sun.star.beans.PropertyValue;
import java.util.*;
import java.io.File;
@@ -28,6 +29,43 @@ import java.net.URL;
public class JavaTools
{
+ /** Creates a new instance of JavaTools */
+ public JavaTools()
+ {
+ }
+
+ public static String[] copyStringArray(String[] FirstArray)
+ {
+ if (FirstArray != null)
+ {
+ String[] SecondArray = new String[FirstArray.length];
+ System.arraycopy(FirstArray, 0, SecondArray, 0, FirstArray.length);
+ return SecondArray;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static Object[] initializeArray(Object[] olist, Object ovalue)
+ {
+ for (int i = 0; i < olist.length; i++)
+ {
+ olist[i] = ovalue;
+ }
+ return olist;
+ }
+
+ public static Object[][] initializeMultiDimArray(Object[][] olist, Object[] ovalue)
+ {
+ for (int i = 0; i < olist.length; i++)
+ {
+ olist[i] = ovalue;
+ }
+ return olist;
+ }
+
public static String[] ArrayOutOfMultiDimArray(String _sMultiDimArray[][], int _index)
{
String[] sRetArray = null;
@@ -42,9 +80,24 @@ public class JavaTools
return sRetArray;
}
+ public static int[] initializeintArray(int FieldCount, int nValue)
+ {
+ int[] LocintArray = new int[FieldCount];
+ for (int i = 0; i < LocintArray.length; i++)
+ {
+ LocintArray[i] = nValue;
+ }
+ return LocintArray;
+ }
+
/**converts a list of Integer values included in an Integer vector to a list of int values
+ *
+ *
+ * @param _aIntegerVector
+ * @return
*/
- public static int[] IntegerTointList(java.util.List<Integer> _aIntegerVector) {
+ public static int[] IntegerTointList(java.util.List<Integer> _aIntegerVector)
+ {
int[] nintValues = null;
if (_aIntegerVector.size() > 0) {
int i = 0;
@@ -57,8 +110,13 @@ public class JavaTools
}
/**converts a list of Boolean values included in a Boolean vector to a list of boolean values
+ *
+ *
+ * @param _aBooleanVector
+ * @return
*/
- public static boolean[] BooleanTobooleanList(java.util.List<Boolean> _aBooleanVector) {
+ public static boolean[] BooleanTobooleanList(java.util.List<Boolean> _aBooleanVector)
+ {
boolean[] bbooleanValues = null;
if (_aBooleanVector.size() > 0) {
int i = 0;
@@ -70,6 +128,19 @@ public class JavaTools
return bbooleanValues;
}
+ public static String[] multiDimListToArray(String[][] multidimlist)
+ {
+ String[] retlist = new String[]
+ {
+ };
+ retlist = new String[multidimlist.length];
+ for (int i = 0; i < multidimlist.length; i++)
+ {
+ retlist[i] = multidimlist[i][0];
+ }
+ return retlist;
+ }
+
public static String getlongestArrayItem(String[] StringArray)
{
String sLongestItem = PropertyNames.EMPTY_STRING;
@@ -87,12 +158,13 @@ public class JavaTools
return sLongestItem;
}
- public static String ArraytoString(String[] LocArray) {
+ public static String ArraytoString(String[] LocArray)
+ {
StringBuilder ResultString = new StringBuilder(PropertyNames.EMPTY_STRING);
boolean bActive = false;
for (String str : LocArray) {
if (bActive) {
- ResultString.append(PropertyNames.SEMI_COLON);
+ ResultString.append(PropertyNames.SEMI_COLON);
} else {
bActive = true;
}
@@ -102,6 +174,8 @@ public class JavaTools
}
/**
+ * @param SearchList
+ * @param SearchString
* @return the index of the field that contains the string 'SearchString' or '-1' if not it is
* not contained within the array
*/
@@ -116,7 +190,26 @@ public class JavaTools
return retvalue;
}
- public static int FieldInTable(String[][] SearchList, String SearchString) {
+ public static int FieldInList(String[] SearchList, String SearchString, int StartIndex)
+ {
+ int FieldLen = SearchList.length;
+ int retvalue = -1;
+ if (StartIndex < FieldLen)
+ {
+ for (int i = StartIndex; i < FieldLen; i++)
+ {
+ if (SearchList[i].equals(SearchString))
+ {
+ retvalue = i;
+ break;
+ }
+ }
+ }
+ return retvalue;
+ }
+
+ public static int FieldInTable(String[][] SearchList, String SearchString)
+ {
int retvalue = -1;
int FieldLen = SearchList.length;
if (FieldLen > 0) {
@@ -203,6 +296,11 @@ public class JavaTools
return SortList;
}
+ /**
+ * @param MainString
+ * @param Token
+ * @return
+ */
public static String[] ArrayoutofString(String MainString, String Token)
{
String[] StringArray;
@@ -261,6 +359,24 @@ public class JavaTools
}
}
+ public static String getFilenameOutOfPath(String sPath)
+ {
+ String[] Hierarchy = ArrayoutofString(sPath, "/");
+ return Hierarchy[Hierarchy.length - 1];
+ }
+
+ public static String getFileDescription(String sPath)
+ {
+ String sFilename = getFilenameOutOfPath(sPath);
+ String[] FilenameList = ArrayoutofString(sFilename, ".");
+ StringBuilder FileDescription = new StringBuilder(PropertyNames.EMPTY_STRING);
+ for (int i = 0; i < FilenameList.length - 1; i++)
+ {
+ FileDescription.append(FilenameList[i]);
+ }
+ return FileDescription.toString();
+ }
+
public static String convertfromURLNotation(String _sURLPath)
{
String sPath = PropertyNames.EMPTY_STRING;
@@ -277,6 +393,27 @@ public class JavaTools
return sPath;
}
+ public static DateTime getDateTime(long timeMillis)
+ {
+ java.util.Calendar cal = java.util.Calendar.getInstance();
+ setTimeInMillis(cal, timeMillis);
+ DateTime dt = new DateTime();
+ dt.Year = (short) cal.get(Calendar.YEAR);
+ dt.Day = (short) cal.get(Calendar.DAY_OF_MONTH);
+ dt.Month = (short) (cal.get(Calendar.MONTH) + 1);
+ dt.Hours = (short) cal.get(Calendar.HOUR);
+ dt.Minutes = (short) cal.get(Calendar.MINUTE);
+ dt.Seconds = (short) cal.get(Calendar.SECOND);
+ dt.NanoSeconds = cal.get(Calendar.MILLISECOND)*1000000;
+ return dt;
+ }
+
+ public static long getTimeInMillis(Calendar _calendar)
+ {
+ java.util.Date dDate = _calendar.getTime();
+ return dDate.getTime();
+ }
+
public static void setTimeInMillis(Calendar _calendar, long _timemillis)
{
java.util.Date dDate = new java.util.Date();
@@ -284,6 +421,13 @@ public class JavaTools
_calendar.setTime(dDate);
}
+ public static long getMillis(DateTime time)
+ {
+ java.util.Calendar cal = java.util.Calendar.getInstance();
+ cal.set(time.Year, time.Month, time.Day, time.Hours, time.Minutes, time.Seconds);
+ return getTimeInMillis(cal);
+ }
+
public static String[] removeOutdatedFields(String[] baselist, String[] _complist)
{
String[] retarray = new String[]
@@ -371,6 +515,8 @@ public class JavaTools
* MasterFieldName1;MasterFieldName2;MasterFieldName3
* The entries SlaveFieldNameX and MasterFieldNameX are grouped together and then the created groups are compared
* If a group is duplicate the entry of the second group is returned.
+ * @param _scomplist
+ * @return
*/
public static int getDuplicateFieldIndex(String[][] _scomplist)
{
@@ -397,6 +543,8 @@ public class JavaTools
/**
* not tested!!!!!
+ * @param scomplist
+ * @return
*/
public static int getDuplicateFieldIndex(String[] scomplist)
{
@@ -434,7 +582,7 @@ public class JavaTools
return -1;
}
- private static boolean isEqual(PropertyValue firstPropValue, PropertyValue secPropValue)
+ public static boolean isEqual(PropertyValue firstPropValue, PropertyValue secPropValue)
{
if (!firstPropValue.Name.equals(secPropValue.Name))
{
@@ -510,6 +658,9 @@ public class JavaTools
/**
* compares two strings. If one of them is empty and the other one is null it also returns true
+ * @param sFirstString
+ * @param sSecondString
+ * @return
*/
public static boolean isSame(String sFirstString, String sSecondString)
{
diff --git a/wizards/com/sun/star/wizards/common/NamedValueCollection.java b/wizards/com/sun/star/wizards/common/NamedValueCollection.java
index 32cc0cd80deb..2813b22647ea 100644
--- a/wizards/com/sun/star/wizards/common/NamedValueCollection.java
+++ b/wizards/com/sun/star/wizards/common/NamedValueCollection.java
@@ -45,7 +45,20 @@ public class NamedValueCollection
m_values.put( i_name, i_value );
}
-
+ @SuppressWarnings("unchecked")
+ public final < T > T getOrDefault( final String i_key, final T i_default )
+ {
+ if ( m_values.containsKey( i_key ) )
+ {
+ final Object value = m_values.get( i_key );
+ try
+ {
+ return (T)value;
+ }
+ catch ( ClassCastException e ) { }
+ }
+ return i_default;
+ }
public final < T extends XInterface > T queryOrDefault( final String i_key, final T i_default, Class<T> i_interfaceClass )
{
@@ -57,6 +70,11 @@ public class NamedValueCollection
return i_default;
}
+ public final boolean has( final String i_key )
+ {
+ return m_values.containsKey( i_key );
+ }
+
public final PropertyValue[] getPropertyValues()
{
PropertyValue[] values = new PropertyValue[ m_values.size() ];
diff --git a/wizards/com/sun/star/wizards/common/NumberFormatter.java b/wizards/com/sun/star/wizards/common/NumberFormatter.java
index 1d9a9c3d8635..05fb55f202ee 100644
--- a/wizards/com/sun/star/wizards/common/NumberFormatter.java
+++ b/wizards/com/sun/star/wizards/common/NumberFormatter.java
@@ -36,17 +36,17 @@ import com.sun.star.util.XNumberFormatter;
public class NumberFormatter
{
- private int iDateFormatKey = -1;
- private int iDateTimeFormatKey = -1;
- private int iNumberFormatKey = -1;
- private int iTextFormatKey = -1;
- private int iTimeFormatKey = -1;
- private int iLogicalFormatKey = -1;
- private long lDateCorrection;
- private XNumberFormatter xNumberFormatter;
- private XNumberFormats xNumberFormats;
- private XNumberFormatTypes xNumberFormatTypes;
- private XPropertySet xNumberFormatSettings;
+ public int iDateFormatKey = -1;
+ public int iDateTimeFormatKey = -1;
+ public int iNumberFormatKey = -1;
+ public int iTextFormatKey = -1;
+ public int iTimeFormatKey = -1;
+ public int iLogicalFormatKey = -1;
+ public long lDateCorrection;
+ public XNumberFormatter xNumberFormatter;
+ public XNumberFormats xNumberFormats;
+ public XNumberFormatTypes xNumberFormatTypes;
+ public XPropertySet xNumberFormatSettings;
private boolean bNullDateCorrectionIsDefined = false;
private Locale aLocale;
@@ -72,6 +72,14 @@ public class NumberFormatter
}
+ /**
+ * @param _xMSF
+ * @param _xNumberFormatsSupplier
+ * @return
+ * @throws Exception
+ * @deprecated
+ *
+ */
public static XNumberFormatter createNumberFormatter(XMultiServiceFactory _xMSF, XNumberFormatsSupplier _xNumberFormatsSupplier) throws Exception
{
Object oNumberFormatter = _xMSF.createInstance("com.sun.star.util.NumberFormatter");
@@ -90,6 +98,7 @@ public class NumberFormatter
* XNumberFormatter nf = Desktop.createNumberFormatter(xmsf, nsf);
* nf.convertNumberToString( key, 1972 );
* </pre>
+ * @param numberFormatsSupplier
* @param type - a constant out of i18n.NumberFormatIndex enumeration.
* @return a key to use with a util.NumberFormat instance.
*
@@ -108,7 +117,10 @@ public class NumberFormatter
}
-
+ public static String convertNumberToString(XNumberFormatter _xNumberFormatter, int _nkey, double _dblValue)
+ {
+ return _xNumberFormatter.convertNumberToString(_nkey, _dblValue);
+ }
public double convertStringToNumber(int _nkey, String _sString)throws Exception
@@ -146,9 +158,12 @@ public class NumberFormatter
/**
- * @return a numberformat for a FormatString.
+ * returns a numberformat for a FormatString.
+ * @param _FormatString
+ * @param _aLocale
+ * @return
*/
- private int defineNumberFormat(String _FormatString, Locale _aLocale)
+ public int defineNumberFormat(String _FormatString, Locale _aLocale)
{
try
{
@@ -183,11 +198,11 @@ public class NumberFormatter
}
if (xPSet.getPropertySetInfo().hasPropertyByName("NumberFormat"))
{
- xPSet.setPropertyValue("NumberFormat", Integer.valueOf(NewFormatKey));
+ xPSet.setPropertyValue("NumberFormat", new Integer(NewFormatKey));
}
else if (xPSet.getPropertySetInfo().hasPropertyByName("FormatKey"))
{
- xPSet.setPropertyValue("FormatKey", Integer.valueOf(NewFormatKey));
+ xPSet.setPropertyValue("FormatKey", new Integer(NewFormatKey));
}
else
{
diff --git a/wizards/com/sun/star/wizards/common/NumericalHelper.java b/wizards/com/sun/star/wizards/common/NumericalHelper.java
index f2c6e767e271..ab1cd3615628 100644
--- a/wizards/com/sun/star/wizards/common/NumericalHelper.java
+++ b/wizards/com/sun/star/wizards/common/NumericalHelper.java
@@ -33,20 +33,20 @@ import com.sun.star.uno.TypeClass;
public class NumericalHelper
{
- private static final int UNKNOWN_TYPE = -32768;
- private static final int BYTE_TYPE = 0;
- private static final int SHORT_TYPE = 1;
- private static final int INT_TYPE = 2;
- private static final int LONG_TYPE = 3;
- private static final int FLOAT_TYPE = 4;
- private static final int DOUBLE_TYPE = 5;
- private static final int CHAR_TYPE = 6;
- private static final int STRING_TYPE = -1;
- private static final int BOOLEAN_TYPE = -2;
- private static final int SEQUENCE_TYPE = -3;
-
-
-
+ public static final int UNKNOWN_TYPE = -32768;
+ public static final int BYTE_TYPE = 0;
+ public static final int SHORT_TYPE = 1;
+ public static final int INT_TYPE = 2;
+ public static final int LONG_TYPE = 3;
+ public static final int FLOAT_TYPE = 4;
+ public static final int DOUBLE_TYPE = 5;
+ public static final int CHAR_TYPE = 6;
+ public static final int STRING_TYPE = -1;
+ public static final int BOOLEAN_TYPE = -2;
+ public static final int SEQUENCE_TYPE = -3;
+ public static final int ASCII_VALUE_0 = 48;
+ public static final int ASCII_VALUE_A = 65;
+ public static final int COUNT_CHARS_IN_ALPHABET = 26;
private static final int HEX_BASE = 16;
private static final int DEC_BASE = 10;
private static final int ASCII_LETTER_A_OFFSET = 55;
@@ -59,10 +59,341 @@ public class NumericalHelper
// private c'tor, so no one can instantiate
}
+ /**
+ * get the type of an object: returns all types that can possibly converted
+ * with this class.
+ * @param obj an object that is checked for conversion
+ * @return the type of the object
+ */
+ public static int getType(Object obj)
+ {
+ try
+ {
+ TypeObject aTypeObject = getTypeObject(obj);
+ return aTypeObject.iType;
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ // ignore this one; just return unknown type
+ }
+ return UNKNOWN_TYPE;
+ }
+
+ /**
+ * get a byte value from the object
+ * @param aValue
+ * @return a byte
+ * @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(
+ "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 a char value from the object
+ * @param aValue
+ * @return a char
+ * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
+ */
+ public static char toChar(Object aValue)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+
+ char retValue = 0;
+ TypeObject aTypeObject = getTypeObject(aValue);
+ switch (aTypeObject.iType)
+ {
+ case CHAR_TYPE:
+ retValue = getChar(aTypeObject);
+ break;
+ case BYTE_TYPE:
+ retValue = (char) getByte(aTypeObject);
+ break;
+ case SHORT_TYPE:
+ retValue = (char) getShort(aTypeObject);
+ break;
+ case INT_TYPE:
+ retValue = (char) getInt(aTypeObject);
+ break;
+ case LONG_TYPE:
+ retValue = (char) getLong(aTypeObject);
+ break;
+ case FLOAT_TYPE:
+ retValue = (char) getFloat(aTypeObject);
+ break;
+ case DOUBLE_TYPE:
+ retValue = (char) getDouble(aTypeObject);
+ break;
+ case STRING_TYPE:
+ try
+ {
+ String s = (String) aTypeObject.aValue;
+ if (s.length() > 0)
+ {
+ retValue = s.charAt(0);
+ }
+ else
+ {
+ retValue = (char) 0;
+ }
+ }
+ catch (java.lang.NumberFormatException e)
+ {
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert to char: " + aTypeObject.aValue);
+ }
+ break;
+ case BOOLEAN_TYPE:
+ retValue = getBool(aTypeObject) ? (char) -1 : (char) 0;
+ break;
+ default:
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert this type: " + aValue.getClass().getName());
+ }
+ return retValue;
+ }
+
+ /**
+ * get a short value from the object
+ * @param aValue
+ * @return a short
+ * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
+ */
+ public static short toShort(Object aValue)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ short retValue = 0;
+ TypeObject aTypeObject = getTypeObject(aValue);
+ switch (aTypeObject.iType)
+ {
+ case BYTE_TYPE:
+ retValue = getByte(aTypeObject);
+ break;
+ case CHAR_TYPE:
+ retValue = (byte) getChar(aTypeObject);
+ break;
+ case SHORT_TYPE:
+ retValue = getShort(aTypeObject);
+ break;
+ case INT_TYPE:
+ retValue = (short) getInt(aTypeObject);
+ break;
+ case LONG_TYPE:
+ retValue = (short) getLong(aTypeObject);
+ break;
+ case FLOAT_TYPE:
+ retValue = (short) getFloat(aTypeObject);
+ break;
+ case DOUBLE_TYPE:
+ retValue = (short) getDouble(aTypeObject);
+ break;
+ case STRING_TYPE:
+ try
+ {
+ retValue = Short.parseShort((String) aTypeObject.aValue);
+ }
+ catch (java.lang.NumberFormatException e)
+ {
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert to short: " + aTypeObject.aValue);
+ }
+ break;
+ case BOOLEAN_TYPE:
+ retValue = getBool(aTypeObject) ? (short) -1 : (short) 0;
+ break;
+ default:
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert this type: " + aValue.getClass().getName());
+ }
+ return retValue;
+ }
+
+ public static boolean isValidAndNumerical(Object aValue) throws com.sun.star.lang.IllegalArgumentException
+ {
+ if (aValue != null)
+ {
+ if (!AnyConverter.isVoid(aValue))
+ {
+ return (NumericalHelper.isNumerical(aValue));
+ }
+ }
+ return false;
+ }
+
+ public static boolean isValidAndBoolean(Object aValue) throws com.sun.star.lang.IllegalArgumentException
+ {
+ if (aValue != null)
+ {
+ if (!AnyConverter.isVoid(aValue))
+ {
+ int nType = AnyConverter.getType(aValue).getTypeClass().getValue();
+ return (nType == TypeClass.BOOLEAN_value);
+ }
+ }
+ return false;
+ }
+ public static boolean isValid(Object aValue)
+ {
+ if (aValue != null)
+ {
+ if (!AnyConverter.isVoid(aValue))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ @param aValue a object this can contain anything
+ @return true, if the parameter aValue is type of real numbers
+ @deprecate, use isRealNumber() instead.
+ */
+ public static boolean isNumerical(Object aValue)
+ {
+ try
+ {
+ TypeObject aTypeObject = getTypeObject(aValue);
+ switch (aTypeObject.iType)
+ {
+ case BYTE_TYPE:
+ case CHAR_TYPE:
+ case SHORT_TYPE:
+ case INT_TYPE:
+ case LONG_TYPE:
+ case DOUBLE_TYPE:
+ case FLOAT_TYPE:
+ return true;
+ default:
+ return false;
+ }
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ return false;
+ }
+ }
+
+ /**
+ @param _aValue a object this can contain anything
+ @return true, if the parameter aValue is type of real numbers
+
+ see also http://en.wikipedia.org/wiki/Mathematics
+ */
+ public static boolean isRealNumber(Object _aValue)
+ {
+ return isNumerical(_aValue);
+ }
+
+ /**
+ @param aValue a object this can contain anything
+ * @return true, if the value is type of any integer values. double / float are not(!) integer values
+ * @throws com.sun.star.lang.IllegalArgumentException
+ */
+ public static boolean isInteger(Object aValue) throws com.sun.star.lang.IllegalArgumentException
+ {
+ TypeObject aTypeObject = getTypeObject(aValue);
+ switch (aTypeObject.iType)
+ {
+ case BYTE_TYPE:
+ case CHAR_TYPE:
+ case SHORT_TYPE:
+ case INT_TYPE:
+ case LONG_TYPE:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Can a given object be converted to a String array?
+ * @param aValue the object to test
+ * @return true, if the object can be converted to a String array.
+ */
+ public static boolean isStringArray(Object aValue)
+ {
+ try
+ {
+ toStringArray(aValue);
+ return true;
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ // ignore
+ }
+ return false;
+ }
+
+ /**
+ * Can a given object be converted to an int array?
+ * @param aValue the object to test
+ * @return true, if the object can be converted to an Integer array.
+ */
+ public static boolean isIntegerArray(Object aValue)
+ {
+ try
+ {
+ toIntArray(aValue);
+ return true;
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ // ignore
+ }
+ return false;
+ }
/**
* get an int value from the object
+ * @param aValue
* @return an int
* @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
*/
@@ -116,7 +447,118 @@ public class NumericalHelper
}
/**
+ * get a long value from the object
+ * @param aValue
+ * @return a long
+ * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
+ */
+ public static long toLong(Object aValue)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ long retValue = 0;
+ TypeObject aTypeObject = getTypeObject(aValue);
+ switch (aTypeObject.iType)
+ {
+ case BYTE_TYPE:
+ retValue = getByte(aTypeObject);
+ break;
+ case CHAR_TYPE:
+ retValue = getChar(aTypeObject);
+ break;
+ case SHORT_TYPE:
+ retValue = getShort(aTypeObject);
+ break;
+ case INT_TYPE:
+ retValue = getInt(aTypeObject);
+ break;
+ case LONG_TYPE:
+ retValue = getLong(aTypeObject);
+ break;
+ case FLOAT_TYPE:
+ retValue = (long) getFloat(aTypeObject);
+ break;
+ case DOUBLE_TYPE:
+ retValue = (long) getDouble(aTypeObject);
+ break;
+ case STRING_TYPE:
+ try
+ {
+ retValue = Long.parseLong((String) aTypeObject.aValue);
+ }
+ catch (java.lang.NumberFormatException e)
+ {
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert to short: " + aTypeObject.aValue);
+ }
+ break;
+ case BOOLEAN_TYPE:
+ retValue = getBool(aTypeObject) ? -1 : 0;
+ break;
+ default:
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert this type: " + aValue.getClass().getName());
+ }
+ return retValue;
+ }
+
+ /**
+ * get a float value from the object
+ * @param aValue
+ * @return a float
+ * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
+ */
+ public static float toFloat(Object aValue)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ float retValue = (float) 0.0;
+ TypeObject aTypeObject = getTypeObject(aValue);
+ switch (aTypeObject.iType)
+ {
+ case BYTE_TYPE:
+ retValue = getByte(aTypeObject);
+ break;
+ case CHAR_TYPE:
+ retValue = getChar(aTypeObject);
+ break;
+ case SHORT_TYPE:
+ retValue = getShort(aTypeObject);
+ break;
+ case INT_TYPE:
+ retValue = getInt(aTypeObject);
+ break;
+ case LONG_TYPE:
+ retValue = getLong(aTypeObject);
+ break;
+ case FLOAT_TYPE:
+ retValue = getFloat(aTypeObject);
+ break;
+ case DOUBLE_TYPE:
+ retValue = (float) getDouble(aTypeObject);
+ break;
+ case STRING_TYPE:
+ try
+ {
+ retValue = Float.parseFloat((String) aTypeObject.aValue);
+ }
+ catch (java.lang.NumberFormatException e)
+ {
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert to short: " + aTypeObject.aValue);
+ }
+ break;
+ case BOOLEAN_TYPE:
+ retValue = getBool(aTypeObject) ? (float) -1 : (float) 0;
+ break;
+ default:
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert this type: " + aValue.getClass().getName());
+ }
+ return retValue;
+ }
+
+ /**
* get a double value from the object
+ * @param aValue
* @return a double
* @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
*/
@@ -170,7 +612,58 @@ public class NumericalHelper
}
/**
+ * get a String value from the object
+ * @param aValue
+ * @return a String
+ * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
+ */
+ public static String toString(Object aValue)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ String retValue = null;
+ TypeObject aTypeObject = getTypeObject(aValue);
+ switch (aTypeObject.iType)
+ {
+ case BYTE_TYPE:
+ retValue = aTypeObject.aValue.toString();
+ break;
+ case CHAR_TYPE:
+ retValue = aTypeObject.aValue.toString();
+ break;
+ case SHORT_TYPE:
+ retValue = aTypeObject.aValue.toString();
+ break;
+ case INT_TYPE:
+ retValue = aTypeObject.aValue.toString();
+ break;
+ case LONG_TYPE:
+ retValue = aTypeObject.aValue.toString();
+ break;
+ case FLOAT_TYPE:
+ retValue = aTypeObject.aValue.toString();
+ break;
+ case DOUBLE_TYPE:
+ retValue = aTypeObject.aValue.toString();
+ break;
+ case STRING_TYPE:
+ retValue = (String) aTypeObject.aValue;
+ break;
+ case BOOLEAN_TYPE:
+ retValue = aTypeObject.aValue.toString();
+ break;
+ case SEQUENCE_TYPE:
+ retValue = new String(toByteArray((aValue)));
+ break;
+ default:
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert this type: " + aValue.getClass().getName());
+ }
+ return retValue;
+ }
+
+ /**
* get a boolean value from the object
+ * @param aValue
* @return a boolean
* @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
*/
@@ -224,6 +717,320 @@ public class NumericalHelper
}
/**
+ * get an int array from an object
+ * @param anArrayValue a value that is constructed into an array
+ * @return an integer array
+ * @throws com.sun.star.lang.IllegalArgumentException
+ */
+ public static int[] toIntArray(Object anArrayValue)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ int[] retValue = null;
+ TypeObject aTypeObject = getTypeObject(anArrayValue);
+ if (aTypeObject.iType == SEQUENCE_TYPE)
+ {
+ Object[] obj = convertSequenceToObjectArray(aTypeObject);
+ retValue = new int[obj.length];
+ for (int i = 0; i < obj.length; i++)
+ {
+ retValue[i] = toInt(obj[i]);
+ }
+ }
+ else
+ { // object is not really an array
+ retValue = new int[]
+ {
+ toInt(anArrayValue)
+ };
+ }
+ return retValue;
+ }
+
+ /**
+ * get an byte array from an object
+ * @param anArrayValue a value that is constructed into an array
+ * @return a byte array
+ * @throws com.sun.star.lang.IllegalArgumentException
+ */
+ public static byte[] toByteArray(Object anArrayValue)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ byte[] retValue = null;
+ TypeObject aTypeObject = getTypeObject(anArrayValue);
+ if (aTypeObject.iType == SEQUENCE_TYPE)
+ {
+ Object[] obj = convertSequenceToObjectArray(aTypeObject);
+ retValue = new byte[obj.length];
+ for (int i = 0; i < obj.length; i++)
+ {
+ retValue[i] = toByte(obj[i]);
+ }
+ }
+ else
+ { // object is not really an array
+ retValue = new byte[]
+ {
+ toByte(anArrayValue)
+ };
+ }
+ return retValue;
+ }
+
+ /**
+ * get a short array from an object
+ * @param anArrayValue a value that is constructed into an array
+ * @return a short array
+ * @throws com.sun.star.lang.IllegalArgumentException
+ */
+ public static short[] toShortArray(Object anArrayValue)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ short[] retValue = null;
+ TypeObject aTypeObject = getTypeObject(anArrayValue);
+ if (aTypeObject.iType == SEQUENCE_TYPE)
+ {
+ Object[] obj = convertSequenceToObjectArray(aTypeObject);
+ retValue = new short[obj.length];
+ for (int i = 0; i < obj.length; i++)
+ {
+ retValue[i] = toShort(obj[i]);
+ }
+ }
+ else
+ { // object is not really an array
+ retValue = new short[]
+ {
+ toShort(anArrayValue)
+ };
+ }
+ return retValue;
+ }
+
+ /**
+ * get a string array from an object
+ * @param anArrayValue a value that is constructed into an array
+ * @return a short array
+ * @throws com.sun.star.lang.IllegalArgumentException
+ */
+ public static String[] toStringArray(Object anArrayValue)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ String[] retValue = null;
+ TypeObject aTypeObject = getTypeObject(anArrayValue);
+ if (aTypeObject.iType == SEQUENCE_TYPE)
+ {
+ Object[] obj = convertSequenceToObjectArray(aTypeObject);
+ retValue = new String[obj.length];
+ for (int i = 0; i < obj.length; i++)
+ {
+ retValue[i] = toString(obj[i]);
+ }
+ }
+ else
+ { // object is not really an array
+ retValue = new String[]
+ {
+ toString(anArrayValue)
+ };
+ }
+ return retValue;
+ }
+
+ /**
+ * get an int from an object
+ * @param _aValue a value that is constructed into an int
+ * @param _ndefaultValue the value that is returned, if conversion fails, or if 'aValue' is null
+ * @return an int value
+ * @throws java.lang.Exception
+ */
+ public static int toInt(Object _aValue, int _ndefaultValue) throws Exception
+ {
+ int nreturn = _ndefaultValue;
+ try
+ {
+ if ((_aValue != null) && (!(AnyConverter.isVoid(_aValue))))
+ {
+ if (isInteger(_aValue))
+ {
+ nreturn = toInt(_aValue);
+ }
+ else
+ {
+ DebugHelper.exception(1/* BasicErrorCode.SbERR_CONVERSION*/, PropertyNames.EMPTY_STRING);
+ }
+ }
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ DebugHelper.exception(1 /*BasicErrorCode.SbERR_METHOD_FAILED*/, PropertyNames.EMPTY_STRING);
+ }
+ return nreturn;
+ }
+
+ /**
+ * get a long from an object
+ * @param aValue a value that is constructed into a long
+ * @param defaultValue the value that is returned, if conversion fails
+ * @return a long value
+ */
+ public static long toLong(Object aValue, long defaultValue)
+ {
+ try
+ {
+ return toLong(aValue);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ // ignore exception
+ }
+ return defaultValue;
+ }
+
+ /**
+ * get a float from an object
+ * @param aValue a value that is constructed into a float
+ * @param defaultValue the value that is returned, if conversion fails
+ * @return a long value
+ */
+ public static float toFloat(Object aValue, float defaultValue)
+ {
+ try
+ {
+ return toFloat(aValue);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ // ignore exception
+ }
+ return defaultValue;
+ }
+
+ /**
+ * get a double from an object
+ * @param aValue a value that is constructed into a double
+ * @param defaultValue the value that is returned, if conversion fails
+ * @return a double value
+ */
+ public static double toDouble(Object aValue, double defaultValue)
+ {
+ try
+ {
+ return toDouble(aValue);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ // ignore exception
+ }
+ return defaultValue;
+ }
+
+ /**
+ * get a string from an object
+ * @param aValue a value that is constructed into a string
+ * @param defaultValue the value that is returned, if conversion fails
+ * @return a string value
+ */
+ public static String toString(Object aValue, String defaultValue)
+ {
+ try
+ {
+ return toString(aValue);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ // ignore exception
+ }
+ return defaultValue;
+ }
+
+ /**
+ * get a boolean from an object
+ * @param aValue a value that is constructed into a boolean
+ * @param defaultValue the value that is returned, if conversion fails
+ * @return a boolean value
+ */
+ public static boolean toBoolean(Object aValue, boolean defaultValue)
+ {
+ try
+ {
+ return toBoolean(aValue);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ // ignore exception
+ }
+ return defaultValue;
+ }
+
+ /**
+ * get a int array from an object
+ * @param anArrayValue a value that is constructed into an int array
+ * @param defaultValue the value that is returned, if conversion fails
+ * @return an int array
+ */
+ public static int[] toIntArray(Object anArrayValue, int[] defaultValue)
+ {
+ try
+ {
+ return toIntArray(anArrayValue);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ // ignore exception
+ }
+ return defaultValue;
+ }
+
+ /**
+ * get a short array from an object
+ * @param anArrayValue a value that is constructed into a short array
+ * @param defaultValue the value that is returned, if conversion fails
+ * @return a short array
+ */
+ public static short[] toShortArray(Object anArrayValue, short[] defaultValue)
+ {
+ try
+ {
+ return toShortArray(anArrayValue);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ // ignore exception
+ }
+ return defaultValue;
+ }
+
+ /**
+ * get a string array from an object
+ * @param anArrayValue a value that is constructed into a string array
+ * @param defaultValue the value that is returned, if conversion fails
+ * @return a string array
+ */
+ public static String[] toStringArray(Object anArrayValue, String[] defaultValue)
+ {
+ try
+ {
+ return toStringArray(anArrayValue);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ // ignore exception
+ }
+ return defaultValue;
+ }
+
+ /**
+ * get a hexadecimal representation from a number
+ * @param number the number to transform
+ * @return a String with the hex code of the number
+ */
+ public static String getHexStringFromNumber(long number)
+ {
+ TransformNumToHex num = new TransformNumToHex(number);
+ return num.getResult();
+ }
+
+ /**
* get the type object from the given object
* @param aValue an object representing a (numerical) value; can also be an 'any'
* @return a type object: the object together with the its type information
@@ -246,19 +1053,19 @@ public class NumericalHelper
break;
case TypeClass.BYTE_value:
aTypeObject.iType = BYTE_TYPE;
- aTypeObject.aValue = Byte.valueOf(AnyConverter.toByte(aValue));
+ aTypeObject.aValue = new Byte(AnyConverter.toByte(aValue));
break;
case TypeClass.SHORT_value:
aTypeObject.iType = SHORT_TYPE;
- aTypeObject.aValue = Short.valueOf(AnyConverter.toShort(aValue));
+ aTypeObject.aValue = new Short(AnyConverter.toShort(aValue));
break;
case TypeClass.LONG_value:
aTypeObject.iType = INT_TYPE;
- aTypeObject.aValue = Integer.valueOf(AnyConverter.toInt(aValue));
+ aTypeObject.aValue = new Integer(AnyConverter.toInt(aValue));
break;
case TypeClass.HYPER_value:
aTypeObject.iType = LONG_TYPE;
- aTypeObject.aValue = Long.valueOf(AnyConverter.toLong(aValue));
+ aTypeObject.aValue = new Long(AnyConverter.toLong(aValue));
break;
case TypeClass.FLOAT_value:
aTypeObject.iType = FLOAT_TYPE;
@@ -335,7 +1142,7 @@ public class NumericalHelper
* @return
* @throws com.sun.star.lang.IllegalArgumentException
*/
- private static int getInt(TypeObject typeObject)
+ static int getInt(TypeObject typeObject)
throws com.sun.star.lang.IllegalArgumentException
{
if (typeObject.iType != INT_TYPE)
@@ -350,7 +1157,7 @@ public class NumericalHelper
* get the simple float type
* @throws com.sun.star.lang.IllegalArgumentException
*/
- private static float getFloat(TypeObject typeObject)
+ static float getFloat(TypeObject typeObject)
throws com.sun.star.lang.IllegalArgumentException
{
if (typeObject.iType != FLOAT_TYPE)
@@ -444,5 +1251,114 @@ public class NumericalHelper
transform(number);
}
}
+
+ public String getResult()
+ {
+ return val.toString();
+ }
+ }
+
+ private static Object[] convertSequenceToObjectArray(
+ TypeObject sourceObject)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ Object array = sourceObject.aValue;
+ Class<?> c = array.getClass();
+ Object[] aShortVal = null;
+ if (c.equals(byte[].class))
+ {
+ byte[] vals = (byte[]) array;
+ aShortVal = new Object[vals.length];
+ for (int i = 0; i < vals.length; i++)
+ {
+ aShortVal[i] = new Byte(vals[i]);
+ }
+ }
+ else if (c.equals(short[].class))
+ {
+ short[] vals = (short[]) array;
+ aShortVal = new Object[vals.length];
+ for (int i = 0; i < vals.length; i++)
+ {
+ aShortVal[i] = new Short(vals[i]);
+ }
+ }
+ else if (c.equals(int[].class))
+ {
+ int[] vals = (int[]) array;
+ aShortVal = new Object[vals.length];
+ for (int i = 0; i < vals.length; i++)
+ {
+ aShortVal[i] = new Integer(vals[i]);
+ }
+ }
+ else if (c.equals(long[].class))
+ {
+ long[] vals = (long[]) array;
+ aShortVal = new Object[vals.length];
+ for (int i = 0; i < vals.length; i++)
+ {
+ aShortVal[i] = new Long(vals[i]);
+ }
+ }
+ else if (c.equals(float[].class))
+ {
+ float[] vals = (float[]) array;
+ aShortVal = new Object[vals.length];
+ for (int i = 0; i < vals.length; i++)
+ {
+ aShortVal[i] = new Float(vals[i]);
+ }
+ }
+ else if (c.equals(double[].class))
+ {
+ double[] vals = (double[]) array;
+ aShortVal = new Object[vals.length];
+ for (int i = 0; i < vals.length; i++)
+ {
+ aShortVal[i] = new Double(vals[i]);
+ }
+ }
+ else if (c.equals(boolean[].class))
+ {
+ boolean[] vals = (boolean[]) array;
+ aShortVal = new Object[vals.length];
+ for (int i = 0; i < vals.length; i++)
+ {
+ aShortVal[i] = Boolean.valueOf(vals[i]);
+ }
+ }
+ // if nothing did match, try this
+ if (aShortVal == null)
+ {
+ try
+ {
+ aShortVal = (Object[]) array;
+ }
+ catch (java.lang.ClassCastException e)
+ {
+ // unknown type cannot be converted
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert unknown type: '" + e.getMessage() + "'");
+ }
+ }
+ return aShortVal;
+ }
+
+ public static boolean representsIntegerNumber(double _dblvalue)
+ {
+ double dblsecvalue = ((int) _dblvalue);
+ return Double.compare(_dblvalue, dblsecvalue) == 0;
+ }
+
+ public static double roundDouble(Double _Dblvalue, int _ndecimals)
+ {
+ return roundDouble(_Dblvalue.doubleValue(), _ndecimals);
+ }
+
+ public static double roundDouble(double _dblvalue, int _ndecimals)
+ {
+ double dblfactor = java.lang.Math.pow(10.0, _ndecimals);
+ return ((int) (_dblvalue * dblfactor)) / dblfactor;
}
}
diff --git a/wizards/com/sun/star/wizards/common/ParaStyled.java b/wizards/com/sun/star/wizards/common/ParaStyled.java
index 48ba18f7e625..e1eedfdfd2d3 100644
--- a/wizards/com/sun/star/wizards/common/ParaStyled.java
+++ b/wizards/com/sun/star/wizards/common/ParaStyled.java
@@ -25,14 +25,14 @@ import com.sun.star.text.*;
class ParaStyled implements TemplateElement
{
- private String paraStyle;
+ String paraStyle;
ParaStyled(String paraStyle_)
{
paraStyle = paraStyle_;
}
- private void format(Object textRange)
+ void format(Object textRange)
{
XText o;
o = UnoRuntime.queryInterface(XText.class, textRange);
diff --git a/wizards/com/sun/star/wizards/common/PlaceholderTextElement.java b/wizards/com/sun/star/wizards/common/PlaceholderTextElement.java
index fd2f5721e26e..a6e69da9ef60 100644
--- a/wizards/com/sun/star/wizards/common/PlaceholderTextElement.java
+++ b/wizards/com/sun/star/wizards/common/PlaceholderTextElement.java
@@ -23,15 +23,16 @@ import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.text.*;
+import com.sun.star.wizards.text.*;
import com.sun.star.wizards.common.PlaceholderTextElement;
public class PlaceholderTextElement extends TextElement
{
- private String hint;
- private String placeHolderText;
- private XMultiServiceFactory xmsf;
-
+ String hint;
+ String placeHolderText;
+ XMultiServiceFactory xmsf;
+ TextDocument templateDocument;
public PlaceholderTextElement(XTextRange textRange, String placeHolderText_, String hint_, XMultiServiceFactory xmsf_)
{
@@ -49,7 +50,6 @@ public class PlaceholderTextElement extends TextElement
xmsf = xmsf_;
}
- @Override
public void write(Object textRange)
{
super.write(textRange);
@@ -68,7 +68,7 @@ public class PlaceholderTextElement extends TextElement
}
}
- private static XTextContent createPlaceHolder(XMultiServiceFactory xmsf, String ph, String hint)
+ public static XTextContent createPlaceHolder(XMultiServiceFactory xmsf, String ph, String hint)
{
Object placeHolder;
try
@@ -82,7 +82,7 @@ public class PlaceholderTextElement extends TextElement
}
Helper.setUnoPropertyValue(placeHolder, "PlaceHolder", ph);
Helper.setUnoPropertyValue(placeHolder, "Hint", hint);
- Helper.setUnoPropertyValue(placeHolder, "PlaceHolderType", Short.valueOf(PlaceholderType.TEXT));
+ Helper.setUnoPropertyValue(placeHolder, "PlaceHolderType", new Short(PlaceholderType.TEXT));
return UnoRuntime.queryInterface(XTextContent.class, placeHolder);
}
diff --git a/wizards/com/sun/star/wizards/common/Properties.java b/wizards/com/sun/star/wizards/common/Properties.java
index ee098842e2ac..4c4a69df044e 100644
--- a/wizards/com/sun/star/wizards/common/Properties.java
+++ b/wizards/com/sun/star/wizards/common/Properties.java
@@ -64,7 +64,7 @@ public class Properties extends HashMap<String,Object>
return getProperties(this);
}
- private static PropertyValue[] getProperties(Map<String,Object> map)
+ public static PropertyValue[] getProperties(Map<String,Object> map)
{
PropertyValue[] pv = new PropertyValue[map.size()];
@@ -76,7 +76,7 @@ public class Properties extends HashMap<String,Object>
return pv;
}
- private static PropertyValue createProperty(String name, Map<String,Object> map)
+ public static PropertyValue createProperty(String name, Map<String,Object> map)
{
return createProperty(name, map.get(name));
}
diff --git a/wizards/com/sun/star/wizards/common/PropertyNames.java b/wizards/com/sun/star/wizards/common/PropertyNames.java
index af23a119d20d..c851b7432b3b 100644
--- a/wizards/com/sun/star/wizards/common/PropertyNames.java
+++ b/wizards/com/sun/star/wizards/common/PropertyNames.java
@@ -36,7 +36,7 @@ public class PropertyNames
public static String PROPERTY_TITLE = "Title";
public static String PROPERTY_BORDER = "Border";
public static String PROPERTY_MOVEABLE = "Moveable";
-
+ public static String PROPERTY_CLOSEABLE = "Closeable";
public static String PROPERTY_ALIGN = "Align";
public static String COMMAND = "Command";
public static String COMMAND_TYPE = "CommandType";
diff --git a/wizards/com/sun/star/wizards/common/PropertySetHelper.java b/wizards/com/sun/star/wizards/common/PropertySetHelper.java
index bebab376c0d0..8cf933d3bea2 100644
--- a/wizards/com/sun/star/wizards/common/PropertySetHelper.java
+++ b/wizards/com/sun/star/wizards/common/PropertySetHelper.java
@@ -17,15 +17,19 @@
*/
package com.sun.star.wizards.common;
+import com.sun.star.beans.Property;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.XPropertySetInfo;
import com.sun.star.uno.AnyConverter;
+import com.sun.star.lang.XServiceInfo;
+
import java.util.HashMap;
public class PropertySetHelper
{
- private XPropertySet m_xPropertySet;
+ protected XPropertySet m_xPropertySet;
private HashMap<String, Object> m_aHashMap;
public PropertySetHelper(Object _aObj)
@@ -67,8 +71,9 @@ public class PropertySetHelper
set a property,
@param _sName name of the property to set
@param _aValue property value as object
+ * @throws java.lang.Exception
*/
- private void setPropertyValue(String _sName, Object _aValue) throws java.lang.Exception
+ public void setPropertyValue(String _sName, Object _aValue) throws java.lang.Exception
{
if (m_xPropertySet != null)
{
@@ -139,7 +144,45 @@ public class PropertySetHelper
return nValue;
}
+ /**
+ get a property and convert it to a short value
+ @param _sName the string name of the property
+ @param _nDefault if an error occur, return this value
+ @return the int value of the property
+ */
+ public short getPropertyValueAsShort(String _sName, short _nDefault)
+ {
+ Object aObject = null;
+ short nValue = _nDefault;
+ if (m_xPropertySet != null)
+ {
+ try
+ {
+ aObject = m_xPropertySet.getPropertyValue(_sName);
+ }
+ catch (com.sun.star.beans.UnknownPropertyException e)
+ {
+ DebugHelper.writeInfo(e.getMessage());
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ DebugHelper.writeInfo(e.getMessage());
+ }
+ }
+ if (aObject != null)
+ {
+ try
+ {
+ nValue = NumericalHelper.toShort(aObject);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ DebugHelper.writeInfo("can't convert a object to short.");
+ }
+ }
+ return nValue;
+ }
/**
get a property and convert it to a double value
@@ -188,7 +231,46 @@ public class PropertySetHelper
return nValue;
}
+ /**
+ get a property and convert it to a boolean value
+ @param _sName the string name of the property
+ @param _bDefault if an error occur, return this value
+ @return the boolean value of the property
+ */
+ public boolean getPropertyValueAsBoolean(String _sName, boolean _bDefault)
+ {
+ Object aObject = null;
+ boolean bValue = _bDefault;
+ if (m_xPropertySet != null)
+ {
+ try
+ {
+ aObject = m_xPropertySet.getPropertyValue(_sName);
+ }
+ catch (com.sun.star.beans.UnknownPropertyException e)
+ {
+ DebugHelper.writeInfo(e.getMessage());
+ DebugHelper.writeInfo("UnknownPropertyException caught: Name:=" + _sName);
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ DebugHelper.writeInfo(e.getMessage());
+ }
+ }
+ if (aObject != null)
+ {
+ try
+ {
+ bValue = NumericalHelper.toBoolean(aObject);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ DebugHelper.writeInfo("can't convert a object to boolean.");
+ }
+ }
+ return bValue;
+ }
/**
get a property and convert it to a string value
@@ -256,4 +338,42 @@ public class PropertySetHelper
}
return aObject;
}
+
+ /**
+ * Debug helper, to show all properties which are available in the given object.
+ * @param _xObj the object of which the properties should shown
+ */
+ public static void showProperties(Object _xObj)
+ {
+ PropertySetHelper aHelper = new PropertySetHelper(_xObj);
+ aHelper.showProperties();
+ }
+
+ /**
+ Debug helper, to show all properties which are available in the current object.
+ */
+ public void showProperties()
+ {
+ String sName = PropertyNames.EMPTY_STRING;
+
+ if (m_xPropertySet != null)
+ {
+ XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, m_xPropertySet);
+ if (xServiceInfo != null)
+ {
+ sName = xServiceInfo.getImplementationName();
+ }
+ XPropertySetInfo xInfo = m_xPropertySet.getPropertySetInfo();
+ Property[] aAllProperties = xInfo.getProperties();
+ DebugHelper.writeInfo("Show all properties of Implementation of :'" + sName + "'");
+ for (int i = 0; i < aAllProperties.length; i++)
+ {
+ DebugHelper.writeInfo(" - " + aAllProperties[i].Name);
+ }
+ }
+ else
+ {
+ DebugHelper.writeInfo("The given object don't support XPropertySet interface.");
+ }
+ }
}
diff --git a/wizards/com/sun/star/wizards/common/Resource.java b/wizards/com/sun/star/wizards/common/Resource.java
index 7ef61faafb10..1b7ec56d195d 100644
--- a/wizards/com/sun/star/wizards/common/Resource.java
+++ b/wizards/com/sun/star/wizards/common/Resource.java
@@ -18,6 +18,7 @@
package com.sun.star.wizards.common;
+import com.sun.star.beans.PropertyValue;
import com.sun.star.container.XIndexAccess;
import com.sun.star.container.XNameAccess;
import com.sun.star.lang.XMultiServiceFactory;
@@ -27,12 +28,15 @@ import com.sun.star.uno.UnoRuntime;
public class Resource
{
- private XMultiServiceFactory xMSF;
- private String Module;
- private XIndexAccess xStringIndexAccess;
- private XIndexAccess xStringListIndexAccess;
+ XMultiServiceFactory xMSF;
+ String Module;
+ XIndexAccess xStringIndexAccess;
+ XIndexAccess xStringListIndexAccess;
/** Creates a new instance of Resource
+ * @param _xMSF
+ * @param _Unit
+ * @param _Module
*/
public Resource(XMultiServiceFactory _xMSF, String _Unit /* unused */, String _Module)
{
@@ -83,7 +87,18 @@ public class Resource
}
}
-
+ public PropertyValue[] getStringList(int nID)
+ {
+ try
+ {
+ return (PropertyValue[])this.xStringListIndexAccess.getByIndex(nID);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace();
+ throw new java.lang.IllegalArgumentException("Resource with ID not " + String.valueOf(nID) + "not found");
+ }
+ }
public String[] getResArray(int nID, int iCount)
{
diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.java b/wizards/com/sun/star/wizards/common/SystemDialog.java
index 58c85af8ab1f..8cfc29e751d3 100644
--- a/wizards/com/sun/star/wizards/common/SystemDialog.java
+++ b/wizards/com/sun/star/wizards/common/SystemDialog.java
@@ -34,23 +34,25 @@ import com.sun.star.beans.PropertyValue;
public class SystemDialog
{
- private Object systemDialog;
- private XFilePicker xFilePicker;
- private XFolderPicker2 xFolderPicker;
- private XFilterManager xFilterManager;
- private XInitialization xInitialize;
- private XExecutableDialog xExecutable;
-
- private XFilePickerControlAccess xFilePickerControlAccess;
- private XMultiServiceFactory xMSF;
- private XStringSubstitution xStringSubstitution;
+ Object systemDialog;
+ XFilePicker xFilePicker;
+ XFolderPicker2 xFolderPicker;
+ XFilterManager xFilterManager;
+ XInitialization xInitialize;
+ XExecutableDialog xExecutable;
+ XComponent xComponent;
+ XFilePickerControlAccess xFilePickerControlAccess;
+ XMultiServiceFactory xMSF;
+ public XStringSubstitution xStringSubstitution;
public String sStorePath;
/**
*
+ * @param xMSF
+ * @param ServiceName
* @param type according to com.sun.star.ui.dialogs.TemplateDescription
*/
- private SystemDialog(XMultiServiceFactory xMSF, String ServiceName, short type)
+ public SystemDialog(XMultiServiceFactory xMSF, String ServiceName, short type)
{
try
{
@@ -61,12 +63,12 @@ public class SystemDialog
xFilterManager = UnoRuntime.queryInterface(XFilterManager.class, systemDialog);
xInitialize = UnoRuntime.queryInterface(XInitialization.class, systemDialog);
xExecutable = UnoRuntime.queryInterface(XExecutableDialog.class, systemDialog);
- UnoRuntime.queryInterface(XComponent.class, systemDialog);
+ xComponent = UnoRuntime.queryInterface(XComponent.class, systemDialog);
xFilePickerControlAccess = UnoRuntime.queryInterface(XFilePickerControlAccess.class, systemDialog);
xStringSubstitution = createStringSubstitution(xMSF);
Short[] listAny = new Short[]
{
- Short.valueOf(type)
+ new Short(type)
};
if (xInitialize != null)
{
@@ -84,11 +86,20 @@ public class SystemDialog
return new SystemDialog(xmsf, "com.sun.star.ui.dialogs.FilePicker", TemplateDescription.FILESAVE_AUTOEXTENSION);
}
+ public static SystemDialog createOpenDialog(XMultiServiceFactory xmsf)
+ {
+ return new SystemDialog(xmsf, "com.sun.star.ui.dialogs.FilePicker", TemplateDescription.FILEOPEN_SIMPLE);
+ }
+ public static SystemDialog createFolderDialog(XMultiServiceFactory xmsf)
+ {
+ return new SystemDialog(xmsf, "com.sun.star.ui.dialogs.FolderPicker", (short) 0);
+ }
-
-
-
+ public static SystemDialog createOfficeFolderDialog(XMultiServiceFactory xmsf)
+ {
+ return new SystemDialog(xmsf, "com.sun.star.ui.dialogs.OfficeFolderPicker", (short) 0);
+ }
private String subst(String path)
{
@@ -107,6 +118,11 @@ public class SystemDialog
* 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?
+ *
+ * @param DisplayDirectory
+ * @param DefaultName
+ * @param sDocuType
+ * @return
*/
public String callStoreDialog(String DisplayDirectory, String DefaultName, String sDocuType)
{
@@ -117,9 +133,12 @@ public class SystemDialog
/**
*
+ * @param displayDir
+ * @param defaultName
* given url to a local path.
+ * @return
*/
- private String callStoreDialog(String displayDir, String defaultName)
+ public String callStoreDialog(String displayDir, String defaultName)
{
sStorePath = null;
try
@@ -140,17 +159,55 @@ public class SystemDialog
return sStorePath;
}
-
+ public String callFolderDialog(String title, String description, String displayDir)
+ {
+ try
+ {
+ xFolderPicker.setDisplayDirectory(subst(displayDir));
+ }
+ catch (com.sun.star.lang.IllegalArgumentException iae)
+ {
+ iae.printStackTrace();
+ throw new IllegalArgumentException(iae.getMessage());
+ }
+ xFolderPicker.setTitle(title);
+ xFolderPicker.setDescription(description);
+ if (execute(xFolderPicker))
+ {
+ return xFolderPicker.getDirectory();
+ }
+ else
+ {
+ return null;
+ }
+ }
private boolean execute(XExecutableDialog execDialog)
{
return execDialog.execute() == 1;
}
+ public String[] callOpenDialog(boolean multiSelect, String displayDirectory)
+ {
+ try
+ {
+ xFilePicker.setMultiSelectionMode(multiSelect);
+ xFilePicker.setDisplayDirectory(subst(displayDirectory));
+ if (execute(xExecutable))
+ {
+ return xFilePicker.getFiles();
+ }
+ }
+ catch (com.sun.star.lang.IllegalArgumentException exception)
+ {
+ exception.printStackTrace();
+ }
+ return null;
+ }
//("writer_StarOffice_XML_Writer_Template") 'StarOffice XML (Writer)
- private void addFilterToDialog(String sExtension, String filterName, boolean setToDefault)
+ public void addFilterToDialog(String sExtension, String filterName, boolean setToDefault)
{
try
{
@@ -167,7 +224,7 @@ public class SystemDialog
}
}
- private void addFilter(String uiName, String pattern, boolean setToDefault)
+ public void addFilter(String uiName, String pattern, boolean setToDefault)
{
try
{
@@ -293,6 +350,12 @@ public class SystemDialog
/**
* just like the other showMessageBox(...) method, but receives a
* peer argument to use to create the message box.
+ * @param xMSF
+ * @param peer
+ * @param windowServiceName
+ * @param windowAttribute
+ * @param MessageText
+ * @return
*/
public static int showMessageBox(XMultiServiceFactory xMSF, XWindowPeer peer, String windowServiceName, int windowAttribute, String MessageText)
{
@@ -326,7 +389,7 @@ public class SystemDialog
return iMessage;
}
- private static XStringSubstitution createStringSubstitution(XMultiServiceFactory xMSF)
+ public static XStringSubstitution createStringSubstitution(XMultiServiceFactory xMSF)
{
Object xPathSubst = null;
try
diff --git a/wizards/com/sun/star/wizards/common/TemplateElement.java b/wizards/com/sun/star/wizards/common/TemplateElement.java
index 07fc84f41fdd..caa40f0e2db3 100644
--- a/wizards/com/sun/star/wizards/common/TemplateElement.java
+++ b/wizards/com/sun/star/wizards/common/TemplateElement.java
@@ -20,5 +20,5 @@ package com.sun.star.wizards.common;
interface TemplateElement
{
-
+ void write(Object any) throws Exception;
}
diff --git a/wizards/com/sun/star/wizards/common/TextElement.java b/wizards/com/sun/star/wizards/common/TextElement.java
index 0a07f2c0216f..383089172145 100644
--- a/wizards/com/sun/star/wizards/common/TextElement.java
+++ b/wizards/com/sun/star/wizards/common/TextElement.java
@@ -39,7 +39,6 @@ public class TextElement extends ParaStyled
text = text_;
}
- @Override
public void write(Object textRange)
{
UnoRuntime.queryInterface(XTextRange.class, textRange).setString(text);
diff --git a/wizards/com/sun/star/wizards/common/UCB.java b/wizards/com/sun/star/wizards/common/UCB.java
index 0c770cd37bf9..46e1cd2a69b5 100644
--- a/wizards/com/sun/star/wizards/common/UCB.java
+++ b/wizards/com/sun/star/wizards/common/UCB.java
@@ -103,6 +103,10 @@ public class UCB
/**
* @deprecated
+ * @param sourceDir
+ * @param filename
+ * @param targetDir
+ * @throws Exception
*/
public void copy(String sourceDir, String filename, String targetDir) throws Exception
{
@@ -111,6 +115,11 @@ public class UCB
/**
* target name can be PropertyNames.EMPTY_STRING, in which case the name stays lige the source name
+ * @param sourceDir
+ * @param sourceFilename
+ * @param targetDir
+ * @param targetFilename
+ * @return
*/
public GlobalTransferCommandArgument copyArg(String sourceDir, String sourceFilename, String targetDir, String targetFilename)
{
@@ -219,11 +228,11 @@ public class UCB
}
else if (type.equals(Integer.class))
{
- return Integer.valueOf(xrow.getInt(1));
+ return new Integer(xrow.getInt(1));
}
else if (type.equals(Short.class))
{
- return Short.valueOf(xrow.getShort(1));
+ return new Short(xrow.getShort(1));
}
else
{
@@ -240,9 +249,9 @@ public class UCB
XContentProvider.class,ucb).queryContent(id);
}
- private interface Verifier
+ public static interface Verifier
{
- boolean verify(Object object);
+ public boolean verify(Object object);
}
}
diff --git a/wizards/com/sun/star/wizards/common/XMLProvider.java b/wizards/com/sun/star/wizards/common/XMLProvider.java
index 287e861ee714..063cb7a620a5 100644
--- a/wizards/com/sun/star/wizards/common/XMLProvider.java
+++ b/wizards/com/sun/star/wizards/common/XMLProvider.java
@@ -28,5 +28,5 @@ import org.w3c.dom.Node;
public interface XMLProvider
{
- Node createDOM(Node parent);
+ public Node createDOM(Node parent);
}
diff --git a/wizards/com/sun/star/wizards/db/BlindtextCreator.java b/wizards/com/sun/star/wizards/db/BlindtextCreator.java
index 0d79f457d6f4..96208c89e6a3 100644
--- a/wizards/com/sun/star/wizards/db/BlindtextCreator.java
+++ b/wizards/com/sun/star/wizards/db/BlindtextCreator.java
@@ -23,7 +23,7 @@ import com.sun.star.wizards.common.PropertyNames;
public class BlindtextCreator
{
- private static final String BlindText =
+ public static final String BlindText =
"Ut wisi enim ad minim veniam, quis nostrud exerci tation " + "ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor " + "in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at " + "vero et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore " + "te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy " + "nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, " + "quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. " + "Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum " + "dolore eu feugiat nulla facilisis at vero et accumsan et iusto odio dignissim qui blandit praesent " + "luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis " + "eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum.";
public static String adjustBlindTextlength(String FieldTitle, int FieldWidth, boolean bIsCurLandscape, boolean bIsGroupTable, String[] _RecordFieldNames)
@@ -31,28 +31,28 @@ public class BlindtextCreator
String BlindTextString = PropertyNames.EMPTY_STRING;
if (bIsGroupTable)
{
- return getBlindTextString(FieldTitle, FieldWidth);
+ return getBlindTextString(FieldTitle, FieldWidth, FieldWidth);
}
int MaxFieldCount = getMaxFieldCount(bIsCurLandscape);
if (_RecordFieldNames.length <= 2 * MaxFieldCount)
{
if (_RecordFieldNames.length <= MaxFieldCount)
{
- BlindTextString = getBlindTextString(FieldTitle, FieldWidth);
+ BlindTextString = getBlindTextString(FieldTitle, FieldWidth, FieldWidth);
}
else
{
- BlindTextString = getBlindTextString(FieldTitle, (int) (0.5 * FieldWidth));
+ BlindTextString = getBlindTextString(FieldTitle, FieldWidth, (int) (0.5 * FieldWidth));
}
}
else
{
- BlindTextString = getBlindTextString(FieldTitle, (int) 1.1 * FieldTitle.length());
+ BlindTextString = getBlindTextString(FieldTitle, FieldWidth, (int) 1.1 * FieldTitle.length());
}
return BlindTextString;
}
- public static String getBlindTextString(String FieldTitle, int MaxWidth)
+ public static String getBlindTextString(String FieldTitle, int FieldWidth, int MaxWidth)
{
String[] BlindTextArray = JavaTools.ArrayoutofString(BlindText, PropertyNames.SPACE);
String PartBlindText = BlindTextArray[0];
diff --git a/wizards/com/sun/star/wizards/db/ColumnPropertySet.java b/wizards/com/sun/star/wizards/db/ColumnPropertySet.java
index 2d81090b2855..e8c2f108c234 100644
--- a/wizards/com/sun/star/wizards/db/ColumnPropertySet.java
+++ b/wizards/com/sun/star/wizards/db/ColumnPropertySet.java
@@ -27,7 +27,7 @@ import com.sun.star.wizards.common.PropertyNames;
public class ColumnPropertySet
{
- private TypeInspector oTypeInspector;
+ TypeInspector oTypeInspector;
public XPropertySet xPropertySet;
private int nType;
private String sTypeName = PropertyNames.EMPTY_STRING;
@@ -76,7 +76,7 @@ public class ColumnPropertySet
{
xPropertySet.setPropertyValue("Precision", precision);
}
- setType(sTypeName, precision);
+ setType(nType, sTypeName, precision);
for (int i = 0; i < _aNewColPropertyValues.length; i++)
{
String sPropName = _aNewColPropertyValues[i].Name;
@@ -96,7 +96,7 @@ public class ColumnPropertySet
}
if (_bsetDefaultProperties)
{
- assignPropertyValue("IsNullable", Integer.valueOf(oTypeInspector.isNullable(xPropertySet)));
+ assignPropertyValue("IsNullable", new Integer(oTypeInspector.isNullable(xPropertySet)));
}
}
catch (Exception e)
@@ -124,7 +124,7 @@ public class ColumnPropertySet
}
}
- private void setType(String _sTypeName, Integer precision)
+ private void setType(int _nType, String _sTypeName, Integer precision)
{
if (_sTypeName.equals(PropertyNames.EMPTY_STRING))
{
@@ -135,7 +135,7 @@ public class ColumnPropertySet
sTypeName = _sTypeName;
}
nType = oTypeInspector.getDataType(sTypeName);
- assignPropertyValue("Type", Integer.valueOf(nType));
+ assignPropertyValue("Type", new Integer(nType));
assignPropertyValue("TypeName", sTypeName);
}
@@ -146,7 +146,7 @@ public class ColumnPropertySet
if (_spropname.equals("Type"))
{
nType = ((Integer) _oValue).intValue();
- xPropertySet.setPropertyValue("Type", Integer.valueOf(nType));
+ xPropertySet.setPropertyValue("Type", new Integer(nType));
}
else if (_spropname.equals(PropertyNames.PROPERTY_NAME))
{
@@ -160,13 +160,13 @@ public class ColumnPropertySet
{
int nScale = ((Integer) _oValue).intValue();
nScale = oTypeInspector.getScale(xPropertySet);
- xPropertySet.setPropertyValue("Scale", Integer.valueOf(nScale));
+ xPropertySet.setPropertyValue("Scale", new Integer(nScale));
}
else if (_spropname.equals("IsNullable"))
{
int nNullability = ((Integer) _oValue).intValue();
nNullability = oTypeInspector.getNullability(xPropertySet, nNullability);
- xPropertySet.setPropertyValue("IsNullable", Integer.valueOf(nNullability));
+ xPropertySet.setPropertyValue("IsNullable", new Integer(nNullability));
}
else if (_spropname.equals("TypeName"))
{
diff --git a/wizards/com/sun/star/wizards/db/CommandMetaData.java b/wizards/com/sun/star/wizards/db/CommandMetaData.java
index 37dbf19d716d..a4fe38852e9c 100644
--- a/wizards/com/sun/star/wizards/db/CommandMetaData.java
+++ b/wizards/com/sun/star/wizards/db/CommandMetaData.java
@@ -19,6 +19,9 @@ package com.sun.star.wizards.db;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbcx.KeyType;
+import com.sun.star.sdbcx.XColumnsSupplier;
+import com.sun.star.sdbcx.XKeysSupplier;
import com.sun.star.uno.AnyConverter;
import com.sun.star.awt.VclWindowPeerAttribute;
import com.sun.star.uno.UnoRuntime;
@@ -63,10 +66,10 @@ public class CommandMetaData extends DBMetaData
public String[] NonAggregateFieldNames;
private int CommandType;
private String Command;
- private boolean bCatalogAtStart = true;
- private String sCatalogSep = PropertyNames.EMPTY_STRING;
- private String sIdentifierQuote = PropertyNames.EMPTY_STRING;
- private boolean bCommandComposerAttributesalreadyRetrieved = false;
+ boolean bCatalogAtStart = true;
+ String sCatalogSep = PropertyNames.EMPTY_STRING;
+ String sIdentifierQuote = PropertyNames.EMPTY_STRING;
+ boolean bCommandComposerAttributesalreadyRetrieved = false;
private XIndexAccess xIndexKeys;
public CommandMetaData(XMultiServiceFactory xMSF, Locale _aLocale, NumberFormatter oNumberFormatter)
@@ -79,7 +82,7 @@ public class CommandMetaData extends DBMetaData
super(xMSF);
}
- public void initializeFieldColumns(String _CommandName, String[] _FieldNames)
+ public void initializeFieldColumns(boolean _bgetDefaultValue, String _CommandName, String[] _FieldNames)
{
this.setCommandName(_CommandName);
FieldColumns = new FieldColumn[_FieldNames.length];
@@ -268,7 +271,7 @@ public class CommandMetaData extends DBMetaData
throw new com.sun.star.uno.RuntimeException();
}
- public boolean getFieldNamesOfCommand(String _commandname, int _commandtype)
+ public boolean getFieldNamesOfCommand(String _commandname, int _commandtype, boolean _bAppendMode)
{
try
{
@@ -309,7 +312,20 @@ public class CommandMetaData extends DBMetaData
return false;
}
-
+ public String[] getOrderableColumns(String[] _fieldnames)
+ {
+ ArrayList<String> aOrderableColumns = new ArrayList<String>();
+ for (int i = 0; i < _fieldnames.length; i++)
+ {
+ FieldColumn ofieldcolumn = getFieldColumnByFieldName(_fieldnames[i]);
+ if (getDBDataTypeInspector().isColumnOrderable(ofieldcolumn.getXColumnPropertySet()))
+ {
+ aOrderableColumns.add(_fieldnames[i]);
+ }
+ }
+ String[] sretfieldnames = new String[aOrderableColumns.size()];
+ return aOrderableColumns.toArray(sretfieldnames);
+ }
/**
* @return Returns the command.
@@ -343,7 +359,7 @@ public class CommandMetaData extends DBMetaData
CommandType = _commandType;
}
- private boolean isnumeric(FieldColumn _oFieldColumn)
+ public boolean isnumeric(FieldColumn _oFieldColumn)
{
try
{
@@ -452,7 +468,25 @@ public class CommandMetaData extends DBMetaData
}
}
-
+ /**
+ * the fieldnames passed over are not necessarily the ones that are defined in the class
+ * @param _DisplayFieldNames
+ * @return
+ */
+ public boolean hasNumericalFields(String[] _DisplayFieldNames)
+ {
+ if (_DisplayFieldNames != null && _DisplayFieldNames.length > 0)
+ {
+ for (int i = 0; i < _DisplayFieldNames.length; i++)
+ {
+ if (isnumeric(getFieldColumnByDisplayName(_DisplayFieldNames[i])))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
public String getFieldTitle(String FieldName)
{
@@ -536,11 +570,101 @@ public class CommandMetaData extends DBMetaData
return RecordFieldNames[i];
}
+ /**@deprecated use 'RelationController' class instead
+ *
+ * @param _stablename
+ * @param _ncommandtype
+ * @return
+ */
+ public String[] getReferencedTables(String _stablename, int _ncommandtype)
+ {
+ String[] sTotReferencedTables = new String[]
+ {
+ };
+ try
+ {
+ if (_ncommandtype == com.sun.star.sdb.CommandType.TABLE && xDBMetaData.supportsIntegrityEnhancementFacility())
+ {
+ java.util.ArrayList<String> TableVector = new java.util.ArrayList<String>();
+ Object oTable = getTableNamesAsNameAccess().getByName(_stablename);
+ XKeysSupplier xKeysSupplier = UnoRuntime.queryInterface(XKeysSupplier.class, oTable);
+ xIndexKeys = xKeysSupplier.getKeys();
+ for (int i = 0; i < xIndexKeys.getCount(); i++)
+ {
+ XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xIndexKeys.getByIndex(i));
+ int curtype = AnyConverter.toInt(xPropertySet.getPropertyValue("Type"));
+ if (curtype == KeyType.FOREIGN)
+ {
+ String sreftablename = AnyConverter.toString(xPropertySet.getPropertyValue("ReferencedTable"));
+ if (getTableNamesAsNameAccess().hasByName(sreftablename))
+ {
+ TableVector.add(sreftablename);
+ }
+ }
+ }
+ if (TableVector.size() > 0)
+ {
+ sTotReferencedTables = new String[TableVector.size()];
+ TableVector.toArray(sTotReferencedTables);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ }
+ return sTotReferencedTables;
+ }
+ /**@deprecated use 'RelationController' class instead
+ *
+ * @param _sreferencedtablename
+ * @return
+ */
+ public String[][] getKeyColumns(String _sreferencedtablename)
+ {
+ String[][] skeycolumnnames = null;
+ try
+ {
+ for (int i = 0; i < xIndexKeys.getCount(); i++)
+ {
+ XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xIndexKeys.getByIndex(i));
+ int curtype = AnyConverter.toInt(xPropertySet.getPropertyValue("Type"));
+ if (curtype == KeyType.FOREIGN)
+ {
+ String scurreftablename = AnyConverter.toString(xPropertySet.getPropertyValue("ReferencedTable"));
+ if (getTableNamesAsNameAccess().hasByName(scurreftablename))
+ {
+ if (scurreftablename.equals(_sreferencedtablename))
+ {
+ XColumnsSupplier xColumnsSupplier = UnoRuntime.queryInterface(XColumnsSupplier.class, xPropertySet);
+ String[] smastercolnames = xColumnsSupplier.getColumns().getElementNames();
+ skeycolumnnames = new String[2][smastercolnames.length];
+ skeycolumnnames[0] = smastercolnames;
+ skeycolumnnames[1] = new String[smastercolnames.length];
+ for (int n = 0; n < smastercolnames.length; n++)
+ {
+ XPropertySet xcolPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xColumnsSupplier.getColumns().getByName(smastercolnames[n]));
+ skeycolumnnames[1][n] = AnyConverter.toString(xcolPropertySet.getPropertyValue("RelatedColumn"));
+ }
+ return skeycolumnnames;
+ }
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return skeycolumnnames;
+ }
+ public void openFormDocument(boolean _bReadOnly)
+ {
+ }
-
- private void setCommandComposingAttributes()
+ public void setCommandComposingAttributes()
{
try
{
diff --git a/wizards/com/sun/star/wizards/db/CommandName.java b/wizards/com/sun/star/wizards/db/CommandName.java
index 285e3e47725f..2621b96e167b 100644
--- a/wizards/com/sun/star/wizards/db/CommandName.java
+++ b/wizards/com/sun/star/wizards/db/CommandName.java
@@ -25,17 +25,17 @@ import com.sun.star.wizards.common.PropertyNames;
public class CommandName
{
- private CommandMetaData oCommandMetaData;
- private String CatalogName = PropertyNames.EMPTY_STRING;
- private String SchemaName = PropertyNames.EMPTY_STRING;
- private String TableName = PropertyNames.EMPTY_STRING;
- private String DisplayName = PropertyNames.EMPTY_STRING;
- private String ComposedName = PropertyNames.EMPTY_STRING;
- private String AliasName = PropertyNames.EMPTY_STRING;
- private boolean bCatalogAtStart;
- private String sCatalogSep;
-
- private boolean baddQuotation = true;
+ protected CommandMetaData oCommandMetaData;
+ protected String CatalogName = PropertyNames.EMPTY_STRING;
+ protected String SchemaName = PropertyNames.EMPTY_STRING;
+ protected String TableName = PropertyNames.EMPTY_STRING;
+ protected String DisplayName = PropertyNames.EMPTY_STRING;
+ protected String ComposedName = PropertyNames.EMPTY_STRING;
+ protected String AliasName = PropertyNames.EMPTY_STRING;
+ protected boolean bCatalogAtStart;
+ protected String sCatalogSep;
+ protected String sIdentifierQuote;
+ protected boolean baddQuotation = true;
public CommandName(CommandMetaData _CommandMetaData, String _DisplayName)
{
@@ -131,7 +131,7 @@ public class CommandName
}
}
- private void setComposedCommandName()
+ public void setComposedCommandName()
{
if (this.setMetaDataAttributes())
{
@@ -176,6 +176,7 @@ public class CommandName
{
bCatalogAtStart = oCommandMetaData.xDBMetaData.isCatalogAtStart();
sCatalogSep = oCommandMetaData.xDBMetaData.getCatalogSeparator();
+ sIdentifierQuote = oCommandMetaData.xDBMetaData.getIdentifierQuoteString();
return true;
}
catch (SQLException e)
@@ -185,7 +186,7 @@ public class CommandName
}
}
- private String quoteName(String _sName)
+ public String quoteName(String _sName)
{
if (baddQuotation)
{
diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java
index 4106e7594071..4fd83b1a74c8 100644
--- a/wizards/com/sun/star/wizards/db/DBMetaData.java
+++ b/wizards/com/sun/star/wizards/db/DBMetaData.java
@@ -85,16 +85,16 @@ public class DBMetaData
private XPropertySet m_dataSourceSettings;
private XOfficeDatabaseDocument xModel;
private XPropertySet xDataSourcePropertySet;
-
-
- private java.util.ArrayList<CommandObject> CommandObjects = new ArrayList<CommandObject>(1);
- private Locale aLocale;
- private int[] CommandTypes;
+ public String[] DataSourceNames;
+ public String[] CommandNames;
+ public java.util.ArrayList<CommandObject> CommandObjects = new ArrayList<CommandObject>(1);
+ public Locale aLocale;
+ public int[] CommandTypes;
public String DataSourceName;
public com.sun.star.sdbc.XConnection DBConnection;
private com.sun.star.sdb.tools.XConnectionTools m_connectionTools;
public com.sun.star.lang.XMultiServiceFactory xMSF;
- private XComponent xConnectionComponent;
+ public XComponent xConnectionComponent;
private XNameAccess xNameAccess;
private XInterface xDatabaseContext;
@@ -201,6 +201,7 @@ public class DBMetaData
this.xMSF = xMSF;
xDatabaseContext = (XInterface) xMSF.createInstance("com.sun.star.sdb.DatabaseContext");
xNameAccess = UnoRuntime.queryInterface( XNameAccess.class, xDatabaseContext );
+ DataSourceNames = xNameAccess.getElementNames();
}
catch (Exception e)
{
@@ -208,7 +209,31 @@ public class DBMetaData
}
}
-
+ public void setCommandTypes()
+ {
+ int TableCount;
+ int QueryCount;
+ int CommandCount;
+ int i;
+ int a;
+ TableCount = JavaTools.getArraylength(TableNames);
+ QueryCount = JavaTools.getArraylength(QueryNames);
+ CommandCount = TableCount + QueryCount;
+ CommandTypes = new int[CommandCount];
+ if (TableCount > 0)
+ {
+ for (i = 0; i < TableCount; i++)
+ {
+ CommandTypes[i] = com.sun.star.sdb.CommandType.TABLE;
+ }
+ a = i;
+ for (i = 0; i < QueryCount; i++)
+ {
+ CommandTypes[a] = com.sun.star.sdb.CommandType.QUERY;
+ a += 1;
+ }
+ }
+ }
public boolean hasTableByName(String _stablename)
{
@@ -264,7 +289,7 @@ public class DBMetaData
private String Name;
private int CommandType;
- private CommandObject(String _CommandName, int _CommandType)
+ public CommandObject(String _CommandName, int _CommandType)
{
try
{
@@ -492,7 +517,18 @@ public class DBMetaData
return isSQL92CheckEnabled;
}
-
+ public String verifyName(String _sname, int _maxlen)
+ {
+ if (_sname.length() > _maxlen)
+ {
+ return _sname.substring(0, _maxlen);
+ }
+ if (this.isSQL92CheckEnabled())
+ {
+ return Desktop.removeSpecialCharacters(xMSF, Configuration.getLocale(xMSF), _sname);
+ }
+ return _sname;
+ }
public XDataSource getDataSource()
{
@@ -531,7 +567,7 @@ public class DBMetaData
}
}
- private void getDataSourceInterfaces() throws Exception
+ public void getDataSourceInterfaces() throws Exception
{
xDataSourcePropertySet = UnoRuntime.queryInterface( XPropertySet.class, getDataSource() );
bPasswordIsRequired = ((Boolean) xDataSourcePropertySet.getPropertyValue("IsPasswordRequired")).booleanValue();
@@ -749,7 +785,7 @@ public class DBMetaData
return supportsPrimaryKeys;
}
- private boolean supportsCoreSQLGrammar()
+ public boolean supportsCoreSQLGrammar()
{
try
{
@@ -762,6 +798,11 @@ public class DBMetaData
}
}
+ public boolean supportsAutoIncrementation()
+ {
+ return false;
+ }
+
public boolean supportsQueriesInFrom() throws SQLException
{
return m_connectionTools.getDataSourceMetaData().supportsQueriesInFrom();
@@ -774,6 +815,8 @@ public class DBMetaData
/**
* inserts a Query to a datasource; There is no validation if the queryname is already existing in the datasource
+ * @param _oSQLQueryComposer
+ * @param _QueryName
*/
public boolean createQuery(SQLQueryComposer _oSQLQueryComposer, String _QueryName)
{
@@ -866,9 +909,11 @@ public class DBMetaData
/**
* adds the passed document as a report or a form to the database. Afterwards the document is deleted.
* the document may not be open
+ * @param _xComponent
+ * @param _xDocNameAccess
* @param i_createTemplate describes the type of the document: "form" or "report"
*/
- private void addDatabaseDocument(XComponent _xComponent, XHierarchicalNameAccess _xDocNameAccess, boolean i_createTemplate)
+ public void addDatabaseDocument(XComponent _xComponent, XHierarchicalNameAccess _xDocNameAccess, boolean i_createTemplate)
{
try
{
diff --git a/wizards/com/sun/star/wizards/db/FieldColumn.java b/wizards/com/sun/star/wizards/db/FieldColumn.java
index f0d55d3859bb..409af6e15002 100644
--- a/wizards/com/sun/star/wizards/db/FieldColumn.java
+++ b/wizards/com/sun/star/wizards/db/FieldColumn.java
@@ -214,7 +214,17 @@ public class FieldColumn
FieldTitle = _sTitle;
}
-
+ public static String getCommandName(String _DisplayName)
+ {
+ String locCommandName = null;
+ String[] sFieldMetaData = JavaTools.ArrayoutofString(_DisplayName, ".");
+ if (sFieldMetaData.length >= 2)
+ {
+ String locfieldname = sFieldMetaData[sFieldMetaData.length - 1];
+ locCommandName = _DisplayName.substring(0, _DisplayName.length() - locfieldname.length() - 1);
+ }
+ return locCommandName;
+ }
public boolean isBoolean()
{
@@ -376,7 +386,7 @@ public class FieldColumn
}
}
- private void initDefaultValue()
+ public void initDefaultValue()
{
switch (getFieldType())
{
@@ -406,11 +416,11 @@ public class FieldColumn
break;
case DataType.VARCHAR: // == 12;
- DefaultValue = BlindtextCreator.getBlindTextString(FieldTitle, FieldWidth);
+ DefaultValue = BlindtextCreator.getBlindTextString(FieldTitle, FieldWidth, FieldWidth);
break;
case DataType.LONGVARCHAR: // == -1;
- DefaultValue = BlindtextCreator.getBlindTextString(FieldTitle, FieldWidth);
+ DefaultValue = BlindtextCreator.getBlindTextString(FieldTitle, FieldWidth, FieldWidth);
break;
case DataType.NUMERIC: // == 2;
diff --git a/wizards/com/sun/star/wizards/db/QueryMetaData.java b/wizards/com/sun/star/wizards/db/QueryMetaData.java
index 58b005db90d8..4b994ac667d9 100644
--- a/wizards/com/sun/star/wizards/db/QueryMetaData.java
+++ b/wizards/com/sun/star/wizards/db/QueryMetaData.java
@@ -28,7 +28,7 @@ public class QueryMetaData extends CommandMetaData
{
private SQLQueryComposer oSQLQueryComposer = null;
-
+ FieldColumn CurFieldColumn;
public String Command;
// Vector CommandNamesV;
private PropertyValue[][] m_aFilterConditions; /* = new PropertyValue[][] {}; */
@@ -36,15 +36,16 @@ public class QueryMetaData extends CommandMetaData
public PropertyValue[][] GroupByFilterConditions = new PropertyValue[][]
{
};
- private String[] UniqueAggregateFieldNames = new String[]
+ public String[] UniqueAggregateFieldNames = new String[]
{
};
public int Type = QueryType.SODETAILQUERY;
- public interface QueryType
+ public static interface QueryType
{
- int SOSUMMARYQUERY = 0;
- int SODETAILQUERY = 1;
+
+ final static int SOSUMMARYQUERY = 0;
+ final static int SODETAILQUERY = 1;
}
public QueryMetaData(XMultiServiceFactory xMSF, Locale CharLocale, NumberFormatter oNumberFormatter)
@@ -133,7 +134,24 @@ public class QueryMetaData extends CommandMetaData
oRemainingFieldColumns.toArray(FieldColumns);
}
-
+ public void removeFieldColumn(String _sFieldName, String _sCommandName)
+ {
+ FieldColumn oFieldColumn = getFieldColumn(_sFieldName, _sCommandName);
+ int a = 0;
+ if (oFieldColumn != null)
+ {
+ FieldColumn[] LocFieldColumns = new FieldColumn[FieldColumns.length - 1];
+ for (int i = 0; i < FieldColumns.length; i++)
+ {
+ if (!FieldColumns[i].getFieldName().equals(_sFieldName) && !FieldColumns[i].getCommandName().equals(_sCommandName))
+ {
+ LocFieldColumns[a] = FieldColumns[i];
+ a++;
+ }
+ }
+ FieldColumns = LocFieldColumns;
+ }
+ }
public String[] getIncludedCommandNames()
{
@@ -176,9 +194,13 @@ public class QueryMetaData extends CommandMetaData
return sIncludedCommandNames;
}
+ public String[] getFieldNamesOfCommand(String _sCommandName)
+ {
+ CommandObject oTable = getTableByName(_sCommandName);
+ return oTable.getColumns().getElementNames();
+ }
-
- public void initializeFieldTitleSet()
+ public void initializeFieldTitleSet(boolean _bAppendMode)
{
try
{
diff --git a/wizards/com/sun/star/wizards/db/RecordParser.java b/wizards/com/sun/star/wizards/db/RecordParser.java
index 39b115206dac..bbe917b59094 100644
--- a/wizards/com/sun/star/wizards/db/RecordParser.java
+++ b/wizards/com/sun/star/wizards/db/RecordParser.java
@@ -40,15 +40,15 @@ import com.sun.star.wizards.common.PropertyNames;
public class RecordParser extends QueryMetaData
{
- private XNameAccess xColumns;
-
- private com.sun.star.sdbc.XRow xResultSetRow;
+ XNameAccess xColumns;
+ com.sun.star.sdbc.XRow xRow;
+ com.sun.star.sdbc.XRow xResultSetRow;
public XResultSet ResultSet;
- private XInterface xRowSet;
- private XCompletedExecution xExecute;
-
- private XComponent xRowSetComponent;
- private XInteractionHandler xInteraction;
+ XInterface xRowSet;
+ XCompletedExecution xExecute;
+ XColumnsSupplier xRowSetColumnsSupplier;
+ XComponent xRowSetComponent;
+ XInteractionHandler xInteraction;
public FieldColumn[] GroupFieldColumns;
public FieldColumn[] RecordFieldColumns;
@@ -70,7 +70,7 @@ public class RecordParser extends QueryMetaData
try
{
xRowSet = (XInterface) xMSF.createInstance("com.sun.star.sdb.RowSet");
- UnoRuntime.queryInterface(XColumnsSupplier.class, xRowSet);
+ xRowSetColumnsSupplier = UnoRuntime.queryInterface(XColumnsSupplier.class, xRowSet);
xRowSetComponent = UnoRuntime.queryInterface(XComponent.class, xRowSet);
xExecute = UnoRuntime.queryInterface(XCompletedExecution.class, xRowSet);
XInterface oInteraction = (XInterface) xMSF.createInstance("com.sun.star.task.InteractionHandler");
@@ -125,7 +125,7 @@ public class RecordParser extends QueryMetaData
return Any.VOID;
}
- private Object getColumnValue(int ColIndex, int iType)
+ public Object getColumnValue(int ColIndex, int iType)
{
Object oAny = Any.VOID;
switch (iType)
@@ -209,7 +209,7 @@ public class RecordParser extends QueryMetaData
Helper.setUnoPropertyValue(xRowSet, "DataSourceName", DataSourceName);
Helper.setUnoPropertyValue(xRowSet, PropertyNames.ACTIVE_CONNECTION, DBConnection);
Helper.setUnoPropertyValue(xRowSet, PropertyNames.COMMAND, Command);
- Helper.setUnoPropertyValue(xRowSet, PropertyNames.COMMAND_TYPE, Integer.valueOf(_nCommandType)); // CommandType
+ Helper.setUnoPropertyValue(xRowSet, PropertyNames.COMMAND_TYPE, new Integer(_nCommandType)); // CommandType
xExecute.executeWithCompletion(xInteraction);
com.sun.star.sdb.XResultSetAccess xResultAccess = UnoRuntime.queryInterface(com.sun.star.sdb.XResultSetAccess.class, xRowSet);
ResultSet = xResultAccess.createResultSet();
@@ -285,7 +285,6 @@ public class RecordParser extends QueryMetaData
return true;
}
- @Override
public void dispose()
{
if (xRowSetComponent != null)
diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java
index 1f7d2df31c75..7fe8530ceff2 100644
--- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java
+++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java
@@ -40,13 +40,13 @@ import java.util.ArrayList;
public class SQLQueryComposer
{
-
- private QueryMetaData CurDBMetaData;
+ public XColumnsSupplier xColSuppl;
+ QueryMetaData CurDBMetaData;
public XSingleSelectQueryAnalyzer m_xQueryAnalyzer;
- private ArrayList<CommandName> composedCommandNames = new ArrayList<CommandName>(1);
+ ArrayList<CommandName> composedCommandNames = new ArrayList<CommandName>(1);
private XSingleSelectQueryComposer m_queryComposer;
- private XMultiServiceFactory xMSF;
- private boolean bincludeGrouping = true;
+ XMultiServiceFactory xMSF;
+ boolean bincludeGrouping = true;
public SQLQueryComposer(QueryMetaData _CurDBMetaData)
{
@@ -109,7 +109,7 @@ public class SQLQueryComposer
return sSelectClause;
}
- private String getAliasFieldNameClause(String _FieldName)
+ public String getAliasFieldNameClause(String _FieldName)
{
String FieldTitle = CurDBMetaData.getFieldTitle(_FieldName);
if (!FieldTitle.equals(_FieldName))
@@ -122,14 +122,27 @@ public class SQLQueryComposer
}
}
-
+ public void appendFilterConditions()
+ {
+ try
+ {
+ for (int i = 0; i < CurDBMetaData.getFilterConditions().length; i++)
+ {
+ m_queryComposer.setStructuredFilter(CurDBMetaData.getFilterConditions());
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.err);
+ }
+ }
public void prependSortingCriteria() throws SQLException
{
prependSortingCriteria(false);
}
- private void prependSortingCriteria(boolean _baddAliasFieldNames) throws SQLException
+ public void prependSortingCriteria(boolean _baddAliasFieldNames) throws SQLException
{
XIndexAccess xColumnIndexAccess = m_xQueryAnalyzer.getOrderColumns();
m_queryComposer.setOrder("");
@@ -170,7 +183,7 @@ public class SQLQueryComposer
m_queryComposer.appendOrderByColumn(xColumn, bascend);
}
- private void appendSortingcriteria(boolean _baddAliasFieldNames) throws SQLException
+ public void appendSortingcriteria(boolean _baddAliasFieldNames) throws SQLException
{
String sOrder = "";
m_queryComposer.setOrder("");
@@ -199,7 +212,7 @@ public class SQLQueryComposer
sOrder = m_queryComposer.getOrder();
}
- private void appendGroupByColumns(boolean _baddAliasFieldNames) throws SQLException
+ public void appendGroupByColumns(boolean _baddAliasFieldNames) throws SQLException
{
for (int i = 0; i < CurDBMetaData.GroupFieldNames.length; i++)
{
@@ -267,12 +280,12 @@ public class SQLQueryComposer
return setQueryCommand(_xParentWindow, _bincludeGrouping, _baddAliasFieldNames, true);
}
- private boolean setQueryCommand(XWindow _xParentWindow, boolean _bincludeGrouping, boolean _baddAliasFieldNames, boolean addQuery)
+ public boolean setQueryCommand(XWindow _xParentWindow, boolean _bincludeGrouping, boolean _baddAliasFieldNames, boolean addQuery)
{
return setQueryCommand(_xParentWindow, _bincludeGrouping, _baddAliasFieldNames, addQuery, false);
}
- private boolean setQueryCommand(XWindow _xParentWindow, boolean _bincludeGrouping, boolean _baddAliasFieldNames, boolean addQuery, boolean prependSortingCriteria)
+ public boolean setQueryCommand(XWindow _xParentWindow, boolean _bincludeGrouping, boolean _baddAliasFieldNames, boolean addQuery, boolean prependSortingCriteria)
{
try
{
@@ -349,7 +362,7 @@ public class SQLQueryComposer
return null;
}
- private CommandName getComposedCommandByDisplayName(String _DisplayName)
+ public CommandName getComposedCommandByDisplayName(String _DisplayName)
{
if (composedCommandNames != null)
{
@@ -364,7 +377,7 @@ public class SQLQueryComposer
return null;
}
- private String getuniqueAliasName(String _TableName)
+ public String getuniqueAliasName(String _TableName)
{
int a = 0;
String AliasName = "";
@@ -391,7 +404,7 @@ public class SQLQueryComposer
return CommandName.quoteName(_sname, CurDBMetaData.getIdentifierQuote());
}
- private void displaySQLErrorDialog(Exception _exception, XWindow _xParentWindow)
+ public void displaySQLErrorDialog(Exception _exception, XWindow _xParentWindow)
{
try
{
diff --git a/wizards/com/sun/star/wizards/db/TableDescriptor.java b/wizards/com/sun/star/wizards/db/TableDescriptor.java
index 08f7351aa82f..2d34c4fe504c 100644
--- a/wizards/com/sun/star/wizards/db/TableDescriptor.java
+++ b/wizards/com/sun/star/wizards/db/TableDescriptor.java
@@ -28,6 +28,7 @@ import com.sun.star.beans.XPropertySet;
import com.sun.star.container.ContainerEvent;
import com.sun.star.container.XContainer;
import com.sun.star.container.XContainerListener;
+import com.sun.star.container.XHierarchicalNameAccess;
import com.sun.star.container.XIndexAccess;
import com.sun.star.container.XNameAccess;
import com.sun.star.lang.EventObject;
@@ -51,20 +52,20 @@ import com.sun.star.wizards.common.PropertyNames;
public class TableDescriptor extends CommandMetaData implements XContainerListener
{
- private XDataDescriptorFactory xTableDataDescriptorFactory;
- private XPropertySet xPropTableDataDescriptor;
+ XDataDescriptorFactory xTableDataDescriptorFactory;
+ XPropertySet xPropTableDataDescriptor;
private XNameAccess xNameAccessColumns;
private XIndexAccess xIndexAccessKeys;
- private XDataDescriptorFactory xColumnDataDescriptorFactory;
- private XContainer xTableContainer;
- private XAppend xTableAppend;
- private XDrop xTableDrop;
+ public XDataDescriptorFactory xColumnDataDescriptorFactory;
+ XContainer xTableContainer;
+ XAppend xTableAppend;
+ XDrop xTableDrop;
private XAppend xKeyAppend;
private XDrop xKeyDrop;
private String[] sTableFilters = null;
private ArrayList<ColumnDescriptor> columncontainer;
private ArrayList<XPropertySet> keycolumncontainer;
-
+ public XHierarchicalNameAccess xTableHierarchicalNameAccess;
private CommandName ComposedTableName;
private XAppend xKeyColAppend;
private XColumnsSupplier xKeyColumnSupplier;
@@ -74,6 +75,9 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
private String sColumnAlreadyExistsMessage = PropertyNames.EMPTY_STRING;
private XWindow xWindow;
+ /**
+ * @param xMSF
+ */
public TableDescriptor(XMultiServiceFactory xMSF, XWindow _xWindow, String _sColumnAlreadyExistsMessage)
{
super(xMSF);
@@ -96,7 +100,6 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
}
}
- @Override
public boolean getConnection(PropertyValue[] _curPropertyValue)
{
if (super.getConnection(_curPropertyValue))
@@ -136,7 +139,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
}
}
- private boolean createPrimaryKeys(String[] _fieldnames, boolean _bAutoincrementation)
+ public boolean createPrimaryKeys(String[] _fieldnames, boolean _bAutoincrementation)
{
try
{
@@ -146,7 +149,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
xKeyDrop = UnoRuntime.queryInterface(XDrop.class, xIndexAccessKeys);
xKeyAppend = UnoRuntime.queryInterface(XAppend.class, xKeyFac);
xKey = xKeyFac.createDataDescriptor();
- xKey.setPropertyValue("Type", Integer.valueOf(KeyType.PRIMARY));
+ xKey.setPropertyValue("Type", new Integer(KeyType.PRIMARY));
xKeyColumnSupplier = UnoRuntime.queryInterface(XColumnsSupplier.class, xKey);
XDataDescriptorFactory xKeyColFac = UnoRuntime.queryInterface(XDataDescriptorFactory.class, xKeyColumnSupplier.getColumns());
xKeyColAppend = UnoRuntime.queryInterface(XAppend.class, xKeyColFac);
@@ -165,7 +168,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
{
xColPropertySet = addPrimaryKeyColumn(_fieldnames[i]);
}
- xColPropertySet.setPropertyValue("IsNullable", Integer.valueOf(com.sun.star.sdbc.ColumnValue.NO_NULLS));
+ xColPropertySet.setPropertyValue("IsNullable", new Integer(com.sun.star.sdbc.ColumnValue.NO_NULLS));
if (_bAutoincrementation)
{
int nDataType = oTypeInspector.getAutoIncrementIndex(xColPropertySet);
@@ -173,7 +176,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
{
if (xColPropertySet.getPropertySetInfo().hasPropertyByName("IsAutoIncrement"))
{
- xColPropertySet.setPropertyValue("Type", Integer.valueOf(nDataType));
+ xColPropertySet.setPropertyValue("Type", new Integer(nDataType));
xColPropertySet.setPropertyValue("IsAutoIncrement", Boolean.valueOf(_bAutoincrementation));
}
}
@@ -202,7 +205,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
return false;
}
- private boolean isColunnNameDuplicate(XNameAccess _xColumns, XPropertySet _xToBeAppendedPropertySet)
+ public boolean isColunnNameDuplicate(XNameAccess _xColumns, XPropertySet _xToBeAppendedPropertySet)
{
try
{
@@ -224,7 +227,10 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
/**
* creates the table under the passed name
+ * @param _catalogname
+ * @param _schemaname
* @param _tablename is made unique if necessary
+ * @param _fieldnames
* @return true or false to indicate successful creation or not
*/
public boolean createTable(String _catalogname, String _schemaname, String _tablename, String[] _fieldnames)
@@ -383,7 +389,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
}
}
- private boolean modifyColumn(String _sname, String _spropname, Object _oValue)
+ public boolean modifyColumn(String _sname, String _spropname, Object _oValue)
{
try
{
@@ -639,9 +645,34 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
}
}
+ public boolean addColumn(String _columnname, XPropertySet _xNewColPropertySet)
+ {
+ try
+ {
+ if (!hasByName(_columnname))
+ {
+ if (_columnname.equals(PropertyNames.EMPTY_STRING))
+ {
+ return false;
+ }
+ else
+ {
+ ColumnPropertySet oPropertySet = new ColumnPropertySet(oTypeInspector, xColumnDataDescriptorFactory.createDataDescriptor());
+ oPropertySet.assignNewPropertySet(_columnname, _xNewColPropertySet);
+ ColumnDescriptor oColumnDescriptor = new ColumnDescriptor(oPropertySet.xPropertySet, _columnname);
+ columncontainer.add(oColumnDescriptor);
+ return true;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ }
+ return false;
+ }
-
- private XPropertySet addPrimaryKeyColumn(String _columnname)
+ public XPropertySet addPrimaryKeyColumn(String _columnname)
{
try
{
@@ -654,7 +685,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
xColPropertySet.setPropertyValue(PropertyNames.PROPERTY_NAME, IDFieldName);
int nDataType = oTypeInspector.convertDataType(com.sun.star.sdbc.DataType.INTEGER);
- xColPropertySet.setPropertyValue("Type", Integer.valueOf(nDataType));
+ xColPropertySet.setPropertyValue("Type", new Integer(nDataType));
xColPropertySet.setPropertyValue("TypeName", oTypeInspector.getDefaultTypeName(nDataType, null));
ColumnDescriptor oColumnDescriptor = new ColumnDescriptor(xColPropertySet, IDFieldName);
this.columncontainer.add(0, oColumnDescriptor);
@@ -767,7 +798,11 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
{
}
- private boolean appendTableNameToFilter(String _scomposedtablename)
+ /**
+ * @param _scomposedtablename
+ * @return
+ */
+ public boolean appendTableNameToFilter(String _scomposedtablename)
{
boolean bhastoinsert = true;
for (int i = 0; i < sTableFilters.length; i++)
diff --git a/wizards/com/sun/star/wizards/db/TypeInspector.java b/wizards/com/sun/star/wizards/db/TypeInspector.java
index b93c09737fb3..d0fde032d4a5 100644
--- a/wizards/com/sun/star/wizards/db/TypeInspector.java
+++ b/wizards/com/sun/star/wizards/db/TypeInspector.java
@@ -47,14 +47,19 @@ public class TypeInspector
DataType.INTEGER, DataType.FLOAT, DataType.REAL, DataType.DOUBLE, DataType.NUMERIC, DataType.DECIMAL
};
final int INVALID = 999999;
- private XResultSet xResultSet;
+ XResultSet xResultSet;
public class TypeInfo
{
+
+ public int nDataType;
+ public String sDataTypeName;
public boolean bisAutoIncrementable;
- private TypeInfo(int _nDataType, String _sDataTypeName, boolean _bisAutoIncrementable)
+ public TypeInfo(int _nDataType, String _sDataTypeName, boolean _bisAutoIncrementable)
{
+ nDataType = _nDataType;
+ sDataTypeName = _sDataTypeName;
bisAutoIncrementable = _bisAutoIncrementable;
}
}
@@ -76,13 +81,13 @@ public class TypeInspector
while (xResultSet.next())
{
aTypeNameVector.add(xRow.getString(1));
- aTypeVector.add(Integer.valueOf(xRow.getShort(2)));
- aPrecisionVector.add(Integer.valueOf(xRow.getInt(3)));
- aNullableVector.add(Integer.valueOf(xRow.getShort(7)));
- aSearchableVector.add(Integer.valueOf(xRow.getShort(9)));
+ aTypeVector.add(new Integer(xRow.getShort(2)));
+ aPrecisionVector.add(new Integer(xRow.getInt(3)));
+ aNullableVector.add(new Integer(xRow.getShort(7)));
+ aSearchableVector.add(new Integer(xRow.getShort(9)));
aAutoIncrementVector.add(Boolean.valueOf(xRow.getBoolean(12)));
- aMinScaleVector.add(Integer.valueOf(xRow.getShort(14)));
- aMaxScaleVector.add(Integer.valueOf(xRow.getShort(15)));
+ aMinScaleVector.add(new Integer(xRow.getShort(14)));
+ aMaxScaleVector.add(new Integer(xRow.getShort(15)));
}
sDataTypeNames = new String[aTypeNameVector.size()];
@@ -145,7 +150,28 @@ public class TypeInspector
return _nNullable;
}
-
+ public int getNullability(XPropertySet _xColPropertySet)
+ {
+ try
+ {
+ int i = getDataTypeIndex(_xColPropertySet, false);
+ if (i == -1)
+ {
+ return ColumnValue.NO_NULLS;
+ }
+ int nNullable = AnyConverter.toInt(_xColPropertySet.getPropertyValue("IsNullable"));
+ if (nNullable == ColumnValue.NULLABLE)
+ {
+ return nNullableInfos[i];
+ }
+ return nNullable;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ }
+ return ColumnValue.NO_NULLS;
+ }
public boolean isColumnOrderable(XPropertySet _xColPropertySet)
{
@@ -216,7 +242,7 @@ public class TypeInspector
return -1;
}
- private boolean supportsDataType(int _curDataType)
+ public boolean supportsDataType(int _curDataType)
{
return (JavaTools.FieldInIntTable(nDataTypeInfos, _curDataType) > -1);
}
@@ -236,6 +262,8 @@ public class TypeInspector
/**
* an empty string is returned when no appropriate Typename can be found
* finds the first TypeName of the passed datatype.
+ * @param _curDataType
+ * @return
*/
public String getDefaultTypeName(int _curDataType, Integer precision)
{
diff --git a/wizards/com/sun/star/wizards/document/Control.java b/wizards/com/sun/star/wizards/document/Control.java
index 216e5c755c16..b581898dd5a5 100644
--- a/wizards/com/sun/star/wizards/document/Control.java
+++ b/wizards/com/sun/star/wizards/document/Control.java
@@ -27,6 +27,7 @@ import com.sun.star.beans.XPropertySet;
import com.sun.star.beans.XPropertySetInfo;
import com.sun.star.container.XNameAccess;
import com.sun.star.container.XNameContainer;
+import com.sun.star.container.XNamed;
import com.sun.star.wizards.common.*;
import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
@@ -40,18 +41,18 @@ public class Control extends Shape
{
XControlModel xControlModel;
- private XControl xControl;
+ XControl xControl;
public XPropertySet xPropertySet;
-
+ XPropertySet xControlPropertySet;
XWindowPeer xWindowPeer;
-
-
- private String sServiceName;
-
- private final int SOMAXTEXTSIZE = 50;
+ Object oDefaultValue;
+ GridControl oGridControl;
+ String sServiceName;
+ XNamed xNamed;
+ final int SOMAXTEXTSIZE = 50;
private int icontroltype;
- private XNameContainer xFormName;
- private final int IIMGFIELDWIDTH = 3000;
+ protected XNameContainer xFormName;
+ protected final int IIMGFIELDWIDTH = 3000;
public Control()
{
@@ -66,23 +67,23 @@ public class Control extends Shape
{
super(_oFormHandler, _aPoint, _aSize);
xFormName = _xFormName;
- createControl(_icontroltype, null, _FieldName);
+ 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, _xGroupShapes, null);
+ createControl(_icontroltype, _aPoint, _aSize, _xGroupShapes, null);
}
public Control(FormHandler _oFormHandler, int _icontroltype, Point _aPoint, Size _aSize)
{
super(_oFormHandler, _aPoint, _aSize);
- createControl(_icontroltype, null, null);
+ createControl(_icontroltype, _aPoint, _aSize, null, null);
}
- private void createControl(int _icontroltype, XShapes _xGroupShapes, String _FieldName)
+ public void createControl(int _icontroltype, Point _aPoint, Size _aSize, XShapes _xGroupShapes, String _FieldName)
{
try
{
@@ -94,7 +95,7 @@ public class Control extends Shape
XPropertySetInfo xPSI = xPropertySet.getPropertySetInfo();
if ( xPSI.hasPropertyByName( "MouseWheelBehavior" ) )
- xPropertySet.setPropertyValue( "MouseWheelBehavior", Short.valueOf( com.sun.star.awt.MouseWheelBehavior.SCROLL_DISABLED ) );
+ xPropertySet.setPropertyValue( "MouseWheelBehavior", new Short( com.sun.star.awt.MouseWheelBehavior.SCROLL_DISABLED ) );
insertControlInContainer(_FieldName);
xControlShape.setControl(xControlModel);
@@ -107,7 +108,7 @@ public class Control extends Shape
_xGroupShapes.add(xShape);
}
xControl = oFormHandler.xControlAccess.getControl(xControlModel);
- UnoRuntime.queryInterface( XPropertySet.class, xControl );
+ xControlPropertySet = UnoRuntime.queryInterface( XPropertySet.class, xControl );
xWindowPeer = xControl.getPeer();
}
catch (Exception e)
@@ -116,7 +117,7 @@ public class Control extends Shape
}
}
- private void insertControlInContainer(String _fieldname)
+ public void insertControlInContainer(String _fieldname)
{
try
{
@@ -134,7 +135,7 @@ public class Control extends Shape
}
}
- private String getControlName(String _fieldname)
+ public String getControlName(String _fieldname)
{
String controlname = PropertyNames.EMPTY_STRING;
switch (getControlType())
@@ -226,7 +227,7 @@ public class Control extends Shape
}
}
- private Size getPreferredSize(String sText)
+ public Size getPreferredSize(String sText)
{
try
{
@@ -261,6 +262,8 @@ public class Control extends Shape
/** the peer should be retrieved every time before it is used because it
* might be disposed otherwise
+ *
+ * @return
*/
public XLayoutConstrains getPeer()
{
@@ -342,6 +345,9 @@ public class Control extends Shape
}
}
+ /**
+ * @return
+ */
public int getControlType()
{
return icontroltype;
diff --git a/wizards/com/sun/star/wizards/document/DatabaseControl.java b/wizards/com/sun/star/wizards/document/DatabaseControl.java
index 6995fdca8d92..29903c09e8c7 100644
--- a/wizards/com/sun/star/wizards/document/DatabaseControl.java
+++ b/wizards/com/sun/star/wizards/document/DatabaseControl.java
@@ -53,7 +53,7 @@ public class DatabaseControl extends Control
createGridColumn(_oGridControl, _curfieldcolumn, _fieldtype, _columntitle);
}
- private int getFieldType()
+ protected int getFieldType()
{
return m_nFieldType;
}
@@ -81,7 +81,7 @@ public class DatabaseControl extends Control
XPropertySetInfo xPSI = xPropColumn.getPropertySetInfo();
if ( xPSI.hasPropertyByName( "MouseWheelBehavior" ) )
- xPropColumn.setPropertyValue( "MouseWheelBehavior", Short.valueOf( com.sun.star.awt.MouseWheelBehavior.SCROLL_DISABLED ) );
+ xPropColumn.setPropertyValue( "MouseWheelBehavior", new Short( com.sun.star.awt.MouseWheelBehavior.SCROLL_DISABLED ) );
setNumericLimits();
_oGridControl.xNameContainer.insertByName(sFieldName, xPropColumn);
@@ -176,8 +176,14 @@ public class DatabaseControl extends Control
}
private static long m_nLongMax = 0;
-
- private void setNumericLimits()
+ public static long getLongMax()
+ {
+ if (m_nLongMax == 0)
+ {
+ }
+ return m_nLongMax;
+ }
+ public void setNumericLimits()
{
try
{
diff --git a/wizards/com/sun/star/wizards/document/FormHandler.java b/wizards/com/sun/star/wizards/document/FormHandler.java
index 2626cf5bc528..8cd448917141 100644
--- a/wizards/com/sun/star/wizards/document/FormHandler.java
+++ b/wizards/com/sun/star/wizards/document/FormHandler.java
@@ -61,7 +61,7 @@ public class FormHandler
private static final String TEXTFIELD = "TextField";
private static final String TIMEFIELD = "TimeField";
- private XFormsSupplier xFormsSupplier;
+ public XFormsSupplier xFormsSupplier;
public XMultiServiceFactory xMSFDoc;
public XMultiServiceFactory xMSF;
public XDrawPage xDrawPage;
@@ -78,28 +78,28 @@ public class FormHandler
public final static int SOGRIDCONTROL = 6;
public final static int SOIMAGECONTROL = 7;
public final static int SODATETIMECONTROL = 8;
- private int iImageControlHeight = 2000;
+ int iImageControlHeight = 2000;
public static String SOSIZETEXT = "The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.";
- private int iXPixelFactor = -1;
- private int iYPixelFactor = -1;
- private int iXNirwanaPos = 50000;
- private int iYNirwanaPos = 50000;
- private int nLabelHeight = -1;
- private int nDBRefHeight = -1;
- private int BasicLabelDiffHeight = -1;
- private XNameAccess xNamedForms;
+ int iXPixelFactor = -1;
+ int iYPixelFactor = -1;
+ int iXNirwanaPos = 50000;
+ int iYNirwanaPos = 50000;
+ public int nLabelHeight = -1;
+ public int nDBRefHeight = -1;
+ public int BasicLabelDiffHeight = -1;
+ XNameAccess xNamedForms;
XControlAccess xControlAccess;
XShapeGrouper xShapeGrouper;
- private XNameContainer xNamedFormContainer;
+ XNameContainer xNamedFormContainer;
- class ControlData
+ public class ControlData
{
int DataType;
- private int ControlType;
-
+ int ControlType;
+ String ControlService;
String GridColumnName;
-
+ boolean bIsText;
}
/** Creates a new instance of FormHandler */
@@ -159,11 +159,25 @@ public class FormHandler
return -1;
}
+ public void setglobalMultiServiceFactory(XMultiServiceFactory _xMSF)
+ {
+ xMSF = _xMSF;
+ }
+ public String getModelServiceName(int _fieldtype)
+ {
+ int icontroltype = getControlType(_fieldtype);
+ if (icontroltype > -1)
+ {
+ return sModelServices[icontroltype];
+ }
+ else
+ {
+ return null;
+ }
+ }
-
-
- private void initializeBasicControlValues()
+ public void initializeBasicControlValues()
{
Control oLabelControl = new Control(this, SOLABEL, new Point(), new Size());
XDevice xDevice = UnoRuntime.queryInterface(XDevice.class, oLabelControl.xWindowPeer);
@@ -178,12 +192,14 @@ public class FormHandler
xDrawPage.remove(oTextControl.xShape);
}
- private ControlData createControlData(int _datatype, int _controltype, String _scontrolservicename, String _gridcolumnname, boolean _bIsTextControl)
+ public ControlData createControlData(int _datatype, int _controltype, String _scontrolservicename, String _gridcolumnname, boolean _bIsTextControl)
{
ControlData curControlData = new ControlData();
curControlData.DataType = _datatype;
curControlData.ControlType = _controltype;
+ curControlData.ControlService = _scontrolservicename;
curControlData.GridColumnName = _gridcolumnname;
+ curControlData.bIsText = _bIsTextControl;
return curControlData;
}
@@ -231,14 +247,28 @@ public class FormHandler
}
}
- private boolean hasFormByName(String _FormName)
+ public boolean hasFormByName(String _FormName)
{
xNamedFormContainer = getDocumentForms();
xNamedForms = UnoRuntime.queryInterface(XNameAccess.class, xNamedFormContainer);
return xNamedForms.hasByName(_FormName);
}
-
+ public void removeFormByName(String _FormName)
+ {
+ try
+ {
+ if (hasFormByName(_FormName))
+ {
+ removeControlsofForm(_FormName);
+ xNamedFormContainer.removeByName(_FormName);
+ }
+ }
+ catch (com.sun.star.uno.Exception ex)
+ {
+ Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
public void removeControlsofForm(String _FormName)
{
@@ -275,7 +305,7 @@ public class FormHandler
}
}
- private boolean belongsToForm(Object _oDrawPageElement, String _FormName)
+ public boolean belongsToForm(Object _oDrawPageElement, String _FormName)
{
XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, _oDrawPageElement);
if (xServiceInfo.supportsService("com.sun.star.drawing.ControlShape"))
@@ -319,14 +349,17 @@ public class FormHandler
}
}
-
+ public XNameContainer insertSubFormbyName(String _FormName, XNameContainer _xNamedFormContainer)
+ {
+ return insertFormbyName(_FormName, _xNamedFormContainer);
+ }
public XNameContainer insertFormbyName(String _FormName)
{
return insertFormbyName(_FormName, getDocumentForms());
}
- private XNameContainer getFormByName(String _sname)
+ public XNameContainer getFormByName(String _sname)
{
XNameContainer xNamedForm = null;
try
@@ -344,6 +377,9 @@ public class FormHandler
return xNamedForm;
}
+ /**
+ * @return
+ */
public int getXPixelFactor()
{
if (iXPixelFactor == -1)
@@ -353,6 +389,9 @@ public class FormHandler
return iXPixelFactor;
}
+ /**
+ * @return
+ */
public int getYPixelFactor()
{
if (iYPixelFactor == -1)
@@ -362,20 +401,33 @@ public class FormHandler
return iYPixelFactor;
}
+ /**
+ * @param i
+ */
public void setXPixelFactor(int i)
{
iXPixelFactor = i;
}
+
+ /**
+ * @param i
+ */
public void setYPixelFactor(int i)
{
iYPixelFactor = i;
}
+ /**
+ * @return
+ */
public int getImageControlHeight()
{
return iImageControlHeight;
}
+ /**
+ * @param i
+ */
public void setImageControlHeight(int i)
{
iImageControlHeight = i;
@@ -396,9 +448,30 @@ public class FormHandler
}
}
+ public void moveShapesToNirwana()
+ {
+ try
+ {
+ for (int i = 0; i < this.xDrawPage.getCount(); i++)
+ {
+ XShape xShape = UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
+ xShape.setPosition(new Point(this.iXNirwanaPos, this.iYNirwanaPos));
+ }
+ }
+ catch (Exception e)
+ {
+ Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e);
+ }
+ }
-
-
+ public void removeAllShapes() throws Exception
+ {
+ for (int i = this.xDrawPage.getCount(); i > -1; i--)
+ {
+ XShape xShape = UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
+ removeShape(xShape);
+ }
+ }
/**
* By removing the shape the whole control is disposed too
@@ -410,7 +483,18 @@ public class FormHandler
XComponent xComponent = UnoRuntime.queryInterface(XComponent.class, _xShape);
xComponent.dispose();
}
-
+ // Destroy all Shapes in Nirwana
+ public void removeNirwanaShapes() throws Exception
+ {
+ for (int i = this.xDrawPage.getCount(); i > -1; i--)
+ {
+ XShape xShape = UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
+ if (xShape.getPosition().Y < this.iYNirwanaPos)
+ {
+ xDrawPage.remove(xShape);
+ }
+ }
+ }
public XShape groupShapesTogether(XMultiServiceFactory _xMSF, XShape _xLabelShape, XShape _xControlShape)
{
@@ -429,6 +513,9 @@ public class FormHandler
}
}
+ /**
+ * @return
+ */
public int getBasicLabelDiffHeight()
{
if (this.BasicLabelDiffHeight == -1)
@@ -438,6 +525,9 @@ public class FormHandler
return BasicLabelDiffHeight;
}
+ /**
+ * @return
+ */
public int getControlReferenceHeight()
{
if (this.nDBRefHeight == -1)
@@ -447,6 +537,9 @@ public class FormHandler
return nDBRefHeight;
}
+ /**
+ * @return
+ */
public int getLabelHeight()
{
if (this.nLabelHeight == -1)
diff --git a/wizards/com/sun/star/wizards/document/GridControl.java b/wizards/com/sun/star/wizards/document/GridControl.java
index ce7ef674abf7..ab78017c397b 100644
--- a/wizards/com/sun/star/wizards/document/GridControl.java
+++ b/wizards/com/sun/star/wizards/document/GridControl.java
@@ -35,13 +35,13 @@ import com.sun.star.lang.XMultiServiceFactory;
public class GridControl extends Shape
{
- private FieldColumn[] fieldcolumns;
+ FieldColumn[] fieldcolumns;
public XNameContainer xNameContainer;
public XGridColumnFactory xGridColumnFactory;
public XPropertySet xPropertySet;
XNameAccess xNameAccess;
-
- private XControlModel xControlModel;
+ final String SODEFAULTNAME = "Grid1";
+ XControlModel xControlModel;
public XComponent xComponent;
public GridControl(XMultiServiceFactory _xMSF, String _sname, FormHandler _oFormHandler, XNameContainer _xFormName, FieldColumn[] _fieldcolumns, Point _aPoint, Size _aSize)
@@ -61,6 +61,7 @@ public class GridControl extends Shape
xGridColumnFactory = UnoRuntime.queryInterface( XGridColumnFactory.class, oGridModel );
xComponent = UnoRuntime.queryInterface( XComponent.class, oGridModel );
+// Helper.setUnoPropertyValue(oGridModel, PropertyNames.PROPERTY_NAME, _sname);
for (int i = 0; i < fieldcolumns.length; i++)
{
FieldColumn curfieldcolumn = fieldcolumns[i];
diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.java b/wizards/com/sun/star/wizards/document/OfficeDocument.java
index f78ae3c47966..540c503bdf0f 100644
--- a/wizards/com/sun/star/wizards/document/OfficeDocument.java
+++ b/wizards/com/sun/star/wizards/document/OfficeDocument.java
@@ -20,6 +20,12 @@ package com.sun.star.wizards.document;
import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.document.XDocumentProperties;
+import com.sun.star.document.XDocumentPropertiesSupplier;
+import com.sun.star.document.XEventsSupplier;
+import com.sun.star.document.XTypeDetection;
+import com.sun.star.drawing.XDrawPagesSupplier;
import com.sun.star.wizards.common.*;
import com.sun.star.awt.Rectangle;
import com.sun.star.awt.VclWindowPeerAttribute;
@@ -31,7 +37,9 @@ import com.sun.star.awt.XWindowPeer;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.PropertyVetoException;
import com.sun.star.sheet.XCellRangeData;
+import com.sun.star.sheet.XSpreadsheetDocument;
import com.sun.star.table.XCellRange;
+import com.sun.star.task.XInteractionHandler;
import com.sun.star.text.XTextDocument;
import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
@@ -43,6 +51,7 @@ import com.sun.star.frame.XFrame;
import com.sun.star.frame.XFrames;
import com.sun.star.frame.XFramesSupplier;
import com.sun.star.frame.XModel;
+import com.sun.star.frame.XStorable;
import com.sun.star.frame.XTerminateListener;
import com.sun.star.util.XCloseable;
import com.sun.star.util.XModifiable;
@@ -52,6 +61,31 @@ public class OfficeDocument
private XWindowPeer xWindowPeer;
+ /** Creates a new instance of OfficeDocument */
+ public OfficeDocument(XMultiServiceFactory _xMSF)
+ {
+ }
+
+ public static void attachEventCall(XComponent xComponent, String EventName, String EventType, String EventURL)
+ {
+ try
+ {
+ XEventsSupplier xEventssSuppl = UnoRuntime.queryInterface(XEventsSupplier.class, xComponent);
+ PropertyValue[] oEventProperties = new PropertyValue[2];
+ oEventProperties[0] = new PropertyValue();
+ oEventProperties[0].Name = "EventType";
+ oEventProperties[0].Value = EventType; // "Service", "StarBasic"
+ oEventProperties[1] = new PropertyValue();
+ oEventProperties[1].Name = "Script"; //PropertyNames.URL;
+ oEventProperties[1].Value = EventURL;
+ xEventssSuppl.getEvents().replaceByName(EventName, oEventProperties);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.err);
+ }
+ }
+
public static void dispose(XMultiServiceFactory xMSF, XComponent xComponent)
{
try
@@ -74,7 +108,52 @@ public class OfficeDocument
}
}
+ /**
+ * Create a new office document, attached to the given frame.
+ * @param frame
+ * @param sDocumentType e.g. swriter, scalc, ( simpress, scalc : not tested)
+ * @return the document Component (implements XComponent) object ( XTextDocument, or XSpreadsheedDocument )
+ */
+ public static Object createNewDocument(XFrame frame, String sDocumentType, boolean preview, boolean readonly)
+ {
+
+ PropertyValue[] loadValues = new PropertyValue[2];
+ loadValues[0] = new PropertyValue();
+ loadValues[0].Name = PropertyNames.READ_ONLY;
+ loadValues[0].Value = readonly ? Boolean.TRUE : Boolean.FALSE;
+ loadValues[1] = new PropertyValue();
+ loadValues[1].Name = "Preview";
+ loadValues[1].Value = preview ? Boolean.TRUE : Boolean.FALSE;
+
+ Object oDocument = null;
+ com.sun.star.frame.XComponentLoader xComponentLoader = null;
+ String sURL = "private:factory/" + sDocumentType;
+
+ try
+ {
+ xComponentLoader = UnoRuntime.queryInterface(XComponentLoader.class, frame);
+ /*if (frame.getName() == null || frame.getName().equals(PropertyNames.EMPTY_STRING));
+ frame.setName("T" + System.currentTimeMillis());*/
+ XComponent xComponent = xComponentLoader.loadComponentFromURL(sURL, "_self", 0, loadValues);
+ if (sDocumentType.equals("swriter"))
+ {
+ oDocument = UnoRuntime.queryInterface(XTextDocument.class, xComponent);
+ }
+ else if (sDocumentType.equals("scalc"))
+ {
+ oDocument = UnoRuntime.queryInterface(XSpreadsheetDocument.class, xComponent);
+ //TODO:
+ // else if (sDocumentType == "simpress")
+ // else if (sDocumentType == "sdraw")
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.err);
+ }
+ return oDocument;
+ }
public static XFrame createNewFrame(XMultiServiceFactory xMSF, XTerminateListener listener)
{
@@ -104,7 +183,7 @@ public class OfficeDocument
return xFrame;
}
- private static XFrame createNewPreviewFrame(XMultiServiceFactory xMSF, XTerminateListener listener)
+ public static XFrame createNewPreviewFrame(XMultiServiceFactory xMSF, XTerminateListener listener)
{
XToolkit xToolkit = null;
try
@@ -195,7 +274,43 @@ public class OfficeDocument
return oDocument;
}
+ public static boolean store(XMultiServiceFactory xMSF, XComponent xComponent, String StorePath, String FilterName, boolean bStoreToUrl)
+ {
+ try
+ {
+ XStorable xStoreable = UnoRuntime.queryInterface(XStorable.class, xComponent);
+ PropertyValue[] oStoreProperties;
+ if (FilterName.length() > 0)
+ {
+ oStoreProperties = new PropertyValue[2];
+ oStoreProperties[0] = new PropertyValue();
+ oStoreProperties[0].Name = "FilterName";
+ oStoreProperties[0].Value = FilterName;
+ oStoreProperties[1] = new PropertyValue();
+ oStoreProperties[1].Name = "InteractionHandler";
+ oStoreProperties[1].Value = UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler"));
+ }
+ else
+ {
+ oStoreProperties = new PropertyValue[0];
+ }
+ if (bStoreToUrl)
+ {
+ xStoreable.storeToURL(StorePath, oStoreProperties);
+ }
+ else
+ {
+ xStoreable.storeAsURL(StorePath, oStoreProperties);
+ }
+ return true;
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.err);
+ return false;
+ }
+ }
public static boolean close(XComponent xComponent)
{
@@ -252,15 +367,59 @@ public class OfficeDocument
}
}
+ public static PropertyValue[] getFileMediaDecriptor(XMultiServiceFactory xmsf, String url)
+ throws Exception
+ {
+ Object typeDetect = xmsf.createInstance("com.sun.star.document.TypeDetection");
+ PropertyValue[][] mediaDescr = new PropertyValue[1][1];
+ mediaDescr[0][0] = new PropertyValue();
+ mediaDescr[0][0].Name = PropertyNames.URL;
+ mediaDescr[0][0].Value = url;
+ String type = UnoRuntime.queryInterface(XTypeDetection.class, typeDetect).queryTypeByDescriptor(mediaDescr, true);
+ XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, typeDetect);
+ if (type.equals(PropertyNames.EMPTY_STRING))
+ {
+ return null;
+ }
+ else
+ {
+ return (PropertyValue[]) xNameAccess.getByName(type);
+ }
+ }
+ public static PropertyValue[] getTypeMediaDescriptor(XMultiServiceFactory xmsf, String type)
+ throws Exception
+ {
+ Object typeDetect = xmsf.createInstance("com.sun.star.document.TypeDetection");
+ XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, typeDetect);
+ return (PropertyValue[]) xNameAccess.getByName(type);
+ }
+ /**
+ * returns the count of slides in a presentation,
+ * or the count of pages in a draw document.
+ * @param model a presentation or a draw document
+ * @return the number of slides/pages in the given document.
+ */
+ public static int getSlideCount(Object model)
+ {
+ XDrawPagesSupplier xDrawPagesSupplier = UnoRuntime.queryInterface(XDrawPagesSupplier.class, model);
+ return xDrawPagesSupplier.getDrawPages().getCount();
+ }
+ public static XDocumentProperties getDocumentProperties(Object document)
+ {
+ XDocumentPropertiesSupplier xDocumentPropertiesSupplier = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, document);
+ return xDocumentPropertiesSupplier.getDocumentProperties();
+ }
-
-
+ public static int showMessageBox(XMultiServiceFactory xMSF, String windowServiceName, int windowAttribute, String MessageText)
+ {
+ return SystemDialog.showMessageBox(xMSF, windowServiceName, windowAttribute, MessageText);
+ }
/**
* @return Returns the xWindowPeer.
diff --git a/wizards/com/sun/star/wizards/document/Shape.java b/wizards/com/sun/star/wizards/document/Shape.java
index d6e03f3449b1..93f0606a4207 100644
--- a/wizards/com/sun/star/wizards/document/Shape.java
+++ b/wizards/com/sun/star/wizards/document/Shape.java
@@ -41,9 +41,9 @@ public class Shape
protected FormHandler oFormHandler;
public XServiceInfo xServiceInfo;
protected Point aPoint;
- private Size aSize;
+ protected Size aSize;
protected XControlShape xControlShape;
- private XMultiServiceFactory xMSF;
+ public XMultiServiceFactory xMSF;
public XShapes xShapes;
public Shape(FormHandler _oFormHandler, Point _aPoint, Size _aSize)
diff --git a/wizards/com/sun/star/wizards/document/TimeStampControl.java b/wizards/com/sun/star/wizards/document/TimeStampControl.java
index 4627313535b9..476c6bfdfd3d 100644
--- a/wizards/com/sun/star/wizards/document/TimeStampControl.java
+++ b/wizards/com/sun/star/wizards/document/TimeStampControl.java
@@ -30,23 +30,24 @@ import com.sun.star.uno.UnoRuntime;
import com.sun.star.container.XNameContainer;
import com.sun.star.drawing.XControlShape;
import com.sun.star.drawing.XShape;
+import com.sun.star.drawing.XShapes;
public class TimeStampControl extends DatabaseControl
{
- private DatabaseControl oDateControl;
- private DatabaseControl oTimeControl;
+ DatabaseControl oDateControl;
+ DatabaseControl oTimeControl;
// XShape xGroupShape;
- private Resource oResource;
+ Resource oResource;
private String sDateAppendix; // = GetResText(RID_FORM + 4)
private String sTimeAppendix; // = GetResText(RID_FORM + 5)
-
- private double nreldatewidth;
- private double nreltimewidth;
- private int nTimeWidth;
- private int nDBWidth;
- private int nDateWidth;
- private XShape xShapeGroup;
+ XShapes xGroupShapes = null;
+ double nreldatewidth;
+ double nreltimewidth;
+ int nTimeWidth;
+ int nDBWidth;
+ int nDateWidth;
+ XShape xShapeGroup;
public TimeStampControl(Resource _oResource, FormHandler _oFormHandler, XNameContainer _xFormName, String _curFieldName, Point _aPoint)
{
@@ -98,20 +99,17 @@ public class TimeStampControl extends DatabaseControl
oTimeControl = new DatabaseControl(_oGridControl, _curfieldcolumn, DataType.TIME, _curfieldcolumn.getFieldTitle() + PropertyNames.SPACE + sTimeAppendix);
}
- @Override
public void setPropertyValue(String _sPropertyName, Object _aPropertyValue) throws Exception
{
oDateControl.setPropertyValue(_sPropertyName, _aPropertyValue);
oTimeControl.setPropertyValue(_sPropertyName, _aPropertyValue);
}
- @Override
public int getPreferredWidth()
{
return nDBWidth;
}
- @Override
public void setSize(Size _aSize)
{
try
@@ -127,20 +125,17 @@ public class TimeStampControl extends DatabaseControl
}
}
- @Override
public Size getSize()
{
int ncontrolwidth = oDateControl.xShape.getSize().Width + oTimeControl.xShape.getSize().Width;
return new Size(ncontrolwidth, oDateControl.xShape.getSize().Height);
}
- @Override
public Point getPosition()
{
return xShapeGroup.getPosition();
}
- @Override
public void setPosition(Point _aPoint)
{
// --> TESTING
@@ -150,7 +145,6 @@ public class TimeStampControl extends DatabaseControl
Point aAfterPt = xShapeGroup.getPosition();
}
- @Override
public int getControlType()
{
return FormHandler.SODATETIMECONTROL;
diff --git a/wizards/com/sun/star/wizards/form/CallFormWizard.java b/wizards/com/sun/star/wizards/form/CallFormWizard.java
index a73391a25c63..4445937f1506 100644
--- a/wizards/com/sun/star/wizards/form/CallFormWizard.java
+++ b/wizards/com/sun/star/wizards/form/CallFormWizard.java
@@ -22,7 +22,7 @@ import com.sun.star.uno.Type;
import com.sun.star.wizards.common.Properties;
import com.sun.star.wizards.common.PropertyNames;
-/** This class encapsulates the class, that implements the minimal component, a
+/** This class capsulates the class, that implements the minimal component, a
* factory for creating the service (<CODE>__getServiceFactory</CODE>).
*/
public class CallFormWizard
@@ -103,7 +103,7 @@ public class CallFormWizard
/** This method returns an array of all supported service names.
* @return Array of supported service names.
*/
- public String[] getSupportedServiceNames()
+ public java.lang.String[] getSupportedServiceNames()
{
String[] stringSupportedServiceNames = new String[1];
@@ -128,7 +128,6 @@ public class CallFormWizard
return (booleanSupportsService);
}
- @Override
public byte[] getImplementationId()
{
return new byte[0];
@@ -137,7 +136,7 @@ public class CallFormWizard
/** Return the class name of the component.
* @return Class name of the component.
*/
- public String getImplementationName()
+ public java.lang.String getImplementationName()
{
return (FormWizardImplementation.class.getName());
}
@@ -147,21 +146,25 @@ public class CallFormWizard
* @return Sequence of all types (usually interface types) provided by the
* service.
*/
- @Override
public Type[] getTypes()
{
- Type[] typeReturn = new Type[]
+ Type[] typeReturn =
+ {
+ };
+
+ try
+ {
+ typeReturn = new Type[]
{
- new Type(com.sun.star.task.XJobExecutor.class),
- new Type(com.sun.star.lang.XTypeProvider.class),
- new Type(com.sun.star.lang.XServiceInfo.class),
- new Type(com.sun.star.beans.XPropertySet.class),
- new Type(com.sun.star.beans.XFastPropertySet.class),
- new Type(com.sun.star.beans.XMultiPropertySet.class),
- new Type(com.sun.star.lang.XInitialization.class)
+ new Type(com.sun.star.task.XJobExecutor.class), new Type(com.sun.star.lang.XTypeProvider.class), new Type(com.sun.star.lang.XServiceInfo.class), new Type(com.sun.star.beans.XPropertySet.class), new Type(com.sun.star.beans.XFastPropertySet.class), new Type(com.sun.star.beans.XMultiPropertySet.class), new Type(com.sun.star.lang.XInitialization.class)
};
+ }
+ catch (Exception exception)
+ {
+ System.err.println(exception);
+ }
- return typeReturn;
+ return (typeReturn);
}
}
}
diff --git a/wizards/com/sun/star/wizards/form/DataEntrySetter.java b/wizards/com/sun/star/wizards/form/DataEntrySetter.java
index c087df2d24f6..29cb69f244f9 100644
--- a/wizards/com/sun/star/wizards/form/DataEntrySetter.java
+++ b/wizards/com/sun/star/wizards/form/DataEntrySetter.java
@@ -42,7 +42,7 @@ public class DataEntrySetter
{
this.CurUnoDialog = _CurUnoDialog;
curtabindex = (short) (FormWizard.SODATA_PAGE * 100);
- Integer IDataStep = Integer.valueOf(FormWizard.SODATA_PAGE);
+ Integer IDataStep = new Integer(FormWizard.SODATA_PAGE);
String sNewDataOnly = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 44);
String sDisplayAllData = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 46);
String sNoModification = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 47); // AllowUpdates
@@ -57,7 +57,7 @@ public class DataEntrySetter
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTNEWDATAONLY", sNewDataOnly, 98, 25, IDataStep, Short.valueOf(curtabindex++), 195
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTNEWDATAONLY", sNewDataOnly, 98, 25, IDataStep, new Short(curtabindex++), 195
});
optDisplayAllData = CurUnoDialog.insertRadioButton("optDisplayAllData", "toggleCheckBoxes", this,
@@ -67,7 +67,7 @@ public class DataEntrySetter
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTDISPLAYALLDATA", sDisplayAllData, 98, 50, Short.valueOf((short) 1), IDataStep, Short.valueOf(curtabindex++), 197
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTDISPLAYALLDATA", sDisplayAllData, 98, 50, new Short((short) 1), IDataStep, new Short(curtabindex++), 197
});
chknomodification = CurUnoDialog.insertCheckBox("chknomodification", null,
new String[]
@@ -76,7 +76,7 @@ public class DataEntrySetter
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKNOMODIFICATION", sNoModification, 108, 62, Short.valueOf((short) 0), IDataStep, Short.valueOf(curtabindex++), 189
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKNOMODIFICATION", sNoModification, 108, 62, new Short((short) 0), IDataStep, new Short(curtabindex++), 189
});
chknodeletion = CurUnoDialog.insertCheckBox("chknodeletion", null,
new String[]
@@ -85,7 +85,7 @@ public class DataEntrySetter
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKNODELETION", sNoDeletion, 108, 74, Short.valueOf((short) 0), IDataStep, Short.valueOf(curtabindex++), 189
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKNODELETION", sNoDeletion, 108, 74, new Short((short) 0), IDataStep, new Short(curtabindex++), 189
});
chknoaddition = CurUnoDialog.insertCheckBox("chknoaddition", null,
new String[]
@@ -94,7 +94,7 @@ public class DataEntrySetter
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKNOADDITION", sNoAddition, 108, 86, Short.valueOf((short) 0), IDataStep, Short.valueOf(curtabindex++), 191
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKNOADDITION", sNoAddition, 108, 86, new Short((short) 0), IDataStep, new Short(curtabindex++), 191
});
CurUnoDialog.insertLabel("lbldontdisplayExistingData",
new String[]
@@ -103,7 +103,7 @@ public class DataEntrySetter
},
new Object[]
{
- 8, sdontdisplayExistingData, 108, 33, IDataStep, Short.valueOf(curtabindex++), 134
+ 8, sdontdisplayExistingData, 108, 33, IDataStep, new Short(curtabindex++), 134
});
}
@@ -129,4 +129,11 @@ public class DataEntrySetter
}
+ public void toggleCheckBoxes()
+ {
+ boolean bdisplayalldata = optDisplayAllData.getState();
+ Helper.setUnoPropertyValue(UnoDialog.getModel(chknomodification), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdisplayalldata));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(chknodeletion), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdisplayalldata));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(chknoaddition), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdisplayalldata));
+ }
}
diff --git a/wizards/com/sun/star/wizards/form/FieldLinker.java b/wizards/com/sun/star/wizards/form/FieldLinker.java
index 3aea942e7de3..7ebf56607fcb 100644
--- a/wizards/com/sun/star/wizards/form/FieldLinker.java
+++ b/wizards/com/sun/star/wizards/form/FieldLinker.java
@@ -48,7 +48,6 @@ public class FieldLinker extends DBLimitedFieldSelection
super(_CurUnoDialog, iStep, iCompPosX, iCompPosY, iCompWidth, _firsthelpid);
}
- @Override
protected void insertControlGroup(int i)
{
try
@@ -80,7 +79,7 @@ public class FieldLinker extends DBLimitedFieldSelection
},
new Object[]
{
- Boolean.valueOf(bDoEnable), 8, sSlaveListHeader[i], 97, Integer.valueOf(iCurPosY), IStep, Short.valueOf(curtabindex++), 97
+ Boolean.valueOf(bDoEnable), 8, sSlaveListHeader[i], 97, new Integer(iCurPosY), IStep, new Short(curtabindex++), 97
});
lstSlaveFields[i] = CurUnoDialog.insertListBox("lstSlaveFieldLink" + (i + 1), SOLINKLST[i], null, new ItemListenerImpl(),
new String[]
@@ -104,9 +103,9 @@ public class FieldLinker extends DBLimitedFieldSelection
sSlaveHidString,
Short.valueOf(UnoDialog.getListBoxLineCount()),
97,
- Integer.valueOf(iCurPosY + 10),
+ new Integer(iCurPosY + 10),
IStep,
- Short.valueOf(curtabindex++),
+ new Short(curtabindex++),
97
});
@@ -117,7 +116,7 @@ public class FieldLinker extends DBLimitedFieldSelection
},
new Object[]
{
- Boolean.valueOf(bDoEnable), 8, sMasterListHeader[i], 206, Integer.valueOf(iCurPosY), IStep, Short.valueOf(curtabindex++), 97
+ Boolean.valueOf(bDoEnable), 8, sMasterListHeader[i], 206, new Integer(iCurPosY), IStep, new Short(curtabindex++), 97
});
lstMasterFields[i] = CurUnoDialog.insertListBox("lstMasterFieldLink" + Integer.toString(i + 1), SOLINKLST[i], null, new ItemListenerImpl(),
@@ -142,9 +141,9 @@ public class FieldLinker extends DBLimitedFieldSelection
sMasterHidString,
Short.valueOf(UnoDialog.getListBoxLineCount()),
206,
- Integer.valueOf(iCurPosY + 10),
+ new Integer(iCurPosY + 10),
IStep,
- Short.valueOf(curtabindex++),
+ new Short(curtabindex++),
97
});
iCurPosY = iCurPosY + 38;
@@ -155,7 +154,6 @@ public class FieldLinker extends DBLimitedFieldSelection
}
}
- @Override
protected void enableNextControlRow(int curindex)
{
boolean bSlaveField = lstSlaveFields[curindex].getSelectedItemPos() > 0;
@@ -171,7 +169,6 @@ public class FieldLinker extends DBLimitedFieldSelection
}
}
- @Override
protected int getMaxSelIndex()
{
int MaxSelIndex = -1;
@@ -185,7 +182,6 @@ public class FieldLinker extends DBLimitedFieldSelection
return MaxSelIndex;
}
- @Override
protected void toggleControlRow(int i, boolean bDoEnable)
{
if (i < rowcount)
@@ -202,7 +198,6 @@ public class FieldLinker extends DBLimitedFieldSelection
}
}
- @Override
protected void updateFromNextControlRow(int curindex)
{
short iNextMasterItemPos = lstMasterFields[curindex + 1].getSelectedItemPos();
@@ -282,7 +277,7 @@ public class FieldLinker extends DBLimitedFieldSelection
CurUnoDialog.setStepEnabled(IStep.intValue(), _bdoenable);
}
- private class ItemListenerImpl implements com.sun.star.awt.XItemListener
+ class ItemListenerImpl implements com.sun.star.awt.XItemListener
{
public void itemStateChanged(ItemEvent EventObject)
diff --git a/wizards/com/sun/star/wizards/form/Finalizer.java b/wizards/com/sun/star/wizards/form/Finalizer.java
index 9f9e8cd8c7d6..6a4cf5902b84 100644
--- a/wizards/com/sun/star/wizards/form/Finalizer.java
+++ b/wizards/com/sun/star/wizards/form/Finalizer.java
@@ -31,12 +31,12 @@ import com.sun.star.wizards.ui.*;
public class Finalizer
{
- private WizardDialog CurUnoDialog;
- private short curtabindex;
- private XRadioButton optModifyForm;
-
- private XTextComponent txtFormName;
- private FormDocument oFormDocument;
+ WizardDialog CurUnoDialog;
+ short curtabindex;
+ XRadioButton optModifyForm;
+ XRadioButton optWorkWithForm;
+ XTextComponent txtFormName;
+ FormDocument oFormDocument;
public Finalizer(WizardDialog _CurUnoDialog)
{
@@ -54,7 +54,7 @@ public class Finalizer
},
new Object[]
{
- UIConsts.INTEGERS[8], slblFormName, 97, 25, UIConsts.INTEGERS[8], Short.valueOf(curtabindex++), 111
+ UIConsts.INTEGERS[8], slblFormName, 97, 25, UIConsts.INTEGERS[8], new Short(curtabindex++), 111
});
txtFormName = CurUnoDialog.insertTextField("txtFormName", "toggleFinishButton", this,
new String[]
@@ -63,7 +63,7 @@ public class Finalizer
},
new Object[]
{
- UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGFORM_TXTPATH", 97, 35, UIConsts.INTEGERS[8], Short.valueOf((short) 82), PropertyNames.EMPTY_STRING, 185
+ UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGFORM_TXTPATH", 97, 35, UIConsts.INTEGERS[8], new Short((short) 82), PropertyNames.EMPTY_STRING, 185
});
CurUnoDialog.insertLabel("lblProceed",
new String[]
@@ -72,7 +72,7 @@ public class Finalizer
},
new Object[]
{
- UIConsts.INTEGERS[8], slblProceed, 97, 62, UIConsts.INTEGERS[8], Short.valueOf(curtabindex++), 185
+ UIConsts.INTEGERS[8], slblProceed, 97, 62, UIConsts.INTEGERS[8], new Short(curtabindex++), 185
});
CurUnoDialog.insertRadioButton("optWorkWithForm", null,
new String[]
@@ -81,7 +81,7 @@ public class Finalizer
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTWORKWITHFORM", sWorkWithForm, 101, 77, Short.valueOf((short) 1), UIConsts.INTEGERS[8], Short.valueOf(curtabindex++), 107
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTWORKWITHFORM", sWorkWithForm, 101, 77, new Short((short) 1), UIConsts.INTEGERS[8], new Short(curtabindex++), 107
});
optModifyForm = CurUnoDialog.insertRadioButton("optModifyForm", null,
new String[]
@@ -90,7 +90,7 @@ public class Finalizer
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTMODIFYFORM", sModifyForm, 101, 89, UIConsts.INTEGERS[8], Short.valueOf(curtabindex++), 107
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTMODIFYFORM", sModifyForm, 101, 89, UIConsts.INTEGERS[8], new Short(curtabindex++), 107
});
}
@@ -106,7 +106,10 @@ public class Finalizer
}
}
-
+ public void toggleFinishButton()
+ {
+ CurUnoDialog.enableFinishButton(txtFormName.getText().length() > 0);
+ }
public String getName()
{
diff --git a/wizards/com/sun/star/wizards/form/FormConfiguration.java b/wizards/com/sun/star/wizards/form/FormConfiguration.java
index e6073651bfe2..52ce66cfe113 100644
--- a/wizards/com/sun/star/wizards/form/FormConfiguration.java
+++ b/wizards/com/sun/star/wizards/form/FormConfiguration.java
@@ -36,27 +36,27 @@ import com.sun.star.wizards.db.RelationController;
public class FormConfiguration
{
- private WizardDialog CurUnoDialog;
- private short curtabindex;
- private XRadioButton optOnExistingRelation;
- private XCheckBox chkcreateSubForm;
- private XRadioButton optSelectManually;
-
- private XFixedText lblRelations;
- private XListBox lstRelations;
- private String[] sreferencedTables;
- private CommandFieldSelection CurSubFormFieldSelection;
- private String SSUBFORMMODE = "toggleSubFormMode";
- private String STOGGLESTEPS = "toggleSteps";
- private String SONEXISTINGRELATIONSELECTION = "onexistingRelationSelection";
- private boolean bsupportsRelations;
- private RelationController oRelationController = null;
+ WizardDialog CurUnoDialog;
+ short curtabindex;
+ XRadioButton optOnExistingRelation;
+ XCheckBox chkcreateSubForm;
+ XRadioButton optSelectManually;
+ XFixedText lblSubFormDescription;
+ XFixedText lblRelations;
+ XListBox lstRelations;
+ String[] sreferencedTables;
+ CommandFieldSelection CurSubFormFieldSelection;
+ String SSUBFORMMODE = "toggleSubFormMode";
+ String STOGGLESTEPS = "toggleSteps";
+ String SONEXISTINGRELATIONSELECTION = "onexistingRelationSelection";
+ boolean bsupportsRelations;
+ RelationController oRelationController = null;
public FormConfiguration(WizardDialog _CurUnoDialog)
{
this.CurUnoDialog = _CurUnoDialog;
curtabindex = (short) (FormWizard.SOSUBFORM_PAGE * 100);
- Integer ISubFormStep = Integer.valueOf(FormWizard.SOSUBFORM_PAGE);
+ Integer ISubFormStep = new Integer(FormWizard.SOSUBFORM_PAGE);
String sOnExistingRelation = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 5);
String sOnManualRelation = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 7);
String sSelectManually = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 4);
@@ -71,7 +71,7 @@ public class FormConfiguration
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKCREATESUBFORM", sSelectManually, 97, 26, ISubFormStep, Short.valueOf(curtabindex++), 160
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKCREATESUBFORM", sSelectManually, 97, 26, ISubFormStep, new Short(curtabindex++), 160
});
optOnExistingRelation = CurUnoDialog.insertRadioButton("optOnExistingRelation", STOGGLESTEPS, this,
new String[]
@@ -80,7 +80,7 @@ public class FormConfiguration
},
new Object[]
{
- Boolean.FALSE, UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTONEXISTINGRELATION", sOnExistingRelation, 107, 43, ISubFormStep, Short.valueOf(curtabindex++), 160
+ Boolean.FALSE, UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTONEXISTINGRELATION", sOnExistingRelation, 107, 43, ISubFormStep, new Short(curtabindex++), 160
});
optSelectManually = CurUnoDialog.insertRadioButton("optSelectManually", STOGGLESTEPS, this,
new String[]
@@ -89,7 +89,7 @@ public class FormConfiguration
},
new Object[]
{
- Boolean.FALSE, UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTSELECTMANUALLY", sOnManualRelation, 107, 99, Short.valueOf((short) 1), ISubFormStep, Short.valueOf(curtabindex++), 160
+ Boolean.FALSE, UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTSELECTMANUALLY", sOnManualRelation, 107, 99, new Short((short) 1), ISubFormStep, new Short(curtabindex++), 160
});
lblRelations = CurUnoDialog.insertLabel("lblSelectRelation",
new String[]
@@ -98,7 +98,7 @@ public class FormConfiguration
},
new Object[]
{
- Boolean.FALSE, 19, sSelectRelation, Boolean.TRUE, 119, 56, ISubFormStep, Short.valueOf(curtabindex++), 80
+ Boolean.FALSE, 19, sSelectRelation, Boolean.TRUE, 119, 56, ISubFormStep, new Short(curtabindex++), 80
});
lstRelations = CurUnoDialog.insertListBox("lstrelations", SONEXISTINGRELATIONSELECTION, SONEXISTINGRELATIONSELECTION, this,
new String[]
@@ -107,16 +107,16 @@ public class FormConfiguration
},
new Object[]
{
- Boolean.FALSE, 37, "HID:WIZARDS_HID_DLGFORM_lstRELATIONS", 201, 55, ISubFormStep, Short.valueOf(curtabindex++), 103
+ Boolean.FALSE, 37, "HID:WIZARDS_HID_DLGFORM_lstRELATIONS", 201, 55, ISubFormStep, new Short(curtabindex++), 103
});
- CurUnoDialog.insertLabel("lblSubFormDescription",
+ lblSubFormDescription = CurUnoDialog.insertLabel("lblSubFormDescription",
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- 59, sSubFormDescription, Boolean.TRUE, 110, 120, ISubFormStep, Short.valueOf(curtabindex++), 190
+ 59, sSubFormDescription, Boolean.TRUE, 110, 120, ISubFormStep, new Short(curtabindex++), 190
});
CurUnoDialog.insertInfoImage(97, 120, ISubFormStep.intValue());
}
@@ -132,7 +132,13 @@ public class FormConfiguration
return ((chkcreateSubForm.getState() == 1) && (optOnExistingRelation.getState()));
}
-
+ public void toggleSubFormMode()
+ {
+ boolean bdoEnable = (this.chkcreateSubForm.getState() == 1);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(optOnExistingRelation), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoEnable && bsupportsRelations));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(optSelectManually), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoEnable));
+ toggleSteps();
+ }
public void initialize(CommandFieldSelection _CurSubFormFieldSelection, RelationController _oRelationController)
{
@@ -145,6 +151,29 @@ public class FormConfiguration
Helper.setUnoPropertyValue(UnoDialog.getModel(optOnExistingRelation), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bsupportsRelations && (chkcreateSubForm.getState() == 1)));
}
+ public void toggleSteps()
+ {
+ if (chkcreateSubForm.getState() == 1)
+ {
+ if (optOnExistingRelation.getState())
+ {
+ onexistingRelationSelection();
+ }
+ else if (optSelectManually.getState())
+ {
+ CurUnoDialog.enablefromStep(FormWizard.SOFIELDLINKER_PAGE, (CurSubFormFieldSelection.getSelectedFieldNames().length > 0));
+ CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDS_PAGE, true);
+ }
+ }
+ else
+ {
+ CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDS_PAGE, false);
+ CurUnoDialog.setStepEnabled(FormWizard.SOFIELDLINKER_PAGE, false);
+ CurUnoDialog.enablefromStep(FormWizard.SOCONTROL_PAGE, true);
+ }
+ toggleRelationsListbox();
+ }
+
public String getreferencedTableName()
{
if (areexistingRelationsdefined())
@@ -161,6 +190,27 @@ public class FormConfiguration
return PropertyNames.EMPTY_STRING;
}
+ public void onexistingRelationSelection()
+ {
+ String scurreferencedTableName = getreferencedTableName();
+ if (scurreferencedTableName.length() > 0)
+ {
+ if (CurSubFormFieldSelection.getSelectedCommandName().equals(scurreferencedTableName))
+ {
+ CurUnoDialog.enablefromStep(FormWizard.SOSUBFORMFIELDS_PAGE, true);
+ CurUnoDialog.setStepEnabled(FormWizard.SOFIELDLINKER_PAGE, false);
+ return;
+ }
+ else
+ {
+ CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDS_PAGE, true);
+ CurUnoDialog.enablefromStep(FormWizard.SOFIELDLINKER_PAGE, false);
+ return;
+ }
+ }
+ CurUnoDialog.enablefromStep(FormWizard.SOSUBFORMFIELDS_PAGE, false);
+ }
+
private void toggleRelationsListbox()
{
boolean bdoenable = bsupportsRelations && this.optOnExistingRelation.getState() && (chkcreateSubForm.getState() == 1);
diff --git a/wizards/com/sun/star/wizards/form/FormControlArranger.java b/wizards/com/sun/star/wizards/form/FormControlArranger.java
index 07006beb9a29..4b49ebc737b6 100644
--- a/wizards/com/sun/star/wizards/form/FormControlArranger.java
+++ b/wizards/com/sun/star/wizards/form/FormControlArranger.java
@@ -38,7 +38,7 @@ import com.sun.star.wizards.document.TimeStampControl;
public class FormControlArranger
{
- private static final String LABELCONTROL = "LabelControl";
+ public static final String LABELCONTROL = "LabelControl";
protected DatabaseControl[] DBControlList = null;
private XNameContainer xFormName;
private XMultiServiceFactory xMSF;
@@ -75,7 +75,7 @@ public class FormControlArranger
private int a;
private int StartA;
private int m_controlMaxPosY = 0; //the maximum YPosition of a DBControl in the form
- private Short NBorderType = Short.valueOf((short) 1); //3-D Border
+ private Short NBorderType = new Short((short) 1); //3-D Border
public FormControlArranger(FormHandler _oFormHandler, XNameContainer _xFormName, CommandMetaData oDBMetaData, XStatusIndicator _xProgressBar, Point _StartPoint, Size _FormSize)
{
@@ -105,7 +105,7 @@ public class FormControlArranger
public void setBorderType(short _nBorderType)
{
- NBorderType = Short.valueOf(_nBorderType);
+ NBorderType = new Short(_nBorderType);
}
public Control[] getLabelControlList()
@@ -329,7 +329,7 @@ public class FormControlArranger
}
}
- public void positionControls(int _icurArrangement, Point _aStartPoint, short _iAlign, Short _NBorderType)
+ public void positionControls(int _icurArrangement, Point _aStartPoint, Size _aFormSize, short _iAlign, Short _NBorderType)
{
try
{
@@ -564,11 +564,11 @@ public class FormControlArranger
{
m_currentControlPosX = m_currentLabelPosX;
m_currentControlPosY = m_currentLabelPosY + m_LabelHeight;
- curLabelControl.xPropertySet.setPropertyValue(PropertyNames.PROPERTY_ALIGN, Short.valueOf((short) com.sun.star.awt.TextAlign.LEFT));
+ curLabelControl.xPropertySet.setPropertyValue(PropertyNames.PROPERTY_ALIGN, new Short((short) com.sun.star.awt.TextAlign.LEFT));
}
else
{
- curLabelControl.xPropertySet.setPropertyValue(PropertyNames.PROPERTY_ALIGN, Short.valueOf((short) _iAlign));
+ curLabelControl.xPropertySet.setPropertyValue(PropertyNames.PROPERTY_ALIGN, new Short((short) _iAlign));
}
if (!bControlsareCreated)
{
@@ -661,7 +661,18 @@ public class FormControlArranger
cYOffset = _aPoint.Y;
}
-
+ public void adjustYPositions(int _diffY)
+ {
+ for (int i = 0; i < DBControlList.length; i++)
+ {
+ Point aPoint = DBControlList[i].getPosition();
+ DBControlList[i].setPosition(new Point(aPoint.X, aPoint.Y - _diffY));
+ aPoint = LabelControlList[i].getPosition();
+ LabelControlList[i].setPosition(new Point(aPoint.X, aPoint.Y - _diffY));
+ }
+ m_controlMaxPosY = -_diffY;
+ cYOffset = -_diffY;
+ }
public void setFormSize(Size _FormSize)
{
diff --git a/wizards/com/sun/star/wizards/form/FormDocument.java b/wizards/com/sun/star/wizards/form/FormDocument.java
index d8828dc23078..eb2a997ef6bf 100644
--- a/wizards/com/sun/star/wizards/form/FormDocument.java
+++ b/wizards/com/sun/star/wizards/form/FormDocument.java
@@ -68,12 +68,12 @@ public class FormDocument extends TextDocument
{
oFormHandler = new FormHandler(xMSF, xTextDocument);
oFormHandler.setDrawObjectsCaptureMode(false);
- oTextStyleHandler = new TextStyleHandler(xTextDocument);
- oViewHandler = new ViewHandler(xTextDocument);
+ oTextStyleHandler = new TextStyleHandler(xMSFDoc, xTextDocument);
+ oViewHandler = new ViewHandler(xMSFDoc, xTextDocument);
oMainFormDBMetaData = new CommandMetaData(xMSF);// , CharLocale);
oSubFormDBMetaData = new CommandMetaData(xMSF);// , CharLocale);
- ViewHandler oViewHandler = new ViewHandler(xTextDocument);
- TextStyleHandler oTextStyleSupplier = new TextStyleHandler(xTextDocument);
+ ViewHandler oViewHandler = new ViewHandler(xMSF, xTextDocument);
+ TextStyleHandler oTextStyleSupplier = new TextStyleHandler(xMSFDoc, xTextDocument);
Helper.setUnoPropertyValue(xTextDocument, "ApplyFormDesignMode", Boolean.FALSE);
oViewHandler.setViewSetting("ShowTableBoundaries", Boolean.FALSE);
oViewHandler.setViewSetting("ShowOnlineLayout", Boolean.TRUE);
@@ -121,10 +121,10 @@ public class FormDocument extends TextDocument
{
nMargin = 1000;
}
- xPropPageStyle.setPropertyValue("RightMargin", Integer.valueOf(nMargin));
- xPropPageStyle.setPropertyValue("LeftMargin", Integer.valueOf(nMargin));
- xPropPageStyle.setPropertyValue("TopMargin", Integer.valueOf(nMargin));
- xPropPageStyle.setPropertyValue("BottomMargin", Integer.valueOf(nMargin));
+ xPropPageStyle.setPropertyValue("RightMargin", new Integer(nMargin));
+ xPropPageStyle.setPropertyValue("LeftMargin", new Integer(nMargin));
+ xPropPageStyle.setPropertyValue("TopMargin", new Integer(nMargin));
+ xPropPageStyle.setPropertyValue("BottomMargin", new Integer(nMargin));
aMainFormPoint = new Point(nMargin, nMargin);
nFormWidth = (int) (0.8 * nPageWidth) - 2 * nMargin;
nFormHeight = (int) (0.65 * nPageHeight) - 2 * nMargin;
@@ -160,6 +160,7 @@ public class FormDocument extends TextDocument
adjustMainFormSize(_NBorderType);
final ControlForm aSubControlForm = new ControlForm(this, SOSUBFORM, getSubFormPoint(), getSubFormSize());
oControlForms.add(aSubControlForm);
+ /* ((ControlForm) oControlForms.get(1))*/
aSubControlForm.initialize(curUIControlArranger.getSelectedArrangement(1), _NBorderType);
}
else if (_bModifySubForm)
@@ -239,8 +240,8 @@ public class FormDocument extends TextDocument
{
oMainControlForm.oFormController.positionControls(oMainControlForm.curArrangement,
oMainControlForm.aStartPoint,
- curUIControlArranger.getAlignValue(),
- _NBorderType);
+ oMainControlForm.getFormSize(),
+ curUIControlArranger.getAlignValue(), _NBorderType);
}
}
@@ -259,12 +260,13 @@ public class FormDocument extends TextDocument
}
else
{
+// oSubControlForm.oFormController.adjustYPositions(_idiffheight);
oSubControlForm.setStartPoint(new Point(oSubControlForm.aStartPoint.X, oMainControlForm.getActualFormHeight() + oMainControlForm.aStartPoint.Y + SOFORMGAP));
- oSubControlForm.oFormController.positionControls(oSubControlForm.curArrangement, oSubControlForm.aStartPoint, curUIControlArranger.getAlignValue(), _NBorderType);
+ oSubControlForm.oFormController.positionControls(oSubControlForm.curArrangement, oSubControlForm.aStartPoint, oSubControlForm.getAvailableFormSize(), curUIControlArranger.getAlignValue(), _NBorderType);
}
}
- private ControlForm getControlFormByName(String _sname)
+ public ControlForm getControlFormByName(String _sname)
{
for (int i = 0; i < oControlForms.size(); i++)
{
@@ -334,18 +336,18 @@ public class FormDocument extends TextDocument
public class ControlForm
{
- private XNameContainer xFormContainer;
+ XNameContainer xFormContainer;
GridControl oGridControl;
- private FormControlArranger oFormController;
- private int curArrangement;
- private FormDocument oFormDocument;
- private String Name;
- private Point aStartPoint;
+ FormControlArranger oFormController;
+ int curArrangement;
+ FormDocument oFormDocument;
+ String Name;
+ Point aStartPoint;
private Size aFormSize;
- private CommandMetaData oDBMetaData;
- private XPropertySet xPropertySet;
+ CommandMetaData oDBMetaData;
+ XPropertySet xPropertySet;
- private ControlForm(FormDocument _oFormDocument, String _sname, Point _astartPoint, Size _aFormSize)
+ public ControlForm(FormDocument _oFormDocument, String _sname, Point _astartPoint, Size _aFormSize)
{
aStartPoint = _astartPoint;
aFormSize = _aFormSize;
@@ -402,11 +404,11 @@ public class FormDocument extends TextDocument
else
{
adaptControlStyles = !oFormController.areControlsexisting();
- oFormController.positionControls(_curArrangement, aStartPoint, curUIControlArranger.getAlignValue(), _NBorderType);
+ oFormController.positionControls(_curArrangement, aStartPoint, getAvailableFormSize(), curUIControlArranger.getAlignValue(), _NBorderType);
}
if (adaptControlStyles)
{
- curStyleApplier.applyStyle(true);
+ curStyleApplier.applyStyle(false, true);
}
if ((Name.equals(SOMAINFORM)) && (oControlForms.size() > 1))
{
@@ -437,6 +439,19 @@ public class FormDocument extends TextDocument
return aFormSize;
}
+ private Size getAvailableFormSize()
+ {
+ if (this.Name.equals(SOMAINFORM))
+ {
+ setFormSize(getMainFormSize(curArrangement));
+ }
+ else
+ {
+ setFormSize(getSubFormSize());
+ }
+ return aFormSize;
+ }
+
public void setFormSize(Size _aSize)
{
aFormSize = _aSize;
@@ -482,7 +497,7 @@ public class FormDocument extends TextDocument
{
xPropertySet.setPropertyValue("DataSourceName", getDataSourceName());
xPropertySet.setPropertyValue(PropertyNames.COMMAND, _oDBMetaData.getCommandName());
- xPropertySet.setPropertyValue(PropertyNames.COMMAND_TYPE, Integer.valueOf(_oDBMetaData.getCommandType()));
+ xPropertySet.setPropertyValue(PropertyNames.COMMAND_TYPE, new Integer(_oDBMetaData.getCommandType()));
for (int i = 0; i < _aPropertySetList.length; i++)
{
xPropertySet.setPropertyValue(_aPropertySetList[i].Name, _aPropertySetList[i].Value);
@@ -537,7 +552,7 @@ public class FormDocument extends TextDocument
}
}
- private void finalizeControls()
+ public void finalizeControls()
{
Control[] oLabelControls = getLabelControls();
Control[] oDBControls = getDatabaseControls();
diff --git a/wizards/com/sun/star/wizards/form/FormWizard.java b/wizards/com/sun/star/wizards/form/FormWizard.java
index 7bdd12aa237b..eda38213af72 100644
--- a/wizards/com/sun/star/wizards/form/FormWizard.java
+++ b/wizards/com/sun/star/wizards/form/FormWizard.java
@@ -47,7 +47,7 @@ public class FormWizard extends DatabaseObjectWizard
private static String slblSelFields;
private String sShowBinaryFields = PropertyNames.EMPTY_STRING;
private String serrFormNameexists = PropertyNames.EMPTY_STRING;
- private static final int SOMAIN_PAGE = 1;
+ public static final int SOMAIN_PAGE = 1;
public static final int SOSUBFORM_PAGE = 2;
public static final int SOSUBFORMFIELDS_PAGE = 3;
public static final int SOFIELDLINKER_PAGE = 4;
@@ -75,7 +75,7 @@ public class FormWizard extends DatabaseObjectWizard
},
new Object[]
{
- 210, Boolean.TRUE, "DialogForm", 102, 41, 1, Short.valueOf((short) 0), m_oResource.getResText(UIConsts.RID_FORM), 310
+ 210, Boolean.TRUE, "DialogForm", 102, 41, 1, new Short((short) 0), m_oResource.getResText(UIConsts.RID_FORM), 310
});
drawNaviBar();
if (getFormResources())
@@ -90,7 +90,6 @@ public class FormWizard extends DatabaseObjectWizard
}
// @Override
- @Override
protected void enterStep(int nOldStep, int nNewStep)
{
try
@@ -121,7 +120,7 @@ public class FormWizard extends DatabaseObjectWizard
{
final String sTableName = curSubFormFieldSelection.getSelectedCommandName();
String[] aFieldNames = curSubFormFieldSelection.getSelectedFieldNames();
- curFormDocument.oSubFormDBMetaData.initializeFieldColumns(sTableName, aFieldNames);
+ curFormDocument.oSubFormDBMetaData.initializeFieldColumns(true, sTableName, aFieldNames);
}
else
{
@@ -165,7 +164,6 @@ public class FormWizard extends DatabaseObjectWizard
}
// @Override
- @Override
protected void leaveStep(int nOldStep, int nNewStep)
{
switch (nOldStep)
@@ -174,7 +172,7 @@ public class FormWizard extends DatabaseObjectWizard
{
final String sTableName = curDBCommandFieldSelection.getSelectedCommandName();
final String[] aFieldNames = curDBCommandFieldSelection.getSelectedFieldNames();
- curFormDocument.oMainFormDBMetaData.initializeFieldColumns(sTableName, aFieldNames);
+ curFormDocument.oMainFormDBMetaData.initializeFieldColumns(true, sTableName, aFieldNames);
final String[] aMainFieldNames = curFormDocument.oMainFormDBMetaData.getFieldNames();
try
@@ -192,7 +190,7 @@ public class FormWizard extends DatabaseObjectWizard
{
final String sTableName = curSubFormFieldSelection.getSelectedCommandName();
final String[] aFieldNames = curSubFormFieldSelection.getSelectedFieldNames();
- curFormDocument.oSubFormDBMetaData.initializeFieldColumns(sTableName, aFieldNames);
+ curFormDocument.oSubFormDBMetaData.initializeFieldColumns(true, sTableName, aFieldNames);
final String[] aSubFieldNames = curFormDocument.oSubFormDBMetaData.getFieldNames();
try
@@ -220,7 +218,7 @@ public class FormWizard extends DatabaseObjectWizard
}
}
- private void buildSteps()
+ public void buildSteps()
{
curDBCommandFieldSelection = new CommandFieldSelection(this, curFormDocument.oMainFormDBMetaData, 92, slblFields, slblSelFields, slblTables, true, 34411);
curDBCommandFieldSelection.addFieldSelectionListener(new FieldSelectionListener());
@@ -236,7 +234,7 @@ public class FormWizard extends DatabaseObjectWizard
},
new Object[]
{
- 28, sShowBinaryFields, Boolean.TRUE, 95, 154, Integer.valueOf(SOMAIN_PAGE), 210
+ 28, sShowBinaryFields, Boolean.TRUE, 95, 154, new Integer(SOMAIN_PAGE), 210
});
curFormConfiguration = new FormConfiguration(this);
@@ -254,7 +252,7 @@ public class FormWizard extends DatabaseObjectWizard
},
new Object[]
{
- 28, sShowBinaryFields, Boolean.TRUE, 95, 154, Integer.valueOf(SOSUBFORMFIELDS_PAGE), 210
+ 28, sShowBinaryFields, Boolean.TRUE, 95, 154, new Integer(SOSUBFORMFIELDS_PAGE), 210
});
curFormDocument.xProgressBar.setValue(40);
@@ -281,7 +279,6 @@ public class FormWizard extends DatabaseObjectWizard
}
// @Override
- @Override
public boolean finishWizard()
{
int ncurStep = getCurrentStep();
@@ -314,14 +311,13 @@ public class FormWizard extends DatabaseObjectWizard
}
// @Override
- @Override
public void cancelWizard()
{
m_success = false;
xDialog.endExecute();
}
- private void insertFormRelatedSteps()
+ public void insertFormRelatedSteps()
{
addRoadmap();
int i = 0;
@@ -385,10 +381,10 @@ public class FormWizard extends DatabaseObjectWizard
return true;
}
- private class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener
+ public class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener
{
- private int ID;
+ protected int ID;
// @Override
public int getID()
diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java
index dfb5c8acce4e..02e577c49a69 100644
--- a/wizards/com/sun/star/wizards/form/StyleApplier.java
+++ b/wizards/com/sun/star/wizards/form/StyleApplier.java
@@ -21,6 +21,7 @@ import com.sun.star.awt.XListBox;
import com.sun.star.awt.XRadioButton;
import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.EventObject;
import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.AnyConverter;
@@ -34,6 +35,7 @@ import com.sun.star.wizards.common.NoValidPathException;
import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.document.Control;
import com.sun.star.wizards.document.DatabaseControl;
+import com.sun.star.wizards.document.GridControl;
import com.sun.star.wizards.document.TimeStampControl;
import com.sun.star.wizards.text.TextStyleHandler;
import com.sun.star.wizards.ui.*;
@@ -60,18 +62,18 @@ public class StyleApplier
private final static int SODBTEXTCOLOR = 1;
private final static int SOLABELTEXTCOLOR = 2;
private final static int SOBORDERCOLOR = 5;
- private Short IBorderValue = Short.valueOf((short) 1);
+ private Short IBorderValue = new Short((short) 1);
public StyleApplier(WizardDialog _CurUnoDialog, FormDocument _curFormDocument)
{
this.curFormDocument = _curFormDocument;
xMSF = curFormDocument.xMSF;
- TextStyleHandler oTextStyleHandler = new TextStyleHandler(curFormDocument.xTextDocument);
+ TextStyleHandler oTextStyleHandler = new TextStyleHandler(xMSF, curFormDocument.xTextDocument);
xPageStylePropertySet = oTextStyleHandler.getStyleByName("PageStyles", "Standard");
this.CurUnoDialog = _CurUnoDialog;
curtabindex = (short) (FormWizard.SOSTYLE_PAGE * 100);
- Integer IStyleStep = Integer.valueOf(FormWizard.SOSTYLE_PAGE);
+ Integer IStyleStep = new Integer(FormWizard.SOSTYLE_PAGE);
String sPageStyles = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 86);
String sNoBorder = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 29);
String s3DLook = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 30);
@@ -91,7 +93,7 @@ public class StyleApplier
},
new Object[]
{
- UIConsts.INTEGERS[8], sPageStyles, 92, 25, IStyleStep, Short.valueOf(curtabindex++), 90
+ UIConsts.INTEGERS[8], sPageStyles, 92, 25, IStyleStep, new Short(curtabindex++), 90
});
lstStyles = CurUnoDialog.insertListBox("lstStyles", null, SCHANGELAYOUT, this,
@@ -101,7 +103,7 @@ public class StyleApplier
},
new Object[]
{
- 143, "HID:WIZARDS_HID_DLGFORM_LSTSTYLES", 92, 35, SelLayoutPos, IStyleStep, this.StyleNames, Short.valueOf(curtabindex++), 90
+ 143, "HID:WIZARDS_HID_DLGFORM_LSTSTYLES", 92, 35, SelLayoutPos, IStyleStep, this.StyleNames, new Short(curtabindex++), 90
});
optNoBorder = CurUnoDialog.insertRadioButton("otpNoBorder", SCHANGEBORDERTYPE, this,
@@ -111,7 +113,7 @@ public class StyleApplier
},
new Object[]
{
- UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDNOBORDER", sNoBorder, 196, 39, IStyleStep, Short.valueOf(curtabindex++), "0", 93
+ UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDNOBORDER", sNoBorder, 196, 39, IStyleStep, new Short(curtabindex++), "0", 93
});
opt3DLook = CurUnoDialog.insertRadioButton("otp3DLook", SCHANGEBORDERTYPE, this,
@@ -121,7 +123,7 @@ public class StyleApplier
},
new Object[]
{
- UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMD3DBORDER", s3DLook, 196, 53, Short.valueOf((short) 1), IStyleStep, Short.valueOf(curtabindex++), "1", 93
+ UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMD3DBORDER", s3DLook, 196, 53, new Short((short) 1), IStyleStep, new Short(curtabindex++), "1", 93
});
optFlat = CurUnoDialog.insertRadioButton("otpFlat", SCHANGEBORDERTYPE, this,
@@ -131,7 +133,7 @@ public class StyleApplier
},
new Object[]
{
- UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDSIMPLEBORDER", sFlat, 196, 67, IStyleStep, Short.valueOf(curtabindex++), "2", 93
+ UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDSIMPLEBORDER", sFlat, 196, 67, IStyleStep, new Short(curtabindex++), "2", 93
});
CurUnoDialog.insertFixedLine("lnFieldBorder",
@@ -141,7 +143,7 @@ public class StyleApplier
},
new Object[]
{
- UIConsts.INTEGERS[8], sFieldBorder, 192, 25, IStyleStep, Short.valueOf(curtabindex++), 98
+ UIConsts.INTEGERS[8], sFieldBorder, 192, 25, IStyleStep, new Short(curtabindex++), 98
});
}
@@ -184,7 +186,7 @@ public class StyleApplier
return (short) -1;
}
- public void applyStyle(boolean _bapplyalways)
+ public void applyStyle(boolean _bmodifyBackground, boolean _bapplyalways)
{
short iStyle = getStyleIndex();
if ((iStyle != iOldLayoutPos) || _bapplyalways)
@@ -199,11 +201,89 @@ public class StyleApplier
}
}
+ public void changeLayout()
+ {
+ short iPos = lstStyles.getSelectedItemPos();
+ if (iPos != iOldLayoutPos)
+ {
+ iOldLayoutPos = iPos;
+ String sFileName = FileNames[iPos];
+ int[] iStyles = getStyleColors(sFileName);
+ applyDBControlProperties(iStyles);
+ }
+ curFormDocument.unlockallControllers();
+ }
+
public Short getBorderType()
{
return IBorderValue;
}
+ public void changeBorderLayouts()
+ {
+ try
+ {
+ curFormDocument.xTextDocument.lockControllers();
+
+ if (optNoBorder.getState())
+ {
+ IBorderValue = new Short((short) 0);
+ }
+ else if (opt3DLook.getState())
+ {
+ IBorderValue = new Short((short) 1);
+ }
+ else
+ {
+ IBorderValue = new Short((short) 2);
+ }
+ for (int m = 0; m < curFormDocument.oControlForms.size(); m++)
+ {
+ FormDocument.ControlForm curControlForm = curFormDocument.oControlForms.get(m);
+ if (curControlForm.getArrangemode() == FormWizard.AS_GRID)
+ {
+ GridControl oGridControl = curControlForm.getGridControl();
+ oGridControl.xPropertySet.setPropertyValue(PropertyNames.PROPERTY_BORDER, IBorderValue);
+ }
+ else
+ {
+ DatabaseControl[] DBControls = curControlForm.getDatabaseControls();
+ for (int n = 0; n < DBControls.length; n++)
+ {
+ if (DBControls[n].xServiceInfo.supportsService("com.sun.star.drawing.ShapeCollection"))
+ {
+ TimeStampControl oTimeStampControl = (TimeStampControl) DBControls[n];
+ for (int i = 0; i < 2; i++)
+ {
+ XPropertySet xPropertySet = oTimeStampControl.getControlofGroupShapeByIndex(i);
+ if (xPropertySet.getPropertySetInfo().hasPropertyByName(PropertyNames.PROPERTY_BORDER))
+ {
+ xPropertySet.setPropertyValue(PropertyNames.PROPERTY_BORDER, IBorderValue);
+ }
+ }
+ }
+ else
+ {
+ if (DBControls[n].xPropertySet.getPropertySetInfo().hasPropertyByName(PropertyNames.PROPERTY_BORDER))
+ {
+ DBControls[n].xPropertySet.setPropertyValue(PropertyNames.PROPERTY_BORDER, IBorderValue);
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ }
+ curFormDocument.unlockallControllers();
+ }
+
+ public void disposing(EventObject eventObject)
+ {
+ }
+
private int getStyleColor(String[] _sDataList, String _sHeader, String _sPropertyDescription)
{
int index = JavaTools.FieldInList(_sDataList, _sHeader);
@@ -281,7 +361,7 @@ public class StyleApplier
}
}
- private void applyDBControlProperties(int[] _iStyleColors)
+ public void applyDBControlProperties(int[] _iStyleColors)
{
try
{
@@ -292,7 +372,7 @@ public class StyleApplier
{
if (_iStyleColors[SOLABELTEXTCOLOR] > -1)
{
- curControlForm.oGridControl.xPropertySet.setPropertyValue("TextColor", Integer.valueOf(_iStyleColors[SODBTEXTCOLOR]));
+ curControlForm.oGridControl.xPropertySet.setPropertyValue("TextColor", new Integer(_iStyleColors[SODBTEXTCOLOR]));
}
curControlForm.oGridControl.xPropertySet.setPropertyValue("BackgroundColor", Integer.decode("#DDDDDD"));
}
@@ -327,12 +407,12 @@ public class StyleApplier
{
if (_iStyleColors[SOLABELTEXTCOLOR] > -1)
{
- LabelControls[n].xPropertySet.setPropertyValue("TextColor", Integer.valueOf(_iStyleColors[SOLABELTEXTCOLOR]));
+ LabelControls[n].xPropertySet.setPropertyValue("TextColor", new Integer(_iStyleColors[SOLABELTEXTCOLOR]));
}
}
}
}
- xPageStylePropertySet.setPropertyValue("BackColor", Integer.valueOf(_iStyleColors[SOBACKGROUNDCOLOR]));
+ xPageStylePropertySet.setPropertyValue("BackColor", new Integer(_iStyleColors[SOBACKGROUNDCOLOR]));
}
catch (Exception e)
{
diff --git a/wizards/com/sun/star/wizards/form/UIControlArranger.java b/wizards/com/sun/star/wizards/form/UIControlArranger.java
index 4f6970b6fb83..ff92792e64cc 100644
--- a/wizards/com/sun/star/wizards/form/UIControlArranger.java
+++ b/wizards/com/sun/star/wizards/form/UIControlArranger.java
@@ -26,6 +26,7 @@ import com.sun.star.awt.XRadioButton;
import com.sun.star.lang.EventObject;
import com.sun.star.wizards.common.Helper;
import com.sun.star.wizards.common.PropertyNames;
+import com.sun.star.wizards.document.Control;
import com.sun.star.wizards.ui.ButtonList;
import com.sun.star.wizards.ui.UIConsts;
import com.sun.star.wizards.ui.UnoDialog;
@@ -54,7 +55,7 @@ public class UIControlArranger
this.CurUnoDialog = _CurUnoDialog;
this.curFormDocument = _curFormDocument;
curtabindex = (short) (FormWizard.SOCONTROL_PAGE * 100);
- IControlStep = Integer.valueOf(FormWizard.SOCONTROL_PAGE);
+ IControlStep = new Integer(FormWizard.SOCONTROL_PAGE);
String sLabelPlacment = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 32);
String sAlignLeft = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 33);
String sAlignRight = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 34);
@@ -67,7 +68,7 @@ public class UIControlArranger
},
new Object[]
{
- UIConsts.INTEGERS[8], sLabelPlacment, 97, 25, IControlStep, Short.valueOf(curtabindex++), 207
+ UIConsts.INTEGERS[8], sLabelPlacment, 97, 25, IControlStep, new Short(curtabindex++), 207
});
// Radio Button "Align Left"
optAlignLeft = CurUnoDialog.insertRadioButton("optAlignLeft", SOALIGNMETHOD, this,
@@ -77,7 +78,7 @@ public class UIControlArranger
},
new Object[]
{
- UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDALIGNLEFT", sAlignLeft, 107, 38, Short.valueOf((short) 1), IControlStep, Short.valueOf(curtabindex++), 171
+ UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDALIGNLEFT", sAlignLeft, 107, 38, new Short((short) 1), IControlStep, new Short(curtabindex++), 171
});
// Radio Button "Align Right"
optAlignRight = CurUnoDialog.insertRadioButton("optAlignRight", SOALIGNMETHOD, this,
@@ -87,7 +88,7 @@ public class UIControlArranger
},
new Object[]
{
- UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDALIGNRIGHT", sAlignRight, Boolean.TRUE, 107, 50, IControlStep, Short.valueOf(curtabindex++), 171
+ UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDALIGNRIGHT", sAlignRight, Boolean.TRUE, 107, 50, IControlStep, new Short(curtabindex++), 171
});
@@ -99,7 +100,7 @@ public class UIControlArranger
DefaultListModel imageModel = new DefaultListModel();
for (int i = 0; i < HelpTexts.length; i++)
{
- imageModel.addElement(Integer.valueOf(i));
+ imageModel.addElement(new Integer(i));
}
String sMainArrangementHeader = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 41); // "Arrangement of the main form"
m_aArrangeList[0] = new ArrangeButtonList(0, imageModel, sMainArrangementHeader);
@@ -122,7 +123,7 @@ public class UIControlArranger
int ResId = UIConsts.RID_IMG_FORM + (2 * ((Integer) listitem).intValue());
return new Integer[]
{
- Integer.valueOf(ResId), Integer.valueOf(ResId + 1)
+ new Integer(ResId), new Integer(ResId + 1)
};
}
@@ -148,7 +149,29 @@ public class UIControlArranger
return optAlignLeft.getState() ? (short)0 : (short)2;
}
-
+ public void alignLabelControls()
+ {
+ try
+ {
+ short iAlignValue = getAlignValue();
+ for (int m = 0; m < curFormDocument.oControlForms.size(); m++)
+ {
+ FormDocument.ControlForm curControlForm = curFormDocument.oControlForms.get(m);
+ if (curControlForm.getArrangemode() == FormWizard.COLUMNAR_LEFT)
+ {
+ Control[] LabelControls = curControlForm.getLabelControls();
+ for (int n = 0; n < LabelControls.length; n++)
+ {
+ LabelControls[n].xPropertySet.setPropertyValue(PropertyNames.PROPERTY_ALIGN, new Short(iAlignValue));
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ }
+ }
private void enableAlignControlGroup(boolean _bEnableAlignControlGroup)
{
@@ -166,7 +189,7 @@ public class UIControlArranger
public ArrangeButtonList(int _formindex, ListModel model, String _sArrangementHeader)
{
formindex = _formindex;
- Integer YPos = Integer.valueOf(SOBASEIMAGEYPOSITION + _formindex * SOIMAGELISTHEIGHT);
+ Integer YPos = new Integer(SOBASEIMAGEYPOSITION + _formindex * SOIMAGELISTHEIGHT);
// Label ArrangementHeader ----------------------
CurUnoDialog.insertFixedLine("lnLabelPlacment_" + (_formindex + 1),
new String[]
@@ -186,7 +209,7 @@ public class UIControlArranger
97,
YPos,
IControlStep,
- Short.valueOf(curtabindex++),
+ new Short(curtabindex++),
207
});
diff --git a/wizards/com/sun/star/wizards/query/CallQueryWizard.java b/wizards/com/sun/star/wizards/query/CallQueryWizard.java
index 229caff877fe..204fe281dd66 100644
--- a/wizards/com/sun/star/wizards/query/CallQueryWizard.java
+++ b/wizards/com/sun/star/wizards/query/CallQueryWizard.java
@@ -24,7 +24,7 @@ import com.sun.star.uno.Type;
import com.sun.star.wizards.common.Properties;
import com.sun.star.wizards.common.PropertyNames;
-/** This class encapsulates the class, that implements the minimal component, a
+/** This class capsulates the class, that implements the minimal component, a
* factory for creating the service (<CODE>__getServiceFactory</CODE>).
*/
public class CallQueryWizard
@@ -56,8 +56,8 @@ public class CallQueryWizard
public static class QueryWizardImplementation extends com.sun.star.lib.uno.helper.PropertySet implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.task.XJobExecutor
{
private PropertyValue[] m_wizardContext;
-
-
+ public String Command;
+ public final Integer CommandType = com.sun.star.sdb.CommandType.QUERY;
/** The constructor of the inner class has a XMultiServiceFactory parameter.
* @param i_serviceFactory A special service factory could be introduced while initializing.
@@ -77,7 +77,7 @@ public class CallQueryWizard
if (sEvent.equals(PropertyNames.START))
{
QueryWizard CurQueryWizard = new QueryWizard( m_serviceFactory, m_wizardContext );
- CurQueryWizard.start();
+ Command = CurQueryWizard.start();
}
}
catch (Exception exception)
@@ -108,7 +108,7 @@ public class CallQueryWizard
/** This method returns an array of all supported service names.
* @return Array of supported service names.
*/
- public String[] getSupportedServiceNames()
+ public java.lang.String[] getSupportedServiceNames()
{
String[] stringSupportedServiceNames = new String[1];
@@ -142,7 +142,7 @@ public class CallQueryWizard
/** Return the class name of the component.
* @return Class name of the component.
*/
- public String getImplementationName()
+ public java.lang.String getImplementationName()
{
return (QueryWizardImplementation.class.getName());
}
diff --git a/wizards/com/sun/star/wizards/query/Finalizer.java b/wizards/com/sun/star/wizards/query/Finalizer.java
index c6567f1d931c..9f39ef49232b 100644
--- a/wizards/com/sun/star/wizards/query/Finalizer.java
+++ b/wizards/com/sun/star/wizards/query/Finalizer.java
@@ -63,7 +63,7 @@ public class Finalizer
},
new Object[]
{
- 8, reslblQueryTitle, 95, 27, Integer.valueOf(QueryWizard.SOSUMMARY_PAGE), Short.valueOf(curtabindex++), 52
+ 8, reslblQueryTitle, 95, 27, new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), 52
});
m_aTxtTitle = m_queryWizard.insertTextField("txtQueryTitle", "changeTitle", this, new String[]
{
@@ -71,7 +71,7 @@ public class Finalizer
},
new Object[]
{
- 12, HelpIds.getHelpIdString(curHelpIndex++), 95, 37, Integer.valueOf(QueryWizard.SOSUMMARY_PAGE), Short.valueOf(curtabindex++), 90
+ 12, HelpIds.getHelpIdString(curHelpIndex++), 95, 37, new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), 90
});
m_queryWizard.insertLabel("lblHowGoOn", new String[]
{
@@ -79,7 +79,7 @@ public class Finalizer
},
new Object[]
{
- 16, reslblHowGoOn, Boolean.TRUE, 192, 27, Integer.valueOf(QueryWizard.SOSUMMARY_PAGE), Short.valueOf(curtabindex++), 112
+ 16, reslblHowGoOn, Boolean.TRUE, 192, 27, new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), 112
});
this.xRadioDisplayQuery = m_queryWizard.insertRadioButton("optDisplayQuery",
new String[]
@@ -88,7 +88,7 @@ public class Finalizer
},
new Object[]
{
- 9, HelpIds.getHelpIdString(curHelpIndex++), resoptDisplayQuery, 192, 46, Short.valueOf((short) 1), Integer.valueOf(QueryWizard.SOSUMMARY_PAGE), Short.valueOf(curtabindex++), 118
+ 9, HelpIds.getHelpIdString(curHelpIndex++), resoptDisplayQuery, 192, 46, new Short((short) 1), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), 118
});
m_queryWizard.insertRadioButton("optModifyQuery",
@@ -98,7 +98,7 @@ public class Finalizer
},
new Object[]
{
- 10, HelpIds.getHelpIdString(curHelpIndex++), resoptModifyQuery, 192, 56, Integer.valueOf(QueryWizard.SOSUMMARY_PAGE), Short.valueOf(curtabindex++), 118
+ 10, HelpIds.getHelpIdString(curHelpIndex++), resoptModifyQuery, 192, 56, new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), 118
});
m_queryWizard.insertFixedLine("flnSummary", new String[]
{
@@ -106,7 +106,7 @@ public class Finalizer
},
new Object[]
{
- 10, resflnSummary, 95, 68, 8, Short.valueOf(curtabindex++), 209
+ 10, resflnSummary, 95, 68, 8, new Short(curtabindex++), 209
});
m_queryWizard.insertTextField("txtSummary", 0, null, new String[]
{
@@ -118,7 +118,11 @@ public class Finalizer
});
}
-
+ public void changeTitle()
+ {
+ final String TitleName = m_aTxtTitle.getText();
+ m_queryWizard.enableFinishButton( TitleName.length() > 0 );
+ }
/* TODO: The title textbox always has to be updated when
a new Table has been selected if it is clear that the user has not made any input meanwhile
@@ -138,7 +142,6 @@ public class Finalizer
Helper.setUnoPropertyValue(UnoDialog.getModel(m_aTxtTitle), "Text", sCurQueryName);
}
}
-
CurDBMetaData.setSummaryString();
m_queryWizard.setControlProperty("txtSummary", "Text", CurDBMetaData.getSummaryString());
return sCurQueryName;
@@ -153,6 +156,7 @@ public class Finalizer
exception.printStackTrace(System.err);
return PropertyNames.EMPTY_STRING;
}
+
}
private String getTitle()
diff --git a/wizards/com/sun/star/wizards/query/QuerySummary.java b/wizards/com/sun/star/wizards/query/QuerySummary.java
index e6999b63be85..47dc89fa2432 100644
--- a/wizards/com/sun/star/wizards/query/QuerySummary.java
+++ b/wizards/com/sun/star/wizards/query/QuerySummary.java
@@ -29,10 +29,10 @@ import com.sun.star.wizards.ui.FilterComponent;
public class QuerySummary extends QueryMetaData
{
- final private int RID_QUERY = 2300;
-
- private String sSummary;
- private Resource oResource;
+ final protected int RID_QUERY = 2300;
+ final protected int RID_REPORT = 2400;
+ String sSummary;
+ Resource oResource;
private String sSeparator;
private String sReturnChar;
private String sAnd;
@@ -149,7 +149,7 @@ public class QuerySummary extends QueryMetaData
}
// TODO: How can you merge the following two methods to a single one in a smarter way??
- private String combinePartString(int _InitResID, String[] _FieldNames, int _AlternativeResID)
+ public String combinePartString(int _InitResID, String[] _FieldNames, int _AlternativeResID)
{
if (_FieldNames != null && _FieldNames.length > 0)
{
@@ -158,7 +158,7 @@ public class QuerySummary extends QueryMetaData
return oResource.getResText(_AlternativeResID);
}
- private String ArrayFieldsToString(int _InitResID, String[] _FieldNames)
+ protected String ArrayFieldsToString(int _InitResID, String[] _FieldNames)
{
String sReturn = oResource.getResText(_InitResID);
int FieldCount = _FieldNames.length;
@@ -173,7 +173,7 @@ public class QuerySummary extends QueryMetaData
return (sReturn);
}
- private String combinePartString(int _InitResID, String[][] _FieldNames, int _AlternativeResID, int _BaseStringID, String[] _ReplaceTags)
+ public String combinePartString(int _InitResID, String[][] _FieldNames, int _AlternativeResID, int _BaseStringID, String[] _ReplaceTags)
{
if (_FieldNames != null && _FieldNames.length > 0)
{
@@ -182,7 +182,7 @@ public class QuerySummary extends QueryMetaData
return oResource.getResText(_AlternativeResID);
}
- private String ArrayFieldsToString(int _InitResID, String[][] _FieldNames, int _BaseStringID, String[] _ReplaceTags)
+ public String ArrayFieldsToString(int _InitResID, String[][] _FieldNames, int _BaseStringID, String[] _ReplaceTags)
{
String CurString = PropertyNames.EMPTY_STRING;
String sReturn = oResource.getResText(_InitResID);
diff --git a/wizards/com/sun/star/wizards/query/QueryWizard.java b/wizards/com/sun/star/wizards/query/QueryWizard.java
index 41d937732d1c..f082d8fc5d3a 100644
--- a/wizards/com/sun/star/wizards/query/QueryWizard.java
+++ b/wizards/com/sun/star/wizards/query/QueryWizard.java
@@ -43,7 +43,7 @@ import com.sun.star.wizards.ui.TitlesComponent;
public class QueryWizard extends DatabaseObjectWizard
{
-
+ public static final String SFILLUPFIELDSLISTBOX = "fillUpFieldsListbox";
private static final int SOFIELDSELECTION_PAGE = 1;
private static final int SOSORTING_PAGE = 2;
private static final int SOFILTER_PAGE = 3;
@@ -107,7 +107,7 @@ public class QueryWizard extends DatabaseObjectWizard
},
new Object[]
{
- 210, Boolean.TRUE, "DialogQuery", 102, 41, 1, Short.valueOf((short) 0), resQueryWizard, 310
+ 210, Boolean.TRUE, "DialogQuery", 102, 41, 1, new Short((short) 0), resQueryWizard, 310
});
drawNaviBar();
setRightPaneHeaders(m_oResource, UIConsts.RID_QUERY + 70, 8);
@@ -139,7 +139,7 @@ public class QueryWizard extends DatabaseObjectWizard
return m_createdQuery;
}
- private void enableRoadmapItems(boolean _bEnabled)
+ public void enableRoadmapItems(String[] _FieldNames, boolean _bEnabled)
{
try
{
@@ -190,7 +190,7 @@ public class QueryWizard extends DatabaseObjectWizard
}
}
- private void insertQueryRelatedSteps()
+ public void insertQueryRelatedSteps()
{
try
{
@@ -221,7 +221,7 @@ public class QueryWizard extends DatabaseObjectWizard
}
}
- private void buildSteps()
+ public void buildSteps()
{
try
{
@@ -254,7 +254,6 @@ public class QueryWizard extends DatabaseObjectWizard
}
}
- @Override
public boolean finishWizard()
{
int ncurStep = getCurrentStep();
@@ -272,7 +271,6 @@ public class QueryWizard extends DatabaseObjectWizard
return false;
}
- @Override
protected void enterStep(int nOldStep, int nNewStep)
{
try
@@ -320,14 +318,13 @@ public class QueryWizard extends DatabaseObjectWizard
}
}
- @Override
protected void leaveStep(int nOldStep, int nNewStep)
{
switch (nOldStep)
{
case SOFIELDSELECTION_PAGE:
m_DBMetaData.reorderFieldColumns(m_DBCommandFieldSelectio.getSelectedFieldNames());
- m_DBMetaData.initializeFieldTitleSet();
+ m_DBMetaData.initializeFieldTitleSet(true);
m_DBMetaData.setNumericFields();
searchForOutdatedFields();
break;
@@ -390,13 +387,13 @@ public class QueryWizard extends DatabaseObjectWizard
boolean bEnabled = NewItems.length > 0;
setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, bEnabled);
setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, bEnabled);
- enableRoadmapItems(bEnabled); // Note: Performancewise this could be improved
+ enableRoadmapItems(NewItems, bEnabled); // Note: Performancewise this could be improved
}
- private class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener
+ public class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener
{
- private int ID;
+ protected int ID;
public int getID()
{
diff --git a/wizards/com/sun/star/wizards/report/CallReportWizard.java b/wizards/com/sun/star/wizards/report/CallReportWizard.java
index 01267942d052..70c418ad24ca 100644
--- a/wizards/com/sun/star/wizards/report/CallReportWizard.java
+++ b/wizards/com/sun/star/wizards/report/CallReportWizard.java
@@ -33,7 +33,7 @@ import java.util.logging.Logger;
public class CallReportWizard
{
- private static boolean bWizardstartedalready;
+ static boolean bWizardstartedalready;
/** Gives a factory for creating the service.
* This method is called by the <code>JavaLoader</code>
@@ -63,7 +63,7 @@ public class CallReportWizard
/** This class implements the component. At least the interfaces XServiceInfo,
* XTypeProvider, and XInitialization should be provided by the service.
*/
- private static class ReportWizardImplementation extends com.sun.star.lib.uno.helper.PropertySet implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.task.XJobExecutor
+ public static class ReportWizardImplementation extends com.sun.star.lib.uno.helper.PropertySet implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.task.XJobExecutor
{
private PropertyValue[] m_wizardContext;
@@ -160,7 +160,6 @@ public class CallReportWizard
return (booleanSupportsService);
}
- @Override
public byte[] getImplementationId()
{
return new byte[0];
@@ -179,7 +178,6 @@ public class CallReportWizard
* @return Sequence of all types (usually interface types) provided by the
* service.
*/
- @Override
public Type[] getTypes()
{
Type[] typeReturn =
diff --git a/wizards/com/sun/star/wizards/report/DBColumn.java b/wizards/com/sun/star/wizards/report/DBColumn.java
index 677fb6e250ac..3be19016063b 100644
--- a/wizards/com/sun/star/wizards/report/DBColumn.java
+++ b/wizards/com/sun/star/wizards/report/DBColumn.java
@@ -34,6 +34,7 @@ import com.sun.star.text.XTextTable;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.XNumberFormats;
import com.sun.star.wizards.db.*;
import com.sun.star.wizards.common.*;
import com.sun.star.wizards.text.TextDocument;
@@ -43,29 +44,29 @@ import com.sun.star.wizards.text.TextFieldHandler;
public class DBColumn
{
- private XCell xValCell;
- private XTextRange xValTextCell;
- private XTextCursor xValCellCursor;
-
+ public XCell xValCell;
+ public XTextRange xValTextCell;
+ public XTextCursor xValCellCursor;
+ public XNumberFormats xValCellNumberFormats;
public XCell xNameCell;
- private XTextRange xNameTextCell;
- private boolean bAlignLeft;
-
- private String CharFontName;
-
- private PropertyState PropertyState;
+ public XTextRange xNameTextCell;
+ public boolean bAlignLeft;
+ public Object DefaultValue;
+ public String CharFontName;
+ public int FormatKey;
+ public PropertyState PropertyState;
public int ValColumn = 1;
- private int ValRow = 0;
+ public int ValRow = 0;
public FieldColumn CurDBField;
private XTextTable xTextTable;
private XTableColumns xTableColumns;
private XCellRange xCellRange;
public XNamed xTableName;
private boolean bIsGroupColumn;
-
- private RecordParser CurDBMetaData;
- private RecordTable CurRecordTable;
- private TextTableHandler oTextTableHandler;
+ TextDocument oTextDocument;
+ RecordParser CurDBMetaData;
+ RecordTable CurRecordTable;
+ TextTableHandler oTextTableHandler;
public DBColumn(TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i)
{
@@ -136,7 +137,7 @@ public class DBColumn
return false;
}
- public DBColumn(TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, String _FieldName, String TableName, DBColumn OldDBColumn) {
+ public DBColumn(TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, String _FieldName, int GroupIndex, String TableName, DBColumn OldDBColumn) {
this.oTextTableHandler = _oTextTableHandler;
this.CurDBMetaData = _CurDBMetaData;
CurDBField = CurDBMetaData.getFieldColumnByDisplayName(_FieldName);
@@ -152,7 +153,7 @@ public class DBColumn
initializeNumberFormat();
}
- public DBColumn(TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, String _FieldName, String TableName) throws Exception
+ public DBColumn(TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, String _FieldName, int GroupIndex, String TableName) throws Exception
{
this.oTextTableHandler = _oTextTableHandler;
this.CurDBMetaData = _CurDBMetaData;
@@ -167,7 +168,7 @@ public class DBColumn
{
xRows = xTextTable.getRows();
}
- catch (NullPointerException e)
+ catch (java.lang.NullPointerException e)
{
e.printStackTrace();
// TODO: handle the nullpointer right
@@ -240,7 +241,7 @@ public class DBColumn
replaceValueCellofTable(_bIsLandscape);
}
- private void insertUserFieldToTableCell(TextFieldHandler oTextFieldHandler)
+ public void insertUserFieldToTableCell(TextFieldHandler oTextFieldHandler)
{
XTextCursor xTextCursor = TextDocument.createTextCursor(xNameCell);
xTextCursor.gotoStart(false);
@@ -249,7 +250,14 @@ public class DBColumn
oTextFieldHandler.insertUserField(xTextCursor, CurDBField.getFieldName(), CurDBField.getFieldTitle());
}
-
+ public void insertUserFieldToTableCell(TextFieldHandler oTextFieldHandler, XCell xCell)
+ {
+ XTextCursor xTextCursor = TextDocument.createTextCursor(xCell);
+ xTextCursor.gotoStart(false);
+ xTextCursor.gotoEnd(true);
+ xTextCursor.setString(PropertyNames.EMPTY_STRING);
+ oTextFieldHandler.insertUserField(xTextCursor, CurDBField.getFieldName(), CurDBField.getFieldTitle());
+ }
public void formatValueCell()
{
@@ -276,7 +284,7 @@ public class DBColumn
if (bAlignLeft)
{
xValCellCursor = TextDocument.createTextCursor(xValCell);
- Helper.setUnoPropertyValue(xValCellCursor, "ParaAdjust", Integer.valueOf(com.sun.star.style.ParagraphAdjust.LEFT_value));
+ Helper.setUnoPropertyValue(xValCellCursor, "ParaAdjust", new Integer(com.sun.star.style.ParagraphAdjust.LEFT_value));
}
}
catch (Exception exception)
@@ -285,7 +293,7 @@ public class DBColumn
}
}
- private void modifyCellContent(Object CurGroupValue)
+ public void modifyCellContent(Object CurGroupValue)
{
double dblValue = 0;
try
@@ -337,7 +345,7 @@ public class DBColumn
}
}
// If the parameter CurGroupValue is null the placeholders are inserted
- private void replaceValueCellofTable(boolean _bIsLandscape)
+ public void replaceValueCellofTable(boolean _bIsLandscape)
{
try
{
@@ -353,7 +361,7 @@ public class DBColumn
modifyCellContent(CurGroupValue);
if (bAlignLeft)
{
- Helper.setUnoPropertyValue(xValCellCursor, "ParaAdjust", Integer.valueOf(ParagraphAdjust.LEFT_value));
+ Helper.setUnoPropertyValue(xValCellCursor, "ParaAdjust", new Integer(ParagraphAdjust.LEFT_value));
}
int nFieldType = CurDBField.getFieldType();
@@ -364,7 +372,7 @@ public class DBColumn
Helper.setUnoPropertyValue(xValCellCursor, "CharFontName", CharFontName);
if (!bIsGroupColumn)
{
- Helper.setUnoPropertyValue(xValCellCursor, "ParaAdjust", Integer.valueOf(ParagraphAdjust.CENTER_value));
+ Helper.setUnoPropertyValue(xValCellCursor, "ParaAdjust", new Integer(ParagraphAdjust.CENTER_value));
}
}
else
diff --git a/wizards/com/sun/star/wizards/report/Dataimport.java b/wizards/com/sun/star/wizards/report/Dataimport.java
index d5cd0665b1b3..acf3cc63c73f 100644
--- a/wizards/com/sun/star/wizards/report/Dataimport.java
+++ b/wizards/com/sun/star/wizards/report/Dataimport.java
@@ -34,13 +34,13 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi
// ReportTextDocument CurReportDocument;
IReportDocument CurReportDocument;
-
- private static String sProgressDBConnection;
- private static String sProgressDataImport;
-
-
- private static String sProgressTitle;
- private static String sStop;
+ static boolean bStopProcess;
+ static String sProgressDBConnection;
+ static String sProgressDataImport;
+ static String sProgressBaseCurRecord;
+ static String sProgressCurRecord;
+ static String sProgressTitle;
+ static String sStop;
public Dataimport(XMultiServiceFactory _xMSF)
{
@@ -49,6 +49,7 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi
sProgressDBConnection = m_oResource.getResText(UIConsts.RID_DB_COMMON + 34);
sProgressDataImport = m_oResource.getResText(UIConsts.RID_REPORT + 67);
sProgressTitle = m_oResource.getResText(UIConsts.RID_REPORT + 62);
+ sProgressBaseCurRecord = m_oResource.getResText(UIConsts.RID_REPORT + 63);
sStop = m_oResource.getResText(UIConsts.RID_DB_COMMON + 21);
}
@@ -63,7 +64,7 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi
CurReportDocument.StopProcess();
}
- private void showProgressDisplay(boolean bgetConnection)
+ public void showProgressDisplay(XMultiServiceFactory xMSF, boolean bgetConnection)
{
try
{
@@ -129,7 +130,7 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi
},
new Object[]
{
- 14, HelpIds.getHelpIdString(34321), 74, 58, 0, Short.valueOf((short) 1), 40, sStop
+ 14, HelpIds.getHelpIdString(34321), 74, 58, 0, new Short((short) 1), 40, sStop
});
createWindowPeer(CurReportDocument.getWizardParent());
calculateDialogPosition(CurReportDocument.getFrame().getComponentWindow().getPosSize());
@@ -148,7 +149,7 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi
}
}
- private void importReportData(final XMultiServiceFactory _xMSF, PropertyValue[] _properties)
+ public void importReportData(final XMultiServiceFactory _xMSF, final Dataimport _CurDataimport, IReportDocument _CurReportDocument, PropertyValue[] _properties)
{
if (CurReportDocument.reconnectToDatabase(_xMSF, _properties))
{
@@ -165,7 +166,7 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi
PropertyValue[] properties)
{
CurReportDocument = ReportTextImplementation.create( xMSF, i_documentUI, _textDocument, m_oResource );
- showProgressDisplay(true);
- importReportData(xMSF, properties);
+ showProgressDisplay(xMSF, true);
+ importReportData(xMSF, this, CurReportDocument, properties);
}
}
diff --git a/wizards/com/sun/star/wizards/report/GroupFieldHandler.java b/wizards/com/sun/star/wizards/report/GroupFieldHandler.java
index 7933f99ad12b..d6185880a9cd 100644
--- a/wizards/com/sun/star/wizards/report/GroupFieldHandler.java
+++ b/wizards/com/sun/star/wizards/report/GroupFieldHandler.java
@@ -56,7 +56,7 @@ public class GroupFieldHandler extends FieldSelection
},
new Object[]
{
- Boolean.FALSE, 18, sNote, Boolean.TRUE, 95, 158, Integer.valueOf(ReportWizard.SOGROUPPAGE), 209
+ Boolean.FALSE, 18, sNote, Boolean.TRUE, 95, 158, new Integer(ReportWizard.SOGROUPPAGE), 209
});
}
catch (Exception exception)
@@ -65,7 +65,7 @@ public class GroupFieldHandler extends FieldSelection
}
}
- private boolean isGroupField(String _FieldName)
+ public boolean isGroupField(String _FieldName)
{
return (JavaTools.FieldInList(CurDBMetaData.GroupFieldNames, _FieldName) != -1);
}
@@ -115,7 +115,6 @@ public class GroupFieldHandler extends FieldSelection
CurDBMetaData.GroupFieldNames = GroupFieldNames;
}
// @Override
- @Override
protected void toggleListboxButtons(short iFieldsSelIndex, short iSelFieldsSelIndex)
{
super.toggleListboxButtons(iFieldsSelIndex, iSelFieldsSelIndex);
@@ -126,7 +125,6 @@ public class GroupFieldHandler extends FieldSelection
}
}
- @Override
public void selectFields(boolean bMoveAll)
{
int iSelCount = xSelectedFieldsListBox.getItemCount();
@@ -137,7 +135,7 @@ public class GroupFieldHandler extends FieldSelection
}
- private class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener
+ /* protected */ class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener
{
public void moveItemDown(String Selitem)
@@ -174,6 +172,7 @@ public class GroupFieldHandler extends FieldSelection
String[] NewSelGroupNames = xSelectedFieldsListBox.getItems();
CurUnoDialog.setControlProperty("lblBlindTextNote_1", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(NewSelGroupNames.length == 0));
+ // CurReportDocument.refreshGroupFields(xSelectedFieldsListBox.getItems());
}
}
diff --git a/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java b/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java
index 8f1446f0e1fc..3bffc856c235 100644
--- a/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java
+++ b/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java
@@ -29,78 +29,87 @@ public interface IReportBuilderLayouter
* This name identifies the layout in the internal access list.
* @return the internal layout name.
*/
- String getName();
+ public String getName();
/**
* Get the localized name of the layout, which is shown in the layout page of the report wizard.
* This name comes out of the resource and will be translate in different languages.
* @return localized name of the layout.
*/
- String getLocalizedName();
+ public String getLocalizedName();
/**
* For Landscape give nOrientation == com.sun.star.wizards.report.ReportLayouter.SOOPTLANDSCAPE
* All other numbers are interpreted as portrait format.
+ * @param nOrientation
*/
- void setPageOrientation(int nOrientation);
+ public void setPageOrientation(int nOrientation);
/**
* dispose the layouter
*/
- void dispose();
+ public void dispose();
/**
* Set the table name of the report
* This is the name to the database table.
* @param _nType something of com.sun.star.sdb.CommandType
+ * @param TableName
*/
- void setTableName(int _nType, String TableName);
+ public void setTableName(int _nType, String TableName);
/**
* Insert the field names, these are the field names out of a given datebase table
+ * @param FieldNames
*/
- void insertFieldNames(final String[] FieldNames);
+ public void insertFieldNames(final String[] FieldNames);
/**
* Insert the field type (Varchar, int, ...) as internal an int representation.
+ * @param FieldTypes
*/
- void insertFieldTypes(int[] FieldTypes);
+ public void insertFieldTypes(int[] FieldTypes);
/**
* Insert the field width in count of chars as given in the database.
+ * @param FieldWidths
*/
- void insertFieldWidths(int[] FieldWidths);
+ public void insertFieldWidths(int[] FieldWidths);
/**
* Insert the titles of the field names. This names are free formed
+ * @param _aFieldTitles
*/
- void insertFieldTitles(String[] _aFieldTitles);
+ public void insertFieldTitles(String[] _aFieldTitles);
/**
* Insert the names of the groups, the group names are names out of the field names.
*
* If a group name is given here, it will not shown in the fields/titles, but must be in the field string list.
+ * @param _aGroupFieldNames
*/
- void insertGroupNames(String[] _aGroupFieldNames);
+ public void insertGroupNames(String[] _aGroupFieldNames);
/**
* Insert the names of the groups which should be used as sorting, the group names are names out of the field names.
*
* If a group name is given here, it will not shown in the fields/titles, but must be in the field string list.
+ * @param _aSortFieldNames
*/
- void insertSortingNames(String[][] _aSortFieldNames);
+ public void insertSortingNames(String[][] _aSortFieldNames);
/**
* This method redraws the whole layout with all its content
*/
- void layout();
+ public void layout();
/**
* Initialize the current Layouter with data's out of an other Layouter.
*
* This Method copies the internal fields, groups and titles
+ * @param aOtherLayouter
*/
- void initializeData(IReportBuilderLayouter aOtherLayouter);
+ public void initializeData(IReportBuilderLayouter aOtherLayouter);
- void loadAndSetBackgroundTemplate(String LayoutTemplatePath);
+ public void loadAndSetBackgroundTemplate(String LayoutTemplatePath);
}
diff --git a/wizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java b/wizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java
index aa81c48984ec..b365a06a94bc 100644
--- a/wizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java
+++ b/wizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java
@@ -32,17 +32,18 @@ public interface IReportDefinitionReadAccess
* Gives access to a ReportDefinition, if initialized.
* @return a ReportDefinition or null.
*/
- XReportDefinition getReportDefinition(); /* should throw NullPointerException but does not. */
+ public XReportDefinition getReportDefinition(); /* should throw NullPointerException but does not. */
/**
* This ServiceFactory is the 'global' Service Factory, which knows all and every thing in the program.
* @return the global service factory of the program
*/
- XMultiServiceFactory getGlobalMSF();
+ public XMultiServiceFactory getGlobalMSF();
/**
* Returns the file path to the default report definition, we need this name for early initialisation
+ * @return
*/
- String getDefaultHeaderLayout();
+ public String getDefaultHeaderLayout();
}
diff --git a/wizards/com/sun/star/wizards/report/IReportDocument.java b/wizards/com/sun/star/wizards/report/IReportDocument.java
index 0c124a2c7a22..f071a2e480be 100644
--- a/wizards/com/sun/star/wizards/report/IReportDocument.java
+++ b/wizards/com/sun/star/wizards/report/IReportDocument.java
@@ -33,7 +33,7 @@ public interface IReportDocument
// initialisation
- void initialize(
+ public void initialize(
final XDatabaseDocumentUI i_documentUI,
final Resource i_resource
);
@@ -43,57 +43,65 @@ public interface IReportDocument
/**
* Gives access to the DB Values
+ * @return
*/
- com.sun.star.wizards.db.RecordParser getRecordParser();
+ public com.sun.star.wizards.db.RecordParser getRecordParser();
/**
* Give access to the parent document
* It is a document in the old Wizard
* It is a Report Builder in the new Wizard
+ * @return
*/
- com.sun.star.awt.XWindowPeer getWizardParent();
+ public com.sun.star.awt.XWindowPeer getWizardParent();
/**
*
* @return the Frame of the document Window or Report Builder Window
*/
- com.sun.star.frame.XFrame getFrame();
+ public com.sun.star.frame.XFrame getFrame();
- XComponent getComponent();
+ public XComponent getComponent();
// First step: After entering the table name, select fields
/**
* Is called after first step, set Tablename and the fields, which should occur in the Report.
+ * @param _aType
+ * @param TableName
+ * @param FieldNames
*/
- void initializeFieldColumns(final int _aType, final String TableName, final String[] FieldNames);
+ public void initializeFieldColumns(final int _aType, final String TableName, final String[] FieldNames);
/**
* Empties the report document
*/
- void clearDocument();
+ public void clearDocument();
/**
* Empties the report document, if we called back, don't remove Grouping/Sorting
*/
- void removeTextTableAndTextSection();
+ public void removeTextTableAndTextSection();
// Second step: Label field titles
/**
* Set new names for the titles
+ * @param sFieldTitles
*/
- void setFieldTitles(final String[] sFieldTitles);
+ public void setFieldTitles(final String[] sFieldTitles);
/**
* Change a the name of the 'title' of one field.
* It is possible to give all element names new names which are used as
* element title of a given element name.
* This is only used as a preview
+ * @param FieldName
+ * @param TitleName
*/
- void liveupdate_changeUserFieldContent(final String FieldName, final String TitleName);
+ public void liveupdate_changeUserFieldContent(final String FieldName, final String TitleName);
// Third step: Grouping
@@ -101,53 +109,66 @@ public interface IReportDocument
// Document should not hold the grouping information!
/**
* Called by press ('greater then') add a group to the group list
+ * @param GroupNames
+ * @param CurGroupTitle
+ * @param GroupFieldVector
+ * @param ReportPath
+ * @param iSelCount
+ * @return
*/
- boolean liveupdate_addGroupNametoDocument(String[] GroupNames, String CurGroupTitle, ArrayList<String> GroupFieldVector, ArrayList<String> ReportPath, int iSelCount);
+ public boolean liveupdate_addGroupNametoDocument(String[] GroupNames, String CurGroupTitle, ArrayList<String> GroupFieldVector, ArrayList<String> ReportPath, int iSelCount);
- void refreshGroupFields(String[] _sNewNames);
+ public void refreshGroupFields(String[] _sNewNames);
/**
* Called by press ('less then') Removes an already set Groupname out of the list
+ * @param NewSelGroupNames
+ * @param CurGroupTitle
+ * @param GroupFieldVector
*/
- void liveupdate_removeGroupName(String[] NewSelGroupNames, String CurGroupTitle, java.util.ArrayList<String> GroupFieldVector);
+ public void liveupdate_removeGroupName(String[] NewSelGroupNames, String CurGroupTitle, java.util.ArrayList<String> GroupFieldVector);
/**
* set the list how to group
+ * @param aGroupList
*/
- void setGrouping(String[] aGroupList);
+ public void setGrouping(String[] aGroupList);
// Fourth step: Sorting
/**
* Set the list how to sort
+ * @param aSort
*/
- void setSorting(String[][] aSort);
+ public void setSorting(String[][] aSort);
// Fivth step: Templates / Layout
/* Template Page */
- void setPageOrientation(int nOrientation) throws com.sun.star.lang.IllegalArgumentException;
+ public void setPageOrientation(int nOrientation) throws com.sun.star.lang.IllegalArgumentException;
- int getDefaultPageOrientation();
+ public int getDefaultPageOrientation();
- ArrayList<String> getReportPath();
+ public ArrayList<String> getReportPath();
- String getLayoutPath();
+ public String getLayoutPath();
- String getContentPath();
+ public String getContentPath();
/**
* Called if a new Layout is selected
+ * @param LayoutTemplatePath
*/
- void liveupdate_changeLayoutTemplate(String LayoutTemplatePath/*, String BitmapPath*/);
+ public void liveupdate_changeLayoutTemplate(String LayoutTemplatePath/*, String BitmapPath*/);
/**
* Called if a new Template is selected
+ * @param ContentTemplatePath
*/
- void liveupdate_changeContentTemplate(String ContentTemplatePath);
+ public void liveupdate_changeContentTemplate(String ContentTemplatePath);
- void layout_selectFirstPage();
+ public void layout_selectFirstPage();
- void layout_setupRecordSection(String TemplateName);
+ public void layout_setupRecordSection(String TemplateName);
// finishing
@@ -156,64 +177,73 @@ public interface IReportDocument
/**
* Set the Title into the document from the 'Create Report Page'
* BUG: The Title is empty after create Report.
+ * @param _sTitleName
*/
- void liveupdate_updateReportTitle(String _sTitleName);
+ public void liveupdate_updateReportTitle(String _sTitleName);
/**
* Store the document by the given name
+ * @param Name
+ * @param OpenMode
*/
- void store(String Name, int OpenMode) throws com.sun.star.uno.Exception;
+ public void store(String Name, int OpenMode) throws com.sun.star.uno.Exception;
/**
* The current report is added to the DB View under the given name
*
* TODO: add Name to this functionality
*/
- void addReportToDBView();
+ public void addReportToDBView();
- void importReportData(ReportWizard aWizard);
+ public void importReportData(ReportWizard aWizard);
/**
* Create the final Report document
+ * @param Name
+ * @param _bAsTemplate
+ * @param _bOpenInDesign
*/
- void createAndOpenReportDocument(
+ public void createAndOpenReportDocument(
final String Name,
final boolean _bAsTemplate,
final boolean _bOpenInDesign
);
- void dispose();
+ public void dispose();
// Garbage dump
/* DataImport */
// ???
// ???
- boolean reconnectToDatabase(XMultiServiceFactory xMSF, PropertyValue[] Properties);
+ public boolean reconnectToDatabase(XMultiServiceFactory xMSF, PropertyValue[] Properties);
// ???
- void insertDatabaseDatatoReportDocument(XMultiServiceFactory xMSF);
+ public void insertDatabaseDatatoReportDocument(XMultiServiceFactory xMSF);
// ???
/**
* set a internal variable to stop a maybe longer DB access.
*/
- void StopProcess(); // cancel
+ public void StopProcess(); // cancel
/**
* Returns a string list of layouts.
+ * @return
*/
- String[][] getDataLayout();
+ public String[][] getDataLayout();
/**
* Returns a string list of header layouts
+ * @return
*/
- String[][] getHeaderLayout();
+ public String[][] getHeaderLayout();
- void setCommandType(int CommandType);
+ public void setCommandType(int CommandType);
- void setCommand(String Command);
+ public void setCommand(String Command);
/**
* check internal invariants
+ * @throws java.lang.Exception
*/
- void checkInvariants() throws java.lang.Exception;
+ public void checkInvariants() throws java.lang.Exception;
}
diff --git a/wizards/com/sun/star/wizards/report/RecordTable.java b/wizards/com/sun/star/wizards/report/RecordTable.java
index 3bf7b0ca11e8..7b4cd1a76e78 100644
--- a/wizards/com/sun/star/wizards/report/RecordTable.java
+++ b/wizards/com/sun/star/wizards/report/RecordTable.java
@@ -23,6 +23,7 @@ import com.sun.star.container.XNamed;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.table.XCellRange;
import com.sun.star.table.XTableColumns;
+import com.sun.star.table.XTableRows;
import com.sun.star.text.XTextTable;
import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
@@ -32,14 +33,14 @@ import com.sun.star.wizards.text.ViewHandler;
public class RecordTable
{
-
-
+ String CurFieldName;
+ String LabelDescription;
public XNamed xTableName;
public XCellRange xCellRange;
public XTextTable xTextTable;
private TextTableHandler oTextTableHandler;
public XTableColumns xTableColumns;
-
+ public XTableRows xTableRows;
public RecordTable(TextTableHandler _oTextTableHandler)
{
@@ -71,7 +72,7 @@ public class RecordTable
xTableName = UnoRuntime.queryInterface(XNamed.class, xTextTable);
xTableName.setName(ReportTextDocument.TBLRECORDSECTION);
}
- xTextTable.getRows();
+ xTableRows = xTextTable.getRows();
xTableColumns = xTextTable.getColumns();
xCellRange = UnoRuntime.queryInterface(XCellRange.class, xTextTable);
}
diff --git a/wizards/com/sun/star/wizards/report/ReportFinalizer.java b/wizards/com/sun/star/wizards/report/ReportFinalizer.java
index 8ca9b9c4c055..dbd01df3cc05 100644
--- a/wizards/com/sun/star/wizards/report/ReportFinalizer.java
+++ b/wizards/com/sun/star/wizards/report/ReportFinalizer.java
@@ -30,17 +30,18 @@ import com.sun.star.wizards.db.RecordParser;
public class ReportFinalizer
{
- private WizardDialog CurUnoDialog;
- private XTextComponent xTitleTextBox;
-
-
- private String CHANGEREPORTTITLE_FUNCNAME = "changeReportTitle";
- private String TOGGLESUBTEMPLATECONTROLS_FUNCNAME = "toggleSubTemplateControls";
- private String StoreName;
-
- private String DefaultName;
- private String OldDefaultName;
- private IReportDocument CurReportDocument;
+ WizardDialog CurUnoDialog;
+ XTextComponent xTitleTextBox;
+ XTextComponent[] xSaveTextBox = new XTextComponent[2];
+ Object chkTemplate;
+ String CHANGEREPORTTITLE_FUNCNAME = "changeReportTitle";
+ String TOGGLESUBTEMPLATECONTROLS_FUNCNAME = "toggleSubTemplateControls";
+ String TemplatePath;
+ String StoreName;
+ boolean bfinalaskbeforeOverwrite;
+ String DefaultName;
+ String OldDefaultName;
+ IReportDocument CurReportDocument;
public static final int SOCREATEDOCUMENT = 1;
public static final int SOCREATETEMPLATE = 2;
public static final int SOUSETEMPLATE = 3;
@@ -69,7 +70,7 @@ public class ReportFinalizer
},
new Object[]
{
- 8, sReportTitle, 95, 27, Integer.valueOf(ReportWizard.SOSTOREPAGE), Short.valueOf(curtabindex++), 68
+ 8, sReportTitle, 95, 27, new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 68
});
xTitleTextBox = CurUnoDialog.insertTextField("txtTitle", CHANGEREPORTTITLE_FUNCNAME, this,
@@ -79,7 +80,7 @@ public class ReportFinalizer
},
new Object[]
{
- 12, "HID:WIZARDS_HID_DLGREPORT_4_TITLE", 95, 37, Integer.valueOf(ReportWizard.SOSTOREPAGE), Short.valueOf(curtabindex++), 209
+ 12, "HID:WIZARDS_HID_DLGREPORT_4_TITLE", 95, 37, new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 209
});
CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblChooseReportKind",
@@ -89,7 +90,7 @@ public class ReportFinalizer
},
new Object[]
{
- 8, slblChooseReportKind, 95, 57, Integer.valueOf(ReportWizard.SOSTOREPAGE), Short.valueOf(curtabindex++), 209
+ 8, slblChooseReportKind, 95, 57, new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 209
});
CurUnoDialog.insertRadioButton("optCreateDocument", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this,
@@ -99,7 +100,7 @@ public class ReportFinalizer
},
new Object[]
{
- 10, "HID:WIZARDS_HID_DLGREPORT_5_OPTSTATDOCUMENT", sSaveAsDocument, 95, 69, Short.valueOf((short) 0), Integer.valueOf(ReportWizard.SOSTOREPAGE), Short.valueOf(curtabindex++), 138
+ 10, "HID:WIZARDS_HID_DLGREPORT_5_OPTSTATDOCUMENT", sSaveAsDocument, 95, 69, new Short((short) 0), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 138
});
CurUnoDialog.insertRadioButton("optCreateReportTemplate", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this,
@@ -109,7 +110,7 @@ public class ReportFinalizer
},
new Object[]
{
- 8, "HID:WIZARDS_HID_DLGREPORT_5_OPTDYNTEMPLATE", sSaveAsTemplate, 95, 81, Short.valueOf((short) 1), Integer.valueOf(ReportWizard.SOSTOREPAGE), Short.valueOf(curtabindex++), 209
+ 8, "HID:WIZARDS_HID_DLGREPORT_5_OPTDYNTEMPLATE", sSaveAsTemplate, 95, 81, new Short((short) 1), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 209
});
@@ -120,7 +121,7 @@ public class ReportFinalizer
},
new Object[]
{
- 8, slblHowProceed, 105, 93, Integer.valueOf(ReportWizard.SOSTOREPAGE), Short.valueOf(curtabindex++), 209
+ 8, slblHowProceed, 105, 93, new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 209
});
@@ -131,7 +132,7 @@ public class ReportFinalizer
},
new Object[]
{
- 10, "HID:WIZARDS_HID_DLGREPORT_5_OPTEDITTEMPLATE", sEditTemplate, 111, 105, 6, Short.valueOf(curtabindex++), 138
+ 10, "HID:WIZARDS_HID_DLGREPORT_5_OPTEDITTEMPLATE", sEditTemplate, 111, 105, 6, new Short(curtabindex++), 138
});
CurUnoDialog.insertRadioButton("optUseTemplate", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this,
@@ -141,12 +142,27 @@ public class ReportFinalizer
},
new Object[]
{
- 10, "HID:WIZARDS_HID_DLGREPORT_5_OPTUSETEMPLATE", sUseTemplate, 111, 115, Short.valueOf((short) 1), Integer.valueOf(ReportWizard.SOSTOREPAGE), Short.valueOf(curtabindex++), 138
+ 10, "HID:WIZARDS_HID_DLGREPORT_5_OPTUSETEMPLATE", sUseTemplate, 111, 115, new Short((short) 1), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 138
});
}
+ /*
+ * This function is called if one of the radio buttons is pressed
+ */
+ public void toggleSubTemplateControls()
+ {
+ // String sStorePath = PropertyNames.EMPTY_STRING;
+ Short iState = (Short) CurUnoDialog.getControlProperty("optCreateReportTemplate", PropertyNames.PROPERTY_STATE);
+ boolean bDoTemplateEnable = iState.shortValue() == 1;
+ CurUnoDialog.setControlProperty("optEditTemplate", PropertyNames.PROPERTY_ENABLED, bDoTemplateEnable);
+ CurUnoDialog.setControlProperty("optUseTemplate", PropertyNames.PROPERTY_ENABLED, bDoTemplateEnable);
+ CurUnoDialog.setControlProperty("lblHowProceed", PropertyNames.PROPERTY_ENABLED, bDoTemplateEnable);
+ String sTitle = xTitleTextBox.getText();
+ boolean bDoEnable = sTitle.equals(PropertyNames.EMPTY_STRING);
+ CurUnoDialog.enableFinishButton(!bDoEnable);
+ }
public void initialize(RecordParser _CurDBMetaData)
{
String FirstCommandName = (_CurDBMetaData.getIncludedCommandNames())[0];
@@ -189,7 +205,12 @@ public class ReportFinalizer
}
}
-
+ public void changeReportTitle()
+ {
+ final String TitleName = xTitleTextBox.getText();
+ CurReportDocument.liveupdate_updateReportTitle(TitleName);
+ CurUnoDialog.enableFinishButton(!PropertyNames.EMPTY_STRING.equals(TitleName));
+ }
public int getReportOpenMode()
{
diff --git a/wizards/com/sun/star/wizards/report/ReportImplementationHelper.java b/wizards/com/sun/star/wizards/report/ReportImplementationHelper.java
index 765d85eb92a3..70c735be9e4b 100644
--- a/wizards/com/sun/star/wizards/report/ReportImplementationHelper.java
+++ b/wizards/com/sun/star/wizards/report/ReportImplementationHelper.java
@@ -27,6 +27,10 @@ public class ReportImplementationHelper
private XMultiServiceFactory m_xMSF;
protected int m_nDefaultPageOrientation;
+ /**
+ * @param _aMSF
+ * @param _nOrientation
+ */
public ReportImplementationHelper(XMultiServiceFactory _aMSF, int _nOrientation)
{
m_xMSF = _aMSF;
diff --git a/wizards/com/sun/star/wizards/report/ReportLayouter.java b/wizards/com/sun/star/wizards/report/ReportLayouter.java
index 91303df49f87..598b74a8d0dd 100644
--- a/wizards/com/sun/star/wizards/report/ReportLayouter.java
+++ b/wizards/com/sun/star/wizards/report/ReportLayouter.java
@@ -36,20 +36,20 @@ import java.util.ArrayList;
public class ReportLayouter
{
- private UnoDialog CurUnoDialog;
-
- private final int SOCONTENTLST = 29;
+ UnoDialog CurUnoDialog;
+ final int SOTXTTITLE = 28;
+ final int SOCONTENTLST = 29;
final static public int SOOPTLANDSCAPE = 30;
final static public int SOOPTPORTRAIT = 31;
- private final int SOLAYOUTLST = 32;
- private XListBox xContentListBox;
- private XListBox xLayoutListBox;
- private int iOldContentPos;
- private int iOldLayoutPos;
- private IReportDocument CurReportDocument;
- private String[][] LayoutFiles;
- private String[][] ContentFiles;
- private Object aOrientationImage;
+ final int SOLAYOUTLST = 32;
+ XListBox xContentListBox;
+ XListBox xLayoutListBox;
+ int iOldContentPos;
+ int iOldLayoutPos;
+ IReportDocument CurReportDocument;
+ public String[][] LayoutFiles;
+ public String[][] ContentFiles;
+ Object aOrientationImage;
private XMultiServiceFactory m_xMSF;
private XTextRange trTitleconst, trAuthorconst, trDateconst, trPageconst;
private TextElement teTitleconst, teAuthorconst, teDateconst, tePageconst;
@@ -80,7 +80,7 @@ public class ReportLayouter
},
new Object[]
{
- 8, slblDataStructure, 95, 27, Integer.valueOf(ReportWizard.SOTEMPLATEPAGE), Short.valueOf(curtabindex++), 99
+ 8, slblDataStructure, 95, 27, new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 99
});
short iSelPos = 0;
@@ -101,7 +101,7 @@ public class ReportLayouter
108, "HID:WIZARDS_HID_DLGREPORT_4_DATALAYOUT", 95, 37, new short[]
{
iSelPos
- }, Integer.valueOf(ReportWizard.SOTEMPLATEPAGE), ContentFiles[0], Short.valueOf(curtabindex++), 99
+ }, new Integer(ReportWizard.SOTEMPLATEPAGE), ContentFiles[0], new Short(curtabindex++), 99
});
CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblLayout",
@@ -111,7 +111,7 @@ public class ReportLayouter
},
new Object[]
{
- 8, slblPageLayout, 205, 27, Integer.valueOf(ReportWizard.SOTEMPLATEPAGE), Short.valueOf(curtabindex++), 99
+ 8, slblPageLayout, 205, 27, new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 99
});
short iSelLayoutPos = 0;
@@ -135,7 +135,7 @@ public class ReportLayouter
108, "HID:WIZARDS_HID_DLGREPORT_4_PAGELAYOUT", 205, 37, new short[]
{
iSelLayoutPos
- }, Integer.valueOf(ReportWizard.SOTEMPLATEPAGE), LayoutFiles[0], Short.valueOf(curtabindex++), 99
+ }, new Integer(ReportWizard.SOTEMPLATEPAGE), LayoutFiles[0], new Short(curtabindex++), 99
});
iOldLayoutPos = iSelPos;
CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblOrientation",
@@ -145,10 +145,10 @@ public class ReportLayouter
},
new Object[]
{
- 8, sOrientationHeader, 95, 148, Integer.valueOf(ReportWizard.SOTEMPLATEPAGE), Short.valueOf(curtabindex++), 74
+ 8, sOrientationHeader, 95, 148, new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 74
});
- short nLandscapeState = CurReportDocument.getDefaultPageOrientation() == SOOPTLANDSCAPE ? (short) 1 : 0;
+ short m_nLandscapeState = CurReportDocument.getDefaultPageOrientation() == SOOPTLANDSCAPE ? (short) 1 : 0;
CurUnoDialog.insertRadioButton("optLandscape", SOOPTLANDSCAPE, new ItemListenerImpl(),
new String[]
{
@@ -156,10 +156,10 @@ public class ReportLayouter
},
new Object[]
{
- 10, "HID:WIZARDS_HID_DLGREPORT_4_LANDSCAPE", sOrientHorizontal, 101, 158, Short.valueOf(nLandscapeState), Integer.valueOf(ReportWizard.SOTEMPLATEPAGE), Short.valueOf(curtabindex++), 60
+ 10, "HID:WIZARDS_HID_DLGREPORT_4_LANDSCAPE", sOrientHorizontal, 101, 158, new Short(m_nLandscapeState), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 60
});
- short nPortraitState = CurReportDocument.getDefaultPageOrientation() == SOOPTPORTRAIT ? (short) 1 : (short) 0;
+ short m_nPortraitState = CurReportDocument.getDefaultPageOrientation() == SOOPTPORTRAIT ? (short) 1 : (short) 0;
CurUnoDialog.insertRadioButton("optPortrait", SOOPTPORTRAIT, new ItemListenerImpl(),
new String[]
{
@@ -167,7 +167,7 @@ public class ReportLayouter
},
new Object[]
{
- 10, "HID:WIZARDS_HID_DLGREPORT_4_PORTRAIT", sOrientVertical, 101, 171, Short.valueOf(nPortraitState), Integer.valueOf(ReportWizard.SOTEMPLATEPAGE), Short.valueOf(curtabindex++), 60
+ 10, "HID:WIZARDS_HID_DLGREPORT_4_PORTRAIT", sOrientVertical, 101, 171, new Short(m_nPortraitState), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 60
});
aOrientationImage = CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlImageControlModel", "imgOrientation",
@@ -177,7 +177,7 @@ public class ReportLayouter
},
new Object[]
{
- Short.valueOf("0"), 23, 164, 158, Boolean.FALSE, Integer.valueOf(ReportWizard.SOTEMPLATEPAGE), 30
+ new Short("0"), 23, 164, 158, Boolean.FALSE, new Integer(ReportWizard.SOTEMPLATEPAGE), 30
});
String sNote = ReportWizard.getBlindTextNote(CurReportDocument, CurUnoDialog.m_oResource);
@@ -188,9 +188,9 @@ public class ReportLayouter
},
new Object[]
{
- 34, sNote, Boolean.TRUE, 205, 148, Integer.valueOf(ReportWizard.SOTEMPLATEPAGE), 99
+ 34, sNote, Boolean.TRUE, 205, 148, new Integer(ReportWizard.SOTEMPLATEPAGE), 99
});
- if (nLandscapeState == 1)
+ if (m_nLandscapeState == 1)
{
CurUnoDialog.getPeerConfiguration().setImageUrl(aOrientationImage, 1002, 1003);
}
@@ -217,7 +217,7 @@ public class ReportLayouter
CurUnoDialog.setFocus("lblContent");
}
- private class ItemListenerImpl implements com.sun.star.awt.XItemListener
+ class ItemListenerImpl implements com.sun.star.awt.XItemListener
{
public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject)
@@ -260,6 +260,7 @@ public class ReportLayouter
break;
case SOOPTLANDSCAPE:
+ // CurReportDocument.getDoc().changePageOrientation(true);
try
{
CurReportDocument.setPageOrientation(SOOPTLANDSCAPE);
@@ -301,7 +302,7 @@ public class ReportLayouter
}
}
- private class ActionListenerImpl implements com.sun.star.awt.XActionListener
+ class ActionListenerImpl implements com.sun.star.awt.XActionListener
{
public void disposing(EventObject eventObject)
@@ -365,7 +366,7 @@ public class ReportLayouter
}
}
- private void clearConstants()
+ public void clearConstants()
{
constRangeList.clear();
trTitleconst = null;
@@ -384,7 +385,7 @@ public class ReportLayouter
te.write(tr);
}
- private List<XTextRange> searchFillInItems(int type)
+ public List<XTextRange> searchFillInItems(int type)
{
try
{
diff --git a/wizards/com/sun/star/wizards/report/ReportTextDocument.java b/wizards/com/sun/star/wizards/report/ReportTextDocument.java
index fcd6bae0b244..ed6a9bcfe319 100644
--- a/wizards/com/sun/star/wizards/report/ReportTextDocument.java
+++ b/wizards/com/sun/star/wizards/report/ReportTextDocument.java
@@ -58,14 +58,14 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
private String sMsgCommonReportError;
private String ContentTemplatePath;
private String sMsgEndAutopilot;
- private boolean bIsCurLandscape;
+ public boolean bIsCurLandscape;
public TextTableHandler oTextTableHandler;
public TextSectionHandler oTextSectionHandler;
public FormHandler oFormHandler;
- private TextStyleHandler oTextStyleHandler;
+ public TextStyleHandler oTextStyleHandler;
public TextFieldHandler oTextFieldHandler;
public ViewHandler oViewHandler;
- private NumberFormatter oNumberFormatter;
+ public NumberFormatter oNumberFormatter;
public static final String TBLRECORDSECTION = "Tbl_RecordSection";
public static final String TBLGROUPSECTION = "Tbl_GroupField";
public static final String RECORDSECTION = "RecordSection";
@@ -94,15 +94,17 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
oTextTableHandler = new TextTableHandler(xMSFDoc, xTextDocument);
oTextSectionHandler = new TextSectionHandler(xMSFDoc, xTextDocument);
oFormHandler = new FormHandler(xMSFDoc, xTextDocument);
- oTextStyleHandler = new TextStyleHandler(xTextDocument);
- oViewHandler = new ViewHandler(xTextDocument);
+ oTextStyleHandler = new TextStyleHandler(xMSFDoc, xTextDocument);
+ oViewHandler = new ViewHandler(xMSFDoc, xTextDocument);
oTextFieldHandler = new TextFieldHandler(xMSFDoc, xTextDocument);
DBColumnsVector = new java.util.ArrayList<DBColumn>();
oNumberFormatter = oTextTableHandler.getNumberFormatter();
+ // CurDBMetaData = new RecordParser(xMSF); //, CharLocale, oNumberFormatter);
CurDBMetaData = _aRecordParser;
long lDateCorrection = oNumberFormatter.getNullDateCorrection();
oNumberFormatter.setBooleanReportDisplayNumberFormat();
oNumberFormatter.setNullDateCorrection(lDateCorrection);
+ // sMsgInvalidTextField = oResource.getResText(UIConsts.RID_REPORT + 73);
sMsgTableNotExisting = oResource.getResText(UIConsts.RID_REPORT + 61);
sMsgCommonReportError = oResource.getResText(UIConsts.RID_REPORT + 72);
sMsgCommonReportError = JavaTools.replaceSubString(sMsgCommonReportError, String.valueOf((char) 13), "<BR>");
@@ -117,7 +119,29 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
return oNumberFormatter;
}
-
+ public boolean checkReportLayoutMode(String[] GroupFieldNames)
+ {
+ try
+ {
+ XNameAccess xTextSections = oTextSectionHandler.xTextSectionsSupplier.getTextSections();
+ Object oTextSection;
+ if (GroupFieldNames.length > 0)
+ {
+ oTextSection = xTextSections.getByName(GROUPSECTION + String.valueOf(1));
+ }
+ else
+ {
+ oTextSection = xTextSections.getByName(RECORDSECTION);
+ }
+ return AnyConverter.toBoolean(Helper.getUnoPropertyValue(oTextSection, ISVISIBLE));
+ }
+ catch (Exception e)
+ {
+ Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e);
+ // In doubt we rather suggest this is LayoutMode...
+ return true;
+ }
+ }
public void swapContentTemplate(String ContentTemplatePath)
{
@@ -155,6 +179,8 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
if (CurDBMetaData.getCommandType() == CommandType.QUERY)
{
oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, PropertyNames.COMMAND, "");
+ //DBMetaData.CommandObject oCommand = CurDBMetaData.getQueryByName(CurDBMetaData.getCommandName());
+ //oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, COMMAND, CurDBMetaData.Command);
}
else
{
@@ -185,9 +211,12 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "RecordFieldNames", JavaTools.ArraytoString(CurDBMetaData.getRecordFieldNames()));
}
+ public void updateReportTitle(String _sTitleName)
+ {
+ m_xDocProps.setTitle(_sTitleName);
+ }
-
- private void getReportPageStyles()
+ public void getReportPageStyles()
{
try
{
@@ -218,6 +247,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
Helper.setUnoPropertyValue(FirstPageStyle, SIZE, oNewSize);
int iLeftMargin = AnyConverter.toInt(Helper.getUnoPropertyValue(ReportPageStyle, "LeftMargin"));
int iRightMargin = AnyConverter.toInt(Helper.getUnoPropertyValue(ReportPageStyle, "RightMargin"));
+ PageWidth = oNewSize.Width - iLeftMargin - iRightMargin;
if (CurRecordTable != null)
{
CurRecordTable.adjustOptimalTableWidths(xMSF, oViewHandler);
@@ -230,7 +260,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
}
}
- private boolean loadSectionsfromTemplate(String sTemplateUrl)
+ public boolean loadSectionsfromTemplate(String sTemplateUrl)
{
try
{
@@ -253,7 +283,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
}
for (i = 0; i < GroupCount; i++)
{
- CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurDBMetaData.GroupFieldNames[i], TBLGROUPSECTION + (i + 1));
+ CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurDBMetaData.GroupFieldNames[i], i, TBLGROUPSECTION + (i + 1));
CurDBColumn.formatValueCell();
DBColumnsVector.set(i, CurDBColumn);
replaceFieldValueInGroupTable(CurDBColumn, i);
@@ -306,9 +336,17 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
}
}
+ public void replaceFieldValueInRecordSection(int RecordCount)
+ {
+ int GroupCount = CurDBMetaData.GroupFieldNames.length;
+ int FieldCount = CurDBMetaData.getFieldNames().length;
+ for (int i = GroupCount; i < FieldCount; i++)
+ {
+ DBColumnsVector.get(i).insertColumnData(oTextFieldHandler, this.bIsCurLandscape);
+ }
+ }
-
- private void updateTextSections(String[] SelGroupNames)
+ public void updateTextSections(String[] SelGroupNames)
{
String TableName;
DBColumn OldDBColumn;
@@ -319,14 +357,14 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
{
TableName = TBLGROUPSECTION + Integer.toString(i + 1);
OldDBColumn = DBColumnsVector.get(i);
- CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, SelGroupNames[i], TableName, OldDBColumn);
+ CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, SelGroupNames[i], i, TableName, OldDBColumn);
CurDBColumn.formatValueCell();
DBColumnsVector.set(i, CurDBColumn);
CurDBColumn.insertColumnData(oTextFieldHandler, this.bIsCurLandscape);
}
}
- private void replaceFieldValueInGroupTable(DBColumn CurDBColumn, int TableIndex)
+ public void replaceFieldValueInGroupTable(DBColumn CurDBColumn, int TableIndex)
{
String TableName = TBLGROUPSECTION + (TableIndex + 1);
// Note: for some reason the table might lose its name and has to be renamed therefor
@@ -339,9 +377,23 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
CurDBColumn.setCellFont();
}
+ public void replaceFieldValueInRecordTable()
+ {
+ String TableName = TBLRECORDSECTION;
+ String OldTableName = CurRecordTable.xTableName.getName();
+ if (OldTableName.compareTo(TableName) != 0)
+ {
+ CurRecordTable.xTableName.setName(TableName);
+ }
+ int GroupCount = CurDBMetaData.GroupFieldNames.length;
+ int RecordCount = CurDBMetaData.getRecordFieldNames().length;
+ for (int i = GroupCount; i < RecordCount; i++)
+ {
+ DBColumnsVector.get(i).insertColumnData(oTextFieldHandler, this.bIsCurLandscape);
+ }
+ }
-
- private void insertColumnstoRecordTable()
+ public void insertColumnstoRecordTable()
{
int GroupCount = CurDBMetaData.GroupFieldNames.length;
DBColumn CurDBColumn;
@@ -380,7 +432,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
}
}
- public boolean addGroupNametoDocument(String CurGroupTitle, ArrayList<String> GroupFieldVector, ArrayList<String> ReportPath, int iSelCount)
+ public boolean addGroupNametoDocument(String[] GroupNames, String CurGroupTitle, ArrayList<String> GroupFieldVector, ArrayList<String> ReportPath, int iSelCount)
{
DBColumn CurDBColumn = null;
int GroupCount = GroupFieldVector.size();
@@ -394,7 +446,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
{
String sPath = FileAccess.getPathFromList(xMSF, ReportPath, "cnt-default.ott");
oTextSectionHandler.insertTextSection(GROUPSECTION + GroupCount, sPath, GroupCount == 1);
- CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurFieldColumn.getFieldName(), TBLGROUPSECTION + (GroupCount));
+ CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurFieldColumn.getFieldName(), GroupCount - 1, TBLGROUPSECTION + (GroupCount));
CurDBColumn.formatValueCell();
DBColumnsVector.add(CurDBColumn);
replaceFieldValueInGroupTable(CurDBColumn, GroupCount - 1);
@@ -426,7 +478,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
DBColumnsVector.remove(iSelItemCount);
}
- private void removeGroupNamesofRecordTable(int GroupFieldCount)
+ public void removeGroupNamesofRecordTable(int GroupFieldCount)
{
int CurFieldCount = DBColumnsVector.size();
if (CurFieldCount > GroupFieldCount)
@@ -438,7 +490,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
}
}
- private void showCommonReportErrorBox(Exception exception)
+ public void showCommonReportErrorBox(Exception exception)
{
String SystemContentPath = JavaTools.convertfromURLNotation(ContentTemplatePath);
String sMsgCurCommonReportError = JavaTools.replaceSubString(sMsgCommonReportError, SystemContentPath, "%PATH");
@@ -455,7 +507,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
{
if (i < CurDBMetaData.GroupFieldNames.length)
{
- CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurDBMetaData.GroupFieldNames[i], COPYOFTBLGROUPSECTION + (i + 1));
+ CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurDBMetaData.GroupFieldNames[i], i, COPYOFTBLGROUPSECTION + (i + 1));
}
else
{
@@ -535,7 +587,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
return null;
}
- private static FieldColumn[] removeFieldColumnByFieldName(String _FieldName, FieldColumn[] _FieldColumns)
+ public static FieldColumn[] removeFieldColumnByFieldName(String _FieldName, FieldColumn[] _FieldColumns)
{
try
{
diff --git a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
index efc840283f08..57d1215a17b1 100644
--- a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
+++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
@@ -70,7 +70,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
* We have to remove this!!!
* @return
*/
- private ReportTextDocument getDoc()
+ ReportTextDocument getDoc()
{
if (m_aDoc == null)
{
@@ -125,22 +125,24 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
{
return getDoc().xWindowPeer;
}
- private static String sMsgQueryCreationImpossible;
- private static String sReportFormNotExisting;
-
- private static String sMsgEndAutopilot;
-
-
-
+ static String sMsgQueryCreationImpossible;
+ static String sReportFormNotExisting;
+ static String sMsgHiddenControlMissing;
+ static String sMsgEndAutopilot;
+ static String sMsgConnectionImpossible;
+ static String sMsgNoConnection;
+ static String[] ReportMessages = new String[4];
private void initialResources()
{
sReportFormNotExisting = m_resource.getResText(UIConsts.RID_REPORT + 64);
sMsgQueryCreationImpossible = m_resource.getResText(UIConsts.RID_REPORT + 65);
+ sMsgHiddenControlMissing = m_resource.getResText(UIConsts.RID_REPORT + 66);
sMsgEndAutopilot = m_resource.getResText(UIConsts.RID_DB_COMMON + 33);
+ sMsgNoConnection = m_resource.getResText(UIConsts.RID_DB_COMMON + 14);
}
- private void addTextSectionCopies()
+ public void addTextSectionCopies()
{
m_aDoc.setLayoutSectionsVisible(false);
XTextCursor xTextCursor = ReportTextDocument.createTextCursor(m_aDoc.xTextDocument.getText());
@@ -475,7 +477,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
public boolean liveupdate_addGroupNametoDocument(String[] GroupNames, String CurGroupTitle, ArrayList<String> GroupFieldVector, ArrayList<String> ReportPath, int iSelCount)
{
- return getDoc().addGroupNametoDocument(CurGroupTitle, GroupFieldVector, ReportPath, iSelCount);
+ return getDoc().addGroupNametoDocument(GroupNames, CurGroupTitle, GroupFieldVector, ReportPath, iSelCount);
}
public void refreshGroupFields(String[] _sNewNames)
@@ -491,6 +493,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
public void setPageOrientation(int nOrientation) throws com.sun.star.lang.IllegalArgumentException
{
// LLA: should we lock controllers here?
+ // CurReportDocument.getDoc().xTextDocument.lockControllers();
if (nOrientation == ReportLayouter.SOOPTLANDSCAPE)
{
getDoc().changePageOrientation(true);
@@ -597,7 +600,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
// Check general availability of office paths
try
{
- m_aReportPath = FileAccess.getOfficePaths(getMSF(), "Template");
+ m_aReportPath = FileAccess.getOfficePaths(getMSF(), "Template", "share", "/wizard");
FileAccess.combinePaths(getMSF(), m_aReportPath, "/wizard/report");
}
catch (Exception e)
diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java
index 37d527749d9d..89d757107142 100644
--- a/wizards/com/sun/star/wizards/report/ReportWizard.java
+++ b/wizards/com/sun/star/wizards/report/ReportWizard.java
@@ -55,7 +55,7 @@ import java.util.Map;
public class ReportWizard extends DatabaseObjectWizard implements XTextListener
{
- private FieldSelection CurGroupFieldSelection;
+ protected FieldSelection CurGroupFieldSelection;
private SortingComponent CurSortingComponent;
private TitlesComponent CurTitlesComponent;
private CommandFieldSelection CurDBCommandFieldSelection;
@@ -110,7 +110,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
102,
41,
1,
- Short.valueOf((short) 0),
+ new Short((short) 0),
sMsgWizardName,
310
});
@@ -119,7 +119,6 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
}
}
- @Override
protected void enterStep(int nOldStep, int nNewStep)
{
if ((nOldStep >= SOTEMPLATEPAGE) && (nNewStep < SOTEMPLATEPAGE))
@@ -163,7 +162,6 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
}
}
- @Override
protected void leaveStep(int nOldStep, int nNewStep)
{
@@ -188,6 +186,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
case SOTITLEPAGE:
String[] sFieldTitles = CurTitlesComponent.getFieldTitles();
// set new field name titles
+ // CurReportDocument.getRecordParser().setFieldTitles(sFieldTitles);
m_reportDocument.setFieldTitles(sFieldTitles);
break;
@@ -195,11 +194,13 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
// TODO: DESIGN!!! a getter should return a value!!!
CurGroupFieldHandler.getGroupFieldNames(m_reportDocument.getRecordParser());
String[] aGroupFieldNames = m_reportDocument.getRecordParser().GroupFieldNames;
+ // CurReportDocument.getRecordParser().prependSortFieldNames(aGroupFieldNames);
m_reportDocument.setGrouping(aGroupFieldNames);
break;
case SOSORTPAGE:
String[][] aSortFieldNames = CurSortingComponent.getSortFieldNames();
+ // CurReportDocument.getRecordParser().SortFieldNames = aSortFieldNames;
m_reportDocument.setSorting(aSortFieldNames);
// TODO: why do we make a switch here
super.enablefromStep(SOTEMPLATEPAGE, true);
@@ -303,8 +304,9 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
return bQueryCreated;
}
- private void buildSteps()
+ public void buildSteps()
{
+ // CurReportDocument.getDoc().xProgressBar.setValue(30);
CurDBCommandFieldSelection = new CommandFieldSelection(this, m_reportDocument.getRecordParser(), 100, slblFields, slblSelFields, slblTables, true, 34330);
CurDBCommandFieldSelection.addFieldSelectionListener(new FieldSelectionListener());
if (!isReportBuilderInstalled())
@@ -329,7 +331,6 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
enableNavigationButtons(false, false, false);
}
- @Override
public boolean finishWizard()
{
final int ncurStep = getCurrentStep();
@@ -349,13 +350,12 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
return false;
}
- @Override
public void cancelWizard()
{
xDialog.endExecute();
}
- private void insertQueryRelatedSteps()
+ public void insertQueryRelatedSteps()
{
setRMItemLabels(m_oResource, UIConsts.RID_QUERY + 80);
addRoadmap();
@@ -505,6 +505,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
}
if (bexecute)
{
+ // CurDataimport.insertDatabaseDatatoReportDocument(xMSF);
m_reportDocument.insertDatabaseDatatoReportDocument(xMSF);
}
@@ -524,7 +525,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
m_reportDocument.getRecordParser().dispose();
}
- private boolean getReportResources(boolean bgetProgressResourcesOnly)
+ public boolean getReportResources(boolean bgetProgressResourcesOnly)
{
sMsgWizardName = super.m_oResource.getResText(UIConsts.RID_REPORT);
if (!bgetProgressResourcesOnly)
@@ -556,7 +557,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
return sBlindTextNote;
}
- private void enableRoadmapItems(boolean _bEnabled)
+ public void enableRoadmapItems(boolean _bEnabled)
{
try
{
@@ -591,7 +592,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
boolean bEnabled = NewItems.length > 0;
setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bEnabled));
setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bEnabled));
- enableRoadmapItems(bEnabled); // Note: Performance-wise this could be improved
+ enableRoadmapItems(bEnabled); // Note: Performancewise this could be improved
}
public void textChanged(TextEvent xTextEvent)
@@ -601,6 +602,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
Object oModel = UnoDialog.getModel(xTextEvent.Source);
String sContent = (String) Helper.getUnoPropertyValue(oModel, "Text");
String fieldname = this.CurTitlesComponent.getFieldNameByTitleControl(oModel);
+ // CurReportDocument.getDoc().oTextFieldHandler.changeUserFieldContent(fieldname, sfieldtitle);
m_reportDocument.liveupdate_changeUserFieldContent(fieldname, sContent);
}
catch (Exception exception)
@@ -609,12 +611,10 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
}
}
- @Override
public void disposing(EventObject EventObject)
{
}
- @Override
public void setmodified(int _ndialogpage, Object ooldValue, Object onewValue)
{
switch (_ndialogpage)
@@ -639,10 +639,10 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
super.setStepEnabled(SOSORTPAGE, bdoenable);
}
- private class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener
+ public class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener
{
- private int m_nID;
+ protected int m_nID;
public int getID()
{
diff --git a/wizards/com/sun/star/wizards/report/report.component b/wizards/com/sun/star/wizards/report/report.component
index 050871fd587b..68c8ce94021e 100644
--- a/wizards/com/sun/star/wizards/report/report.component
+++ b/wizards/com/sun/star/wizards/report/report.component
@@ -20,7 +20,7 @@
<component loader="com.sun.star.loader.Java2"
xmlns="http://openoffice.org/2010/uno-components">
<implementation name=
- "com.sun.star.wizards.report.CallReportWizard">
+ "com.sun.star.wizards.report.CallReportWizard$ReportWizardImplementation">
<service name="com.sun.star.wizards.report.CallReportWizard"/>
</implementation>
</component>
diff --git a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java
index 42c15d4e4c63..191df4436cab 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java
@@ -504,7 +504,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
if (m_aReportPath == null)
{
// Check general availability of office paths
- m_aReportPath = FileAccess.getOfficePaths(getMSF(), "Template");
+ m_aReportPath = FileAccess.getOfficePaths(getMSF(), "Template", "share", "/wizard");
FileAccess.combinePaths(getMSF(), m_aReportPath, "/wizard/report");
}
return m_aReportPath;
@@ -599,6 +599,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
/**
* Return a string array array with all found layouts
* At the moment these layout are hard coded
+ * @return
*/
public String[][] getDataLayout()
{
@@ -631,7 +632,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
try
{
// TODO: check different languages in header layouts
- ArrayList<String> aReportPath = FileAccess.getOfficePaths(getMSF(), "Template");
+ ArrayList<String> aReportPath = FileAccess.getOfficePaths(getMSF(), "Template", "share", "/wizard");
FileAccess.combinePaths(getMSF(), aReportPath, "/wizard/report");
LayoutFiles = FileAccess.getFolderTitles(getMSF(), null, aReportPath, ".otr");
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java
index d553d24d7600..ac166083dd9b 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java
@@ -41,7 +41,6 @@ public class ColumnarSingleColumn extends ReportBuilderLayouter
return getResource().getResText(UIConsts.RID_REPORT + 81);
}
- @Override
protected void insertDetailFields()
{
copyDetailProperties();
@@ -83,7 +82,6 @@ public class ColumnarSingleColumn extends ReportBuilderLayouter
doNotBreakInTable(xSection);
}
- @Override
protected void insertDetailFieldTitles(int lastGroupPostion)
{
// we won't extra field titles
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java
index e12d87087ada..82281f548be4 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java
@@ -29,19 +29,16 @@ public class ColumnarThreeColumns extends ColumnarTwoColumns
super(_xDefinitionAccess, _aResource);
}
- @Override
public String getName()
{
return "ColumnarThreeColumnsLayoutOfData";
}
- @Override
public String getLocalizedName()
{
return getResource().getResText(UIConsts.RID_REPORT + 83);
}
- @Override
protected void insertDetailFields()
{
insertDetailFields(3);
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java
index 2d5b618e7abd..e75eefc21359 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java
@@ -41,7 +41,6 @@ public class ColumnarTwoColumns extends ReportBuilderLayouter
return getResource().getResText(UIConsts.RID_REPORT + 82);
}
- @Override
protected void insertDetailFields()
{
insertDetailFields(2);
@@ -115,7 +114,6 @@ public class ColumnarTwoColumns extends ReportBuilderLayouter
doNotBreakInTable(xSection);
}
- @Override
protected void insertDetailFieldTitles(int lastGroupPostion)
{
// we won't extra field titles
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java b/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java
index 82c8b53af8c2..65fed5b1c9f6 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java
@@ -33,8 +33,8 @@ public class DesignTemplate
{
private XReportDefinition m_xReportDefinition;
-
-
+ XMultiServiceFactory m_xGlobalMSF;
+ String m_sFilename;
private DesignTemplate()
{
@@ -264,6 +264,10 @@ public class DesignTemplate
/**
* create a new DesignTemplate by try to load a otr file from the given path.
* Internally we store the loaded ReportDefinition.
+ *
+ * @param _xMSF
+ * @param _sPath
+ * @return
*/
public static DesignTemplate create(XMultiServiceFactory _xMSF, String _sPath)
{
@@ -291,6 +295,8 @@ public class DesignTemplate
private void load(XMultiServiceFactory _xMSF, String _sPath) throws com.sun.star.uno.Exception
{
+ m_xGlobalMSF = _xMSF;
+ m_sFilename = _sPath;
final Object aObj = _xMSF.createInstance("com.sun.star.report.ReportDefinition");
m_xReportDefinition = UnoRuntime.queryInterface(XReportDefinition.class, aObj);
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java
index 46d8f7bc62e5..00319ce2f856 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java
@@ -31,19 +31,16 @@ public class InBlocksLabelsAbove extends ColumnarTwoColumns
super(_xDefinitionAccess, _aResource);
}
- @Override
public String getName()
{
return "InBlocksLabelsAboveLayoutOfData";
}
- @Override
public String getLocalizedName()
{
return getResource().getResText(UIConsts.RID_REPORT + 85);
}
- @Override
protected void insertDetailFields()
{
copyDetailProperties();
@@ -140,7 +137,6 @@ public class InBlocksLabelsAbove extends ColumnarTwoColumns
doNotBreakInTable(xSection);
}
- @Override
protected void insertDetailFieldTitles(int lastGroupPostion)
{
// we won't extra field titles
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java
index 5fea096e9989..f7fef368ab02 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java
@@ -32,19 +32,16 @@ public class InBlocksLabelsLeft extends ColumnarTwoColumns
super(_xDefinitionAccess, _aResource);
}
- @Override
public String getName()
{
return "InBlocksLabelsLeftLayoutOfData";
}
- @Override
public String getLocalizedName()
{
return getResource().getResText(UIConsts.RID_REPORT + 84);
}
- @Override
protected void insertDetailFields()
{
copyDetailProperties();
@@ -111,7 +108,6 @@ public class InBlocksLabelsLeft extends ColumnarTwoColumns
doNotBreakInTable(xSection);
}
- @Override
protected void insertDetailFieldTitles(int lastGroupPostion)
{
// we won't extra field titles
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java
index 8c8175b3b9e2..aa1037b4597f 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java
@@ -163,7 +163,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
/**
* Remove all Groups
*/
- private void clearGroups()
+ protected void clearGroups()
{
final XGroups xGroups = getReportDefinition().getGroups();
while (xGroups.hasElements())
@@ -232,7 +232,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
return nIndent;
}
- private int m_nLeftIndent = -1;
+ int m_nLeftIndent = -1;
/**
* Get left page indent.
@@ -249,7 +249,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
return m_nLeftIndent;
}
- private int m_nRightIndent = -1;
+ int m_nRightIndent = -1;
/**
* Get right page indent.
@@ -297,7 +297,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
return aUsedStyle;
}
- private int getFromPageStyles(String _sStyleName, int _nDefault)
+ protected int getFromPageStyles(String _sStyleName, int _nDefault)
{
int nValue = _nDefault;
final XStyle xStyle = getUsedStyle("PageStyles");
@@ -310,7 +310,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
return nValue;
}
- private void setToPageStyles(String _sStyleName, Object _aObj)
+ protected void setToPageStyles(String _sStyleName, Object _aObj)
{
final XStyle xStyle = getUsedStyle("PageStyles");
if (xStyle != null)
@@ -320,7 +320,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
}
- private int m_nPageWidth = -1;
+ int m_nPageWidth = -1;
/**
* Get page width. The default is 21000 1/100mm what is 21cm of DIN A4.
@@ -338,6 +338,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
/**
* Stores the Group names. To insert/create a report with such group names, call layout()
+ * @param _aGroupNames
*/
public void insertGroupNames(String[] _aGroupNames)
{
@@ -381,7 +382,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
- private int insertGroups()
+ protected int insertGroups()
{
final XGroups xGroups = getReportDefinition().getGroups();
int lastGroupPosition = -1;
@@ -466,6 +467,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
/**
* Give a list off all field title names to insert the field title names, call layout()
+ * @param _aFieldTitleNames
*/
public void insertFieldTitles(String[] _aFieldTitleNames)
{
@@ -473,7 +475,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
- private String getTitleFromFieldName(String _sField)
+ protected String getTitleFromFieldName(String _sField)
{
for (int i = 0; i < m_aFieldNames.length; i++)
{
@@ -485,7 +487,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
return PropertyNames.EMPTY_STRING;
}
- private int getTypeFromFieldName(String _sField)
+ protected int getTypeFromFieldName(String _sField)
{
for (int i = 0; i < m_aFieldNames.length; i++)
{
@@ -497,7 +499,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
return 0;
}
- private boolean listContains(String[] _aList, String _aValue)
+ protected boolean listContains(String[] _aList, String _aValue)
{
for (int i = 0; i < _aList.length; i++)
{
@@ -516,7 +518,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
* @param _aGetResultFrom
* @return
*/
- private String[] getNamesWithoutGroupNames(String[] _aList, String[] _aGetResultFrom)
+ protected String[] getNamesWithoutGroupNames(String[] _aList, String[] _aGetResultFrom)
{
if (_aList == null)
{
@@ -580,6 +582,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
/**
* Give a list off all field names to insert the field names, call layout()
+ * @param _aFieldNames
*/
public void insertFieldNames(String[] _aFieldNames)
{
@@ -694,7 +697,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
- private String convertFromFieldName(String _sName)
+ protected String convertFromFieldName(String _sName)
{
if (_sName.startsWith("field:["))
{
@@ -722,7 +725,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
return insertFormattedField(_xSection, _sFormattedfield, _aRect, _nWidth, _aSO, (short) com.sun.star.awt.TextAlign.LEFT);
}
- private Rectangle insertFormattedField(XSection _xSection, String _sFormattedfield, Rectangle _aRect, int _nWidth, SectionObject _aSO, short _nAlignment)
+ protected Rectangle insertFormattedField(XSection _xSection, String _sFormattedfield, Rectangle _aRect, int _nWidth, SectionObject _aSO, short _nAlignment)
{
if (_xSection != null)
{
@@ -831,9 +834,9 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
getReportDefinition().setCommandType(_aType);
getReportDefinition().setCommand(_sTableName);
}
- private XMultiServiceFactory m_xMSF;
+ protected XMultiServiceFactory m_xMSF;
- private XMultiServiceFactory getMSFofReportDefinition()
+ protected XMultiServiceFactory getMSFofReportDefinition()
{
if (m_xMSF == null)
{
@@ -843,14 +846,17 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
+ protected Rectangle insertVerticalLine(XSection _xSection, Rectangle _aRect, int _nWidth, int _nHeight)
+ {
+ return insertLine(_xSection, _aRect, _nWidth, _nHeight, 1);
+ }
-
- private Rectangle insertHorizontalLine(XSection _xSection, Rectangle _aRect, int _nWidth, int _nHeight)
+ protected Rectangle insertHorizontalLine(XSection _xSection, Rectangle _aRect, int _nWidth, int _nHeight)
{
return insertLine(_xSection, _aRect, _nWidth, _nHeight, 0);
}
- private Rectangle insertLine(XSection _xSection, Rectangle _aRect, int _nWidth, int _nHeight, int _nOrientation)
+ protected Rectangle insertLine(XSection _xSection, Rectangle _aRect, int _nWidth, int _nHeight, int _nOrientation)
{
if (_xSection != null)
{
@@ -880,7 +886,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
- private void clearReportHeader()
+ protected void clearReportHeader()
{
XSection xSection;
try
@@ -897,7 +903,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
}
- private void insertReportHeader()
+ protected void insertReportHeader()
{
if (getDesignTemplate() != null)
{
@@ -930,7 +936,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
}
- private void clearReportFooter()
+ protected void clearReportFooter()
{
XSection xSection;
try
@@ -947,7 +953,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
}
- private void insertReportFooter()
+ protected void insertReportFooter()
{
if (getDesignTemplate() != null)
{
@@ -981,7 +987,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
- private void clearPageHeader()
+ protected void clearPageHeader()
{
XSection xSection;
try
@@ -998,7 +1004,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
}
- private void clearPageFooter()
+ protected void clearPageFooter()
{
XSection xSection;
try
@@ -1025,8 +1031,8 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
setToPageStyles("IsLandscape", Boolean.TRUE);
if (nWidth < nHeight)
{
- setToPageStyles(PropertyNames.PROPERTY_WIDTH, Integer.valueOf(nHeight));
- setToPageStyles(PropertyNames.PROPERTY_HEIGHT, Integer.valueOf(nWidth));
+ setToPageStyles(PropertyNames.PROPERTY_WIDTH, new Integer(nHeight));
+ setToPageStyles(PropertyNames.PROPERTY_HEIGHT, new Integer(nWidth));
}
}
else
@@ -1034,8 +1040,8 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
setToPageStyles("IsLandscape", Boolean.FALSE);
if (nHeight < nWidth)
{
- setToPageStyles(PropertyNames.PROPERTY_WIDTH, Integer.valueOf(nHeight));
- setToPageStyles(PropertyNames.PROPERTY_HEIGHT, Integer.valueOf(nWidth));
+ setToPageStyles(PropertyNames.PROPERTY_WIDTH, new Integer(nHeight));
+ setToPageStyles(PropertyNames.PROPERTY_HEIGHT, new Integer(nWidth));
}
}
// dirty the PageWidth
@@ -1050,7 +1056,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
* @param _aFont
* @return width of given text in 1/100mm
*/
- private Size getPreferredSize(String _sText, FontDescriptor _aFont)
+ Size getPreferredSize(String _sText, FontDescriptor _aFont)
{
Size aSizeMM_100TH = new Size(0, 0);
try
@@ -1097,7 +1103,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
return aSizeMM_100TH;
}
- private String getTableName()
+ protected String getTableName()
{
if (m_sTableName != null)
{
@@ -1106,7 +1112,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
return PropertyNames.EMPTY_STRING;
}
- private String getUserNameFromConfiguration()
+ protected String getUserNameFromConfiguration()
{
String sFirstName = PropertyNames.EMPTY_STRING;
String sLastName = PropertyNames.EMPTY_STRING;
@@ -1186,6 +1192,8 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
// but there seems some problems, we have to control.
copyProperties(aComponent, aClone);
+ // aShape.setPosition(aComponent.getPosition());
+ // aShape.setSize(aComponent.getSize());
_xToSection.add(aShape);
}
}
@@ -1197,7 +1205,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
}
- private void insertPageHeader()
+ protected void insertPageHeader()
{
if (getDesignTemplate() != null)
{
@@ -1298,7 +1306,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
}
- private void insertPageFooter()
+ protected void insertPageFooter()
{
if (getDesignTemplate() != null)
{
@@ -1392,13 +1400,13 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
return m_aResource;
}
- private int m_aCommandType; // Table or Query
- private String m_sTableName;
- private String[] m_aGroupNames;
- private String[] m_aFieldNames;
- private String[] m_aFieldTitleNames;
- private int[] m_aFieldWidths;
- private int[] m_aFieldTypes;
+ protected int m_aCommandType; // Table or Query
+ protected String m_sTableName;
+ protected String[] m_aGroupNames;
+ protected String[] m_aFieldNames;
+ protected String[] m_aFieldTitleNames;
+ protected int[] m_aFieldWidths;
+ protected int[] m_aFieldTypes;
private DesignTemplate m_xDesignTemplate = null;
public void initializeData(IReportBuilderLayouter _aOther)
@@ -1457,14 +1465,14 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
* @param _sLabel
* @return the width in 1/100mm
*/
- private int getLabelWidth(String _sLabel)
+ protected int getLabelWidth(String _sLabel)
{
return getLabelWidth(_sLabel, 0.0f, 0.0f);
}
- private XFixedText m_aFixedTextHelper = null;
- private HashMap<String, Integer> m_aLabelWidthMap;
+ XFixedText m_aFixedTextHelper = null;
+ HashMap<String, Integer> m_aLabelWidthMap;
- private int getLabelWidth(String _sLabel, FontDescriptor _aFD)
+ protected int getLabelWidth(String _sLabel, FontDescriptor _aFD)
{
float fCharWeight = 0.0f;
float fCharHeight = 0.0f;
@@ -1476,7 +1484,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
return getLabelWidth(_sLabel, fCharWeight, fCharHeight);
}
- private int getLabelWidth(String _sLabel, float _nCharWeight, float _nCharHeight)
+ protected int getLabelWidth(String _sLabel, float _nCharWeight, float _nCharHeight)
{
int nWidth = 0;
@@ -1517,7 +1525,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
final Size aSize = getPreferredSize(_sLabel, xFont);
nWidth = aSize.Width;
// cache the found width
- m_aLabelWidthMap.put(sKey, Integer.valueOf(nWidth));
+ m_aLabelWidthMap.put(sKey, new Integer(nWidth));
}
catch (com.sun.star.uno.Exception e)
{
@@ -1560,6 +1568,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
/**
* load the given string as a template and use it's content to paint the other
+ * @param LayoutTemplatePath
*/
public void loadAndSetBackgroundTemplate(String LayoutTemplatePath)
{
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java
index f8f03c4c0483..27c30f85feb5 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java
@@ -32,7 +32,6 @@ public class SectionEmptyObject extends SectionObject
return new SectionEmptyObject();
}
- @Override
public FontDescriptor getFontDescriptor()
{
return null;
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java
index 8a4027033603..5a1c0e24790e 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java
@@ -23,7 +23,7 @@ import com.sun.star.report.XFixedText;
public class SectionLabel extends SectionObject
{
- private SectionLabel(XFixedText _aFixedText)
+ protected SectionLabel(XFixedText _aFixedText)
{
m_aParentObject = _aFixedText;
}
@@ -35,8 +35,8 @@ public class SectionLabel extends SectionObject
/**
* Return the current FontDescriptor
+ * @return
*/
- @Override
public FontDescriptor getFontDescriptor()
{
FontDescriptor a = null;
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java
index c6d3887cccaf..de2d1cd4aded 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java
@@ -25,7 +25,7 @@ abstract public class SectionObject
{
Object m_aParentObject; // this could be FixedText or FormattedField or null
- private PropertySetHelper m_aPropertySetHelper;
+ PropertySetHelper m_aPropertySetHelper;
public SectionObject()
{
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java
index bc7be4e88462..fae7d9a2fe37 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java
@@ -23,7 +23,7 @@ import com.sun.star.report.XFormattedField;
public class SectionTextField extends SectionObject
{
- private SectionTextField(XFormattedField _aFormattedField)
+ protected SectionTextField(XFormattedField _aFormattedField)
{
m_aParentObject = _aFormattedField;
// We would like to know, what properties are in this object.
@@ -34,7 +34,6 @@ public class SectionTextField extends SectionObject
return new SectionTextField(_aFormattedField);
}
- @Override
public FontDescriptor getFontDescriptor()
{
FontDescriptor a = null;
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java b/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java
index 593ae72609a0..fe9f4db8f6e6 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java
@@ -44,7 +44,6 @@ public class Tabular extends ReportBuilderLayouter
return getResource().getResText(UIConsts.RID_REPORT + 80);
}
- @Override
protected void insertDetailFields()
{
copyDetailProperties();
@@ -77,7 +76,6 @@ public class Tabular extends ReportBuilderLayouter
xSection.setHeight(nHeight);
}
- @Override
protected void insertDetailFieldTitles(int lastGroupPostion)
{
final String[] aFieldTitleNames = getFieldTitleNames();
@@ -107,6 +105,7 @@ public class Tabular extends ReportBuilderLayouter
xGroup = UnoRuntime.queryInterface(XGroup.class, xGroups.getByIndex(lastGroupPostion));
// We don't need to copy the GroupProperties, because this is done in the insertGroup() member function
+ // copyGroupProperties(0);
aSO = getDesignTemplate().getGroupLabel(lastGroupPostion);
}
diff --git a/wizards/com/sun/star/wizards/table/CGCategory.java b/wizards/com/sun/star/wizards/table/CGCategory.java
index eff29ca31aa5..bdcad65db0f2 100644
--- a/wizards/com/sun/star/wizards/table/CGCategory.java
+++ b/wizards/com/sun/star/wizards/table/CGCategory.java
@@ -30,13 +30,13 @@ import com.sun.star.wizards.common.Configuration;
public class CGCategory
{
-
-
+ public String Name;
+ public int Index;
private final String CGROOTPATH = "/org.openoffice.Office.TableWizard/TableWizard/";
- private XMultiServiceFactory xMSF;
+ XMultiServiceFactory xMSF;
XNameAccess xNameAccessTablesNode;
- private XNameAccess xNameAccessCurBusinessNode;
- private Object oconfigView;
+ XNameAccess xNameAccessCurBusinessNode;
+ Object oconfigView;
public CGCategory(XMultiServiceFactory _xMSF)
{
diff --git a/wizards/com/sun/star/wizards/table/CGTable.java b/wizards/com/sun/star/wizards/table/CGTable.java
index cf3fb17a49e3..21f8a9136666 100644
--- a/wizards/com/sun/star/wizards/table/CGTable.java
+++ b/wizards/com/sun/star/wizards/table/CGTable.java
@@ -26,11 +26,11 @@ import com.sun.star.wizards.common.PropertyNames;
public class CGTable
{
- private XMultiServiceFactory xMSF;
+ XMultiServiceFactory xMSF;
XNameAccess xNameAccessFieldsNode;
- private XNameAccess xNameAccessTableNode;
-
-
+ XNameAccess xNameAccessTableNode;
+ public String Index;
+ public String Name;
public CGTable(XMultiServiceFactory _xMSF)
{
diff --git a/wizards/com/sun/star/wizards/table/CallTableWizard.java b/wizards/com/sun/star/wizards/table/CallTableWizard.java
index 09e99ff18690..0674ff72d301 100644
--- a/wizards/com/sun/star/wizards/table/CallTableWizard.java
+++ b/wizards/com/sun/star/wizards/table/CallTableWizard.java
@@ -23,7 +23,7 @@ import com.sun.star.uno.Type;
import com.sun.star.wizards.common.Properties;
import com.sun.star.wizards.common.PropertyNames;
-/** This class encapsulates the class, that implements the minimal component, a
+/** This class capsulates the class, that implements the minimal component, a
* factory for creating the service (<CODE>__getServiceFactory</CODE>).
*/
public class CallTableWizard
@@ -52,14 +52,17 @@ public class CallTableWizard
/** This class implements the component. At least the interfaces XServiceInfo,
* XTypeProvider, and XInitialization should be provided by the service.
*/
- private static class TableWizardImplementation extends com.sun.star.lib.uno.helper.PropertySet implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.task.XJobExecutor
+ public static class TableWizardImplementation extends com.sun.star.lib.uno.helper.PropertySet implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.task.XJobExecutor
{
private PropertyValue[] m_wizardContext;
-
-
+ // <properties>
+ public String Command;
+ public final Integer CommandType = com.sun.star.sdb.CommandType.TABLE;
+ // </properties>
/** The constructor of the inner class has a XMultiServiceFactory parameter.
+ * @param i_serviceFactory
*/
public TableWizardImplementation(com.sun.star.lang.XMultiServiceFactory i_serviceFactory)
{
@@ -76,7 +79,7 @@ public class CallTableWizard
if ( sEvent.equals(PropertyNames.START) )
{
TableWizard CurTableWizard = new TableWizard( m_serviceFactory, m_wizardContext );
- CurTableWizard.startTableWizard();
+ Command = CurTableWizard.startTableWizard();
}
}
catch (Exception exception)
@@ -107,7 +110,7 @@ public class CallTableWizard
/** This method returns an array of all supported service names.
* @return Array of supported service names.
*/
- public String[] getSupportedServiceNames()
+ public java.lang.String[] getSupportedServiceNames()
{
String[] stringSupportedServiceNames = new String[1];
@@ -132,7 +135,6 @@ public class CallTableWizard
return (booleanSupportsService);
}
- @Override
public byte[] getImplementationId()
{
return new byte[0];
@@ -141,7 +143,7 @@ public class CallTableWizard
/** Return the class name of the component.
* @return Class name of the component.
*/
- public String getImplementationName()
+ public java.lang.String getImplementationName()
{
return (TableWizardImplementation.class.getName());
}
@@ -151,7 +153,6 @@ public class CallTableWizard
* @return Sequence of all types (usually interface types) provided by the
* service.
*/
- @Override
public Type[] getTypes()
{
Type[] typeReturn =
diff --git a/wizards/com/sun/star/wizards/table/FieldDescription.java b/wizards/com/sun/star/wizards/table/FieldDescription.java
index 826989c611df..b122b40ecb5c 100644
--- a/wizards/com/sun/star/wizards/table/FieldDescription.java
+++ b/wizards/com/sun/star/wizards/table/FieldDescription.java
@@ -66,7 +66,7 @@ public class FieldDescription
{
Name = _fieldname;
aPropertyValues = new ArrayList<PropertyValue>();
- Type = Integer.valueOf(com.sun.star.sdbc.DataType.VARCHAR);
+ Type = new Integer(com.sun.star.sdbc.DataType.VARCHAR);
aPropertyValues.add(Properties.createProperty(PropertyNames.PROPERTY_NAME, _fieldname));
aPropertyValues.add(Properties.createProperty("Type", Type));
}
diff --git a/wizards/com/sun/star/wizards/table/FieldFormatter.java b/wizards/com/sun/star/wizards/table/FieldFormatter.java
index ce6217eaf015..e64375b0b1af 100644
--- a/wizards/com/sun/star/wizards/table/FieldFormatter.java
+++ b/wizards/com/sun/star/wizards/table/FieldFormatter.java
@@ -27,6 +27,7 @@ import com.sun.star.beans.XPropertySet;
import com.sun.star.lang.EventObject;
import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.Desktop;
import com.sun.star.wizards.common.Helper;
import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.db.TableDescriptor;
@@ -36,29 +37,29 @@ import com.sun.star.wizards.ui.UnoDialog;
public class FieldFormatter implements XItemListener
{
- private TableWizard CurUnoDialog;
- private TableDescriptor curTableDescriptor;
- private Object oColumnDescriptorModel;
- private XTextComponent txtfieldname;
- private XListBox xlstFieldNames;
- private XButton btnplus;
- private XButton btnminus;
- private XButton btnShiftUp;
- private XButton btnShiftDown;
- private short curtabindex;
-
-
-
- private String MODIFYFIELDNAME = "modifyFieldName";
-
- private String suntitled;
- private Integer IFieldFormatStep;
-
- public FieldFormatter(TableWizard _CurUnoDialog)
+ TableWizard CurUnoDialog;
+ TableDescriptor curTableDescriptor;
+ Object oColumnDescriptorModel;
+ XTextComponent txtfieldname;
+ XListBox xlstFieldNames;
+ XButton btnplus;
+ XButton btnminus;
+ XButton btnShiftUp;
+ XButton btnShiftDown;
+ short curtabindex;
+ String TOGGLEBUTTONS = "toggleButtons";
+ String ADDFIELDNAME = "addFieldName";
+ String REMOVEFIELDNAME = "removeFieldName";
+ String MODIFYFIELDNAME = "modifyFieldName";
+ String[] fieldnames;
+ String suntitled;
+ Integer IFieldFormatStep;
+
+ public FieldFormatter(TableWizard _CurUnoDialog, TableDescriptor _curTableDescriptor)
{
this.CurUnoDialog = _CurUnoDialog;
curtabindex = (short) (TableWizard.SOFIELDSFORMATPAGE * 100);
- IFieldFormatStep = Integer.valueOf(TableWizard.SOFIELDSFORMATPAGE);
+ IFieldFormatStep = new Integer(TableWizard.SOFIELDSFORMATPAGE);
String sFieldName = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 23);
String sFieldNames = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 25);
String sfieldinfo = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 20);
@@ -74,7 +75,7 @@ public class FieldFormatter implements XItemListener
},
new Object[]
{
- UIConsts.INTEGERS[8], sFieldNames, 91, 27, IFieldFormatStep, Short.valueOf(curtabindex++), 90
+ UIConsts.INTEGERS[8], sFieldNames, 91, 27, IFieldFormatStep, new Short(curtabindex++), 90
});
try
@@ -86,7 +87,7 @@ public class FieldFormatter implements XItemListener
},
new Object[]
{
- 133, "HID:WIZARDS_HID_DLGTABLE_LB_SELFIELDNAMES", 92, 37, IFieldFormatStep, Short.valueOf(curtabindex++), 62
+ 133, "HID:WIZARDS_HID_DLGTABLE_LB_SELFIELDNAMES", 92, 37, IFieldFormatStep, new Short(curtabindex++), 62
});
}
catch (Exception e)
@@ -104,7 +105,7 @@ public class FieldFormatter implements XItemListener
},
new Object[]
{
- Boolean.FALSE, oFontDesc, 14, "HID:WIZARDS_HID_DLGTABLE_CMDMOVEFIELDUP", String.valueOf((char) 8743), 158, 139, IFieldFormatStep, Short.valueOf(curtabindex++), 14
+ Boolean.FALSE, oFontDesc, 14, "HID:WIZARDS_HID_DLGTABLE_CMDMOVEFIELDUP", String.valueOf((char) 8743), 158, 139, IFieldFormatStep, new Short(curtabindex++), 14
});
btnShiftDown = CurUnoDialog.insertButton("btnShiftDown", "shiftFieldNameDown", this,
@@ -114,7 +115,7 @@ public class FieldFormatter implements XItemListener
},
new Object[]
{
- Boolean.FALSE, oFontDesc, 14, "HID:WIZARDS_HID_DLGTABLE_CMDMOVEFIELDDOWN", String.valueOf((char) 8744), 158, 156, IFieldFormatStep, Short.valueOf(curtabindex++), 14
+ Boolean.FALSE, oFontDesc, 14, "HID:WIZARDS_HID_DLGTABLE_CMDMOVEFIELDDOWN", String.valueOf((char) 8744), 158, 156, IFieldFormatStep, new Short(curtabindex++), 14
});
oFontDesc = new FontDescriptor();
oFontDesc.Weight = com.sun.star.awt.FontWeight.BOLD;
@@ -126,7 +127,7 @@ public class FieldFormatter implements XItemListener
},
new Object[]
{
- oFontDesc, 14, "HID:WIZARDS_HID_DLGTABLE_CMDMINUS", "-", 118, 175, IFieldFormatStep, Short.valueOf(curtabindex++), 14
+ oFontDesc, 14, "HID:WIZARDS_HID_DLGTABLE_CMDMINUS", "-", 118, 175, IFieldFormatStep, new Short(curtabindex++), 14
});
btnplus = CurUnoDialog.insertButton("btnplus", "addFieldName", this,
@@ -136,7 +137,7 @@ public class FieldFormatter implements XItemListener
},
new Object[]
{
- oFontDesc, 14, "HID:WIZARDS_HID_DLGTABLE_CMDPLUS", "+", 137, 175, IFieldFormatStep, Short.valueOf(curtabindex++), 14
+ oFontDesc, 14, "HID:WIZARDS_HID_DLGTABLE_CMDPLUS", "+", 137, 175, IFieldFormatStep, new Short(curtabindex++), 14
});
CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "ColDescriptorHeader",
@@ -146,7 +147,7 @@ public class FieldFormatter implements XItemListener
},
new Object[]
{
- 8, sfieldinfo, 0, 158, 27, IFieldFormatStep, Short.valueOf(curtabindex++), 165
+ 8, sfieldinfo, 0, 158, 27, IFieldFormatStep, new Short(curtabindex++), 165
});
@@ -157,7 +158,7 @@ public class FieldFormatter implements XItemListener
},
new Object[]
{
- UIConsts.INTEGERS[8], sFieldName, 158, 39, IFieldFormatStep, Short.valueOf(curtabindex++), 94
+ UIConsts.INTEGERS[8], sFieldName, 158, 39, IFieldFormatStep, new Short(curtabindex++), 94
});
txtfieldname = CurUnoDialog.insertTextField("txtfieldname", MODIFYFIELDNAME, this,
@@ -167,7 +168,7 @@ public class FieldFormatter implements XItemListener
},
new Object[]
{
- UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGTABLE_COLNAME", 274, 37, IFieldFormatStep, Short.valueOf(curtabindex++), PropertyNames.EMPTY_STRING, 50
+ UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGTABLE_COLNAME", 274, 37, IFieldFormatStep, new Short(curtabindex++), PropertyNames.EMPTY_STRING, 50
});
txtfieldname.addTextListener(CurUnoDialog);
CurUnoDialog.getPeerConfiguration().setAccessibleName(btnplus, sbtnplushelptext);
@@ -185,7 +186,7 @@ public class FieldFormatter implements XItemListener
}, // PropertyNames.PROPERTY_HELPURL
new Object[]
{
- 85, 158, 49, IFieldFormatStep, Short.valueOf(curtabindex++), 166, 50
+ 85, 158, 49, IFieldFormatStep, new Short(curtabindex++), 166, 50
}); //, "HID:WIZARDS_HID_DLGTABLE_COLMODIFIER"
curTableDescriptor = _curTableDescriptor;
Helper.setUnoPropertyValue(oColumnDescriptorModel, PropertyNames.ACTIVE_CONNECTION, _curTableDescriptor.DBConnection);
@@ -210,7 +211,7 @@ public class FieldFormatter implements XItemListener
CurUnoDialog.setFocus("lstfieldnames");
}
- private void toggleButtons()
+ public void toggleButtons()
{
boolean benableShiftUpButton = false;
boolean benableShiftDownButton = false;
@@ -229,15 +230,142 @@ public class FieldFormatter implements XItemListener
CurUnoDialog.setcompleted(TableWizard.SOFIELDSFORMATPAGE, blistispopulated);
}
+ public void addFieldName()
+ {
+ String snewfieldname = Desktop.getUniqueName(xlstFieldNames.getItems(), suntitled, PropertyNames.EMPTY_STRING);
+ short icount = xlstFieldNames.getItemCount();
+ if (CurUnoDialog.verifyfieldcount(icount))
+ {
+ xlstFieldNames.addItem(snewfieldname, icount);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[]
+ {
+ icount
+ });
+ toggleButtons();
+ FieldDescription curfielddescription = new FieldDescription(snewfieldname);
+ CurUnoDialog.fielditems.put(snewfieldname, curfielddescription);
+ curTableDescriptor.addColumn(curfielddescription.getPropertyValues());
+ updateColumnDescriptor(snewfieldname, curTableDescriptor.getByName(snewfieldname));
+ CurUnoDialog.setControlVisible("oColumnDescriptor", true);
+ CurUnoDialog.repaintDialogStep();
+ }
+ }
+ public void removeFieldName()
+ {
+ String[] fieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST);
+ short ipos = UnoDialog.getSelectedItemPos(xlstFieldNames);
+ String fieldname = fieldnames[ipos];
+ xlstFieldNames.removeItems(ipos, (short) 1);
+ CurUnoDialog.fielditems.remove(fieldname);
+ int ilistcount = /* xlstFieldNames.getItemCount();*/ UnoDialog.getListBoxItemCount(xlstFieldNames);
+ if ((ipos) < ilistcount)
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[]
+ {
+ ipos
+ });
+ }
+ else
+ {
+ if (ilistcount > -1)
+ {
+ ipos = (short) ((short) ilistcount - (short) 1);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[]
+ {
+ ipos
+ });
+ }
+ }
+ curTableDescriptor.dropColumnbyName(fieldname);
+ fieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST);
+ boolean benable = ((ipos > -1) && (ipos < fieldnames.length));
+ if (benable)
+ {
+ String snewfieldname = fieldnames[ipos];
+ updateColumnDescriptor(snewfieldname, curTableDescriptor.getByName(snewfieldname));
+ toggleButtons();
+ }
+ else
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(txtfieldname), "Text", PropertyNames.EMPTY_STRING);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benable));
+ CurUnoDialog.setcompleted(TableWizard.SOFIELDSFORMATPAGE, benable);
+ }
+ Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benable));
+ CurUnoDialog.setControlVisible("oColumnDescriptor", benable);
+ CurUnoDialog.repaintDialogStep();
+ }
+ public void modifyFieldName()
+ {
+ String newfieldname = txtfieldname.getText();
+ String oldfieldname = xlstFieldNames.getSelectedItem();
+ if (!newfieldname.equals(oldfieldname))
+ {
+ if (curTableDescriptor.modifyColumnName(oldfieldname, newfieldname))
+ {
+ Object oColumn = Helper.getUnoPropertyValue(oColumnDescriptorModel, "Column");
+ Helper.setUnoPropertyValue(oColumn, PropertyNames.PROPERTY_NAME, newfieldname);
+ FieldDescription curfielddescription = CurUnoDialog.fielditems.get(oldfieldname);
+ CurUnoDialog.fielditems.remove(oldfieldname);
+ curfielddescription.setName(newfieldname);
+ CurUnoDialog.fielditems.put(newfieldname, curfielddescription);
+ String[] fieldnames = xlstFieldNames.getItems();
+ short ipos = xlstFieldNames.getSelectedItemPos();
+ fieldnames[ipos] = newfieldname;
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST, fieldnames);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[]
+ {
+ ipos
+ });
+ }
+ }
+ }
+ public void shiftFieldNameUp()
+ {
+ short ipos = xlstFieldNames.getSelectedItemPos();
+ String[] snewlist = shiftArrayItem(xlstFieldNames.getItems(), ipos, -1);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST, snewlist);
+ if ((ipos - 1) > -1)
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[]
+ {
+ (short) (ipos - 1)
+ });
+ curTableDescriptor.moveColumn(ipos, ipos - 1);
+ }
+ toggleButtons();
+ }
+ public void shiftFieldNameDown()
+ {
+ short ipos = xlstFieldNames.getSelectedItemPos();
+ String[] snewlist = shiftArrayItem(xlstFieldNames.getItems(), ipos, 1);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST, snewlist);
+ if ((ipos + 1) < xlstFieldNames.getItemCount())
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[]
+ {
+ (short) (ipos + 1)
+ });
+ curTableDescriptor.moveColumn(ipos, ipos + 1);
+ }
+ toggleButtons();
+ }
-
-
-
-
+ public String[] shiftArrayItem(String[] _slist, int _oldindex, int _shiftcount)
+ {
+ int newindex = _oldindex + _shiftcount;
+ if ((newindex >= 0) && (newindex < _slist.length))
+ {
+ String buffer = _slist[newindex];
+ _slist[newindex] = _slist[_oldindex];
+ _slist[_oldindex] = buffer;
+ }
+ return _slist;
+ }
public boolean updateColumnofColumnDescriptor()
{
@@ -262,6 +390,11 @@ public class FieldFormatter implements XItemListener
txtfieldname.setText(_ColumnName);
}
+ public XPropertySet clonePropertySet(XPropertySet _xPropertySet)
+ {
+ return null;
+ }
+
public void itemStateChanged(ItemEvent arg0)
{
String fieldname = xlstFieldNames.getSelectedItem();
diff --git a/wizards/com/sun/star/wizards/table/Finalizer.java b/wizards/com/sun/star/wizards/table/Finalizer.java
index b8a81912d674..17883abbfb78 100644
--- a/wizards/com/sun/star/wizards/table/Finalizer.java
+++ b/wizards/com/sun/star/wizards/table/Finalizer.java
@@ -30,17 +30,17 @@ import com.sun.star.wizards.ui.*;
public class Finalizer
{
- private TableWizard CurUnoDialog;
- private short curtabindex;
- private XRadioButton optModifyTable;
- private XRadioButton optWorkWithTable;
-
- private XTextComponent txtTableName;
- private XListBox xCatalogListBox;
- private XListBox xSchemaListBox;
- private TableDescriptor curtabledescriptor;
- private String SETCOMPLETIONFLAG = "setCompletionFlag";
- private static int WORKWITHTABLEMODE = 0;
+ TableWizard CurUnoDialog;
+ short curtabindex;
+ XRadioButton optModifyTable;
+ XRadioButton optWorkWithTable;
+ XRadioButton optStartFormWizard;
+ XTextComponent txtTableName;
+ XListBox xCatalogListBox;
+ XListBox xSchemaListBox;
+ TableDescriptor curtabledescriptor;
+ public String SETCOMPLETIONFLAG = "setCompletionFlag";
+ public static int WORKWITHTABLEMODE = 0;
public static int MODIFYTABLEMODE = 1;
public static int STARTFORMWIZARDMODE = 2;
@@ -51,7 +51,7 @@ public class Finalizer
this.CurUnoDialog = _CurUnoDialog;
this.curtabledescriptor = _curtabledescriptor;
curtabindex = (short) (TableWizard.SOFINALPAGE * 100);
- Integer IFINALSTEP = Integer.valueOf(TableWizard.SOFINALPAGE);
+ Integer IFINALSTEP = new Integer(TableWizard.SOFINALPAGE);
String slblTableName = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 34);
String slblProceed = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 36);
String sWorkWithTable = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 38);
@@ -83,7 +83,7 @@ public class Finalizer
},
new Object[]
{
- UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGTABLE_TXT_NAME", 97, 35, IFINALSTEP, Short.valueOf(curtabindex++), PropertyNames.EMPTY_STRING, 223
+ UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGTABLE_TXT_NAME", 97, 35, IFINALSTEP, new Short(curtabindex++), PropertyNames.EMPTY_STRING, 223
});
txtTableName.addTextListener(CurUnoDialog);
txtTableName.setMaxTextLen((short) this.curtabledescriptor.getMaxTableNameLength());
@@ -110,7 +110,7 @@ public class Finalizer
},
new Object[]
{
- 8, slblCatalog, Integer.valueOf(nListBoxPosX), 52, IFINALSTEP, Short.valueOf(curtabindex++), 120
+ 8, slblCatalog, new Integer(nListBoxPosX), 52, IFINALSTEP, new Short(curtabindex++), 120
});
try
@@ -122,7 +122,7 @@ public class Finalizer
},
new Object[]
{
- Boolean.TRUE, 12, "HID:WIZARDS_HID_DLGTABLE_LST_CATALOG", Short.valueOf(UnoDialog.getListBoxLineCount()), Integer.valueOf(nListBoxPosX), 62, IFINALSTEP, sCatalogNames, Short.valueOf(curtabindex++), 80
+ Boolean.TRUE, 12, "HID:WIZARDS_HID_DLGTABLE_LST_CATALOG", new Short(UnoDialog.getListBoxLineCount()), new Integer(nListBoxPosX), 62, IFINALSTEP, sCatalogNames, new Short(curtabindex++), 80
});
int isel = JavaTools.FieldInList(sCatalogNames, sCatalog);
if (isel < 0)
@@ -165,7 +165,7 @@ public class Finalizer
},
new Object[]
{
- 8, slblSchema, Integer.valueOf(nListBoxPosX), 52, IFINALSTEP, Short.valueOf(curtabindex++), 80
+ 8, slblSchema, new Integer(nListBoxPosX), 52, IFINALSTEP, new Short(curtabindex++), 80
});
try
@@ -177,7 +177,7 @@ public class Finalizer
},
new Object[]
{
- Boolean.TRUE, 12, "HID:WIZARDS_HID_DLGTABLE_LST_SCHEMA", Short.valueOf(UnoDialog.getListBoxLineCount()), Integer.valueOf(nListBoxPosX), 62, IFINALSTEP, sSchemaNames, Short.valueOf(curtabindex++), 80
+ Boolean.TRUE, 12, "HID:WIZARDS_HID_DLGTABLE_LST_SCHEMA", new Short(UnoDialog.getListBoxLineCount()), new Integer(nListBoxPosX), 62, IFINALSTEP, sSchemaNames, new Short(curtabindex++), 80
});
int isel = JavaTools.FieldInList(sSchemaNames, sSchema);
if (isel < 0)
@@ -205,7 +205,7 @@ public class Finalizer
},
new Object[]
{
- 16, sCongratulations, Boolean.TRUE, 97, 62, IFINALSTEP, Short.valueOf(curtabindex++), 226
+ 16, sCongratulations, Boolean.TRUE, 97, 62, IFINALSTEP, new Short(curtabindex++), 226
});
}
else
@@ -219,7 +219,7 @@ public class Finalizer
},
new Object[]
{
- UIConsts.INTEGERS[8], slblProceed, 97, Integer.valueOf(82 + ndiffPosY), IFINALSTEP, Short.valueOf(curtabindex++), 227
+ UIConsts.INTEGERS[8], slblProceed, 97, new Integer(82 + ndiffPosY), IFINALSTEP, new Short(curtabindex++), 227
});
optWorkWithTable = CurUnoDialog.insertRadioButton("optWorkWithTable", null,
new String[]
@@ -228,7 +228,7 @@ public class Finalizer
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_WORKWITHTABLE", sWorkWithTable, 101, Integer.valueOf(97 + ndiffPosY), Short.valueOf((short) 1), IFINALSTEP, Short.valueOf(curtabindex++), 177
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_WORKWITHTABLE", sWorkWithTable, 101, new Integer(97 + ndiffPosY), new Short((short) 1), IFINALSTEP, new Short(curtabindex++), 177
});
optModifyTable = CurUnoDialog.insertRadioButton("optModifyTable", null,
new String[]
@@ -237,16 +237,16 @@ public class Finalizer
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_MODIFYTABLE", sModifyTable, 101, Integer.valueOf(109 + ndiffPosY), IFINALSTEP, Short.valueOf(curtabindex++), 177
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_MODIFYTABLE", sModifyTable, 101, new Integer(109 + ndiffPosY), IFINALSTEP, new Short(curtabindex++), 177
});
- CurUnoDialog.insertRadioButton("optStartFormWizard", null,
+ optStartFormWizard = CurUnoDialog.insertRadioButton("optStartFormWizard", null,
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_STARTFORMWIZARD", sStartFormWizard, 101, Integer.valueOf(121 + ndiffPosY), IFINALSTEP, Short.valueOf(curtabindex++), 177
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_STARTFORMWIZARD", sStartFormWizard, 101, new Integer(121 + ndiffPosY), IFINALSTEP, new Short(curtabindex++), 177
});
}
catch (SQLException e)
@@ -344,7 +344,7 @@ public class Finalizer
return (txtTableName.getText().length() > 0);
}
- private void setCompletionFlag()
+ public void setCompletionFlag()
{
CurUnoDialog.setcompleted(TableWizard.SOFINALPAGE, iscompleted());
}
diff --git a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java
index 953fcf4996df..d7ac335dfb6b 100644
--- a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java
+++ b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java
@@ -60,7 +60,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
curTableDescriptor = _curTableDescriptor;
bAutoPrimaryKeysupportsAutoIncrmentation = isAutoPrimeKeyAutoIncrementationsupported();
curtabindex = (short) ((TableWizard.SOPRIMARYKEYPAGE * 100) - 20);
- Integer IPRIMEKEYSTEP = Integer.valueOf(TableWizard.SOPRIMARYKEYPAGE);
+ Integer IPRIMEKEYSTEP = new Integer(TableWizard.SOPRIMARYKEYPAGE);
final String sExplanations = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 26);
final String screatePrimaryKey = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 27);
final String slblPrimeFieldName = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 31);
@@ -77,7 +77,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
},
new Object[]
{
- 40, sExplanations, Boolean.TRUE, 91, 27, IPRIMEKEYSTEP, Short.valueOf(curtabindex++), 233
+ 40, sExplanations, Boolean.TRUE, 91, 27, IPRIMEKEYSTEP, new Short(curtabindex++), 233
});
chkcreatePrimaryKey = CurUnoDialog.insertCheckBox("chkcreatePrimaryKey", SPRIMEKEYMODE, this,
@@ -87,7 +87,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_CHK_USEPRIMEKEY", screatePrimaryKey, 97, 70, Short.valueOf((short) 1), IPRIMEKEYSTEP, Short.valueOf(curtabindex++), 160
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_CHK_USEPRIMEKEY", screatePrimaryKey, 97, 70, new Short((short) 1), IPRIMEKEYSTEP, new Short(curtabindex++), 160
});
optAddAutomatically = CurUnoDialog.insertRadioButton("optAddAutomatically", SPRIMEKEYMODE, this,
@@ -97,7 +97,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_PK_AUTOMATIC", sAddAutomatically, 106, 82, Short.valueOf((short) 1), IPRIMEKEYSTEP, Short.valueOf(curtabindex++), 200
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_PK_AUTOMATIC", sAddAutomatically, 106, 82, new Short((short) 1), IPRIMEKEYSTEP, new Short(curtabindex++), 200
});
optUseExisting = CurUnoDialog.insertRadioButton("optUseExisting", SPRIMEKEYMODE, this,
@@ -107,7 +107,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
}, //94
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_PK_SINGLE", sUseExisting, 106, 104, IPRIMEKEYSTEP, Short.valueOf(curtabindex++), 200
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_PK_SINGLE", sUseExisting, 106, 104, IPRIMEKEYSTEP, new Short(curtabindex++), 200
});
optUseSeveral = CurUnoDialog.insertRadioButton("optUseSeveral", SPRIMEKEYMODE, this,
@@ -117,7 +117,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_PK_SEVERAL", sUseSeveral, 106, 132, IPRIMEKEYSTEP, Short.valueOf(curtabindex++), 200
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_PK_SEVERAL", sUseSeveral, 106, 132, IPRIMEKEYSTEP, new Short(curtabindex++), 200
});
chkApplyAutoValueAutomatic = CurUnoDialog.insertCheckBox("chkApplyAutoValueAutomatic", SPRIMEKEYMODE, this,
@@ -127,7 +127,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
}, //107
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_CK_PK_AUTOVALUE_AUTOMATIC", sApplyAutoValue, 116, 92, IPRIMEKEYSTEP, Short.valueOf(curtabindex++), 68
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_CK_PK_AUTOVALUE_AUTOMATIC", sApplyAutoValue, 116, 92, IPRIMEKEYSTEP, new Short(curtabindex++), 68
});
lblPrimeFieldName = CurUnoDialog.insertLabel("lblPrimeFieldName",
@@ -137,7 +137,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
},
new Object[]
{
- Boolean.FALSE, UIConsts.INTEGERS[8], slblPrimeFieldName, 116, 117, IPRIMEKEYSTEP, Short.valueOf(curtabindex++), 46
+ Boolean.FALSE, UIConsts.INTEGERS[8], slblPrimeFieldName, 116, 117, IPRIMEKEYSTEP, new Short(curtabindex++), 46
});
lstSinglePrimeKey = CurUnoDialog.insertListBox("lstSinglePrimeKey", "onPrimeKeySelected", null, this,
@@ -164,7 +164,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
162,
115,
IPRIMEKEYSTEP,
- Short.valueOf(curtabindex++),
+ new Short(curtabindex++),
80
});
@@ -175,7 +175,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
}, //107
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_CK_PK_AUTOVALUE", sApplyAutoValue, 248, 117, IPRIMEKEYSTEP, Short.valueOf(curtabindex++), 66
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_CK_PK_AUTOVALUE", sApplyAutoValue, 248, 117, IPRIMEKEYSTEP, new Short(curtabindex++), 66
});
curPrimaryKeySelection = new FieldSelection(CurUnoDialog, IPRIMEKEYSTEP.intValue(), 116, 142, 208, 47, slblAvailableFields, slblSelPrimaryFields, 41234, false);
curPrimaryKeySelection.addFieldSelectionListener(this);
@@ -244,7 +244,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
return false;
}
- private void togglePrimeKeyFields()
+ public void togglePrimeKeyFields()
{
boolean bdoEnable = (this.chkcreatePrimaryKey.getState() == 1);
Helper.setUnoPropertyValue(UnoDialog.getModel(optAddAutomatically), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoEnable));
@@ -333,7 +333,30 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
return bischecked;
}
-
+ public void onPrimeKeySelected()
+ {
+ try
+ {
+ String selfieldname = lstSinglePrimeKey.getSelectedItem();
+ boolean bdoenable = isAutoIncrementatable(selfieldname);
+ CurUnoDialog.setcompleted(TableWizard.SOPRIMARYKEYPAGE, lstSinglePrimeKey.getSelectedItemPos() != -1);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoenable));
+ XPropertySet xColPropertySet = curTableDescriptor.getByName(selfieldname);
+ boolean bIsAutoIncremented = ((Boolean) xColPropertySet.getPropertyValue("IsAutoIncrement")).booleanValue();
+ if (bIsAutoIncremented)
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_STATE, new Short((short) 1));
+ }
+ else
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_STATE, new Short((short) 0));
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ }
+ }
private void toggleAutomaticAutoValueCheckBox()
{
@@ -358,7 +381,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoenableAutoValueCheckBox));
}
- public String[] getPrimaryKeyFields()
+ public String[] getPrimaryKeyFields(TableDescriptor _curtabledescriptor)
{
if (chkcreatePrimaryKey.getState() == 0)
{
diff --git a/wizards/com/sun/star/wizards/table/ScenarioSelector.java b/wizards/com/sun/star/wizards/table/ScenarioSelector.java
index 4e916c996be7..5c20f78275ae 100644
--- a/wizards/com/sun/star/wizards/table/ScenarioSelector.java
+++ b/wizards/com/sun/star/wizards/table/ScenarioSelector.java
@@ -44,8 +44,8 @@ import com.sun.star.wizards.ui.XFieldSelectionListener;
*/
public class ScenarioSelector extends FieldSelection implements XItemListener, XFieldSelectionListener
{
- private final static int PRIVATE = 0;
- private final static int BUSINESS = 1;
+ final static int PRIVATE = 0;
+ final static int BUSINESS = 1;
private XFixedText lblExplanation;
private XFixedText lblCategories;
@@ -80,7 +80,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
String sPrivate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 17);
String sTableNames = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 18);
smytable = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 44);
- Integer IMAINSTEP = Integer.valueOf(TableWizard.SOMAINPAGE);
+ Integer IMAINSTEP = new Integer(TableWizard.SOMAINPAGE);
oCGCategory = new CGCategory(CurUnoDialog.xMSF);
oCGTable = new CGTable(CurUnoDialog.xMSF);
lblExplanation = CurUnoDialog.insertLabel("lblScenarioExplanation",
@@ -90,7 +90,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
},
new Object[]
{
- 32, sExplanation, Boolean.TRUE, 91, 27, IMAINSTEP, Short.valueOf(pretabindex++), 233
+ 32, sExplanation, Boolean.TRUE, 91, 27, IMAINSTEP, new Short(pretabindex++), 233
});
lblCategories = CurUnoDialog.insertLabel("lblCategories",
@@ -100,7 +100,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
},
new Object[]
{
- 8, sCategories, 91, 60, IMAINSTEP, Short.valueOf(pretabindex++), 100
+ 8, sCategories, 91, 60, IMAINSTEP, new Short(pretabindex++), 100
});
optBusiness = CurTableWizardUnoDialog.insertRadioButton("optBusiness", SELECTCATEGORY, this,
@@ -110,7 +110,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPTBUSINESS", sBusiness, 98, 70, Short.valueOf((short) 1), IMAINSTEP, Short.valueOf(pretabindex++), 78
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPTBUSINESS", sBusiness, 98, 70, new Short((short) 1), IMAINSTEP, new Short(pretabindex++), 78
});
optPrivate = CurTableWizardUnoDialog.insertRadioButton("optPrivate", SELECTCATEGORY, this,
@@ -120,7 +120,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPTPRIVATE", sPrivate, 182, 70, IMAINSTEP, Short.valueOf(pretabindex++), 90
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPTPRIVATE", sPrivate, 182, 70, IMAINSTEP, new Short(pretabindex++), 90
});
CurUnoDialog.insertLabel("lblTableNames",
@@ -130,7 +130,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
},
new Object[]
{
- 8, sTableNames, 91, 82, IMAINSTEP, Short.valueOf(pretabindex++), 80
+ 8, sTableNames, 91, 82, IMAINSTEP, new Short(pretabindex++), 80
});
try
@@ -142,7 +142,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
},
new Object[]
{
- Boolean.TRUE, 12, "HID:WIZARDS_HID_DLGTABLE_LBTABLES", Short.valueOf(UnoDialog.getListBoxLineCount()), 91, 92, IMAINSTEP, Short.valueOf(pretabindex++), getListboxWidth()
+ Boolean.TRUE, 12, "HID:WIZARDS_HID_DLGTABLE_LBTABLES", new Short(UnoDialog.getListBoxLineCount()), 91, 92, IMAINSTEP, new Short(pretabindex++), getListboxWidth()
});
}
catch (Exception e)
@@ -152,7 +152,19 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
initializeCategory(BUSINESS);
}
- private void initializeCategory(int _iCategory)
+ public void selectCategory()
+ {
+ if (optBusiness.getState())
+ {
+ initializeCategory(BUSINESS);
+ }
+ else
+ {
+ initializeCategory(PRIVATE);
+ }
+ }
+
+ public void initializeCategory(int _iCategory)
{
try
{
@@ -168,7 +180,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
}
}
- private void initializeTable(int _iTable)
+ public void initializeTable(int _iTable)
{
Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.SELECTED_ITEMS, new short[]
{
@@ -178,7 +190,6 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
super.initialize(oCGTable.getFieldNames(bcolumnnameislimited, imaxcolumnchars), true);
}
- @Override
public String[] getSelectedFieldNames()
{
String[] displayfieldnames = super.getSelectedFieldNames();
@@ -256,6 +267,16 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
return smytable;
}
+ public void fillupTables()
+ {
+ }
+
+ public void fillupFieldsListbox()
+ {
+ super.emptyFieldsListBoxes();
+ }
+
+
/* (non-Javadoc)
* @see com.sun.star.awt.XItemListener#itemStateChanged(com.sun.star.awt.ItemEvent)
*/
@@ -270,7 +291,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
public void disposing(EventObject arg0)
{
}
- private int ID;
+ protected int ID;
public int getID()
{
diff --git a/wizards/com/sun/star/wizards/table/TableWizard.java b/wizards/com/sun/star/wizards/table/TableWizard.java
index 44b932bb4ed0..70ce06bccaa2 100644
--- a/wizards/com/sun/star/wizards/table/TableWizard.java
+++ b/wizards/com/sun/star/wizards/table/TableWizard.java
@@ -38,26 +38,27 @@ import com.sun.star.wizards.ui.*;
public class TableWizard extends DatabaseObjectWizard implements XTextListener
{
- private static String slblFields;
- private static String slblSelFields;
- private Finalizer curFinalizer;
- private ScenarioSelector curScenarioSelector;
- private FieldFormatter curFieldFormatter;
- private PrimaryKeyHandler curPrimaryKeyHandler;
-
+ static String slblFields;
+ static String slblSelFields;
+ Finalizer curFinalizer;
+ ScenarioSelector curScenarioSelector;
+ FieldFormatter curFieldFormatter;
+ PrimaryKeyHandler curPrimaryKeyHandler;
+ String sMsgWizardName = PropertyNames.EMPTY_STRING;
public HashMap<String, FieldDescription> fielditems;
- private int wizardmode;
- private String tablename;
- private String serrToManyFields;
- private String serrTableNameexists;
- private String scomposedtablename;
- private TableDescriptor curTableDescriptor;
-
+ int wizardmode;
+ String tablename;
+ String serrToManyFields;
+ String serrTableNameexists;
+ String scomposedtablename;
+ TableDescriptor curTableDescriptor;
+ public static final int SONULLPAGE = 0;
public static final int SOMAINPAGE = 1;
public static final int SOFIELDSFORMATPAGE = 2;
public static final int SOPRIMARYKEYPAGE = 3;
public static final int SOFINALPAGE = 4;
private String sMsgColumnAlreadyExists = PropertyNames.EMPTY_STRING;
+ String WizardHeaderText[] = new String[8];
private String m_tableName;
@@ -73,7 +74,7 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener
},
new Object[]
{
- 218, Boolean.TRUE, "DialogTable", 102, 41, 1, Short.valueOf((short) 0), sTitle, 330
+ 218, Boolean.TRUE, "DialogTable", 102, 41, 1, new Short((short) 0), sTitle, 330
});
drawNaviBar();
fielditems = new HashMap<String, FieldDescription>();
@@ -84,7 +85,6 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener
}
}
- @Override
protected void leaveStep(int nOldStep, int nNewStep)
{
switch (nOldStep)
@@ -107,7 +107,6 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener
}
}
- @Override
protected void enterStep(int nOldStep, int nNewStep)
{
switch (nNewStep)
@@ -132,7 +131,6 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener
/* (non-Javadoc)
* @see com.sun.star.wizards.ui.XCompletion#iscompleted(int)
*/
- @Override
public boolean iscompleted(int _ndialogpage)
{
switch (_ndialogpage)
@@ -157,7 +155,6 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener
/* (non-Javadoc)
* @see com.sun.star.wizards.ui.XCompletion#setcompleted(int, boolean)
*/
- @Override
public void setcompleted(int _ndialogpage, boolean _biscompleted)
{
boolean bScenarioiscompleted = _biscompleted;
@@ -213,10 +210,34 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener
}
}
- private void buildSteps()
+/*
+ public static void main(String args[])
+ {
+ String ConnectStr = "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService";
+ PropertyValue[] curproperties = null;
+ try
+ {
+ XMultiServiceFactory xLocMSF = com.sun.star.wizards.common.Desktop.connect(ConnectStr);
+ TableWizard CurTableWizard = new TableWizard(xLocMSF);
+ if (xLocMSF != null)
+ {
+ System.out.println("Connected to " + ConnectStr);
+ curproperties = new PropertyValue[1];
+ curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography");
+ //curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///path/to/database.odb");
+ CurTableWizard.startTableWizard(xLocMSF, curproperties);
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.err);
+ }
+ }
+*/
+ public void buildSteps()
{
curScenarioSelector = new ScenarioSelector(this, this.curTableDescriptor, slblFields, slblSelFields);
- curFieldFormatter = new FieldFormatter(this);
+ curFieldFormatter = new FieldFormatter(this, curTableDescriptor);
if ( this.curTableDescriptor.supportsPrimaryKeys() )
{
curPrimaryKeyHandler = new PrimaryKeyHandler(this, curTableDescriptor);
@@ -225,7 +246,7 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener
enableNavigationButtons(false, false, false);
}
- private boolean createTable()
+ public boolean createTable()
{
boolean bIsSuccessfull = true;
boolean bTableCreated = false;
@@ -233,7 +254,7 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener
String catalogname = curFinalizer.getCatalogName();
if (curTableDescriptor.supportsPrimaryKeys())
{
- String[] keyfieldnames = curPrimaryKeyHandler.getPrimaryKeyFields();
+ String[] keyfieldnames = curPrimaryKeyHandler.getPrimaryKeyFields(curTableDescriptor);
if (keyfieldnames != null)
{
if (keyfieldnames.length > 0)
@@ -255,7 +276,6 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener
return bIsSuccessfull;
}
- @Override
public boolean finishWizard()
{
super.switchToStep(super.getCurrentStep(), SOFINALPAGE);
@@ -312,13 +332,12 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener
}
}
- @Override
public void cancelWizard()
{
xDialog.endExecute();
}
- private void insertFormRelatedSteps()
+ public void insertFormRelatedSteps()
{
addRoadmap();
int i = 0;
@@ -364,6 +383,7 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener
public boolean getTableResources()
{
+ sMsgWizardName = super.m_oResource.getResText(UIConsts.RID_TABLE + 1);
slblFields = m_oResource.getResText(UIConsts.RID_TABLE + 19);
slblSelFields = m_oResource.getResText(UIConsts.RID_TABLE + 25);
serrToManyFields = m_oResource.getResText(UIConsts.RID_TABLE + 47);
diff --git a/wizards/com/sun/star/wizards/text/TextDocument.java b/wizards/com/sun/star/wizards/text/TextDocument.java
index dcb845918676..5ef82e080b1e 100644
--- a/wizards/com/sun/star/wizards/text/TextDocument.java
+++ b/wizards/com/sun/star/wizards/text/TextDocument.java
@@ -17,34 +17,54 @@
*/
package com.sun.star.wizards.text;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.document.XDocumentProperties;
import com.sun.star.document.XDocumentPropertiesSupplier;
+import com.sun.star.frame.XController;
import com.sun.star.frame.XComponentLoader;
import com.sun.star.frame.XDesktop;
import com.sun.star.frame.XFramesSupplier;
import com.sun.star.frame.XLoadable;
+import com.sun.star.frame.XModel;
import com.sun.star.frame.XModule;
import com.sun.star.frame.XTerminateListener;
import com.sun.star.frame.XStorable;
+import com.sun.star.i18n.NumberFormatIndex;
import com.sun.star.awt.Size;
import com.sun.star.awt.XWindow;
import com.sun.star.awt.XWindowPeer;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.PropertyVetoException;
+import com.sun.star.lang.Locale;
+import com.sun.star.lang.WrappedTargetException;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.style.XStyle;
import com.sun.star.style.XStyleFamiliesSupplier;
import com.sun.star.task.XStatusIndicatorFactory;
+import com.sun.star.text.XPageCursor;
import com.sun.star.text.XSimpleText;
import com.sun.star.text.XText;
+import com.sun.star.text.XTextContent;
import com.sun.star.text.XTextCursor;
import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextViewCursor;
+import com.sun.star.text.XTextViewCursorSupplier;
import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.DateTime;
import com.sun.star.util.XModifiable;
import com.sun.star.util.XNumberFormatsSupplier;
+import com.sun.star.util.XRefreshable;
+import com.sun.star.wizards.common.Configuration;
import com.sun.star.wizards.common.Desktop;
import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.Helper.DateUtils;
import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.document.OfficeDocument;
@@ -53,21 +73,21 @@ public class TextDocument
public XComponent xComponent;
public com.sun.star.text.XTextDocument xTextDocument;
-
- private com.sun.star.document.XDocumentProperties m_xDocProps;
+ public com.sun.star.util.XNumberFormats NumberFormats;
+ public com.sun.star.document.XDocumentProperties m_xDocProps;
public com.sun.star.task.XStatusIndicator xProgressBar;
public com.sun.star.frame.XFrame xFrame;
public XText xText;
public XMultiServiceFactory xMSFDoc;
public XMultiServiceFactory xMSF;
-
+ public com.sun.star.util.XNumberFormatsSupplier xNumberFormatsSupplier;
public com.sun.star.awt.XWindowPeer xWindowPeer;
-
-
-
-
-
-
+ public int PageWidth;
+ public int ScaleWidth;
+ public Size DocSize;
+ public com.sun.star.awt.Rectangle PosSize;
+ public com.sun.star.lang.Locale CharLocale;
+ public XStorable xStorable;
// creates an instance of TextDocument and creates a named frame. No document is actually loaded into this frame.
public TextDocument(XMultiServiceFactory xMSF, XTerminateListener listener, String FrameName)
@@ -93,7 +113,7 @@ public class TextDocument
}
// creates an instance of TextDocument from the desktop's current frame
- public TextDocument(XMultiServiceFactory xMSF, boolean bShowStatusIndicator)
+ public TextDocument(XMultiServiceFactory xMSF, boolean bShowStatusIndicator, XTerminateListener listener)
{
this.xMSF = xMSF;
@@ -115,7 +135,7 @@ public class TextDocument
private String m_identifier;
- private final String getIdentifier()
+ protected final String getIdentifier()
{
return m_identifier;
}
@@ -177,6 +197,7 @@ public class TextDocument
xFrame = _textDocument.getCurrentController().getFrame();
xComponent = UnoRuntime.queryInterface(XComponent.class, _textDocument);
xTextDocument = UnoRuntime.queryInterface(XTextDocument.class, xComponent);
+ //PosSize = xFrame.getComponentWindow().getPosSize();
if (bshowStatusIndicator)
{
XStatusIndicatorFactory xStatusIndicatorFactory = UnoRuntime.queryInterface(XStatusIndicatorFactory.class, xFrame);
@@ -186,10 +207,11 @@ public class TextDocument
}
xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow());
xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
- UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
+ xNumberFormatsSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
m_xDocProps = xDocPropsSuppl.getDocumentProperties();
+ CharLocale = (Locale) Helper.getUnoStructValue(xComponent, "CharLocale");
xText = xTextDocument.getText();
}
@@ -197,10 +219,11 @@ public class TextDocument
{
xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow());
xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
- UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
+ xNumberFormatsSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
m_xDocProps = xDocPropsSuppl.getDocumentProperties();
- UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ CharLocale = (Locale) Helper.getUnoStructValue(xComponent, "CharLocale");
+ xStorable = UnoRuntime.queryInterface(XStorable.class, xTextDocument);
xText = xTextDocument.getText();
}
@@ -212,7 +235,7 @@ public class TextDocument
xProgressBar.setValue(5);
}
- private XTextDocument loadAsPreview(String sDefaultTemplate, boolean asTemplate)
+ public XTextDocument loadAsPreview(String sDefaultTemplate, boolean asTemplate)
{
PropertyValue loadValues[] = new PropertyValue[3];
// open document in the Preview mode
@@ -241,12 +264,13 @@ public class TextDocument
}
Object oDoc = OfficeDocument.load(xFrame, sDefaultTemplate, "_self", loadValues);
xTextDocument = (com.sun.star.text.XTextDocument) oDoc;
+ DocSize = getPageSize();
xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
- ViewHandler myViewHandler = new ViewHandler(xTextDocument);
+ ViewHandler myViewHandler = new ViewHandler(xMSFDoc, xTextDocument);
try
{
- myViewHandler.setViewSetting("ZoomType", Short.valueOf(com.sun.star.view.DocumentZoomType.ENTIRE_PAGE));
+ myViewHandler.setViewSetting("ZoomType", new Short(com.sun.star.view.DocumentZoomType.ENTIRE_PAGE));
}
catch (Exception e)
{
@@ -294,10 +318,11 @@ public class TextDocument
xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xWindow);
xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
- UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
+ xNumberFormatsSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
m_xDocProps = xDocPropsSuppl.getDocumentProperties();
+ CharLocale = (Locale) Helper.getUnoStructValue(xComponent, "CharLocale");
}
public static XTextCursor createTextCursor(Object oCursorContainer)
@@ -312,7 +337,29 @@ public class TextDocument
// to make it really safe you must acquire the Tablenames before the insertion and after the insertion of the new Table. By comparing the
// two sequences of tablenames you can find out the tablename of the last inserted Table
-
+ // Todo: This method is unsecure because the last index is not necessarily the last section
+ public int getCharWidth(String ScaleString)
+ {
+ int iScale = 200;
+ xTextDocument.lockControllers();
+ int iScaleLen = ScaleString.length();
+ com.sun.star.text.XTextCursor xTextCursor = createTextCursor(xTextDocument.getText());
+ xTextCursor.gotoStart(false);
+ com.sun.star.wizards.common.Helper.setUnoPropertyValue(xTextCursor, "PageDescName", "First Page");
+ xTextCursor.setString(ScaleString);
+ XTextViewCursorSupplier xViewCursor = UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xTextDocument.getCurrentController());
+ XTextViewCursor xTextViewCursor = xViewCursor.getViewCursor();
+ xTextViewCursor.gotoStart(false);
+ int iFirstPos = xTextViewCursor.getPosition().X;
+ xTextViewCursor.gotoEnd(false);
+ int iLastPos = xTextViewCursor.getPosition().X;
+ iScale = (iLastPos - iFirstPos) / iScaleLen;
+ xTextCursor.gotoStart(false);
+ xTextCursor.gotoEnd(true);
+ xTextCursor.setString(PropertyNames.EMPTY_STRING);
+ unlockallControllers();
+ return iScale;
+ }
public void unlockallControllers()
{
@@ -322,13 +369,104 @@ public class TextDocument
}
}
+ public void refresh()
+ {
+ XRefreshable xRefreshable = UnoRuntime.queryInterface(XRefreshable.class, xTextDocument);
+ xRefreshable.refresh();
+ }
+ /**
+ * This method sets the Author of a Wizard-generated template correctly
+ * and adds a explanatory sentence to the template description.
+ * @param WizardName The name of the Wizard.
+ * @param TemplateDescription The old Description which is being appended with another sentence.
+ */
+ public void setWizardTemplateDocInfo(String WizardName, String TemplateDescription)
+ {
+ try
+ {
+ Object uD = Configuration.getConfigurationRoot(xMSF, "/org.openoffice.UserProfile/Data", false);
+ XNameAccess xNA = UnoRuntime.queryInterface(XNameAccess.class, uD);
+ Object gn = xNA.getByName("givenname");
+ Object sn = xNA.getByName("sn");
+ String fullname = gn + PropertyNames.SPACE + sn;
+
+ Calendar cal = new GregorianCalendar();
+ int year = cal.get(Calendar.YEAR);
+ int month = cal.get(Calendar.MONTH);
+ int day = cal.get(Calendar.DAY_OF_MONTH);
+ DateTime currentDate = new DateTime();
+ currentDate.Day = (short) day;
+ currentDate.Month = (short) month;
+ currentDate.Year = (short) year;
+ DateUtils du = new DateUtils(xMSF, this.xTextDocument);
+ int ff = du.getFormat(NumberFormatIndex.DATE_SYS_DDMMYY);
+ String myDate = du.format(ff, currentDate);
+
+ XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
+ XDocumentProperties xDocProps2 = xDocPropsSuppl.getDocumentProperties();
+ xDocProps2.setAuthor(fullname);
+ xDocProps2.setModifiedBy(fullname);
+ String description = xDocProps2.getDescription();
+ description = description + PropertyNames.SPACE + TemplateDescription;
+ description = JavaTools.replaceSubString(description, WizardName, "<wizard_name>");
+ description = JavaTools.replaceSubString(description, myDate, "<current_date>");
+ xDocProps2.setDescription(description);
+ }
+ catch (NoSuchElementException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ catch (WrappedTargetException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ catch (Exception e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ /**
+ * removes an arbitrary Object which supports the 'XTextContent' interface
+ * @param oTextContent
+ * @return
+ */
+ public boolean removeTextContent(Object oTextContent)
+ {
+ try
+ {
+ XTextContent xTextContent = UnoRuntime.queryInterface(XTextContent.class, oTextContent);
+ xText.removeTextContent(xTextContent);
+ return true;
+ }
+ catch (NoSuchElementException e)
+ {
+ e.printStackTrace(System.err);
+ return false;
+ }
+ }
-
-
-
-
+ /**
+ * Apparently there is no other way to get the
+ * page count of a text document other than using a cursor and
+ * making it jump to the last page...
+ * @param model the document model.
+ * @return the page count of the document.
+ */
+ public static int getPageCount(Object model)
+ {
+ XModel xModel = UnoRuntime.queryInterface(XModel.class, model);
+ XController xController = xModel.getCurrentController();
+ XTextViewCursorSupplier xTextVCS = UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController);
+ XTextViewCursor xTextVC = xTextVCS.getViewCursor();
+ XPageCursor xPC = UnoRuntime.queryInterface(XPageCursor.class, xTextVC);
+ xPC.jumpToLastPage();
+ return xPC.getPage();
+ }
/* Possible Values for "OptionString" are: "LoadCellStyles", "LoadTextStyles", "LoadFrameStyles",
"LoadPageStyles", "LoadNumberingStyles", "OverwriteStyles" */
diff --git a/wizards/com/sun/star/wizards/text/TextFieldHandler.java b/wizards/com/sun/star/wizards/text/TextFieldHandler.java
index ab6d018f86bc..66c818efc3ef 100644
--- a/wizards/com/sun/star/wizards/text/TextFieldHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextFieldHandler.java
@@ -45,11 +45,13 @@ import com.sun.star.wizards.common.PropertyNames;
public class TextFieldHandler
{
- private XTextFieldsSupplier xTextFieldsSupplier;
+ public XTextFieldsSupplier xTextFieldsSupplier;
private XMultiServiceFactory xMSFDoc;
/**
* Creates a new instance of TextFieldHandler
+ * @param xMSF
+ * @param xTextDocument
*/
public TextFieldHandler(XMultiServiceFactory xMSF, XTextDocument xTextDocument)
{
@@ -57,7 +59,7 @@ public class TextFieldHandler
xTextFieldsSupplier = UnoRuntime.queryInterface(XTextFieldsSupplier.class, xTextDocument);
}
- private void refreshTextFields()
+ public void refreshTextFields()
{
XRefreshable xUp = UnoRuntime.queryInterface(XRefreshable.class, xTextFieldsSupplier.getTextFields());
xUp.refresh();
@@ -111,7 +113,7 @@ public class TextFieldHandler
}
}
- private XPropertySet createUserField(String FieldName, String FieldTitle) throws com.sun.star.uno.Exception
+ public XPropertySet createUserField(String FieldName, String FieldTitle) throws com.sun.star.uno.Exception
{
Object oMaster = xMSFDoc.createInstance("com.sun.star.text.FieldMaster.User");
XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oMaster);
@@ -281,7 +283,35 @@ public class TextFieldHandler
}
}
+ public void removeUserFieldByContent(String _FieldContent)
+ {
+ XDependentTextField[] xDependentTextFields = getTextFieldsByProperty("Content", _FieldContent, "String");
+ if (xDependentTextFields != null)
+ {
+ for (int i = 0; i < xDependentTextFields.length; i++)
+ {
+ xDependentTextFields[i].dispose();
+ }
+ }
+ }
-
-
+ public void changeExtendedUserFieldContent(short UserDataPart, String _FieldContent)
+ {
+ try
+ {
+ XDependentTextField[] xDependentTextFields = getTextFieldsByProperty("UserDataType", new Short(UserDataPart), "Short");
+ if (xDependentTextFields != null)
+ {
+ for (int i = 0; i < xDependentTextFields.length; i++)
+ {
+ xDependentTextFields[i].getTextFieldMaster().setPropertyValue("Content", _FieldContent);
+ }
+ }
+ refreshTextFields();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ }
+ }
}
diff --git a/wizards/com/sun/star/wizards/text/TextSectionHandler.java b/wizards/com/sun/star/wizards/text/TextSectionHandler.java
index ddbe78a3f6c4..bdfea587ec24 100644
--- a/wizards/com/sun/star/wizards/text/TextSectionHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextSectionHandler.java
@@ -68,7 +68,11 @@ public class TextSectionHandler
}
}
-
+ public boolean hasTextSectionByName(String SectionName)
+ {
+ com.sun.star.container.XNameAccess xAllTextSections = xTextSectionsSupplier.getTextSections();
+ return xAllTextSections.hasByName(SectionName);
+ }
public void removeLastTextSection()
{
@@ -84,7 +88,7 @@ public class TextSectionHandler
}
}
- private void removeTextSection(Object _oTextSection)
+ public void removeTextSection(Object _oTextSection)
{
try
{
@@ -166,7 +170,18 @@ public class TextSectionHandler
}
}
-
+ public void breakLinkOfTextSection(Object oTextSection)
+ {
+ SectionFileLink oSectionLink = new SectionFileLink();
+ oSectionLink.FileURL = PropertyNames.EMPTY_STRING;
+ Helper.setUnoPropertyValues(oTextSection, new String[]
+ {
+ "FileLink", "LinkRegion"
+ }, new Object[]
+ {
+ oSectionLink, PropertyNames.EMPTY_STRING
+ });
+ }
public void linkSectiontoTemplate(String TemplateName, String SectionName)
{
@@ -181,7 +196,7 @@ public class TextSectionHandler
}
}
- private void linkSectiontoTemplate(Object oTextSection, String TemplateName, String SectionName)
+ public void linkSectiontoTemplate(Object oTextSection, String TemplateName, String SectionName)
{
SectionFileLink oSectionLink = new SectionFileLink();
oSectionLink.FileURL = TemplateName;
@@ -208,6 +223,7 @@ public class TextSectionHandler
{
XTextCursor xTextCursor = xText.createTextCursor();
xText.insertControlCharacter(xTextCursor, ControlCharacter.PARAGRAPH_BREAK, false);
+ // Helper.setUnoPropertyValue(xTextCursor, "PageDescName", "First Page");
xTextCursor.collapseToEnd();
}
XTextCursor xSecondTextCursor = xText.createTextCursor();
@@ -220,7 +236,7 @@ public class TextSectionHandler
}
}
- private void insertTextSection(String sectionName, String templateName, XTextCursor position)
+ public void insertTextSection(String sectionName, String templateName, XTextCursor position)
{
try
{
diff --git a/wizards/com/sun/star/wizards/text/TextStyleHandler.java b/wizards/com/sun/star/wizards/text/TextStyleHandler.java
index c36bdc670ef2..58e8584eb782 100644
--- a/wizards/com/sun/star/wizards/text/TextStyleHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextStyleHandler.java
@@ -34,7 +34,7 @@ public class TextStyleHandler
public XStyleFamiliesSupplier xStyleFamiliesSupplier;
/** Creates a new instance of TextStyleHandler */
- public TextStyleHandler(XTextDocument xTextDocument)
+ public TextStyleHandler(com.sun.star.lang.XMultiServiceFactory xMSF, XTextDocument xTextDocument)
{
xStyleFamiliesSupplier = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument);
}
diff --git a/wizards/com/sun/star/wizards/text/TextTableHandler.java b/wizards/com/sun/star/wizards/text/TextTableHandler.java
index 1020004ec853..bc37487274ad 100644
--- a/wizards/com/sun/star/wizards/text/TextTableHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextTableHandler.java
@@ -23,6 +23,7 @@ import com.sun.star.container.XNamed;
import com.sun.star.frame.XFrame;
import com.sun.star.lang.Locale;
import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.style.BreakType;
import com.sun.star.table.XCellRange;
import com.sun.star.text.XSimpleText;
import com.sun.star.text.XTextContent;
@@ -32,6 +33,7 @@ import com.sun.star.text.XTextTablesSupplier;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
import com.sun.star.util.XNumberFormatsSupplier;
import com.sun.star.view.XSelectionSupplier;
import com.sun.star.wizards.common.Desktop;
@@ -42,9 +44,9 @@ public class TextTableHandler
{
public XTextTablesSupplier xTextTablesSupplier;
- private XMultiServiceFactory xMSFDoc;
- private XTextDocument xTextDocument;
-
+ public XMultiServiceFactory xMSFDoc;
+ public XTextDocument xTextDocument;
+ public XSimpleText xSimpleText;
private NumberFormatter oNumberFormatter;
private Locale aCharLocale;
@@ -56,7 +58,7 @@ public class TextTableHandler
this.xMSFDoc = xMSF;
this.xTextDocument = xTextDocument;
xTextTablesSupplier = UnoRuntime.queryInterface(XTextTablesSupplier.class, xTextDocument);
- UnoRuntime.queryInterface(XSimpleText.class, xTextDocument.getText());
+ xSimpleText = UnoRuntime.queryInterface(XSimpleText.class, xTextDocument.getText());
XNumberFormatsSupplier xNumberFormatsSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
aCharLocale = (Locale) Helper.getUnoStructValue(xTextDocument, "CharLocale");
oNumberFormatter = new NumberFormatter(xNumberFormatsSupplier, aCharLocale);
@@ -107,7 +109,24 @@ public class TextTableHandler
}
}
-
+ public void insertTextTable(com.sun.star.text.XTextCursor xTextCursor)
+ {
+ try
+ {
+ com.sun.star.uno.XInterface xTextTable = (XInterface) xMSFDoc.createInstance("com.sun.star.text.TextTable");
+ XTextContent xTextContentTable = UnoRuntime.queryInterface(XTextContent.class, xTextTable);
+ if (xTextCursor == null)
+ {
+ xTextCursor = xTextDocument.getText().createTextCursor();
+ xTextCursor.gotoEnd(false);
+ }
+ xTextCursor.getText().insertTextContent(xTextCursor, xTextContentTable, false);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.err);
+ }
+ }
public void removeAllTextTables()
{
@@ -140,7 +159,7 @@ public class TextTableHandler
}
}
- private void removeTextTable(Object oTextTable)
+ public void removeTextTable(Object oTextTable)
{
try
{
@@ -187,7 +206,12 @@ public class TextTableHandler
}
}
-
+ public static BreakType resetBreakTypeofTextTable(Object oTextTable)
+ {
+ BreakType BreakValue = (BreakType) com.sun.star.wizards.common.Helper.getUnoStructValue(oTextTable, "BreakType");
+ Helper.setUnoPropertyValue(oTextTable, "BreakType", BreakType.NONE);
+ return BreakType.NONE;
+ }
public void adjustOptimalTableWidths(XMultiServiceFactory _xMSF, XTextTable xTextTable)
{
@@ -202,7 +226,7 @@ public class TextTableHandler
xSelection.select(xLocCellRange);
Desktop.dispatchURL(_xMSF, ".Uno:DistributeColumns", xFrame);
Desktop.dispatchURL(_xMSF, ".Uno:SetOptimalColumnWidth", xFrame);
- Helper.setUnoPropertyValue(xTextTable, "HoriOrient", Short.valueOf(iHoriOrient));
+ Helper.setUnoPropertyValue(xTextTable, "HoriOrient", new Short(iHoriOrient));
}
catch (Exception exception)
{
diff --git a/wizards/com/sun/star/wizards/text/ViewHandler.java b/wizards/com/sun/star/wizards/text/ViewHandler.java
index 0b3712e00c73..c0a92184b63f 100644
--- a/wizards/com/sun/star/wizards/text/ViewHandler.java
+++ b/wizards/com/sun/star/wizards/text/ViewHandler.java
@@ -23,6 +23,7 @@ import com.sun.star.container.XIndexAccess;
import com.sun.star.container.XNameAccess;
import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.style.XStyleFamiliesSupplier;
import com.sun.star.text.XPageCursor;
import com.sun.star.text.XTextContent;
@@ -43,7 +44,7 @@ public class ViewHandler
private XViewSettingsSupplier xViewSettingsSupplier;
/** Creates a new instance of View */
- public ViewHandler(XTextDocument xTextDocument)
+ public ViewHandler(XMultiServiceFactory xMSF, XTextDocument xTextDocument)
{
xTextViewCursorSupplier = UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xTextDocument.getCurrentController());
xViewSettingsSupplier = UnoRuntime.queryInterface(XViewSettingsSupplier.class, xTextDocument.getCurrentController());
diff --git a/wizards/com/sun/star/wizards/ui/AggregateComponent.java b/wizards/com/sun/star/wizards/ui/AggregateComponent.java
index 3fd52d29e210..5ce45963b124 100644
--- a/wizards/com/sun/star/wizards/ui/AggregateComponent.java
+++ b/wizards/com/sun/star/wizards/ui/AggregateComponent.java
@@ -21,6 +21,7 @@ import java.util.ArrayList;
import com.sun.star.awt.FontDescriptor;
import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.awt.XButton;
import com.sun.star.awt.XListBox;
import com.sun.star.beans.PropertyValue;
import com.sun.star.lang.EventObject;
@@ -37,36 +38,36 @@ import com.sun.star.wizards.db.QueryMetaData;
public class AggregateComponent extends ControlScroller
{
- private String[] sFunctions;
- private String[] sFunctionOperators = new String[]
+ String[] sFunctions;
+ String[] sFunctionOperators = new String[]
{
"SUM", "AVG", "MIN", "MAX"
};
- private QueryMetaData CurDBMetaData;
-
-
- private String soptDetailQuery;
- private String soptSummaryQuery;
- private String slblAggregate;
- private String slblFieldNames;
- private String sDuplicateAggregateFunction;
- private int Count;
-
- private final int SOADDROW = 1;
- private final int SOREMOVEROW = 2;
-
- private ArrayList<ControlRow> ControlRowVector;
-
-
-
-
-
-
-
-
-
- private int curHelpID;
- private int lastHelpIndex;
+ QueryMetaData CurDBMetaData;
+ XButton optDetailQuery;
+ XButton optSummaryQuery;
+ String soptDetailQuery;
+ String soptSummaryQuery;
+ String slblAggregate;
+ String slblFieldNames;
+ String sDuplicateAggregateFunction;
+ int Count;
+ int iQueryType;
+ final int SOADDROW = 1;
+ final int SOREMOVEROW = 2;
+ final int CONTROLROWDIST = 18;
+ ArrayList<ControlRow> ControlRowVector;
+ String OPTIONBUTTONDETAILQUERY_ITEM_CHANGED = "toggleComponent";
+ String OPTIONBUTTONSUMMARYQUERY_ITEM_CHANGED = "toggleComponent";
+ String LISTBOXFUNCTIONS_ACTION_PERFORMED;
+ String LISTBOXFUNCTIONS_ITEM_CHANGED;
+ String LISTBOXFIELDNAMES_ACTION_PERFORMED;
+ String LISTBOXFIELDNAMES_ITEM_CHANGED;
+ String COMMANDBUTTONPLUS_ACTION_PERFORMED = "addRow";
+ String COMMANDBUTTONMINUS_ACTION_PERFORMED = "removeRow";
+ ArrayList<String> ControlRows;
+ int curHelpID;
+ int lastHelpIndex;
/** Creates a new instance of AggrgateComponent */
public AggregateComponent(WizardDialog _CurUnoDialog, QueryMetaData _CurDBMetaData, int _iStep, int _iPosX, int _iPosY, int _iWidth, int _uitextfieldcount, int _firstHelpID)
@@ -77,24 +78,24 @@ public class AggregateComponent extends ControlScroller
curHelpID = _firstHelpID;
this.CurDBMetaData = _CurDBMetaData;
Count = 1;
- CurUnoDialog.insertRadioButton("optDetailQuery", 0, new ActionListenerImpl(),
+ optDetailQuery = CurUnoDialog.insertRadioButton("optDetailQuery", 0, new ActionListenerImpl(),
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- 8, HelpIds.getHelpIdString(curHelpID), soptDetailQuery, Integer.valueOf(_iPosX), Integer.valueOf(iCompPosY - 42), Short.valueOf((short) 1), IStep, Short.valueOf(curtabindex++), Integer.valueOf(iCompWidth)
+ 8, HelpIds.getHelpIdString(curHelpID), soptDetailQuery, new Integer(_iPosX), new Integer(iCompPosY - 42), new Short((short) 1), IStep, new Short(curtabindex++), new Integer(iCompWidth)
});
- CurUnoDialog.insertRadioButton("optSummaryQuery", 0, new ActionListenerImpl(),
+ optSummaryQuery = CurUnoDialog.insertRadioButton("optSummaryQuery", 0, new ActionListenerImpl(),
new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- 16, HelpIds.getHelpIdString(curHelpID + 1), soptSummaryQuery, Boolean.TRUE, Integer.valueOf(_iPosX), Integer.valueOf(iCompPosY - 32), IStep, Short.valueOf(curtabindex++), Integer.valueOf(iCompWidth)
+ 16, HelpIds.getHelpIdString(curHelpID + 1), soptSummaryQuery, Boolean.TRUE, new Integer(_iPosX), new Integer(iCompPosY - 32), IStep, new Short(curtabindex++), new Integer(iCompWidth)
});
CurUnoDialog.insertLabel("lblAggregate",
new String[]
@@ -103,7 +104,7 @@ public class AggregateComponent extends ControlScroller
},
new Object[]
{
- 8, slblAggregate, Integer.valueOf(iCompPosX + 5), Integer.valueOf(iCompPosY - 10), IStep, Short.valueOf(curtabindex++), 90
+ 8, slblAggregate, new Integer(iCompPosX + 5), new Integer(iCompPosY - 10), IStep, new Short(curtabindex++), 90
});
CurUnoDialog.insertLabel("lblFieldnames",
new String[]
@@ -112,7 +113,7 @@ public class AggregateComponent extends ControlScroller
},
new Object[]
{
- 8, slblFieldNames, Integer.valueOf(iCompPosX + 101), Integer.valueOf(iCompPosY - 10), IStep, Short.valueOf(curtabindex++), 90
+ 8, slblFieldNames, new Integer(iCompPosX + 101), new Integer(iCompPosY - 10), IStep, new Short(curtabindex++), 90
});
this.setTotalFieldCount(1);
FontDescriptor oFontDescriptor = new FontDescriptor();
@@ -127,7 +128,7 @@ public class AggregateComponent extends ControlScroller
},
new Object[]
{
- oFontDescriptor, 14, HelpIds.getHelpIdString(lastHelpIndex + 1), "+", Integer.valueOf(_iPosX + iCompWidth - 36), Integer.valueOf(iButtonPosY), IStep, Short.valueOf((curtabindex++)), 16
+ oFontDescriptor, 14, HelpIds.getHelpIdString(lastHelpIndex + 1), "+", new Integer(_iPosX + iCompWidth - 36), new Integer(iButtonPosY), IStep, new Short((curtabindex++)), 16
});
CurUnoDialog.insertButton("btnminus", SOREMOVEROW, new ActionListenerImpl(),
new String[]
@@ -136,7 +137,7 @@ public class AggregateComponent extends ControlScroller
},
new Object[]
{
- oFontDescriptor, 14, HelpIds.getHelpIdString(lastHelpIndex + 2), "-", Integer.valueOf(_iPosX + iCompWidth - 16), Integer.valueOf(iButtonPosY), IStep, Short.valueOf(curtabindex++), 16
+ oFontDescriptor, 14, HelpIds.getHelpIdString(lastHelpIndex + 2), "-", new Integer(_iPosX + iCompWidth - 16), new Integer(iButtonPosY), IStep, new Short(curtabindex++), 16
});
CurDBMetaData.Type = getQueryType();
}
@@ -158,7 +159,7 @@ public class AggregateComponent extends ControlScroller
}
}
- private class ActionListenerImpl implements com.sun.star.awt.XActionListener
+ class ActionListenerImpl implements com.sun.star.awt.XActionListener
{
public void disposing(EventObject eventObject)
@@ -197,7 +198,6 @@ public class AggregateComponent extends ControlScroller
return Count;
}
- @Override
protected void insertControlGroup(int i, int ypos)
{
if (i == 0)
@@ -220,7 +220,6 @@ public class AggregateComponent extends ControlScroller
ControlRowVector.add(oControlRow);
}
- @Override
protected void setControlGroupVisible(int _index, boolean _bIsVisible)
{
ControlRow oControlRow = ControlRowVector.get(_index);
@@ -231,7 +230,7 @@ public class AggregateComponent extends ControlScroller
}
}
- private void addRow()
+ protected void addRow()
{
int fieldcount = super.getTotalFieldCount();
registerControlGroupAtIndex(fieldcount);
@@ -253,7 +252,7 @@ public class AggregateComponent extends ControlScroller
CurUnoDialog.repaintDialogStep();
}
- private void removeRow()
+ protected void removeRow()
{
int fieldcount = super.getTotalFieldCount();
if (fieldcount > 0)
@@ -273,7 +272,7 @@ public class AggregateComponent extends ControlScroller
CurUnoDialog.repaintDialogStep();
}
- private void toggleButtons()
+ protected void toggleButtons()
{
ControlRow curcontrolrow = null;
boolean biscomplete = true;
@@ -289,7 +288,7 @@ public class AggregateComponent extends ControlScroller
togglefollowingDialogSteps();
}
- private void toggleComponent()
+ public void toggleComponent()
{
CurDBMetaData.Type = getQueryType();
boolean benableComponent = isAggregateComponentEnabled();
@@ -435,7 +434,6 @@ public class AggregateComponent extends ControlScroller
CurUnoDialog.repaintDialogStep();
}
- @Override
protected void initializeScrollFields()
{
ControlRow curControlRow;
@@ -506,14 +504,14 @@ public class AggregateComponent extends ControlScroller
}
}
- private class ControlRow
+ protected class ControlRow
{
private XListBox xFieldListBox;
private XListBox xFunctionListBox;
private int index;
- private ControlRow(int _index, int ypos, int _curHelpID)
+ protected ControlRow(int _index, int ypos, int _curHelpID)
{
try
{
@@ -525,7 +523,7 @@ public class AggregateComponent extends ControlScroller
},
new Object[]
{
- Boolean.TRUE, 12, HelpIds.getHelpIdString(_curHelpID++), Integer.valueOf(iCompPosX + 4), Integer.valueOf(ypos), UIConsts.INVISIBLESTEP, sFunctions, Short.valueOf(curtabindex++), 88
+ Boolean.TRUE, 12, HelpIds.getHelpIdString(_curHelpID++), new Integer(iCompPosX + 4), new Integer(ypos), UIConsts.INVISIBLESTEP, sFunctions, new Short(curtabindex++), 88
});
xFieldListBox = CurUnoDialog.insertListBox(getFieldsControlName(index), 1, null, new ItemListenerImpl(),
@@ -535,7 +533,7 @@ public class AggregateComponent extends ControlScroller
},
new Object[]
{
- Boolean.TRUE, 12, HelpIds.getHelpIdString(_curHelpID++), Integer.valueOf(iCompPosX + 98), Integer.valueOf(ypos), UIConsts.INVISIBLESTEP, Short.valueOf(curtabindex++), 86
+ Boolean.TRUE, 12, HelpIds.getHelpIdString(_curHelpID++), new Integer(iCompPosX + 98), new Integer(ypos), UIConsts.INVISIBLESTEP, new Short(curtabindex++), 86
});
lastHelpIndex = _curHelpID - 1;
}
@@ -569,7 +567,7 @@ public class AggregateComponent extends ControlScroller
UnoDialog.deselectListBox(xFunctionListBox);
}
- private class ItemListenerImpl implements com.sun.star.awt.XItemListener
+ protected class ItemListenerImpl implements com.sun.star.awt.XItemListener
{
public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject)
diff --git a/wizards/com/sun/star/wizards/ui/ButtonList.java b/wizards/com/sun/star/wizards/ui/ButtonList.java
index fee21ebc229a..f80d601e6384 100644
--- a/wizards/com/sun/star/wizards/ui/ButtonList.java
+++ b/wizards/com/sun/star/wizards/ui/ButtonList.java
@@ -33,6 +33,7 @@ import com.sun.star.wizards.common.IRenderer;
import com.sun.star.wizards.common.PropertySetHelper;
import com.sun.star.wizards.common.PropertyNames;
import javax.swing.ListModel;
+import javax.swing.event.ListDataEvent;
import com.sun.star.wizards.common.HelpIds;
public class ButtonList implements XItemEventBroadcaster, XActionListener
@@ -57,14 +58,14 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
private int imageTextLines = 1;
private boolean rowSelect = false;
public int tabIndex;
-
+ public Boolean scaleImages = Boolean.TRUE;
private String m_aControlName = "il";
private int m_nCurrentSelection = -1;
private int pageStart = 0;
public int helpURL = 0;
private IImageRenderer renderer;
private ListModel listModel;
- private IRenderer counterRenderer = new SimpleCounterRenderer();
+ public IRenderer counterRenderer = new SimpleCounterRenderer();
private final static int LINE_HEIGHT = 8;
/** Getter for property m_aButtonSize.
@@ -165,7 +166,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
Integer.valueOf(pos.Width + (m_aButtonSize.Width + gap.Width) * cols + gap.Width - btnSize.intValue() + 1),
Integer.valueOf(pos.Height + (m_aButtonSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1),
step,
- Short.valueOf((short) (tabIndex + 2)),
+ new Short((short) (tabIndex + 2)),
Boolean.TRUE,
btnSize
});
@@ -182,14 +183,14 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
Integer.valueOf(cols * (m_aButtonSize.Width + gap.Width) + gap.Width - 2 * btnSize.intValue() - 1)
});
- Helper.setUnoPropertyValue(getModel(lblCounter), PropertyNames.PROPERTY_ALIGN, Short.valueOf((short) 1));
+ Helper.setUnoPropertyValue(getModel(lblCounter), PropertyNames.PROPERTY_ALIGN, new Short((short) 1));
Helper.setUnoPropertyValue(getModel(btnBack), PropertyNames.PROPERTY_LABEL, "<");
Helper.setUnoPropertyValue(getModel(btnNext), PropertyNames.PROPERTY_LABEL, ">");
}
- m_tabIndex = Short.valueOf((short) tabIndex);
+ m_tabIndex = new Short((short) tabIndex);
m_aButtons = new XControl[rows * cols];
@@ -356,7 +357,28 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
return pageStart + i;
}
+ public void contentsChanged(ListDataEvent event)
+ {
+ }
+ public void intervalAdded(ListDataEvent event)
+ {
+ if (event.getIndex0() <= m_nCurrentSelection)
+ {
+ if (event.getIndex1() <= m_nCurrentSelection)
+ {
+ m_nCurrentSelection += event.getIndex1() - event.getIndex0() + 1;
+ }
+ }
+ if (event.getIndex0() < pageStart || event.getIndex1() < (pageStart + getRows() + getCols()))
+ {
+ refreshImages();
+ }
+ }
+
+ public void intervalRemoved(ListDataEvent event)
+ {
+ }
/** Registers ItemListener to receive events.
* @param listener The listener to register.
@@ -461,21 +483,33 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
cols = i;
}
+ /**
+ * @param size
+ */
public void setGap(Size size)
{
gap = size;
}
+ /**
+ * @param model
+ */
public void setListModel(ListModel model)
{
listModel = model;
}
+ /**
+ * @param short1
+ */
public void setStep(Short short1)
{
step = short1;
}
+ /**
+ * @param i
+ */
public void setPageStart(int i)
{
if (i == pageStart)
@@ -487,21 +521,33 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
refreshImages();
}
+ /**
+ * @param _size
+ */
public void setPos(Size _size)
{
pos = _size;
}
+ /**
+ * @param _renderer
+ */
public void setRenderer(IImageRenderer _renderer)
{
this.renderer = _renderer;
}
+ /**
+ * @param i
+ */
public void setRows(int i)
{
rows = i;
}
+ /**
+ * @param i
+ */
public void setSelected(int i)
{
if (rowSelect && (i >= 0))
@@ -529,19 +575,43 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
Helper.setUnoPropertyValue(getModel(lblImageText), PropertyNames.PROPERTY_LABEL, sText);
}
+ /**
+ * @param size
+ */
public void setSelectionGap(Size size)
{
selectionGap = size;
}
+ /**
+ * @param b
+ */
public void setShowButtons(boolean b)
{
showButtons = b;
}
+ public void nextPage()
+ {
+ if (pageStart < getListModel().getSize() - rows * cols)
+ {
+ setPageStart(pageStart + rows * cols);
+ }
+ }
-
-
+ public void prevPage()
+ {
+ if (pageStart == 0)
+ {
+ return;
+ }
+ int i = pageStart - rows * cols;
+ if (i < 0)
+ {
+ i = 0;
+ }
+ setPageStart(i);
+ }
private void enableButtons()
{
@@ -568,14 +638,15 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
}
- public interface IImageRenderer extends IRenderer
+ public static interface IImageRenderer extends IRenderer
{
/**
+ * @param listItem
* @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);
+ public Object[] getImageUrls(Object listItem);
}
private static class SimpleCounterRenderer implements IRenderer
@@ -587,12 +658,12 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
}
}
- private static class Counter
+ public static class Counter
{
- private int start, end, max;
+ public int start, end, max;
- private Counter(int start_, int end_, int max_)
+ public Counter(int start_, int end_, int max_)
{
start = start_;
end = end_;
@@ -617,13 +688,26 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
}
-
+ /**
+ * jump to the given item (display the screen
+ * that contains the given item).
+ * @param i
+ */
+ public void display(int i)
+ {
+ int is = (getCols() * getRows());
+ int ps = (listModel.getSize() / is) * is;
+ setPageStart(ps);
+ }
public boolean isenabled()
{
return benabled;
}
+ /**
+ * @param b
+ */
public void setenabled(boolean b)
{
@@ -670,6 +754,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
/**
* implementation of XActionListener
* will call if a button from the m_aButtonList is pressed.
+ * @param actionEvent
*/
public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent)
{
diff --git a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java
index 3ffeb19bc4b7..80b5b9c3ae03 100644
--- a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java
+++ b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java
@@ -44,7 +44,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator<
private WizardDialog oWizardDialog;
private Collator aCollator = null;
- private class ItemListenerImpl implements com.sun.star.awt.XItemListener
+ class ItemListenerImpl implements com.sun.star.awt.XItemListener
{
public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject)
@@ -72,6 +72,15 @@ public class CommandFieldSelection extends FieldSelection implements Comparator<
/**
* instantiates a CommandFieldSelection with a preselected command
+ * @param _CurUnoDialog
+ * @param _CurDBMetaData
+ * @param iStep
+ * @param _iHeight
+ * @param _reslblFields
+ * @param _reslblSelFields
+ * @param _reslblTables
+ * @param _bgetQueries
+ * @param _ifirstHID
*/
public CommandFieldSelection(WizardDialog _CurUnoDialog, CommandMetaData _CurDBMetaData, int iStep, int _iHeight, String _reslblFields, String _reslblSelFields, String _reslblTables, boolean _bgetQueries, int _ifirstHID)
{
@@ -82,6 +91,14 @@ public class CommandFieldSelection extends FieldSelection implements Comparator<
/**
* instantiates a CommandFieldSelection with a preselected command
+ * @param _CurUnoDialog
+ * @param _CurDBMetaData
+ * @param _iHeight
+ * @param _reslblFields
+ * @param _reslblSelFields
+ * @param _reslblTables
+ * @param _bgetQueries
+ * @param _ifirstHID
*/
public CommandFieldSelection(UnoDialog _CurUnoDialog, CommandMetaData _CurDBMetaData, int _iHeight, String _reslblFields, String _reslblSelFields, String _reslblTables, boolean _bgetQueries, int _ifirstHID)
{
@@ -102,7 +119,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator<
sTableListBoxName = "lstTables_" + super.sIncSuffix;
sTablePrefix = getTablePrefix();
sQueryPrefix = getQueryPrefix();
- Integer LabelWidth = Integer.valueOf(getListboxWidth().intValue() + 6);
+ Integer LabelWidth = new Integer(getListboxWidth().intValue() + 6);
// Label 'Tables or Queries'
xlblTable = CurUnoDialog.insertLabel(sTableLabelName,
new String[]
@@ -111,7 +128,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator<
},
new Object[]
{
- Boolean.FALSE, 8, _reslblTables, 95, 27, IStep, Short.valueOf((short) 3), LabelWidth
+ Boolean.FALSE, 8, _reslblTables, 95, 27, IStep, new Short((short) 3), LabelWidth
});
// DropDown Listbox TableNames
xTableListBox = CurUnoDialog.insertListBox(sTableListBoxName, 0, null, new ItemListenerImpl(),
@@ -121,7 +138,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator<
},
new Object[]
{
- Boolean.TRUE, Boolean.FALSE, 12, HelpIds.getHelpIdString(super.FirstHelpIndex - 1), Short.valueOf(UnoDialog.getListBoxLineCount()), 95, 37, IStep, Short.valueOf((short) 4), getListboxWidth()
+ Boolean.TRUE, Boolean.FALSE, 12, HelpIds.getHelpIdString(super.FirstHelpIndex - 1), new Short(UnoDialog.getListBoxLineCount()), 95, 37, IStep, new Short((short) 4), getListboxWidth()
});
fillupCommandListBox();
}
@@ -192,7 +209,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator<
}
}
- private void fillUpFieldsListbox()
+ public void fillUpFieldsListbox()
{
try
{
@@ -205,7 +222,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator<
{
curCommandName = sSelectedTableName; // sLocList[iSelPos];
CurDBMetaData.setTableByName(curCommandName);
- binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.TABLE);
+ binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.TABLE, AppendMode);
}
else
{
@@ -214,14 +231,14 @@ public class CommandFieldSelection extends FieldSelection implements Comparator<
CurDBMetaData.setCommandType(CommandType.TABLE);
curCommandName = JavaTools.replaceSubString(sSelectedTableName, PropertyNames.EMPTY_STRING, sTablePrefix);
CurDBMetaData.setTableByName(curCommandName);
- binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.TABLE);
+ binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.TABLE, AppendMode);
}
else
{
CurDBMetaData.setCommandType(CommandType.QUERY);
curCommandName = JavaTools.replaceSubString(sSelectedTableName, PropertyNames.EMPTY_STRING, sQueryPrefix);
CurDBMetaData.setQueryByName(curCommandName);
- binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.QUERY);
+ binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.QUERY, AppendMode);
}
}
if (binitialize)
@@ -330,7 +347,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator<
toggleCommandListBox(bdoenable);
}
- private void toggleCommandListBox(boolean _bdoenable)
+ public void toggleCommandListBox(boolean _bdoenable)
{
Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bdoenable));
Helper.setUnoPropertyValue(UnoDialog.getModel(xlblTable), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bdoenable));
@@ -386,7 +403,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator<
}
}
- private void preselectCommand(String _selitem, int _nCommandType, boolean _bReadOnly)
+ public void preselectCommand(String _selitem, int _nCommandType, boolean _bReadOnly)
{
if (_selitem.length() > 0)
{
diff --git a/wizards/com/sun/star/wizards/ui/ControlScroller.java b/wizards/com/sun/star/wizards/ui/ControlScroller.java
index fba70c444c78..7c2193fb6e70 100644
--- a/wizards/com/sun/star/wizards/ui/ControlScroller.java
+++ b/wizards/com/sun/star/wizards/ui/ControlScroller.java
@@ -28,35 +28,35 @@ public abstract class ControlScroller
{
protected WizardDialog CurUnoDialog;
-
+ protected XMultiServiceFactory xMSF;
protected int ncurfieldcount;
- private int nblockincrement;
+ protected int nblockincrement;
private int nlineincrement;
- private int nscrollvalue = 0;
- private int ntotfieldcount;
- private XScrollBar xScrollBar;
- private ArrayList<PropertyValue[]> scrollfields;
-
+ protected int nscrollvalue = 0;
+ protected int ntotfieldcount;
+ XScrollBar xScrollBar;
+ protected ArrayList<PropertyValue[]> scrollfields;
+ protected Integer ICompPosX;
protected int iCompPosX;
-
+ protected Integer ICompPosY;
protected int iCompPosY;
-
+ protected Integer ICompWidth;
protected int iCompWidth;
-
+ protected Integer ICompHeight;
protected int iCompHeight;
- private int iStartPosY;
+ protected int iStartPosY;
protected short curtabindex;
- private int iStep;
+ int iStep;
protected Integer IStep;
- private int linedistance;
+ protected int linedistance;
int iScrollBarWidth = 10;
- private int SORELFIRSTPOSY = 3;
+ int SORELFIRSTPOSY = 3;
protected int curHelpIndex;
- private String sIncSuffix;
+ String sIncSuffix;
protected ArrayList<Object> ControlGroupVector = new ArrayList<Object>();
+ protected PeerConfig oTitlePeerConfig;
-
- private class AdjustmentListenerImpl implements com.sun.star.awt.XAdjustmentListener
+ class AdjustmentListenerImpl implements com.sun.star.awt.XAdjustmentListener
{
public void disposing(com.sun.star.lang.EventObject eventObject)
@@ -82,16 +82,20 @@ public abstract class ControlScroller
// TODO add parameters for tabindices and helpindex
protected ControlScroller(WizardDialog _CurUnoDialog, XMultiServiceFactory _xMSF, int _iStep, int _iCompPosX, int _iCompPosY, int _iCompWidth, int _nblockincrement, int _nlinedistance, int _firsthelpindex)
{
+ this.xMSF = _xMSF;
this.nblockincrement = _nblockincrement;
this.CurUnoDialog = _CurUnoDialog;
this.iStep = _iStep;
this.curHelpIndex = _firsthelpindex;
curtabindex = UnoDialog.setInitialTabindex(iStep);
this.linedistance = _nlinedistance;
- IStep = Integer.valueOf(iStep);
+ IStep = new Integer(iStep);
this.iCompPosX = _iCompPosX;
this.iCompPosY = _iCompPosY;
+ this.ICompPosX = new Integer(iCompPosX);
+ this.ICompPosY = new Integer(iCompPosY);
this.iCompWidth = _iCompWidth;
+ this.ICompWidth = new Integer(iCompWidth);
this.iCompHeight = 2 * SORELFIRSTPOSY + nblockincrement * linedistance;
iStartPosY = iCompPosY + SORELFIRSTPOSY;
int ScrollHeight = iCompHeight - 2;
@@ -105,7 +109,7 @@ public abstract class ControlScroller
},
new Object[]
{
- Short.valueOf((short) 0), Boolean.TRUE, Integer.valueOf(ScrollHeight), HelpIds.getHelpIdString(curHelpIndex), Integer.valueOf(ScrollBarOrientation.VERTICAL), Integer.valueOf(iCompPosX + iCompWidth - iScrollBarWidth - 1), Integer.valueOf(iCompPosY + 1), IStep, Integer.valueOf(iScrollBarWidth)
+ new Short((short) 0), Boolean.TRUE, new Integer(ScrollHeight), HelpIds.getHelpIdString(curHelpIndex), new Integer(ScrollBarOrientation.VERTICAL), new Integer(iCompPosX + iCompWidth - iScrollBarWidth - 1), new Integer(iCompPosY + 1), IStep, new Integer(iScrollBarWidth)
});
scrollfields = new ArrayList<PropertyValue[]>();
int ypos = iStartPosY + SORELFIRSTPOSY;
@@ -116,7 +120,10 @@ public abstract class ControlScroller
}
}
-
+ protected void setScrollBarOrientationHorizontal()
+ {
+ Helper.setUnoPropertyValue(xScrollBar, PropertyNames.ORIENTATION, new Integer(ScrollBarOrientation.HORIZONTAL));
+ }
/**
* @param _ntotfieldcount The number of fields that are to be administered by the ControlScroller
@@ -128,7 +135,7 @@ public abstract class ControlScroller
ntotfieldcount = _ntotfieldcount;
setCurFieldCount();
nscrollvalue = 0;
- Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), "ScrollValue", Integer.valueOf(nscrollvalue));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), "ScrollValue", new Integer(nscrollvalue));
if (ntotfieldcount > nblockincrement)
{
Helper.setUnoPropertyValues(UnoDialog.getModel(xScrollBar), new String[]
@@ -136,7 +143,7 @@ public abstract class ControlScroller
PropertyNames.PROPERTY_ENABLED, "BlockIncrement", "LineIncrement", "ScrollValue", "ScrollValueMax"
}, new Object[]
{
- Boolean.TRUE, Integer.valueOf(nblockincrement), Integer.valueOf(nlineincrement), Integer.valueOf(nscrollvalue), Integer.valueOf(ntotfieldcount - nblockincrement)
+ Boolean.TRUE, new Integer(nblockincrement), new Integer(nlineincrement), new Integer(nscrollvalue), new Integer(ntotfieldcount - nblockincrement)
});
}
else
@@ -146,7 +153,7 @@ public abstract class ControlScroller
PropertyNames.PROPERTY_ENABLED, "ScrollValue"
}, new Object[]
{
- Boolean.FALSE, Integer.valueOf(nscrollvalue)
+ Boolean.FALSE, new Integer(nscrollvalue)
});
}
fillupControls(true);
@@ -157,7 +164,7 @@ public abstract class ControlScroller
}
}
- private void fillupControls(boolean binitialize)
+ protected void fillupControls(boolean binitialize)
{
for (int a = 0; a < this.nblockincrement; a++)
{
@@ -176,7 +183,7 @@ public abstract class ControlScroller
}
}
- private void fillupControls(int guiRow)
+ protected void fillupControls(int guiRow)
{
PropertyValue[] nameProps = scrollfields.get(guiRow);
PropertyValue[] valueProps = scrollfields.get(guiRow + nscrollvalue);
@@ -193,11 +200,11 @@ public abstract class ControlScroller
}
}
- private void setScrollValue(int _nscrollvalue)
+ protected void setScrollValue(int _nscrollvalue)
{
if (_nscrollvalue >= 0)
{
- Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), "ScrollValue", Integer.valueOf(_nscrollvalue));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), "ScrollValue", new Integer(_nscrollvalue));
scrollControls();
}
}
@@ -241,7 +248,7 @@ public abstract class ControlScroller
PropertyNames.PROPERTY_ENABLED, "ScrollValueMax"
}, new Object[]
{
- Boolean.TRUE, Integer.valueOf(ntotfieldcount - nblockincrement)
+ Boolean.TRUE, new Integer(ntotfieldcount - nblockincrement)
});
}
else
@@ -275,11 +282,29 @@ public abstract class ControlScroller
return nscrollvalue;
}
+ protected void setLineIncrementation(int _nlineincrement)
+ {
+ this.nlineincrement = _nlineincrement;
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), "LineIncrement", new Integer(nlineincrement));
+ }
+ protected int getLineIncrementation()
+ {
+ return nlineincrement;
+ }
-
-
+ protected void setBlockIncrementation(int _nblockincrement)
+ {
+ this.nblockincrement = _nblockincrement;
+ Helper.setUnoPropertyValues(UnoDialog.getModel(xScrollBar), new String[]
+ {
+ PropertyNames.PROPERTY_ENABLED, "BlockIncrement", "ScrollValueMax"
+ }, new Object[]
+ {
+ Boolean.valueOf(ntotfieldcount > nblockincrement), new Integer(nblockincrement), new Integer(ntotfieldcount - nblockincrement)
+ });
+ }
protected int getBlockIncrementation()
{
@@ -304,7 +329,7 @@ public abstract class ControlScroller
}
}
- private void scrollRowsInfo()
+ protected void scrollRowsInfo()
{
int cols =
scrollfields.size() > 0
@@ -327,7 +352,7 @@ public abstract class ControlScroller
* @return the propertyValue object corresponding to
* this control.
*/
- private PropertyValue fieldInfo(int guiRow, int column)
+ protected PropertyValue fieldInfo(int guiRow, int column)
{
if (guiRow + nscrollvalue < scrollfields.size())
{
@@ -341,7 +366,7 @@ public abstract class ControlScroller
}
}
- private PropertyValue fieldInfo(PropertyValue valueProp, PropertyValue nameProp)
+ protected PropertyValue fieldInfo(PropertyValue valueProp, PropertyValue nameProp)
{
if (CurUnoDialog.getDlgNameAccess().hasByName(nameProp.Name))
{
@@ -375,9 +400,12 @@ public abstract class ControlScroller
}
}
+ protected PropertyValue[] getControlGroupInfo(int _i)
+ {
+ return scrollfields.get(_i);
+ }
-
- private void setControlData(String controlname, Object newvalue)
+ protected void setControlData(String controlname, Object newvalue)
{
Object oControlModel = UnoDialog.getModel(CurUnoDialog.xDlgContainer.getControl(controlname));
String propertyname = UnoDialog.getDisplayProperty(oControlModel);
@@ -387,7 +415,7 @@ public abstract class ControlScroller
}
}
- private Object getControlData(String controlname)
+ protected Object getControlData(String controlname)
{
Object oControlModel = UnoDialog.getModel(CurUnoDialog.xDlgContainer.getControl(controlname));
String propertyname = UnoDialog.getDisplayProperty(oControlModel);
diff --git a/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java b/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java
index b9946e21a003..ce2d5383de40 100644
--- a/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java
+++ b/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java
@@ -18,6 +18,7 @@
package com.sun.star.wizards.ui;
import com.sun.star.awt.XListBox;
+import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.wizards.common.Helper;
import com.sun.star.wizards.common.JavaTools;
import com.sun.star.wizards.common.PropertyNames;
@@ -29,28 +30,32 @@ import com.sun.star.wizards.common.PropertyNames;
public abstract class DBLimitedFieldSelection
{
-
+ protected XMultiServiceFactory xMSF;
protected WizardDialog CurUnoDialog;
- private String sNoField;
+ protected String sNoField;
protected Integer IStep;
-
-
-
+ protected Integer ICompPosX;
+ protected Integer ICompPosY;
+ protected Integer ICompWidth;
protected final int rowcount = 4;
- private final int MAXSELINDEX = rowcount - 1;
+ protected final int MAXSELINDEX = rowcount - 1;
protected short curtabindex;
protected int iCurPosY;
protected int FirstHelpIndex;
- private int iCompPosX;
+ protected int iCompPosX;
public DBLimitedFieldSelection(WizardDialog _CurUnoDialog, int iStep, int _iCompPosX, int iCompPosY, int iCompWidth, int _FirstHelpIndex)
{
this.CurUnoDialog = _CurUnoDialog;
+ xMSF = CurUnoDialog.xMSF;
FirstHelpIndex = _FirstHelpIndex;
curtabindex = (short) (iStep * 100);
sNoField = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 8);
- IStep = Integer.valueOf(iStep);
+ IStep = new Integer(iStep);
iCompPosX = _iCompPosX;
+ ICompPosX = new Integer(iCompPosX);
+ ICompPosY = new Integer(iCompPosY);
+ ICompWidth = new Integer(iCompWidth);
iCurPosY = iCompPosY;
for (int i = 0; i < rowcount; i++)
{
@@ -123,6 +128,14 @@ public abstract class DBLimitedFieldSelection
}
+ protected void initializeListBox(XListBox xListBox, String[] _AllFieldNames, String _SelFieldName)
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), PropertyNames.STRING_ITEM_LIST, _AllFieldNames);
+ short[] SelList = null;
+ int index = JavaTools.FieldInList(_AllFieldNames, _SelFieldName);
+ SelList = new short[] { (short) (index) };
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), PropertyNames.SELECTED_ITEMS, SelList);
+ }
}
diff --git a/wizards/com/sun/star/wizards/ui/FieldSelection.java b/wizards/com/sun/star/wizards/ui/FieldSelection.java
index fec46db6ea71..db28aaa78331 100644
--- a/wizards/com/sun/star/wizards/ui/FieldSelection.java
+++ b/wizards/com/sun/star/wizards/ui/FieldSelection.java
@@ -35,10 +35,10 @@ public class FieldSelection
protected boolean AppendMode = false;
protected Integer IStep;
-
- private int CompPosY;
- private int CompHeight;
-
+ protected int CompPosX;
+ protected int CompPosY;
+ protected int CompHeight;
+ protected int CompWidth;
private XFieldSelectionListener xFieldSelection;
private int maxfieldcount = 10000000;
@@ -59,7 +59,7 @@ public class FieldSelection
private final static int SOSELFLDSLST = 8;
- private class ItemListenerImpl implements com.sun.star.awt.XItemListener
+ class ItemListenerImpl implements com.sun.star.awt.XItemListener
{
public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject)
@@ -87,7 +87,7 @@ public class FieldSelection
}
}
- private class ActionListenerImpl implements com.sun.star.awt.XActionListener
+ class ActionListenerImpl implements com.sun.star.awt.XActionListener
{
public void disposing(com.sun.star.lang.EventObject eventObject)
@@ -174,8 +174,10 @@ public class FieldSelection
int ShiftButtonCount = 2;
int a = 0;
this.CurUnoDialog = CurUnoDialog;
+ this.CompPosX = CompPosX;
this.CompPosY = CompPosY;
this.CompHeight = CompHeight;
+ this.CompWidth = CompWidth;
Object btnmoveall = null;
Object btnremoveall = null;
@@ -184,22 +186,22 @@ public class FieldSelection
final int lblHeight = 8;
final int lblVertiDist = 2;
- ListBoxWidth = Integer.valueOf(((CompWidth - 3 * cmdButtonHoriDist - 2 * cmdButtonWidth) / 2));
- Integer cmdShiftButtonPosX = Integer.valueOf((CompPosX + ListBoxWidth.intValue() + cmdButtonHoriDist));
- Integer ListBoxPosY = Integer.valueOf(CompPosY + lblVertiDist + lblHeight);
- Integer ListBoxHeight = Integer.valueOf(CompHeight - 8 - 2);
- SelListBoxPosX = Integer.valueOf(cmdShiftButtonPosX.intValue() + cmdButtonWidth + cmdButtonHoriDist);
+ ListBoxWidth = new Integer(((CompWidth - 3 * cmdButtonHoriDist - 2 * cmdButtonWidth) / 2));
+ Integer cmdShiftButtonPosX = new Integer((CompPosX + ListBoxWidth.intValue() + cmdButtonHoriDist));
+ Integer ListBoxPosY = new Integer(CompPosY + lblVertiDist + lblHeight);
+ Integer ListBoxHeight = new Integer(CompHeight - 8 - 2);
+ SelListBoxPosX = new Integer(cmdShiftButtonPosX.intValue() + cmdButtonWidth + cmdButtonHoriDist);
- IStep = Integer.valueOf(_iStep);
+ IStep = new Integer(_iStep);
if (bshowFourButtons)
{
ShiftButtonCount = 4;
}
Integer[] ShiftButtonPosY = getYButtonPositions(ShiftButtonCount);
Integer[] MoveButtonPosY = getYButtonPositions(2);
- Integer cmdMoveButtonPosX = Integer.valueOf(SelListBoxPosX.intValue() + ListBoxWidth.intValue() + cmdButtonHoriDist);
+ Integer cmdMoveButtonPosX = new Integer(SelListBoxPosX.intValue() + ListBoxWidth.intValue() + cmdButtonHoriDist);
- Integer CmdButtonWidth = Integer.valueOf(cmdButtonWidth);
+ Integer CmdButtonWidth = new Integer(cmdButtonWidth);
sIncSuffix = "_" + com.sun.star.wizards.common.Desktop.getIncrementSuffix(CurUnoDialog.getDlgNameAccess(), "lblFields_");
@@ -211,7 +213,7 @@ public class FieldSelection
},
new Object[]
{
- 8, slblFields, Integer.valueOf(CompPosX), Integer.valueOf(CompPosY), IStep, Short.valueOf(curtabindex), 109
+ 8, slblFields, new Integer(CompPosX), new Integer(CompPosY), IStep, new Short(curtabindex), 109
});
// Listbox 'Available fields'
@@ -222,7 +224,7 @@ public class FieldSelection
},
new Object[]
{
- ListBoxHeight, HelpIds.getHelpIdString(_FirstHelpIndex), Boolean.TRUE, Integer.valueOf(CompPosX), ListBoxPosY, IStep, Short.valueOf((curtabindex++)), ListBoxWidth
+ ListBoxHeight, HelpIds.getHelpIdString(_FirstHelpIndex), Boolean.TRUE, new Integer(CompPosX), ListBoxPosY, IStep, new Short((curtabindex++)), ListBoxWidth
});
Object btnmoveselected = CurUnoDialog.insertButton("cmdMoveSelected" + sIncSuffix, SOCMDMOVESEL, new ActionListenerImpl(),
@@ -232,7 +234,7 @@ public class FieldSelection
},
new Object[]
{
- Boolean.FALSE, 14, HelpIds.getHelpIdString(_FirstHelpIndex + 1), ">", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, Short.valueOf(curtabindex++), CmdButtonWidth
+ Boolean.FALSE, 14, HelpIds.getHelpIdString(_FirstHelpIndex + 1), ">", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth
});
if (bshowFourButtons)
@@ -244,7 +246,7 @@ public class FieldSelection
},
new Object[]
{
- 14, HelpIds.getHelpIdString(_FirstHelpIndex + 2), ">>", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, Short.valueOf(curtabindex++), CmdButtonWidth
+ 14, HelpIds.getHelpIdString(_FirstHelpIndex + 2), ">>", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth
});
}
Object btnremoveselected = CurUnoDialog.insertButton("cmdRemoveSelected" + sIncSuffix, SOCMDREMOVESEL, new ActionListenerImpl(),
@@ -254,7 +256,7 @@ public class FieldSelection
},
new Object[]
{
- Boolean.FALSE, 14, HelpIds.getHelpIdString(_FirstHelpIndex + 3), "<", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, Short.valueOf(curtabindex++), CmdButtonWidth
+ Boolean.FALSE, 14, HelpIds.getHelpIdString(_FirstHelpIndex + 3), "<", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth
});
if (bshowFourButtons)
@@ -266,7 +268,7 @@ public class FieldSelection
},
new Object[]
{
- 14, HelpIds.getHelpIdString(_FirstHelpIndex + 4), "<<", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, Short.valueOf(curtabindex++), CmdButtonWidth
+ 14, HelpIds.getHelpIdString(_FirstHelpIndex + 4), "<<", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth
});
}
@@ -281,7 +283,7 @@ public class FieldSelection
},
new Object[]
{
- 8, slblSelFields, SelListBoxPosX, Integer.valueOf(CompPosY), IStep, Short.valueOf(curtabindex++), ListBoxWidth
+ 8, slblSelFields, SelListBoxPosX, new Integer(CompPosY), IStep, new Short(curtabindex++), ListBoxWidth
});
// ListBox 'Fields in the form'
@@ -292,7 +294,7 @@ public class FieldSelection
},
new Object[]
{
- ListBoxHeight, HelpIds.getHelpIdString(_FirstHelpIndex + 5), Boolean.TRUE, SelListBoxPosX, ListBoxPosY, IStep, Short.valueOf(curtabindex++), ListBoxWidth
+ ListBoxHeight, HelpIds.getHelpIdString(_FirstHelpIndex + 5), Boolean.TRUE, SelListBoxPosX, ListBoxPosY, IStep, new Short(curtabindex++), ListBoxWidth
});
Object btnmoveup = CurUnoDialog.insertButton("cmdMoveUp" + sIncSuffix, SOCMDMOVEUP, new ActionListenerImpl(),
@@ -302,7 +304,7 @@ public class FieldSelection
},
new Object[]
{
- Boolean.FALSE, oFontDesc, 14, HelpIds.getHelpIdString(_FirstHelpIndex + 6), String.valueOf((char) 8743), cmdMoveButtonPosX, MoveButtonPosY[0], IStep, Short.valueOf(curtabindex++), CmdButtonWidth
+ Boolean.FALSE, oFontDesc, 14, HelpIds.getHelpIdString(_FirstHelpIndex + 6), String.valueOf((char) 8743), cmdMoveButtonPosX, MoveButtonPosY[0], IStep, new Short(curtabindex++), CmdButtonWidth
});
Object btnmovedown = CurUnoDialog.insertButton("cmdMoveDown" + sIncSuffix, SOCMDMOVEDOWN, new ActionListenerImpl(),
@@ -312,7 +314,7 @@ public class FieldSelection
},
new Object[]
{
- Boolean.FALSE, oFontDesc, 14, HelpIds.getHelpIdString(_FirstHelpIndex + 7), String.valueOf((char) 8744), cmdMoveButtonPosX, MoveButtonPosY[1], IStep, Short.valueOf(curtabindex++), CmdButtonWidth
+ Boolean.FALSE, oFontDesc, 14, HelpIds.getHelpIdString(_FirstHelpIndex + 7), String.valueOf((char) 8744), cmdMoveButtonPosX, MoveButtonPosY[1], IStep, new Short(curtabindex++), CmdButtonWidth
});
CurUnoDialog.getPeerConfiguration().setAccessibleName(btnmoveselected, AccessTextMoveSelected);
@@ -353,12 +355,12 @@ public class FieldSelection
final int cmdButtonHeight = 14;
final int cmdButtonVertiDist = 2;
- YPosArray[0] = Integer.valueOf( (CompPosY + 10 + (((CompHeight - 10) - (ButtonCount * cmdButtonHeight) - ((ButtonCount - 1) * cmdButtonVertiDist)) / 2)));
+ YPosArray[0] = new Integer( (CompPosY + 10 + (((CompHeight - 10) - (ButtonCount * cmdButtonHeight) - ((ButtonCount - 1) * cmdButtonVertiDist)) / 2)));
if (ButtonCount > 1)
{
for (int i = 1; i < ButtonCount; i++)
{
- YPosArray[i] = Integer.valueOf(YPosArray[i - 1].intValue() + cmdButtonHeight + cmdButtonVertiDist);
+ YPosArray[i] = new Integer(YPosArray[i - 1].intValue() + cmdButtonHeight + cmdButtonVertiDist);
}
}
return YPosArray;
@@ -491,7 +493,11 @@ public class FieldSelection
}
}
-
+ public void mergeList(String[] AllFieldNames, String[] SecondList)
+ {
+ xFieldsListBox.addItems(AllFieldNames, (short) 0);
+ toggleListboxButtons((short) - 1, (short) - 1);
+ }
public void intializeSelectedFields(String[] _SelectedFieldNames)
{
@@ -517,7 +523,15 @@ public class FieldSelection
toggleListboxControls(Boolean.TRUE);
}
-
+ public void initialize(String[][] _AllFieldNamesTable, boolean _AppendMode, int _maxfieldcount)
+ {
+ String[] AllFieldNames_ = new String[_AllFieldNamesTable.length];
+ for (int i = 0; i < _AllFieldNamesTable.length; i++)
+ {
+ AllFieldNames_[i] = _AllFieldNamesTable[i][0];
+ }
+ initialize(AllFieldNames_, _AppendMode, _maxfieldcount);
+ }
public void initialize(String[] _AllFieldNames, boolean _AppendMode, int _maxfieldcount)
{
@@ -571,7 +585,7 @@ public class FieldSelection
}
}
- private void deselectFields(boolean bMoveAll)
+ public void deselectFields(boolean bMoveAll)
{
String SearchString;
short iOldFieldSelected = xFieldsListBox.getSelectedItemPos();
diff --git a/wizards/com/sun/star/wizards/ui/FilterComponent.java b/wizards/com/sun/star/wizards/ui/FilterComponent.java
index 4c67f0b6c70a..f608b32d9522 100644
--- a/wizards/com/sun/star/wizards/ui/FilterComponent.java
+++ b/wizards/com/sun/star/wizards/ui/FilterComponent.java
@@ -59,55 +59,60 @@ public class FilterComponent
private String slblFieldNames;
private String slblOperators;
private String slblValue;
- private WizardDialog CurUnoDialog;
+ WizardDialog CurUnoDialog;
private int BaseID = 2300;
private String sIncSuffix;
private ControlRow[] oControlRows;
private String sDuplicateCondition;
- private final int SOOPTORMODE = 100;
- private final int SOOPTANDMODE = 101;
- private QueryMetaData oQueryMetaData;
- private int iDateTimeFormat;
- private int iDateFormat;
- private int iTimeFormat;
+ final int SOOPTORMODE = 100;
+ final int SOOPTANDMODE = 101;
+ QueryMetaData oQueryMetaData;
+ int iDateTimeFormat;
+ int iDateFormat;
+ int iTimeFormat;
private PropertyValue[][] filterconditions;
private short curtabindex;
-
- private final int SO_FIRSTFIELDNAME = 1;
- private final int SO_SECONDFIELDNAME = 2;
- private final int SO_THIRDFIELDNAME = 3;
- private final int SO_FOURTHFIELDNAME = 4;
- private int[] SO_FIELDNAMELIST = new int[]
+ XMultiServiceFactory xMSF;
+ final int SO_FIRSTFIELDNAME = 1;
+ final int SO_SECONDFIELDNAME = 2;
+ final int SO_THIRDFIELDNAME = 3;
+ final int SO_FOURTHFIELDNAME = 4;
+ int[] SO_FIELDNAMELIST = new int[]
{
SO_FIRSTFIELDNAME, SO_SECONDFIELDNAME, SO_THIRDFIELDNAME, SO_FOURTHFIELDNAME
};
- private final int SO_FIRSTCONDITION = 5;
- private final int SO_SECONDCONDITION = 6;
- private final int SO_THIRDCONDITION = 7;
- private final int SO_FOURTHCONDITION = 8;
- private int[] SO_CONDITIONLIST = new int[]
+ final int SO_FIRSTCONDITION = 5;
+ final int SO_SECONDCONDITION = 6;
+ final int SO_THIRDCONDITION = 7;
+ final int SO_FOURTHCONDITION = 8;
+ int[] SO_CONDITIONLIST = new int[]
{
SO_FIRSTCONDITION, SO_SECONDCONDITION, SO_THIRDCONDITION, SO_FOURTHCONDITION
};
- private final int SO_FIRSTTEXTFIELD = 1;
- private final int SO_SECONDTEXTFIELD = 2;
- private final int SO_THIRDTEXTFIELD = 3;
- private final int SO_FOURTHTEXTFIELD = 4;
- private int[] SO_TEXTFIELDLIST = new int[]
+ final int SO_FIRSTTEXTFIELD = 1;
+ final int SO_SECONDTEXTFIELD = 2;
+ final int SO_THIRDTEXTFIELD = 3;
+ final int SO_FOURTHTEXTFIELD = 4;
+ int[] SO_TEXTFIELDLIST = new int[]
{
SO_FIRSTTEXTFIELD, SO_SECONDTEXTFIELD, SO_THIRDTEXTFIELD, SO_FOURTHTEXTFIELD
};
- private final int SO_FIRSTBOOLFIELDNAME = 256 + 1;
- private final int SO_SECONDBOOLFIELDNAME = 256 + 2;
- private final int SO_THIRDBOOLFIELDNAME = 256 + 3;
- private final int SO_FOURTHBOOLFIELDNAME = 256 + 4;
+ final int SO_FIRSTBOOLFIELDNAME = 256 + 1;
+ final int SO_SECONDBOOLFIELDNAME = 256 + 2;
+ final int SO_THIRDBOOLFIELDNAME = 256 + 3;
+ final int SO_FOURTHBOOLFIELDNAME = 256 + 4;
+ int SO_BOOLEANLIST[] =
- private int SOI_MATCHALL = 0;
- private int SOI_MATCHANY = 1;
- private int curHelpID;
+ {
+ SO_FIRSTBOOLFIELDNAME, SO_SECONDBOOLFIELDNAME, SO_THIRDBOOLFIELDNAME, SO_FOURTHBOOLFIELDNAME
+ };
+ final int SO_OPTQUERYMODE = 5;
+ int SOI_MATCHALL = 0;
+ int SOI_MATCHANY = 1;
+ int curHelpID;
- private class ItemListenerImpl implements com.sun.star.awt.XItemListener
+ class ItemListenerImpl implements com.sun.star.awt.XItemListener
{
public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject)
@@ -162,7 +167,7 @@ public class FilterComponent
}
}
- private class TextListenerImpl implements com.sun.star.awt.XTextListener
+ class TextListenerImpl implements com.sun.star.awt.XTextListener
{
public void textChanged(TextEvent EventObject)
@@ -174,9 +179,14 @@ public class FilterComponent
public void disposing(EventObject eventObject)
{
}
+
+ public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent)
+ {
+ getfilterstate();
+ }
}
- private static String getIndexNumber(String _sStr)
+ public static String getIndexNumber(String _sStr)
{
return _sStr.substring(_sStr.length() - 1, _sStr.length());
}
@@ -364,10 +374,20 @@ public class FilterComponent
}
/** Creates a new instance of FilterComponent
+ * @param CurUnoDialog
+ * @param _xMSF
+ * @param iStep
+ * @param iPosX
+ * @param iPosY
+ * @param iWidth
+ * @param FilterCount
+ * @param _oQueryMetaData
+ * @param _firstHelpID
*/
public FilterComponent(WizardDialog CurUnoDialog, XMultiServiceFactory _xMSF, int iStep, int iPosX, int iPosY, int iWidth, int FilterCount, QueryMetaData _oQueryMetaData, int _firstHelpID)
{
this.curHelpID = _firstHelpID;
+ this.xMSF = _xMSF;
this.IStep = Integer.valueOf(iStep);
curtabindex = UnoDialog.setInitialTabindex(iStep);
@@ -454,9 +474,11 @@ public class FilterComponent
for (i = 0; i < RowCount; i++)
{
oControlRows[i].setFieldNames(_fieldnames);
+ // oControlRows[i].setFieldNames(aFieldNamesWithAdditionalEmpty);
}
this.filterconditions = _filterconditions;
PropertyValue[] curfilterconditions;
+ // int a;
if (_filterconditions.length == 1)
{
curfilterconditions = filterconditions[0];
@@ -500,17 +522,17 @@ public class FilterComponent
- private final class ControlRow
+ final class ControlRow
{
private final static int SOLSTFIELDNAME = 3;
private final static int SOLSTOPERATOR = 4;
private final static int SOTXTVALUE = 5;
- private XInterface[] ControlElements = new XInterface[6];
+ protected XInterface[] ControlElements = new XInterface[6];
private boolean m_bEnabled;
- private String[] FieldNames;
+ String[] FieldNames;
- private ControlRow(int iCompPosX, int iCompPosY, int Index, boolean _bEnabled, int _firstRowHelpID)
+ protected ControlRow(int iCompPosX, int iCompPosY, int Index, boolean _bEnabled, int _firstRowHelpID)
{
int nFieldWidth = 71;
int nOperatorWidth = 70;
@@ -694,7 +716,7 @@ public class FilterComponent
* @return true if the current condition is complete, all needed fields are filled with values.
* So we can enable the next.
*/
- private boolean isConditionComplete()
+ boolean isConditionComplete()
{
try
{
@@ -738,7 +760,7 @@ public class FilterComponent
}
}
- private void setCondition(PropertyValue _filtercondition)
+ protected void setCondition(PropertyValue _filtercondition)
{
try
{
@@ -757,6 +779,7 @@ public class FilterComponent
sValue = JavaTools.replaceSubString(sValue, PropertyNames.EMPTY_STRING, "' }");
try
{
+ //Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue", );
oQueryMetaData.getNumberFormatter().convertStringToNumber(iDateFormat, sValue);
}
catch (java.lang.Exception ex)
@@ -771,6 +794,7 @@ public class FilterComponent
sValue = JavaTools.replaceSubString(sValue, PropertyNames.EMPTY_STRING, "' }");
try
{
+ //Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue", );
oQueryMetaData.getNumberFormatter().convertStringToNumber(iTimeFormat, sValue);
}
catch (java.lang.Exception ex)
@@ -782,6 +806,7 @@ public class FilterComponent
//TODO: other datetime formats?
else
{
+ //Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue", sValue);
}
}
else if (AnyConverter.isBoolean(_filtercondition.Value))
@@ -805,13 +830,13 @@ public class FilterComponent
}
}
- private void setFieldNames(String[] _FieldNames)
+ protected void setFieldNames(String[] _FieldNames)
{
Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTFIELDNAME]), PropertyNames.STRING_ITEM_LIST, _FieldNames);
FieldNames = _FieldNames;
}
- private boolean isEnabled()
+ protected boolean isEnabled()
{
return m_bEnabled;
}
@@ -858,7 +883,7 @@ public class FilterComponent
}
}
- private String getSelectedFieldName()
+ protected String getSelectedFieldName()
{
try
{
@@ -874,7 +899,7 @@ public class FilterComponent
// TODO: check if it is really useful to match the indices of the listbox the API constants
// =, <>, <, >, <=, >=, like, !like, is null, !is null
- private short getSelectedOperator()
+ protected short getSelectedOperator()
{
try
{
@@ -913,13 +938,21 @@ public class FilterComponent
}
// TODO make a difference between Text and Numbers
- private Object getValue()
+ protected Object getValue()
{
return (Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue"));
}
+ protected Object getText()
+ {
+ return (Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "Text"));
+ }
-
-
+ protected String getDateTimeString(boolean bgetDate)
+ {
+ double dblValue = ((Double) getValue()).doubleValue();
+ NumberFormatter oNumberFormatter = oQueryMetaData.getNumberFormatter();
+ return oNumberFormatter.convertNumberToString(iDateTimeFormat, dblValue);
+ }
}
}
diff --git a/wizards/com/sun/star/wizards/ui/ImageList.java b/wizards/com/sun/star/wizards/ui/ImageList.java
index 35c301dc833a..5b6677d709e3 100644
--- a/wizards/com/sun/star/wizards/ui/ImageList.java
+++ b/wizards/com/sun/star/wizards/ui/ImageList.java
@@ -59,7 +59,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
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 final static Short NO_BORDER = new Short((short) 0);
private boolean refreshOverNull = true;
private int imageTextLines = 1;
private boolean rowSelect = false;
@@ -76,8 +76,8 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
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 Short HIDE_PAGE = new Short((short) 99);
+ private final static Integer TRANSPARENT = new Integer(-1);
private final static int LINE_HEIGHT = 8;
private MethodInvocation METHOD_MOUSE_PRESSED;
@@ -99,8 +99,10 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
this.imageSize = imageSize;
}
- private class OMouseListener implements XMouseListener
+ class OMouseListener implements XMouseListener
{
+ public OMouseListener()
+ {}
public void mousePressed(MouseEvent arg0)
{
focus(getImageIndexFor(getSelected()));
@@ -148,12 +150,12 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
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),
+ new Short((short) 1),
+ new Integer((imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1),
+ new Integer(pos.Width),
+ new Integer(pos.Height),
step,
- Integer.valueOf((imageSize.Width + gap.Width) * cols + gap.Width)
+ new Integer((imageSize.Width + gap.Width) * cols + gap.Width)
});
opeerConfig.setPeerProperties(imgContainer, new String[]
@@ -181,14 +183,14 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
}, new Object[]
{
TRANSPARENT,
- Short.valueOf((short) 1),
- Integer.valueOf(imageSize.Height + (selectionGap.Height * 2)),
+ new Short((short) 1),
+ new Integer(imageSize.Height + (selectionGap.Height * 2)),
//height
0, //posx
0, //posy
step,
Boolean.TRUE,
- Integer.valueOf(selectionWidth)
+ new Integer(selectionWidth)
});
XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, grbxSelectedImage);
@@ -208,14 +210,14 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
lblImageText = dialog.insertLabel(name + "_imageText", pNames1, new Object[]
{
- Integer.valueOf(imageTextHeight),
+ new Integer(imageTextHeight),
PropertyNames.EMPTY_STRING,
- Integer.valueOf(pos.Width + 1),
- Integer.valueOf(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height),
+ new Integer(pos.Width + 1),
+ new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height),
step,
- Short.valueOf((short) 0),
+ new Short((short) 0),
Boolean.FALSE,
- Integer.valueOf(cols * (imageSize.Width + gap.Width) + gap.Width - 2)
+ new Integer(cols * (imageSize.Width + gap.Width) + gap.Width - 2)
});
@@ -227,10 +229,10 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
{
btnSize,
HelpIds.getHelpIdString(helpURL++),
- Integer.valueOf(pos.Width),
- Integer.valueOf(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1),
+ new Integer(pos.Width),
+ new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1),
step,
- Short.valueOf((short) (tabIndex + 1)),
+ new Short((short) (tabIndex + 1)),
Boolean.TRUE,
btnSize
});
@@ -239,27 +241,27 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
{
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),
+ new Integer(pos.Width + (imageSize.Width + gap.Width) * cols + gap.Width - btnSize.intValue() + 1),
+ new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1),
step,
- Short.valueOf((short) (tabIndex + 2)),
+ new Short((short) (tabIndex + 2)),
Boolean.TRUE,
btnSize
});
lblCounter = dialog.insertLabel(name + "_lblCounter", pNames1, new Object[]
{
- Integer.valueOf(LINE_HEIGHT),
+ new Integer(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)),
+ new Integer(pos.Width + btnSize.intValue() + 1),
+ new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + ((btnSize.intValue() - LINE_HEIGHT) / 2)),
step,
- Short.valueOf((short) 0),
+ new Short((short) 0),
Boolean.FALSE,
- Integer.valueOf(cols * (imageSize.Width + gap.Width) + gap.Width - 2 * btnSize.intValue() - 1)
+ new Integer(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(lblCounter), PropertyNames.PROPERTY_ALIGN, new Short((short) 1));
Helper.setUnoPropertyValue(getModel(btnBack), PropertyNames.PROPERTY_LABEL, "<");
Helper.setUnoPropertyValue(getModel(btnNext), PropertyNames.PROPERTY_LABEL, ">");
@@ -267,7 +269,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
}
imageKeyListener = new ImageKeyListener();
- m_tabIndex = Short.valueOf((short) tabIndex);
+ m_tabIndex = new Short((short) tabIndex);
m_aImages = new XControl[rows * cols];
@@ -280,8 +282,8 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
e.printStackTrace();
}
- m_imageHeight = Integer.valueOf(imageSize.Height);
- m_imageWidth = Integer.valueOf(imageSize.Width);
+ m_imageHeight = new Integer(imageSize.Height);
+ m_imageWidth = new Integer(imageSize.Width);
for (int r = 0; r < rows; r++)
{
@@ -324,8 +326,8 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
BACKGROUND_COLOR,
m_imageHeight,
HelpIds.getHelpIdString(helpURL++),
- Integer.valueOf(getImagePosX(_col)),
- Integer.valueOf(getImagePosY(_row)),
+ new Integer(getImagePosX(_col)),
+ new Integer(getImagePosY(_row)),
scaleImages,
step,
m_tabIndex,
@@ -440,8 +442,8 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
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);
+ MOVE_SELECTION_VALS[0] = new Integer(getImagePosX(col) - selectionGap.Width);
+ MOVE_SELECTION_VALS[1] = new Integer(getImagePosY(row) - selectionGap.Height);
Helper.setUnoPropertyValues(getModel(grbxSelectedImage), MOVE_SELECTION, MOVE_SELECTION_VALS);
@@ -521,6 +523,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
public void intervalRemoved(ListDataEvent event)
{
+ //contentsChanged(event);
}
/** Registers ItemListener to receive events.
@@ -567,6 +570,9 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
}
}
+ /**
+ * @return
+ */
public int getCols()
{
return cols;
@@ -786,14 +792,15 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
};
}
- private interface IImageRenderer extends IRenderer
+ public static interface IImageRenderer extends IRenderer
{
/**
+ * @param listItem
* @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);
+ public Object[] getImageUrls(Object listItem);
}
private static class SimpleCounterRenderer implements IRenderer
@@ -805,12 +812,12 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
}
}
- private static class Counter
+ public static class Counter
{
- private int start, end, max;
+ public int start, end, max;
- private Counter(int start_, int end_, int max_)
+ public Counter(int start_, int end_, int max_)
{
start = start_;
end = end_;
@@ -951,6 +958,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
/**
* jump to the given item (display the screen
* that contains the given item).
+ * @param i
*/
public void display(int i)
{
diff --git a/wizards/com/sun/star/wizards/ui/PathSelection.java b/wizards/com/sun/star/wizards/ui/PathSelection.java
index 8ad0963e7b1c..4210383c064d 100644
--- a/wizards/com/sun/star/wizards/ui/PathSelection.java
+++ b/wizards/com/sun/star/wizards/ui/PathSelection.java
@@ -38,18 +38,18 @@ public class PathSelection
public XPathSelectionListener xAction;
public XTextComponent xSaveTextBox;
- private static class DialogTypes
+ public static class DialogTypes
{
- private static final int FOLDER = 0;
- private static final int FILE = 1;
+ public static final int FOLDER = 0;
+ public static final int FILE = 1;
}
- private static class TransferMode
+ public static class TransferMode
{
- private static final int SAVE = 0;
- private static final int LOAD = 1;
+ public static final int SAVE = 0;
+ public static final int LOAD = 1;
}
public PathSelection(XMultiServiceFactory xMSF, UnoDialog2 CurUnoDialog, int TransferMode, int DialogType)
@@ -69,7 +69,7 @@ public class PathSelection
PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
}, new Object[]
{
- Boolean.valueOf(Enabled), 8, LabelText, Integer.valueOf(XPos), Integer.valueOf(YPos), Integer.valueOf(DialogStep), Short.valueOf(CurTabIndex), Integer.valueOf(Width)
+ Boolean.valueOf(Enabled), 8, LabelText, new Integer(XPos), new Integer(YPos), new Integer(DialogStep), new Short(CurTabIndex), new Integer(Width)
});
xSaveTextBox = CurUnoDialog.insertTextField("txtSavePath", "callXPathSelectionListener", this, new String[]
@@ -77,15 +77,16 @@ public class PathSelection
PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
}, new Object[]
{
- Boolean.valueOf(Enabled), 12, TxtHelpURL, Integer.valueOf(XPos), Integer.valueOf(YPos + 10), Integer.valueOf(DialogStep), Short.valueOf((short) (CurTabIndex + 1)), Integer.valueOf(Width - 26)
+ Boolean.valueOf(Enabled), 12, TxtHelpURL, new Integer(XPos), new Integer(YPos + 10), new Integer(DialogStep), new Short((short) (CurTabIndex + 1)), new Integer(Width - 26)
});
+ //CurUnoDialog.setControlProperty("txtSavePath", PropertyNames.READ_ONLY, Boolean.TRUE);
CurUnoDialog.setControlProperty("txtSavePath", PropertyNames.PROPERTY_ENABLED, Boolean.FALSE);
CurUnoDialog.insertButton("cmdSelectPath", "triggerPathPicker", this, new String[]
{
PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
}, new Object[]
{
- Boolean.valueOf(Enabled), 14, BtnHelpURL, "...", Integer.valueOf(XPos + Width - 16), Integer.valueOf(YPos + 9), Integer.valueOf(DialogStep), Short.valueOf((short) (CurTabIndex + 2)), 16
+ Boolean.valueOf(Enabled), 14, BtnHelpURL, "...", new Integer(XPos + Width - 16), new Integer(YPos + 9), new Integer(DialogStep), new Short((short) (CurTabIndex + 2)), 16
});
}
diff --git a/wizards/com/sun/star/wizards/ui/PeerConfig.java b/wizards/com/sun/star/wizards/ui/PeerConfig.java
index 53f2ba76c1e0..39df7c808e8c 100644
--- a/wizards/com/sun/star/wizards/ui/PeerConfig.java
+++ b/wizards/com/sun/star/wizards/ui/PeerConfig.java
@@ -33,9 +33,9 @@ public class PeerConfig implements XWindowListener
{
private ArrayList<PeerTask> m_aPeerTasks = new ArrayList<PeerTask>();
- private ArrayList<ControlTask> aControlTasks = new ArrayList<ControlTask>();
- private ArrayList<ImageUrlTask> aImageUrlTasks = new ArrayList<ImageUrlTask>();
- private UnoDialog oUnoDialog = null;
+ ArrayList<ControlTask> aControlTasks = new ArrayList<ControlTask>();
+ ArrayList<ImageUrlTask> aImageUrlTasks = new ArrayList<ImageUrlTask>();
+ UnoDialog oUnoDialog = null;
public PeerConfig(UnoDialog _oUnoDialog)
{
@@ -43,14 +43,14 @@ public class PeerConfig implements XWindowListener
oUnoDialog.xWindow.addWindowListener(this);
}
- private class PeerTask
+ class PeerTask
{
- private XControl xControl;
- private String[] propnames;
- private Object[] propvalues;
+ XControl xControl;
+ String[] propnames;
+ Object[] propvalues;
- private PeerTask(XControl _xControl, String[] propNames_, Object[] propValues_)
+ public PeerTask(XControl _xControl, String[] propNames_, Object[] propValues_)
{
propnames = propNames_;
propvalues = propValues_;
@@ -58,14 +58,14 @@ public class PeerConfig implements XWindowListener
}
}
- private class ControlTask
+ class ControlTask
{
- private Object oModel;
- private String propname;
- private Object propvalue;
+ Object oModel;
+ String propname;
+ Object propvalue;
- private ControlTask(Object _oModel, String _propName, Object _propValue)
+ public ControlTask(Object _oModel, String _propName, Object _propValue)
{
propname = _propName;
propvalue = _propValue;
@@ -73,14 +73,14 @@ public class PeerConfig implements XWindowListener
}
}
- private class ImageUrlTask
+ class ImageUrlTask
{
- private Object oModel;
- private Object oResource;
- private Object oHCResource;
+ Object oModel;
+ Object oResource;
+ Object oHCResource;
- private ImageUrlTask(Object _oModel, Object _oResource, Object _oHCResource)
+ public ImageUrlTask(Object _oModel, Object _oResource, Object _oHCResource)
{
oResource = _oResource;
oHCResource = _oHCResource;
@@ -150,6 +150,7 @@ public class PeerConfig implements XWindowListener
/**
* @param oAPIControl an API control that the interface XControl can be derived from
+ * @param _saccessname
*/
public void setAccessibleName(Object oAPIControl, String _saccessname)
{
@@ -163,9 +164,27 @@ public class PeerConfig implements XWindowListener
});
}
+ public void setAccessibleName(XControl _xControl, String _saccessname)
+ {
+ setPeerProperties(_xControl, new String[]
+ {
+ "AccessibleName"
+ }, new String[]
+ {
+ _saccessname
+ });
+ }
-
-
+ /**
+ * @param oAPIControl an API control that the interface XControl can be derived from
+ * @param _propnames
+ * @param _propvalues
+ */
+ public void setPeerProperties(Object oAPIControl, String[] _propnames, Object[] _propvalues)
+ {
+ XControl xControl = UnoRuntime.queryInterface(XControl.class, oAPIControl);
+ setPeerProperties(xControl, _propnames, _propvalues);
+ }
public void setPeerProperties(XControl _xControl, String[] propnames, Object[] propvalues)
{
@@ -173,22 +192,39 @@ public class PeerConfig implements XWindowListener
this.m_aPeerTasks.add(oPeerTask);
}
-
+ /**
+ * assigns an arbitrary property to a control as soon as the peer is created
+ * Note: The property 'ImageUrl' should better be assigned with 'setImageurl(...)', to consider the High Contrast Mode
+ * @param _ocontrolmodel
+ * @param _spropname
+ * @param _propvalue
+ */
+ public void setControlProperty(Object _ocontrolmodel, String _spropname, Object _propvalue)
+ {
+ ControlTask oControlTask = new ControlTask(_ocontrolmodel, _spropname, _propvalue);
+ this.aControlTasks.add(oControlTask);
+ }
/**
* Assigns an image to the property 'ImageUrl' of a dialog control. The image id must be assigned in a resource file
* within the wizards project
* wizards project
+ * @param _ocontrolmodel
+ * @param _nResId
+ * @param _nhcResId
*/
public void setImageUrl(Object _ocontrolmodel, int _nResId, int _nhcResId)
{
- ImageUrlTask oImageUrlTask = new ImageUrlTask(_ocontrolmodel, Integer.valueOf(_nResId), Integer.valueOf(_nhcResId));
+ ImageUrlTask oImageUrlTask = new ImageUrlTask(_ocontrolmodel, new Integer(_nResId), new Integer(_nhcResId));
this.aImageUrlTasks.add(oImageUrlTask);
}
/**
* Assigns an image to the property 'ImageUrl' of a dialog control. The image ids that the Resource urls point to
* may be assigned in a Resource file outside the wizards project
+ * @param _ocontrolmodel
+ * @param _sResourceUrl
+ * @param _sHCResourceUrl
*/
public void setImageUrl(Object _ocontrolmodel, String _sResourceUrl, String _sHCResourceUrl)
{
@@ -200,6 +236,9 @@ public class PeerConfig implements XWindowListener
* Assigns an image to the property 'ImageUrl' of a dialog control. The image id must be assigned in a resource file
* within the wizards project
* wizards project
+ * @param _ocontrolmodel
+ * @param _oResource
+ * @param _oHCResource
*/
public void setImageUrl(Object _ocontrolmodel, Object _oResource, Object _oHCResource)
{
diff --git a/wizards/com/sun/star/wizards/ui/SortingComponent.java b/wizards/com/sun/star/wizards/ui/SortingComponent.java
index 27323b7e089c..9b0ff2e8649f 100644
--- a/wizards/com/sun/star/wizards/ui/SortingComponent.java
+++ b/wizards/com/sun/star/wizards/ui/SortingComponent.java
@@ -26,28 +26,28 @@ import java.util.ArrayList;
public class SortingComponent
{
-
- private WizardDialog CurUnoDialog;
- private int MaxSortIndex = -1;
-
- private static String sNoSorting;
- private static String sSortCriteriaisduplicate;
- private static String[] sSortHeader = new String[4];
- private static String[] sSortAscend = new String[4];
- private static String[] sSortDescend = new String[4];
-
- private int MAXSORTCRITERIAINDEX = 3;
- private final int SOFIRSTSORTLST = 0;
- private final int SOSECSORTLST = 1;
- private final int SOTHIRDSORTLST = 2;
- private final int SOFOURTHSORTLST = 3;
- private final int[] SOSORTLST = new int[]
+ com.sun.star.lang.XMultiServiceFactory xMSF;
+ WizardDialog CurUnoDialog;
+ int MaxSortIndex = -1;
+ public String[][] FieldNames;
+ static String sNoSorting;
+ static String sSortCriteriaisduplicate;
+ static String[] sSortHeader = new String[4];
+ static String[] sSortAscend = new String[4];
+ static String[] sSortDescend = new String[4];
+ static short[] bOldSortValues = new short[4];
+ public int MAXSORTCRITERIAINDEX = 3;
+ final int SOFIRSTSORTLST = 0;
+ final int SOSECSORTLST = 1;
+ final int SOTHIRDSORTLST = 2;
+ final int SOFOURTHSORTLST = 3;
+ final int[] SOSORTLST = new int[]
{
SOFIRSTSORTLST, SOSECSORTLST, SOTHIRDSORTLST, SOFOURTHSORTLST
};
- private XListBox[] xSortListBox = new XListBox[4];
+ XListBox[] xSortListBox = new XListBox[4];
- private class ItemListenerImpl implements com.sun.star.awt.XItemListener
+ class ItemListenerImpl implements com.sun.star.awt.XItemListener
{
public void itemStateChanged(ItemEvent EventObject)
@@ -69,15 +69,16 @@ public class SortingComponent
{
this.CurUnoDialog = CurUnoDialog;
short curtabindex = UnoDialog.setInitialTabindex(iStep);
- Integer IStep = Integer.valueOf(iStep);
- Integer ICompPosX = Integer.valueOf(iCompPosX);
- Integer ICompWidth = Integer.valueOf(iCompWidth);
+ xMSF = CurUnoDialog.xMSF;
+ Integer IStep = new Integer(iStep);
+ Integer ICompPosX = new Integer(iCompPosX);
+ Integer ICompWidth = new Integer(iCompWidth);
- Integer IListBoxPosX = Integer.valueOf(iCompPosX + 6);
+ Integer IListBoxPosX = new Integer(iCompPosX + 6);
int iOptButtonWidth = 65;
- Integer IOptButtonWidth = Integer.valueOf(iOptButtonWidth);
- Integer IListBoxWidth = Integer.valueOf(iCompWidth - iOptButtonWidth - 12);
- Integer IOptButtonPosX = Integer.valueOf(IListBoxPosX.intValue() + IListBoxWidth.intValue() + 6);
+ Integer IOptButtonWidth = new Integer(iOptButtonWidth);
+ Integer IListBoxWidth = new Integer(iCompWidth - iOptButtonWidth - 12);
+ Integer IOptButtonPosX = new Integer(IListBoxPosX.intValue() + IListBoxWidth.intValue() + 6);
getResources();
boolean bDoEnable;
String HIDString;
@@ -90,7 +91,7 @@ public class SortingComponent
PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.ORIENTATION, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
}, new Object[]
{
- Boolean.valueOf(bDoEnable), 8, sSortHeader[i], 0, ICompPosX, Integer.valueOf(iCurPosY), IStep, Short.valueOf(curtabindex++), ICompWidth
+ Boolean.valueOf(bDoEnable), 8, sSortHeader[i], 0, ICompPosX, new Integer(iCurPosY), IStep, new Short(curtabindex++), ICompWidth
});
HIDString = HelpIds.getHelpIdString(FirstHelpIndex);
@@ -99,8 +100,8 @@ public class SortingComponent
"Dropdown", PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "LineCount", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
}, new Object[]
{
- true, bDoEnable, 12, HIDString, Short.valueOf(UnoDialog.getListBoxLineCount()), "lstSort" + Integer.valueOf(i + 1), IListBoxPosX, Integer.valueOf(iCurPosY + 14), IStep, Short.valueOf(curtabindex++), IListBoxWidth
- }); //Short.valueOf((short) (17+i*4))
+ true, bDoEnable, 12, HIDString, new Short(UnoDialog.getListBoxLineCount()), "lstSort" + new Integer(i + 1), IListBoxPosX, new Integer(iCurPosY + 14), IStep, new Short(curtabindex++), IListBoxWidth
+ }); //new Short((short) (17+i*4))
HIDString = HelpIds.getHelpIdString(FirstHelpIndex + 1);
XRadioButton xRadioButtonAsc = CurUnoDialog.insertRadioButton("optAscend" + Integer.toString(i + 1), 0, new String[]
@@ -108,8 +109,8 @@ public class SortingComponent
PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Tag", PropertyNames.PROPERTY_WIDTH
}, new Object[]
{
- bDoEnable, 10, HIDString, sSortAscend[i], IOptButtonPosX, Integer.valueOf(iCurPosY + 10), Short.valueOf((short) 1), IStep, Short.valueOf(curtabindex++), PropertyNames.ASC, IOptButtonWidth
- }); //, Short.valueOf((short) (18+i*4))
+ bDoEnable, 10, HIDString, sSortAscend[i], IOptButtonPosX, new Integer(iCurPosY + 10), new Short((short) 1), IStep, new Short(curtabindex++), PropertyNames.ASC, IOptButtonWidth
+ }); //, new Short((short) (18+i*4))
HIDString = HelpIds.getHelpIdString(FirstHelpIndex + 2);
XRadioButton xRadioButtonDesc = CurUnoDialog.insertRadioButton("optDescend" + Integer.toString(i + 1), 0, new String[]
@@ -117,8 +118,8 @@ public class SortingComponent
PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Tag", PropertyNames.PROPERTY_WIDTH
}, new Object[]
{
- bDoEnable, 10, HIDString, sSortDescend[i], IOptButtonPosX, Integer.valueOf(iCurPosY + 24), Short.valueOf((short) 0), IStep, Short.valueOf(curtabindex++), "DESC", IOptButtonWidth
- }); //, Short.valueOf((short) (19+i*4))
+ bDoEnable, 10, HIDString, sSortDescend[i], IOptButtonPosX, new Integer(iCurPosY + 24), new Short((short) 0), IStep, new Short(curtabindex++), "DESC", IOptButtonWidth
+ }); //, new Short((short) (19+i*4))
iCurPosY = iCurPosY + 36;
FirstHelpIndex += 3;
}
@@ -192,8 +193,9 @@ public class SortingComponent
/**
* sets the controls of a Sorting criterion to readonly or not.
* @param _index index of the Sorting criterion
+ * @param _breadonly
*/
- private void setReadOnly(int _index, boolean _breadonly)
+ public void setReadOnly(int _index, boolean _breadonly)
{
CurUnoDialog.setControlProperty("lstSort" + Integer.toString(_index + 1), PropertyNames.READ_ONLY, Boolean.valueOf(_breadonly));
}
@@ -201,6 +203,7 @@ public class SortingComponent
/**
*
* @param _index the first Sorting criterion in which 'ReadOnly is set to 'false'
+ * @param _bcomplete
*/
public void setReadOnlyUntil(int _index, boolean _bcomplete)
{
@@ -273,7 +276,26 @@ public class SortingComponent
}
}
-
+ public void disableListBoxesfromIndex(int CurIndex)
+ {
+ if (CurIndex < MAXSORTCRITERIAINDEX)
+ {
+ for (int i = CurIndex + 1; i <= MAXSORTCRITERIAINDEX; i++)
+ {
+ toggleSortListBox(i, (false));
+ if (i < MaxSortIndex)
+ {
+ CurUnoDialog.setControlProperty("lstSort" + Integer.toString(i + 2), PropertyNames.SELECTED_ITEMS, new short[]
+ {
+ 0
+ });
+ }
+ // xSortListBox[i+1].selectItemPos((short)0, true);
+ }
+ CurUnoDialog.setFocus("lblSort" + new Integer(CurIndex + 1));
+ MaxSortIndex = CurIndex - 1;
+ }
+ }
// The following code can be reactivated in a future version when task #100799 will be fixed
private void moveupSortItems(int CurIndex, boolean bDoEnable)
diff --git a/wizards/com/sun/star/wizards/ui/TitlesComponent.java b/wizards/com/sun/star/wizards/ui/TitlesComponent.java
index 0571cc03080b..6a0d9573aea4 100644
--- a/wizards/com/sun/star/wizards/ui/TitlesComponent.java
+++ b/wizards/com/sun/star/wizards/ui/TitlesComponent.java
@@ -29,14 +29,14 @@ import java.util.*;
public class TitlesComponent extends ControlScroller
{
- private int iLabelPosX;
- private final int iRelLabelPosXDist = 6;
- private String[] fieldnames;
- private Map<String, String> fieldtitleset;
- private String[] fieldtitles;
-
- private final String SOLABELPREFIX = "lblColumnName_";
- private final String SOTITLEPREFIX = "lblTitleName_";
+ int iLabelPosX;
+ final int iRelLabelPosXDist = 6;
+ public String[] fieldnames;
+ public Map<String, String> fieldtitleset;
+ public String[] fieldtitles;
+ public XTextListener xTextListener;
+ final String SOLABELPREFIX = "lblColumnName_";
+ final String SOTITLEPREFIX = "lblTitleName_";
public TitlesComponent(WizardDialog _CurUnoDialog, int _iStep, int _iCompPosX, int _iCompPosY, int _iCompWidth, int _uitextfieldcount, String _slblColumnNames, String _slblColumnTitles, int _firsthelpindex)
{
@@ -46,18 +46,17 @@ public class TitlesComponent extends ControlScroller
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH
}, new Object[]
{
- 8, _slblColumnNames, Integer.valueOf(iLabelPosX), Integer.valueOf(iCompPosY - 10), IStep, 60
+ 8, _slblColumnNames, new Integer(iLabelPosX), new Integer(iCompPosY - 10), IStep, 60
});
CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblColumnTitles", new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH
}, new Object[]
{
- 8, _slblColumnTitles, 90, Integer.valueOf(iCompPosY - 10), IStep, 152
+ 8, _slblColumnTitles, 90, new Integer(iCompPosY - 10), IStep, 152
});
}
- @Override
protected void insertControlGroup(int i, int ypos)
{
iLabelPosX = iCompPosX + iRelLabelPosXDist;
@@ -66,7 +65,6 @@ public class TitlesComponent extends ControlScroller
}
- @Override
protected void setControlGroupVisible(int _index, boolean _bIsVisible)
{
CurUnoDialog.setControlVisible(getColumnName(_index), _bIsVisible);
@@ -86,13 +84,13 @@ public class TitlesComponent extends ControlScroller
}
}
- private class ControlRow
+ class ControlRow
{
+ PropertyValue[] regproperties;
+ XTextComponent xTextComponent;
- private XTextComponent xTextComponent;
-
- private ControlRow(int _index, int _iCompPosY)
+ public ControlRow(int _index, int _iCompPosY)
{
String slabelname = getColumnName(_index);
String stextfieldname = getTitleName(_index);
@@ -104,7 +102,7 @@ public class TitlesComponent extends ControlScroller
},
new Object[]
{
- 16, Boolean.TRUE, Integer.valueOf(iLabelPosX), Integer.valueOf(_iCompPosY + 1), UIConsts.INVISIBLESTEP, Short.valueOf(curtabindex++), 30
+ 16, Boolean.TRUE, new Integer(iLabelPosX), new Integer(_iCompPosY + 1), UIConsts.INVISIBLESTEP, new Short(curtabindex++), 30
});
xTextComponent = CurUnoDialog.insertTextField(stextfieldname, 0, null,
@@ -114,7 +112,7 @@ public class TitlesComponent extends ControlScroller
},
new Object[]
{
- 12, HelpIds.getHelpIdString(curHelpIndex++), Integer.valueOf(iLabelPosX + 30), Integer.valueOf(_iCompPosY), UIConsts.INVISIBLESTEP, Short.valueOf(curtabindex++), Integer.valueOf(iCompWidth - 90 - 20)
+ 12, HelpIds.getHelpIdString(curHelpIndex++), new Integer(iLabelPosX + 30), new Integer(_iCompPosY), UIConsts.INVISIBLESTEP, new Short(curtabindex++), new Integer(iCompWidth - 90 - 20)
});
}
}
@@ -129,7 +127,6 @@ public class TitlesComponent extends ControlScroller
return SOTITLEPREFIX + Integer.toString(_index + 1);
}
- @Override
protected void initializeScrollFields()
{
for (int i = 0; i < fieldnames.length; i++)
@@ -147,9 +144,9 @@ public class TitlesComponent extends ControlScroller
Size aSize = CurUnoDialog.getpreferredLabelSize(getColumnName(0), sLongestFieldName);
double dblMAPConversion = CurUnoDialog.getMAPConversionFactor(getColumnName(0));
int iFieldNameWidth = getFieldNameWidth(aSize.Width, dblMAPConversion) + 10;
- Integer FieldNameWidth = Integer.valueOf(iFieldNameWidth);
- Integer TitlePosX = Integer.valueOf(iLabelPosX + iFieldNameWidth + 2);
- Integer TitleWidth = Integer.valueOf(iCompPosX + iCompWidth - TitlePosX.intValue() - iScrollBarWidth - 6);
+ Integer FieldNameWidth = new Integer(iFieldNameWidth);
+ Integer TitlePosX = new Integer(iLabelPosX + iFieldNameWidth + 2);
+ Integer TitleWidth = new Integer(iCompPosX + iCompWidth - TitlePosX.intValue() - iScrollBarWidth - 6);
for (short i = 0; i <= ncurfieldcount; i++)
{
CurUnoDialog.setControlProperty(getColumnName(i), PropertyNames.PROPERTY_WIDTH, FieldNameWidth);
diff --git a/wizards/com/sun/star/wizards/ui/UIConsts.java b/wizards/com/sun/star/wizards/ui/UIConsts.java
index 948b7251b7e0..9c4d77cad4bf 100644
--- a/wizards/com/sun/star/wizards/ui/UIConsts.java
+++ b/wizards/com/sun/star/wizards/ui/UIConsts.java
@@ -21,55 +21,69 @@ package com.sun.star.wizards.ui;
public interface UIConsts
{
- int RID_COMMON = 500;
- int RID_DB_COMMON = 1000;
- int RID_FORM = 2200;
- int RID_QUERY = 2300;
- int RID_REPORT = 2400;
- int RID_TABLE = 2600;
- int RID_IMG_FORM = 1100;
- Integer INVISIBLESTEP = 99;
- String INFOIMAGEURL = "private:resource/dbu/image/19205";
- String INFOIMAGEURL_HC = "private:resource/dbu/image/19230";
+ public static final int RID_COMMON = 500;
+ public static final int RID_DB_COMMON = 1000;
+ public static final int RID_FORM = 2200;
+ public static final int RID_QUERY = 2300;
+ public static final int RID_REPORT = 2400;
+ public static final int RID_TABLE = 2600;
+ public static final int RID_IMG_REPORT = 1000;
+ public static final int RID_IMG_FORM = 1100;
+ public static final int RID_IMG_WEB = 1200;
+ public static final Integer INVISIBLESTEP = 99;
+ public static final String INFOIMAGEURL = "private:resource/dbu/image/19205";
+ public static final String INFOIMAGEURL_HC = "private:resource/dbu/image/19230";
/**
* The tabindex of the navigation buttons in a wizard must be assigned a very
* high tabindex because on every step their taborder must appear at the end
*/
- short SOFIRSTWIZARDNAVITABINDEX = 30000;
- Integer INTEGER_12 = 12;
+ public static final short SOFIRSTWIZARDNAVITABINDEX = 30000;
+ public static final Integer INTEGER_8 = 8;
+ public static final Integer INTEGER_12 = 12;
+ public static final Integer INTEGER_14 = 14;
+ public static final Integer INTEGER_16 = 16;
+ public static final Integer INTEGER_40 = 40;
+ public static final Integer INTEGER_50 = 50;
/**Steps of the QueryWizard
*
*/
- int SOGROUPSELECTIONPAGE = 5;
- int SOGROUPFILTERPAGE = 6;
- int SOTITLESPAGE = 7;
- Integer[] INTEGERS = new Integer[]
+ public static final int SOFIELDSELECTIONPAGE = 1;
+ public static final int SOSORTINGPAGE = 2;
+ public static final int SOFILTERPAGE = 3;
+ public static final int SOAGGREGATEPAGE = 4;
+ public static final int SOGROUPSELECTIONPAGE = 5;
+ public static final int SOGROUPFILTERPAGE = 6;
+ public static final int SOTITLESPAGE = 7;
+ public static final int SOSUMMARYPAGE = 8;
+ public static final Integer[] INTEGERS = new Integer[]
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
};
- public interface CONTROLTYPE
+ class CONTROLTYPE
{
- int BUTTON = 1;
- int IMAGECONTROL = 2;
- int LISTBOX = 3;
- int COMBOBOX = 4;
- int CHECKBOX = 5;
- int RADIOBUTTON = 6;
- int DATEFIELD = 7;
- int EDITCONTROL = 8;
- int FIXEDLINE = 10;
- int FIXEDTEXT = 11;
- int FORMATTEDFIELD = 12;
- int HYPERTEXT = 14;
- int NUMERICFIELD = 15;
- int PATTERNFIELD = 16;
- int PROGRESSBAR = 17;
- int ROADMAP = 18;
- int SCROLLBAR = 19;
- int TIMEFIELD = 20;
- int CURRENCYFIELD = 21;
- int UNKNOWN = -1;
+ public static final int BUTTON = 1;
+ public static final int IMAGECONTROL = 2;
+ public static final int LISTBOX = 3;
+ public static final int COMBOBOX = 4;
+ public static final int CHECKBOX = 5;
+ public static final int RADIOBUTTON = 6;
+ public static final int DATEFIELD = 7;
+ public static final int EDITCONTROL = 8;
+ public static final int FILECONTROL = 9;
+ public static final int FIXEDLINE = 10;
+ public static final int FIXEDTEXT = 11;
+ public static final int FORMATTEDFIELD = 12;
+ public static final int GROUPBOX = 13;
+ public static final int HYPERTEXT = 14;
+ public static final int NUMERICFIELD = 15;
+ public static final int PATTERNFIELD = 16;
+ public static final int PROGRESSBAR = 17;
+ public static final int ROADMAP = 18;
+ public static final int SCROLLBAR = 19;
+ public static final int TIMEFIELD = 20;
+ public static final int CURRENCYFIELD = 21;
+ public static final int UNKNOWN = -1;
}
}
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.java b/wizards/com/sun/star/wizards/ui/UnoDialog.java
index a6c40caf965c..45482fce304e 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog.java
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog.java
@@ -18,6 +18,7 @@
package com.sun.star.wizards.ui;
import com.sun.star.awt.*;
+import com.sun.star.beans.Property;
import com.sun.star.beans.XMultiPropertySet;
import com.sun.star.beans.XPropertySet;
@@ -39,7 +40,7 @@ public class UnoDialog implements EventNames
public XMultiServiceFactory xMSF;
public XMultiServiceFactory MSFDialogModel;
- private XNameContainer xDlgNames;
+ public XNameContainer xDlgNames;
public XControlContainer xDlgContainer;
private XNameAccess m_xDlgNameAccess;
public XControl xControl;
@@ -48,9 +49,9 @@ public class UnoDialog implements EventNames
public XWindow xWindow;
public XComponent xComponent;
public XInterface xDialogModel;
- private XInterface xUnoDialog;
-
- private XVclWindowPeer xVclWindowPeer;
+ public XInterface xUnoDialog;
+ public XPropertySet xPSetDlg;
+ public XVclWindowPeer xVclWindowPeer;
public HashMap<String, Integer> ControlList;
public Resource m_oResource;
public XWindowPeer xWindowPeer = null;
@@ -76,7 +77,7 @@ public class UnoDialog implements EventNames
xControl = UnoRuntime.queryInterface(XControl.class, xUnoDialog);
XControlModel xControlModel = UnoRuntime.queryInterface(XControlModel.class, xDialogModel);
xControl.setModel(xControlModel);
- UnoRuntime.queryInterface(XPropertySet.class, xDialogModel);
+ xPSetDlg = UnoRuntime.queryInterface(XPropertySet.class, xDialogModel);
xDlgContainer = UnoRuntime.queryInterface(XControlContainer.class, xUnoDialog);
xDlgNames = UnoRuntime.queryInterface(XNameContainer.class, xDialogModel);
xComponent = UnoRuntime.queryInterface(XComponent.class, xUnoDialog);
@@ -108,7 +109,7 @@ public class UnoDialog implements EventNames
return iKey;
}
- private void createPeerConfiguration()
+ public void createPeerConfiguration()
{
m_oPeerConfig = new PeerConfig(this);
}
@@ -197,7 +198,24 @@ public class UnoDialog implements EventNames
}
}
-
+ public void printControlProperties(String ControlName)
+ {
+ try
+ {
+ Object xControlModel = getDlgNameAccess().getByName(ControlName);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xControlModel);
+ Property[] allProps = xPSet.getPropertySetInfo().getProperties();
+ for (int i = 0; i < allProps.length; i++)
+ {
+ String sName = allProps[i].Name;
+ System.out.println(sName);
+ }
+ }
+ catch (com.sun.star.uno.Exception exception)
+ { // com.sun.star.container.NoSuchElementException, com.sun.star.beans.UnknownPropertyException,
+ exception.printStackTrace(System.err); // com.sun.star.lang.WrappedTargetException, com.sun.star.beans.PropertyVetoException
+ }
+ }
public double getMAPConversionFactor(String ControlName)
{
@@ -251,7 +269,14 @@ public class UnoDialog implements EventNames
return ipos.length > 0;
}
-
+ public void addSingleItemtoListbox(XListBox xListBox, String ListItem, short iSelIndex)
+ {
+ xListBox.addItem(ListItem, xListBox.getItemCount());
+ if (iSelIndex != -1)
+ {
+ xListBox.selectItemPos(iSelIndex, true);
+ }
+ }
public XFixedText insertLabel(String sName, String[] sPropNames, Object[] oPropValues)
{
@@ -281,7 +306,7 @@ public class UnoDialog implements EventNames
{
xButton.addActionListener(xActionListener);
}
- Integer ControlKey = Integer.valueOf(iControlKey);
+ Integer ControlKey = new Integer(iControlKey);
if (ControlList != null)
{
ControlList.put(sName, ControlKey);
@@ -289,9 +314,41 @@ public class UnoDialog implements EventNames
return xButton;
}
+ public void insertCheckBox(String sName, int iControlKey, XItemListener xItemListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception
+ {
+ Object oButtonModel = insertControlModel("com.sun.star.awt.UnoControlCheckBoxModel", sName, sProperties, sValues);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oButtonModel);
+ xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName);
+ Object objectCheckBox = xDlgContainer.getControl(sName);
+ XCheckBox xCheckBox = UnoRuntime.queryInterface(XCheckBox.class, objectCheckBox);
+ if (xItemListener != null)
+ {
+ xCheckBox.addItemListener(xItemListener);
+ }
+ Integer ControlKey = new Integer(iControlKey);
+ if (ControlList != null)
+ {
+ ControlList.put(sName, ControlKey);
+ }
+ }
-
-
+ public void insertNumericField(String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception
+ {
+ Object oNumericFieldModel = insertControlModel("com.sun.star.awt.UnoControlNumericFieldModel", sName, sProperties, sValues);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oNumericFieldModel);
+ xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName);
+ Object objectNumericField = xDlgContainer.getControl(sName);
+ XTextComponent xNumericField = UnoRuntime.queryInterface(XTextComponent.class, objectNumericField);
+ if (xTextListener != null)
+ {
+ xNumericField.addTextListener(xTextListener);
+ }
+ Integer ControlKey = new Integer(iControlKey);
+ if (ControlList != null)
+ {
+ ControlList.put(sName, ControlKey);
+ }
+ }
public XScrollBar insertScrollBar(String sName, int iControlKey, XAdjustmentListener xAdjustmentListener, String[] sProperties, Object[] sValues)
{
@@ -306,7 +363,7 @@ public class UnoDialog implements EventNames
{
xScrollBar.addAdjustmentListener(xAdjustmentListener);
}
- Integer ControlKey = Integer.valueOf(iControlKey);
+ Integer ControlKey = new Integer(iControlKey);
if (ControlList != null)
{
ControlList.put(sName, ControlKey);
@@ -330,7 +387,7 @@ public class UnoDialog implements EventNames
return insertEditField("com.sun.star.awt.UnoControlFormattedFieldModel", sName, iControlKey, xTextListener, sProperties, sValues);
}
- private XTextComponent insertEditField(String ServiceName, String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues)
+ public XTextComponent insertEditField(String ServiceName, String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues)
{
try
{
@@ -343,7 +400,7 @@ public class UnoDialog implements EventNames
{
xTextBox.addTextListener(xTextListener);
}
- Integer ControlKey = Integer.valueOf(iControlKey);
+ Integer ControlKey = new Integer(iControlKey);
ControlList.put(sName, ControlKey);
return xTextBox;
}
@@ -369,12 +426,35 @@ public class UnoDialog implements EventNames
{
xListBox.addActionListener(xActionListener);
}
- Integer ControlKey = Integer.valueOf(iControlKey);
+ Integer ControlKey = new Integer(iControlKey);
ControlList.put(sName, ControlKey);
return xListBox;
}
-
+ public XComboBox insertComboBox(String sName, int iControlKey, XActionListener xActionListener, XTextListener xTextListener, XItemListener xItemListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception
+ {
+ XInterface xComboBoxModel = insertControlModel("com.sun.star.awt.UnoControlComboBoxModel", sName, sProperties, sValues);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xComboBoxModel);
+ xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName);
+ XControl xControlComboBox = xDlgContainer.getControl(sName);
+ XComboBox xComboBox = UnoRuntime.queryInterface(XComboBox.class, xControlComboBox);
+ if (xItemListener != null)
+ {
+ xComboBox.addItemListener(xItemListener);
+ }
+ if (xTextListener != null)
+ {
+ XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, xComboBox);
+ xTextComponent.addTextListener(xTextListener);
+ }
+ if (xActionListener != null)
+ {
+ xComboBox.addActionListener(xActionListener);
+ }
+ Integer ControlKey = new Integer(iControlKey);
+ ControlList.put(sName, ControlKey);
+ return xComboBox;
+ }
public XRadioButton insertRadioButton(String sName, int iControlKey, XItemListener xItemListener, String[] sProperties, Object[] sValues)
{
@@ -400,7 +480,7 @@ public class UnoDialog implements EventNames
public XRadioButton insertRadioButton(String sName, int iControlKey, String[] sProperties, Object[] sValues)
{
XRadioButton xRadioButton = insertRadioButton(sName, sProperties, sValues);
- Integer ControlKey = Integer.valueOf(iControlKey);
+ Integer ControlKey = new Integer(iControlKey);
ControlList.put(sName, ControlKey);
return xRadioButton;
}
@@ -439,7 +519,7 @@ public class UnoDialog implements EventNames
int iCurDialogStep = AnyConverter.toInt(Helper.getUnoPropertyValue(this.xDialogModel, PropertyNames.PROPERTY_STEP));
if (bIsVisible)
{
- setControlProperty(controlname, PropertyNames.PROPERTY_STEP, Integer.valueOf(iCurDialogStep));
+ setControlProperty(controlname, PropertyNames.PROPERTY_STEP, new Integer(iCurDialogStep));
}
else
{
@@ -461,7 +541,7 @@ public class UnoDialog implements EventNames
{
int ncurstep = AnyConverter.toInt(Helper.getUnoPropertyValue(this.xDialogModel, PropertyNames.PROPERTY_STEP));
Helper.setUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_STEP, 99);
- Helper.setUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_STEP, Integer.valueOf(ncurstep));
+ Helper.setUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_STEP, new Integer(ncurstep));
}
catch (com.sun.star.lang.IllegalArgumentException exception)
{
@@ -492,7 +572,25 @@ public class UnoDialog implements EventNames
xWindow.setFocus();
}
-
+ public static String[] combineListboxList(String sFirstEntry, String[] MainList)
+ {
+ try
+ {
+ String[] FirstList = new String[]
+ {
+ sFirstEntry
+ };
+ String[] ResultList = new String[MainList.length + 1];
+ System.arraycopy(FirstList, 0, ResultList, 0, 1);
+ System.arraycopy(MainList, 0, ResultList, 1, MainList.length);
+ return ResultList;
+ }
+ catch (java.lang.Exception jexception)
+ {
+ jexception.printStackTrace(System.err);
+ return null;
+ }
+ }
public void selectListBoxItem(XListBox xListBox, short iFieldsSelIndex)
{
@@ -514,6 +612,7 @@ public class UnoDialog implements EventNames
}
/** deselects a Listbox. MultipleMode is not supported
+ * @param _xBasisListBox
*/
public static void deselectListBox(XInterface _xBasisListBox)
{
@@ -541,7 +640,9 @@ public class UnoDialog implements EventNames
/**
*
+ * @param FramePosSize
* @return 0 for cancel, 1 for ok
+ * @throws com.sun.star.uno.Exception
*/
public short executeDialog(Rectangle FramePosSize) throws com.sun.star.uno.Exception
{
@@ -572,10 +673,21 @@ public class UnoDialog implements EventNames
this.xWindow.setVisible(true);
}
-
+ /**
+ * @param parent
+ * @return 0 for cancel, 1 for ok.
+ * @throws com.sun.star.uno.Exception
+ */
+ public short executeDialog(UnoDialog parent)
+ throws com.sun.star.uno.Exception
+ {
+ return executeDialog(parent.xWindow.getPosSize());
+ }
/**
+ * @param xComponent
* @return 0 for cancel, 1 for ok.
+ * @throws com.sun.star.uno.Exception
*/
public short executeDialog(XInterface xComponent) throws com.sun.star.uno.Exception
{
@@ -603,7 +715,14 @@ public class UnoDialog implements EventNames
return executeDialog(Desktop.getActiveFrame(xMSF));
}
-
+ public void setAutoMnemonic(String ControlName, boolean bValue)
+ {
+ Object oControl = xDlgContainer.getControl(ControlName);
+ xControl = UnoRuntime.queryInterface(XControl.class, oControl);
+ XWindowPeer xWindowPeer = xControl.getPeer();
+ XVclWindowPeer xVclWindowPeer = UnoRuntime.queryInterface(XVclWindowPeer.class, xWindowPeer);
+ xVclWindowPeer.setProperty("AutoMnemonics", Boolean.valueOf(bValue));
+ }
public void modifyFontWeight(String ControlName, float FontWeight)
{
@@ -616,6 +735,9 @@ public class UnoDialog implements EventNames
* create a peer for this
* dialog, using the given
* peer as a parent.
+ * @param parentPeer
+ * @return
+ * @throws com.sun.star.uno.Exception
*/
public XWindowPeer createWindowPeer(XWindowPeer parentPeer) throws com.sun.star.uno.Exception
{
@@ -637,15 +759,41 @@ public class UnoDialog implements EventNames
* Creates a peer for this
* dialog, using the active OO frame
* as the parent window.
+ * @return
+ * @throws com.sun.star.uno.Exception
*/
public XWindowPeer createWindowPeer() throws com.sun.star.uno.Exception
{
return createWindowPeer(null);
}
+ // deletes the first entry when this is equal to "DelEntryName"
+ // returns true when a new item is selected
+ public void deletefirstListboxEntry(String ListBoxName, String DelEntryName)
+ {
+ XControl xListControl = xDlgContainer.getControl(ListBoxName);
+ XListBox xListBox = UnoRuntime.queryInterface(XListBox.class, xListControl);
+ String FirstItem = xListBox.getItem((short) 0);
+ if (FirstItem.equals(DelEntryName))
+ {
+ short SelPos = xListBox.getSelectedItemPos();
+ xListBox.removeItems((short) 0, (short) 1);
+ if (SelPos > 0)
+ {
+ setControlProperty(ListBoxName, PropertyNames.SELECTED_ITEMS, new short[SelPos]);
+ xListBox.selectItemPos((short) (SelPos - 1), true);
+ }
+ }
+ }
-
-
+ public void setPeerProperty(String ControlName, String PropertyName, Object PropertyValue)
+ {
+ Object oControl = xDlgContainer.getControl(ControlName);
+ XControl xControl = UnoRuntime.queryInterface(XControl.class, oControl);
+ XWindowPeer xControlPeer = xControl.getPeer();
+ XVclWindowPeer xVclWindowPeer = UnoRuntime.queryInterface(XVclWindowPeer.class, xControlPeer);
+ xVclWindowPeer.setProperty(PropertyName, PropertyValue);
+ }
public static Object getModel(Object control)
{
@@ -658,7 +806,7 @@ public class UnoDialog implements EventNames
setEnabled(control, enabled ? Boolean.TRUE : Boolean.FALSE);
}
- private static void setEnabled(Object control, Boolean enabled)
+ public static void setEnabled(Object control, Boolean enabled)
{
Helper.setUnoPropertyValue(getModel(control), PropertyNames.PROPERTY_ENABLED, enabled);
}
@@ -667,7 +815,7 @@ public class UnoDialog implements EventNames
* @param oControlModel the model of a control
* @return the LabelType according to UIConsts.CONTROLTYPE
*/
- private static int getControlModelType(Object oControlModel)
+ public static int getControlModelType(Object oControlModel)
{
XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, oControlModel);
if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlFixedTextModel"))
@@ -749,6 +897,7 @@ public class UnoDialog implements EventNames
}
/**
+ * @param oControlModel
* @return the name of the property that contains the value of a controlmodel
*/
public static String getDisplayProperty(Object oControlModel)
@@ -762,7 +911,7 @@ public class UnoDialog implements EventNames
* @param itype The type of the control conforming to UIConst.ControlType
* @return the name of the property that contains the value of a controlmodel
*/
- private static String getDisplayProperty(int itype)
+ public static String getDisplayProperty(int itype)
{
switch (itype)
{
@@ -852,20 +1001,20 @@ public class UnoDialog implements EventNames
}
}
- private static int getRedColorShare(int _nColor)
+ public static int getRedColorShare(int _nColor)
{
int nRed = _nColor / 65536;
return nRed;
}
- private static int getGreenColorShare(int _nColor)
+ public static int getGreenColorShare(int _nColor)
{
int nRedModulo = _nColor % 65536;
int nGreen = nRedModulo / 256;
return nGreen;
}
- private static int getBlueColorShare(int _nColor)
+ public static int getBlueColorShare(int _nColor)
{
int nRedModulo = _nColor % 65536;
int nGreenModulo = (nRedModulo % 256);
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.java b/wizards/com/sun/star/wizards/ui/UnoDialog2.java
index 6fcf825222c1..dc60585f0824 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog2.java
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog2.java
@@ -42,7 +42,7 @@ public class UnoDialog2 extends UnoDialog
* Override this method to return another listener.
* @return
*/
- private AbstractListener createListener()
+ protected AbstractListener createListener()
{
return new CommonListener();
}
@@ -75,7 +75,7 @@ public class UnoDialog2 extends UnoDialog
return insertButton(sName, actionPerformed, this, sPropNames, oPropValues);
}
- public XButton insertImageButton(String sName, com.sun.star.awt.XActionListener actionPerformed, String[] sPropNames, Object[] oPropValues)
+ public XButton insertImageButton(String sName, com.sun.star.awt.XActionListener actionPerformed, Object eventTarget, String[] sPropNames, Object[] oPropValues)
{
XButton xButton = (XButton) insertControlModel2("com.sun.star.awt.UnoControlButtonModel", sName, sPropNames, oPropValues, XButton.class);
@@ -87,6 +87,11 @@ public class UnoDialog2 extends UnoDialog
return xButton;
}
+ public XButton insertImageButton(String sName, com.sun.star.awt.XActionListener actionPerformed, String[] sPropNames, Object[] oPropValues)
+ {
+ return insertImageButton(sName, actionPerformed, this, sPropNames, oPropValues);
+ }
+
public XCheckBox insertCheckBox(String sName, String itemChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
{
@@ -105,6 +110,33 @@ public class UnoDialog2 extends UnoDialog
return insertCheckBox(sName, itemChanged, this, sPropNames, oPropValues);
}
+ public XComboBox insertComboBox(String sName, String actionPerformed, String itemChanged, String textChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ {
+ XComboBox xComboBox = (XComboBox) insertControlModel2("com.sun.star.awt.UnoControlComboBoxModel", sName, sPropNames, oPropValues, XComboBox.class);
+ if (actionPerformed != null)
+ {
+ xComboBox.addActionListener((XActionListener) guiEventListener);
+ guiEventListener.add(sName, EVENT_ACTION_PERFORMED, actionPerformed, eventTarget);
+ }
+ if (itemChanged != null)
+ {
+ xComboBox.addItemListener((XItemListener) guiEventListener);
+ guiEventListener.add(sName, EVENT_ITEM_CHANGED, itemChanged, eventTarget);
+ }
+ if (textChanged != null)
+ {
+ XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, xComboBox);
+ xTextComponent.addTextListener((XTextListener) guiEventListener);
+ guiEventListener.add(sName, EVENT_TEXT_CHANGED, textChanged, eventTarget);
+ }
+ return xComboBox;
+ }
+
+ public XComboBox insertComboBox(String sName, String actionPerformed, String itemChanged, String textChanged, String[] sPropNames, Object[] oPropValues)
+ {
+ return insertComboBox(sName, actionPerformed, textChanged, itemChanged, this, sPropNames, oPropValues);
+ }
+
public XListBox insertListBox(String sName, String actionPerformed, String itemChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
{
XListBox xListBox = (XListBox) insertControlModel2("com.sun.star.awt.UnoControlListBoxModel", sName, sPropNames, oPropValues, XListBox.class);
@@ -142,14 +174,21 @@ public class UnoDialog2 extends UnoDialog
return insertRadioButton(sName, itemChanged, this, sPropNames, oPropValues);
}
-
+ public XControl insertTitledBox(String sName, String[] sPropNames, Object[] oPropValues)
+ {
+ Object oTitledBox = insertControlModel2("com.sun.star.awt.UnoControlGroupBoxModel", sName, sPropNames, oPropValues);
+ return UnoRuntime.queryInterface(XControl.class, oTitledBox);
+ }
public XTextComponent insertTextField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
{
return (XTextComponent) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlEditModel", sPropNames, oPropValues, XTextComponent.class);
}
-
+ public XTextComponent insertTextField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues)
+ {
+ return insertTextField(sName, sTextChanged, this, sPropNames, oPropValues);
+ }
public XControl insertImage(String sName, String[] sPropNames, Object[] oPropValues)
{
@@ -165,7 +204,7 @@ public class UnoDialog2 extends UnoDialog
},
new Object[]
{
- Short.valueOf((short) 0), 10, UIConsts.INFOIMAGEURL, Integer.valueOf(_posx), Integer.valueOf(_posy), Boolean.FALSE, Integer.valueOf(_iStep), 10
+ new Short((short) 0), 10, UIConsts.INFOIMAGEURL, new Integer(_posx), new Integer(_posy), Boolean.FALSE, new Integer(_iStep), 10
});
super.getPeerConfiguration().setImageUrl(getModel(xImgControl), UIConsts.INFOIMAGEURL, UIConsts.INFOIMAGEURL_HC);
return xImgControl;
@@ -186,19 +225,101 @@ public class UnoDialog2 extends UnoDialog
return UnoRuntime.queryInterface(type, xField);
}
- public XControl insertFixedLine(String sName, String[] sPropNames, Object[] oPropValues)
+ public XControl insertFileControl(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
{
- Object oLine = insertControlModel2("com.sun.star.awt.UnoControlFixedLineModel", sName, sPropNames, oPropValues);
- return UnoRuntime.queryInterface(XControl.class, oLine);
+ return (XControl) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlFileControlModel", sPropNames, oPropValues, XControl.class);
+ }
+
+ public XControl insertFileControl(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues)
+ {
+ return insertFileControl(sName, sTextChanged, this, sPropNames, oPropValues);
+ }
+
+ public XCurrencyField insertCurrencyField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ {
+ return (XCurrencyField) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlCurrencyFieldModel", sPropNames, oPropValues, XCurrencyField.class);
+ }
+
+ public XCurrencyField insertCurrencyField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues)
+ {
+ return insertCurrencyField(sName, sTextChanged, this, sPropNames, oPropValues);
+ }
+
+ public XDateField insertDateField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ {
+ return (XDateField) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlDateFieldModel", sPropNames, oPropValues, XDateField.class);
}
+ public XDateField insertDateField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues)
+ {
+ return insertDateField(sName, sTextChanged, this, sPropNames, oPropValues);
+ }
+ public XNumericField insertNumericField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ {
+ return (XNumericField) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlNumericFieldModel", sPropNames, oPropValues, XNumericField.class);
+ }
+ public XNumericField insertNumericField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues)
+ {
+ return insertNumericField(sName, sTextChanged, this, sPropNames, oPropValues);
+ }
+ public XTimeField insertTimeField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ {
+ return (XTimeField) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlTimeFieldModel", sPropNames, oPropValues, XTimeField.class);
+ }
+ public XTimeField insertTimeField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues)
+ {
+ return insertTimeField(sName, sTextChanged, this, sPropNames, oPropValues);
+ }
+ public XPatternField insertPatternField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ {
+ return (XPatternField) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlPatternFieldModel", sPropNames, oPropValues, XPatternField.class);
+ }
+
+ public XPatternField insertPatternField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues)
+ {
+ return insertPatternField(sName, sTextChanged, this, sPropNames, oPropValues);
+ }
- private Object insertControlModel2(String serviceName, String componentName, String[] sPropNames, Object[] oPropValues)
+ public XTextComponent insertFormattedField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ {
+ return (XTextComponent) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlFormattedFieldModel", sPropNames, oPropValues, XTextComponent.class);
+ }
+
+ public XTextComponent insertFormattedField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues)
+ {
+ return insertFormattedField(sName, sTextChanged, this, sPropNames, oPropValues);
+ }
+
+ public XControl insertFixedLine(String sName, String[] sPropNames, Object[] oPropValues)
+ {
+ Object oLine = insertControlModel2("com.sun.star.awt.UnoControlFixedLineModel", sName, sPropNames, oPropValues);
+ return UnoRuntime.queryInterface(XControl.class, oLine);
+ }
+
+ public XScrollBar insertScrollBar(String sName, String[] sPropNames, Object[] oPropValues)
+ {
+ Object oScrollBar = insertControlModel2("com.sun.star.awt.UnoControlScrollBarModel", sName, sPropNames, oPropValues);
+ return UnoRuntime.queryInterface(XScrollBar.class, oScrollBar);
+ }
+
+ public XProgressBar insertProgressBar(String sName, String[] sPropNames, Object[] oPropValues)
+ {
+ Object oProgressBar = insertControlModel2("com.sun.star.awt.UnoControlProgressBarModel", sName, sPropNames, oPropValues);
+ return UnoRuntime.queryInterface(XProgressBar.class, oProgressBar);
+ }
+
+ public XControl insertGroupBox(String sName, String[] sPropNames, Object[] oPropValues)
+ {
+ Object oGroupBox = insertControlModel2("com.sun.star.awt.UnoControlGroupBoxModel", sName, sPropNames, oPropValues);
+ return UnoRuntime.queryInterface(XControl.class, oGroupBox);
+ }
+
+ public Object insertControlModel2(String serviceName, String componentName, String[] sPropNames, Object[] oPropValues)
{
try
{
@@ -217,12 +338,20 @@ public class UnoDialog2 extends UnoDialog
return xDlgContainer.getControl(componentName);
}
- private Object insertControlModel2(String serviceName, String componentName, String[] sPropNames, Object[] oPropValues, Class<? extends XInterface> type)
+ public Object insertControlModel2(String serviceName, String componentName, String[] sPropNames, Object[] oPropValues, Class<? extends XInterface> type)
{
return UnoRuntime.queryInterface(type, insertControlModel2(serviceName, componentName, sPropNames, oPropValues));
}
+ public String translateURL(String relativeURL)
+ {
+ return PropertyNames.EMPTY_STRING;
+ }
+ public static Object getControlModel(Object unoControl)
+ {
+ return UnoRuntime.queryInterface(XControl.class, unoControl).getModel();
+ }
public int showMessageBox(String windowServiceName, int windowAttribute, String MessageText)
{
diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.java b/wizards/com/sun/star/wizards/ui/WizardDialog.java
index 6b4ce02c877e..6ed54d9f2e4c 100644
--- a/wizards/com/sun/star/wizards/ui/WizardDialog.java
+++ b/wizards/com/sun/star/wizards/ui/WizardDialog.java
@@ -48,21 +48,21 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
private static final String FINISH_ACTION_PERFORMED = "finishWizard_1";
private static final String CANCEL_ACTION_PERFORMED = "cancelWizard_1";
private static final String HELP_ACTION_PERFORMED = "callHelp";
-
+ public VetoableChangeSupport vetos = new VetoableChangeSupport(this);
private String[] sRightPaneHeaders;
private int iButtonWidth = 50;
private int nNewStep = 1;
private int nOldStep = 1;
private int nMaxStep = 1;
-
- private XControl xRoadmapControl;
- private XItemEventBroadcaster xRoadmapBroadcaster;
- private String[] sRMItemLabels;
+ protected XItemListener RoadmapItemListener;
+ protected XControl xRoadmapControl;
+ XItemEventBroadcaster xRoadmapBroadcaster;
+ String[] sRMItemLabels;
private Object oRoadmap;
private XSingleServiceFactory xSSFRoadmap;
public XIndexContainer xIndexContRoadmap;
private Resource oWizardResource;
-
+ public String sMsgEndAutopilot;
private int hid;
private boolean bTerminateListenermustberemoved = true;
@@ -74,21 +74,29 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
* "HID:(hid+3)" - the next button
* "HID:(hid+4)" - the create button
* "HID:(hid+5)" - the cancel button
+ * @param xMSF
+ * @param hid_
*/
public WizardDialog(XMultiServiceFactory xMSF, int hid_)
{
super(xMSF);
hid = hid_;
oWizardResource = new Resource(xMSF, "Common", "dbw");
+ sMsgEndAutopilot = oWizardResource.getResText(UIConsts.RID_DB_COMMON + 33);
+
+ //new Resource(xMSF,"Common","com");
}
- @Override
+ /**
+ *
+ * @return
+ */
public Resource getResource()
{
return oWizardResource;
}
- private void activate()
+ public void activate()
{
try
{
@@ -142,7 +150,22 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
nNewStep = nOldStep;
}
-
+ public void itemStateChanged(com.sun.star.awt.ItemEvent itemEvent)
+ {
+ try
+ {
+ nNewStep = itemEvent.ItemId;
+ nOldStep = AnyConverter.toInt(Helper.getUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_STEP));
+ if (nNewStep != nOldStep)
+ {
+ switchToStep();
+ }
+ }
+ catch (com.sun.star.lang.IllegalArgumentException exception)
+ {
+ exception.printStackTrace(System.err);
+ }
+ }
public void setRoadmapInteractive(boolean _bInteractive)
{
@@ -174,7 +197,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
int nCurItemID = getCurrentRoadmapItemID();
if (nCurItemID != ID)
{
- Helper.setUnoPropertyValue(oRoadmap, "CurrentItemID", Short.valueOf(ID));
+ Helper.setUnoPropertyValue(oRoadmap, "CurrentItemID", new Short(ID));
}
}
}
@@ -214,11 +237,11 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
},
new Object[]
{
- Integer.valueOf(iDialogHeight - 26),
+ new Integer(iDialogHeight - 26),
0,
0,
0,
- Short.valueOf((short)0),
+ new Short((short)0),
Boolean.TRUE,
85
});
@@ -256,6 +279,13 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
return sRMItemLabels;
}
+ /* public void insertRoadmapItems(int StartIndex, int RMCount)
+ {
+ Object oRoadmapItem;
+ boolean bEnabled;
+ for (int i = StartIndex; i < (StartIndex + RMCount); i++)
+ insertSingleRoadmapItem(i, true, sRMItemLabels[i], i);
+ }*/
public int insertRoadmapItem(int _Index, boolean _bEnabled, int _LabelID, int _CurItemID)
{
return insertRoadmapItem(_Index, _bEnabled, sRMItemLabels[_LabelID], _CurItemID);
@@ -268,7 +298,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
Object oRoadmapItem = xSSFRoadmap.createInstance();
Helper.setUnoPropertyValue(oRoadmapItem, PropertyNames.PROPERTY_LABEL, _sLabel);
Helper.setUnoPropertyValue(oRoadmapItem, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bEnabled));
- Helper.setUnoPropertyValue(oRoadmapItem, "ID", Integer.valueOf(_CurItemID));
+ Helper.setUnoPropertyValue(oRoadmapItem, "ID", new Integer(_CurItemID));
xIndexContRoadmap.insertByIndex(Index, oRoadmapItem);
return Index + 1;
}
@@ -341,9 +371,9 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
abstract protected void enterStep(int nOldStep, int nNewStep);
- private void changeToStep(int nNewStep)
+ protected void changeToStep(int nNewStep)
{
- Helper.setUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_STEP, Integer.valueOf(nNewStep));
+ Helper.setUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_STEP, new Integer(nNewStep));
setCurrentRoadmapItemID((short) (nNewStep));
enableNextButton(getNextAvailableStep() > 0);
enableBackButton(nNewStep != 1);
@@ -353,6 +383,11 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
/* (non-Javadoc)
* @see com.sun.star.wizards.ui.XCompletion#iscompleted(int)
*/
+ /**
+ *
+ * @param _ndialogpage
+ * @return
+ */
public boolean iscompleted(int _ndialogpage)
{
return false;
@@ -360,6 +395,12 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
/* (non-Javadoc)
* @see com.sun.star.wizards.ui.XCompletion#ismodified(int)
*/
+
+ /**
+ *
+ * @param _ndialogpage
+ * @return
+ */
public boolean ismodified(int _ndialogpage)
{
return false;
@@ -367,12 +408,25 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
/* (non-Javadoc)
* @see com.sun.star.wizards.ui.XCompletion#setcompleted(int, boolean)
*/
+
+ /**
+ *
+ * @param _ndialogpage
+ * @param _biscompleted
+ */
public void setcompleted(int _ndialogpage, boolean _biscompleted)
{
}
/* (non-Javadoc)
* @see com.sun.star.wizards.ui.XCompletion#setmodified(int, java.lang.Object, java.lang.Object)
*/
+
+ /**
+ *
+ * @param _ndialogpage
+ * @param ooldValue
+ * @param onewValue
+ */
public void setmodified(int _ndialogpage, Object ooldValue, Object onewValue)
{
}
@@ -383,9 +437,9 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
try
{
short curtabindex = UIConsts.SOFIRSTWIZARDNAVITABINDEX;
- Integer IButtonWidth = Integer.valueOf(iButtonWidth);
+ Integer IButtonWidth = new Integer(iButtonWidth);
int iButtonHeight = 14;
- Integer IButtonHeight = Integer.valueOf(iButtonHeight);
+ Integer IButtonHeight = new Integer(iButtonHeight);
Integer ICurStep = 0;
int iDialogHeight = ((Integer) Helper.getUnoPropertyValue(this.xDialogModel, PropertyNames.PROPERTY_HEIGHT)).intValue();
int iDialogWidth = ((Integer) Helper.getUnoPropertyValue(this.xDialogModel, PropertyNames.PROPERTY_WIDTH)).intValue();
@@ -403,7 +457,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
},
new Object[]
{
- 1, 0, 0, Integer.valueOf(iDialogHeight - 26), ICurStep, Integer.valueOf(iDialogWidth)
+ 1, 0, 0, new Integer(iDialogHeight - 26), ICurStep, new Integer(iDialogWidth)
});
insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "lnRoadSep",
@@ -413,7 +467,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
},
new Object[]
{
- Integer.valueOf(iBtnPosY - 6), 1, 85, 0, ICurStep, 1
+ new Integer(iBtnPosY - 6), 1, 85, 0, ICurStep, 1
});
String[] propNames = new String[]
@@ -428,30 +482,30 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
},
new Object[]
{
- true, IButtonHeight, oWizardResource.getResText(UIConsts.RID_COMMON + 15), Integer.valueOf(iHelpPosX), Integer.valueOf(iBtnPosY), Short.valueOf((short) PushButtonType.HELP_value), ICurStep, Short.valueOf(curtabindex++), IButtonWidth
+ true, IButtonHeight, oWizardResource.getResText(UIConsts.RID_COMMON + 15), new Integer(iHelpPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.HELP_value), ICurStep, new Short(curtabindex++), IButtonWidth
});
insertButton("btnWizardBack", BACK_ACTION_PERFORMED, propNames,
new Object[]
{
- false, IButtonHeight, HelpIds.getHelpIdString(hid + 2), oWizardResource.getResText(UIConsts.RID_COMMON + 13), Integer.valueOf(iBackPosX), Integer.valueOf(iBtnPosY), Short.valueOf((short) PushButtonType.STANDARD_value), ICurStep, Short.valueOf(curtabindex++), IButtonWidth
+ false, IButtonHeight, HelpIds.getHelpIdString(hid + 2), oWizardResource.getResText(UIConsts.RID_COMMON + 13), new Integer(iBackPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth
});
insertButton("btnWizardNext", NEXT_ACTION_PERFORMED, propNames,
new Object[]
{
- true, IButtonHeight, HelpIds.getHelpIdString(hid + 3), oWizardResource.getResText(UIConsts.RID_COMMON + 14), Integer.valueOf(iNextPosX), Integer.valueOf(iBtnPosY), Short.valueOf((short) PushButtonType.STANDARD_value), ICurStep, Short.valueOf(curtabindex++), IButtonWidth
+ true, IButtonHeight, HelpIds.getHelpIdString(hid + 3), oWizardResource.getResText(UIConsts.RID_COMMON + 14), new Integer(iNextPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth
});
insertButton("btnWizardFinish", FINISH_ACTION_PERFORMED, propNames,
new Object[]
{
- true, IButtonHeight, HelpIds.getHelpIdString(hid + 4), oWizardResource.getResText(UIConsts.RID_COMMON + 12), Integer.valueOf(iFinishPosX), Integer.valueOf(iBtnPosY), Short.valueOf((short) PushButtonType.STANDARD_value), ICurStep, Short.valueOf(curtabindex++), IButtonWidth
+ true, IButtonHeight, HelpIds.getHelpIdString(hid + 4), oWizardResource.getResText(UIConsts.RID_COMMON + 12), new Integer(iFinishPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth
});
insertButton("btnWizardCancel", CANCEL_ACTION_PERFORMED, propNames,
new Object[]
{
- true, IButtonHeight, HelpIds.getHelpIdString(hid + 5), oWizardResource.getResText(UIConsts.RID_COMMON + 11), Integer.valueOf(iCancelPosX), Integer.valueOf(iBtnPosY), Short.valueOf((short) PushButtonType.STANDARD_value), ICurStep, Short.valueOf(curtabindex++), IButtonWidth
+ true, IButtonHeight, HelpIds.getHelpIdString(hid + 5), oWizardResource.getResText(UIConsts.RID_COMMON + 11), new Integer(iCancelPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth
});
setControlProperty("btnWizardNext", "DefaultButton", Boolean.TRUE);
@@ -470,9 +524,28 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
}
}
+ protected void insertRoadMapItems(String[] items, int[] steps, boolean[] enabled)
+ {
+ for (int i = 0; i < items.length; i++)
+ {
+ insertRoadmapItem(i, enabled[i], items[i], steps[i]);
+ }
+ }
-
-
+ /** This method also enables and disables the "next" button,
+ * if the step currently dis/enabled is the one of the next steps.
+ * @param _nStep
+ * @param bEnabled
+ * @param enableNextButton
+ */
+ public void setStepEnabled(int _nStep, boolean bEnabled, boolean enableNextButton)
+ {
+ setStepEnabled(_nStep, bEnabled);
+ if (getNextAvailableStep() > 0)
+ {
+ enableNextButton(bEnabled);
+ }
+ }
public void enableNavigationButtons(boolean _bEnableBack, boolean _bEnableNext, boolean _bEnableFinish)
{
@@ -481,7 +554,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
enableFinishButton(_bEnableFinish);
}
- private void enableBackButton(boolean enabled)
+ public void enableBackButton(boolean enabled)
{
setControlProperty("btnWizardBack", PropertyNames.PROPERTY_ENABLED, enabled ? Boolean.TRUE : Boolean.FALSE);
}
@@ -525,7 +598,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
}
}
- private boolean isStepEnabled(int _nStep)
+ public boolean isStepEnabled(int _nStep)
{
try
{
@@ -546,10 +619,32 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
}
}
-
+ public synchronized void gotoPreviousAvailableStep()
+ {
+ boolean bIsEnabled;
+ if (nNewStep > 1)
+ {
+ nOldStep = nNewStep;
+ nNewStep--;
+ while (nNewStep > 0)
+ {
+ bIsEnabled = isStepEnabled(nNewStep);
+ if (bIsEnabled)
+ {
+ break;
+ }
+ nNewStep--;
+ }
+ if (nNewStep == 0) // Exception???
+ {
+ nNewStep = nOldStep;
+ }
+ switchToStep();
+ }
+ }
//TODO discuss with rp
- private int getNextAvailableStep()
+ protected int getNextAvailableStep()
{
if (isRoadmapComplete())
{
@@ -564,11 +659,37 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
return -1;
}
-
+ public synchronized void gotoNextAvailableStep()
+ {
+ nOldStep = nNewStep;
+ nNewStep = getNextAvailableStep();
+ if (nNewStep > -1)
+ {
+ switchToStep();
+ }
+ }
public abstract boolean finishWizard();
-
+ /**
+ * This function will call if the finish button is pressed on the UI.
+ */
+ public void finishWizard_1()
+ {
+ enableFinishButton(false);
+ boolean success = false;
+ try
+ {
+ success = finishWizard();
+ }
+ finally
+ {
+ if ( !success )
+ enableFinishButton( true );
+ }
+ if ( success )
+ removeTerminateListener();
+ }
public int getMaximalStep()
{
@@ -616,7 +737,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
},
new Object[]
{
- oFontDesc, 16, sRightPaneHeaders[i], Boolean.TRUE, 91, 8, Integer.valueOf(i + 1), Short.valueOf((short) 12), 212
+ oFontDesc, 16, sRightPaneHeaders[i], Boolean.TRUE, 91, 8, new Integer(i + 1), new Short((short) 12), 212
});
}
}
@@ -627,9 +748,12 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
xDialog.endExecute();
}
+ public void callHelp()
+ {
+ //should be overwritten by extending class
+ }
-
- private void removeTerminateListener()
+ public void removeTerminateListener()
{
if (bTerminateListenermustberemoved)
{
@@ -644,13 +768,16 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
* if this method was not called before,
* perform a cancel.
*/
- private void cancelWizard_1()
+ public void cancelWizard_1()
{
cancelWizard();
removeTerminateListener();
}
-
+ public void windowHidden()
+ {
+ cancelWizard_1();
+ }
public void notifyTermination(EventObject arg0)
{
diff --git a/wizards/com/sun/star/wizards/ui/XCommandSelectionListener.java b/wizards/com/sun/star/wizards/ui/XCommandSelectionListener.java
new file mode 100644
index 000000000000..2731e0ba513e
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/XCommandSelectionListener.java
@@ -0,0 +1,24 @@
+/*
+ * 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 XCommandSelectionListener
+{
+ public void CommandSelected(String CommandName);
+}
diff --git a/wizards/com/sun/star/wizards/ui/XCompletion.java b/wizards/com/sun/star/wizards/ui/XCompletion.java
index 0b763484ac7e..af444f72cc16 100644
--- a/wizards/com/sun/star/wizards/ui/XCompletion.java
+++ b/wizards/com/sun/star/wizards/ui/XCompletion.java
@@ -20,8 +20,11 @@ package com.sun.star.wizards.ui;
public interface XCompletion
{
- void setcompleted(int _ndialogpage, boolean _biscompleted);
+ public void setcompleted(int _ndialogpage, boolean _biscompleted);
- boolean iscompleted(int _ndialogpage);
+ public boolean iscompleted(int _ndialogpage);
+ public void setmodified(int _ndialogpage, Object ooldValue, Object onewValue);
+
+ public boolean ismodified(int _ndialogpage);
}
diff --git a/wizards/com/sun/star/wizards/ui/XFieldSelectionListener.java b/wizards/com/sun/star/wizards/ui/XFieldSelectionListener.java
index a0c3714b22af..3e0c0fe042f2 100644
--- a/wizards/com/sun/star/wizards/ui/XFieldSelectionListener.java
+++ b/wizards/com/sun/star/wizards/ui/XFieldSelectionListener.java
@@ -21,15 +21,15 @@ package com.sun.star.wizards.ui;
public interface XFieldSelectionListener
{
- void shiftFromLeftToRight(String[] SelItems, String[] NewItems);
+ public void shiftFromLeftToRight(String[] SelItems, String[] NewItems);
- void shiftFromRightToLeft(String[] OldSelItems, String[] NewItems);
+ public void shiftFromRightToLeft(String[] OldSelItems, String[] NewItems);
- void moveItemUp(String Selitem);
+ public void moveItemUp(String Selitem);
- void moveItemDown(String Selitem);
+ public void moveItemDown(String Selitem);
- void setID(String sIncSuffix);
+ public void setID(String sIncSuffix);
- int getID();
+ public int getID();
}
diff --git a/wizards/com/sun/star/wizards/ui/XPathSelectionListener.java b/wizards/com/sun/star/wizards/ui/XPathSelectionListener.java
index 6a9d4ad9e7af..248b46b03983 100644
--- a/wizards/com/sun/star/wizards/ui/XPathSelectionListener.java
+++ b/wizards/com/sun/star/wizards/ui/XPathSelectionListener.java
@@ -21,5 +21,5 @@ package com.sun.star.wizards.ui;
public interface XPathSelectionListener
{
- void validatePath();
+ public void validatePath();
}
diff --git a/wizards/com/sun/star/wizards/ui/event/AbstractListener.java b/wizards/com/sun/star/wizards/ui/event/AbstractListener.java
index 2fec29eddf0a..bfe2c417d1fe 100644
--- a/wizards/com/sun/star/wizards/ui/event/AbstractListener.java
+++ b/wizards/com/sun/star/wizards/ui/event/AbstractListener.java
@@ -43,6 +43,11 @@ public class AbstractListener
private HashMap<String,MethodInvocation> mHashtable = new HashMap<String,MethodInvocation>();
+ /** Creates a new instance of AbstractListener */
+ public AbstractListener()
+ {
+ }
+
public void add(String componentName, String eventName, String methodName, Object target)
{
try
@@ -60,7 +65,7 @@ public class AbstractListener
mHashtable.put(componentName + eventName, mi);
}
- private MethodInvocation get(String componentName, String eventName)
+ public MethodInvocation get(String componentName, String eventName)
{
return mHashtable.get(componentName + eventName);
}
diff --git a/wizards/com/sun/star/wizards/ui/event/CommonListener.java b/wizards/com/sun/star/wizards/ui/event/CommonListener.java
index 8b455b517d44..d0387f7533a6 100644
--- a/wizards/com/sun/star/wizards/ui/event/CommonListener.java
+++ b/wizards/com/sun/star/wizards/ui/event/CommonListener.java
@@ -23,6 +23,11 @@ import com.sun.star.lang.EventObject;
public class CommonListener extends AbstractListener implements XActionListener, XItemListener, XTextListener, EventNames, XWindowListener, XMouseListener, XFocusListener, XKeyListener
{
+ /** Creates a new instance of CommonListener */
+ public CommonListener()
+ {
+ }
+
/**
* Implementation of com.sun.star.awt.XActionListener
*/
diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.java b/wizards/com/sun/star/wizards/ui/event/DataAware.java
index 2b7b1966a0cb..32d8ded9236e 100644
--- a/wizards/com/sun/star/wizards/ui/event/DataAware.java
+++ b/wizards/com/sun/star/wizards/ui/event/DataAware.java
@@ -20,6 +20,8 @@ package com.sun.star.wizards.ui.event;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
import com.sun.star.wizards.common.PropertyNames;
/**
@@ -41,15 +43,17 @@ public abstract class DataAware {
/**
* this is the data object.
*/
- private Object dataObject;
+ protected Object dataObject;
/**
* A Value Object knows how to get/set a value
* from/to the data object.
*/
- private Value value;
+ protected Value value;
/**
* creates a DataAware object for the given data object and Value object.
+ * @param dataObject_
+ * @param value_
*/
protected DataAware(Object dataObject_, Value value_) {
dataObject = dataObject_;
@@ -58,19 +62,38 @@ public abstract class DataAware {
/**
* returns the data object.
+ * @return
*/
public Object getDataObject() {
return dataObject;
}
/**
+ * sets a new data object. Optionally
+ * update the UI.
+ * @param obj the new data object.
+ * @param updateUI if true updateUI() will be called.
+ */
+ public void setDataObject(Object obj, boolean updateUI) {
+
+ if (obj != null && !value.isAssignable(obj.getClass()))
+ throw new ClassCastException("can not cast new DataObject to original Class");
+
+ dataObject = obj;
+
+ if (updateUI)
+ updateUI();
+
+ }
+
+ /**
* Sets the given value to the data object.
* this method delegates the job to the
* Value object, but can be overwritten if
* another kind of Data is needed.
* @param newValue the new value to set to the DataObject.
*/
- private void setToData(Object newValue) {
+ protected void setToData(Object newValue) {
value.set(newValue,getDataObject());
}
@@ -80,7 +103,7 @@ public abstract class DataAware {
* the value object.
* @return the current value of the data object.
*/
- private Object getFromData() {
+ protected Object getFromData() {
return value.get(getDataObject());
}
@@ -97,6 +120,23 @@ public abstract class DataAware {
protected abstract Object getFromUI();
/**
+ * updates the UI control according to the
+ * current state of the data object.
+ */
+ public void updateUI() {
+ Object data = getFromData();
+ Object ui = getFromUI();
+ if (!equals(data, ui))
+ try {
+ setToUI(data);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ //TODO tell user...
+ }
+ enableControls(data);
+ }
+
+ /**
* enables
* @param currentValue
*/
@@ -116,7 +156,7 @@ public abstract class DataAware {
}
public interface Listener {
- void eventPerformed(Object event);
+ public void eventPerformed(Object event);
}
/**
@@ -127,7 +167,7 @@ public abstract class DataAware {
* @param b second object to compare.
* @return true if both are null or both are equal.
*/
- private boolean equals(Object a, Object b) {
+ protected boolean equals(Object a, Object b) {
if (a == null && b == null)
return true;
if (a == null || b == null)
@@ -141,11 +181,33 @@ public abstract class DataAware {
return a.equals(b);
}
+ /**
+ * given a collection containing DataAware objects,
+ * calls updateUI() on each memebr of the collection.
+ * @param dataAwares a collection containing DataAware objects.
+ */
+ public static void updateUI(Collection<DataAware> dataAwares) {
+ for (Iterator<DataAware> i = dataAwares.iterator(); i.hasNext();)
+ i.next().updateUI();
+ }
+ public static void updateData(Collection<DataAware> dataAwares) {
+ for (Iterator<DataAware> i = dataAwares.iterator(); i.hasNext();)
+ i.next().updateData();
+ }
-
-
-
+ /**
+ * /**
+ * Given a collection containing DataAware objects,
+ * sets the given DataObject to each DataAware object
+ * in the given collection
+ * @param dataAwares a collection of DataAware objects.
+ * @param dataObject new data object to set to the DataAware objects in the given collection.
+ * @param updateUI if true, calls updateUI() on each DataAware object.
+ */public static void setDataObject(Collection<DataAware> dataAwares, Object dataObject, boolean updateUI) {
+ for (Iterator<DataAware> i = dataAwares.iterator(); i.hasNext();)
+ i.next().setDataObject(dataObject, updateUI);
+ }
/**
* Value objects read and write a value from and
@@ -163,13 +225,13 @@ public abstract class DataAware {
* @param target the object to get the value from.
* @return the value from the given object.
*/
- Object get(Object target);
+ public Object get(Object target);
/**
* sets a value to the given object.
* @param value the value to set to the object.
* @param target the object to set the value to.
*/
- void set(Object value, Object target);
+ public void set(Object value, Object target);
/**
* checks if this Value object can handle
* the given object type as a target.
@@ -177,7 +239,7 @@ public abstract class DataAware {
* @return true if the given class is acceptable for
* the Value object. False if not.
*/
- boolean isAssignable(Class<?> type);
+ public boolean isAssignable(Class<?> type);
}
/**
@@ -214,7 +276,7 @@ public abstract class DataAware {
* @param obj the object which contains the property.
* @return the get method reflection object.
*/
- private Method createGetMethod(String propName, Object obj)
+ protected Method createGetMethod(String propName, Object obj)
{
Method m = null;
try
@@ -243,7 +305,7 @@ public abstract class DataAware {
if (getMethod.getReturnType().equals(String.class))
return PropertyNames.EMPTY_STRING;
if (getMethod.getReturnType().equals(Short.class))
- return Short.valueOf((short) 0);
+ return new Short((short) 0);
if (getMethod.getReturnType().equals(Integer.class))
return 0;
if (getMethod.getReturnType().equals(short[].class))
@@ -252,7 +314,7 @@ public abstract class DataAware {
return null;
}
- private Method createSetMethod(String propName, Object obj, Class<?> paramClass) {
+ protected Method createSetMethod(String propName, Object obj, Class<?> paramClass) {
Method m = null;
try {
m = obj.getClass().getMethod("set" + propName, paramClass);
diff --git a/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java b/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java
index 5df239a9ec93..f5294fd65f8c 100644
--- a/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java
+++ b/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java
@@ -37,6 +37,11 @@ public class DataAwareFields
/**
* returns a Value Object which sets and gets values
* and converting them to other types, according to the "value" argument.
+ *
+ * @param owner
+ * @param fieldname
+ * @param value
+ * @return
*/
public static DataAware.Value getFieldValueFor(Object owner, String fieldname, Object value)
{
@@ -306,7 +311,7 @@ public class DataAwareFields
}
else
{
- return Integer.valueOf(s);
+ return new Integer(s);
}
}
else if (convertTo.equals(Double.class))
@@ -368,7 +373,7 @@ public class DataAwareFields
}
if (field.getType().equals(Short.class))
{
- return Short.valueOf((short) 0);
+ return new Short((short) 0);
}
if (field.getType().equals(Integer.class))
{
@@ -473,11 +478,11 @@ public class DataAwareFields
{
if (c.equals(Integer.class))
{
- return Integer.valueOf((int) i);
+ return new Integer((int) i);
}
else if (c.equals(Short.class))
{
- return Short.valueOf((short) i);
+ return new Short((short) i);
}
else if (c.equals(Double.class))
{
diff --git a/wizards/com/sun/star/wizards/ui/event/EventNames.java b/wizards/com/sun/star/wizards/ui/event/EventNames.java
index 31cd25cc7815..fbb733f522de 100644
--- a/wizards/com/sun/star/wizards/ui/event/EventNames.java
+++ b/wizards/com/sun/star/wizards/ui/event/EventNames.java
@@ -21,19 +21,19 @@ public interface EventNames
{
//common listener events
- String EVENT_ACTION_PERFORMED = "APR";
- String EVENT_ITEM_CHANGED = "ICH";
- String EVENT_TEXT_CHANGED = "TCH"; //window events (XWindow)
- String EVENT_WINDOW_RESIZED = "WRE";
- String EVENT_WINDOW_MOVED = "WMO";
- String EVENT_WINDOW_SHOWN = "WSH";
- String EVENT_WINDOW_HIDDEN = "WHI"; //focus events (XWindow)
- String EVENT_FOCUS_GAINED = "FGA";
- String EVENT_FOCUS_LOST = "FLO"; //keyboard events
- String EVENT_KEY_PRESSED = "KPR";
- String EVENT_KEY_RELEASED = "KRE"; //mouse events
- String EVENT_MOUSE_PRESSED = "MPR";
-
- String EVENT_MOUSE_ENTERED = "MEN";
- String EVENT_MOUSE_EXITED = "MEX"; //other events
+ public static final String EVENT_ACTION_PERFORMED = "APR";
+ public static final String EVENT_ITEM_CHANGED = "ICH";
+ public static final String EVENT_TEXT_CHANGED = "TCH"; //window events (XWindow)
+ public static final String EVENT_WINDOW_RESIZED = "WRE";
+ public static final String EVENT_WINDOW_MOVED = "WMO";
+ public static final String EVENT_WINDOW_SHOWN = "WSH";
+ public static final String EVENT_WINDOW_HIDDEN = "WHI"; //focus events (XWindow)
+ public static final String EVENT_FOCUS_GAINED = "FGA";
+ public static final String EVENT_FOCUS_LOST = "FLO"; //keyboard events
+ public static final String EVENT_KEY_PRESSED = "KPR";
+ public static final String EVENT_KEY_RELEASED = "KRE"; //mouse events
+ public static final String EVENT_MOUSE_PRESSED = "MPR";
+ public static final String EVENT_MOUSE_RELEASED = "MRE";
+ public static final String EVENT_MOUSE_ENTERED = "MEN";
+ public static final String EVENT_MOUSE_EXITED = "MEX"; //other events
}
diff --git a/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java b/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java
index 4ad1cff82884..31d8ed5fe2a8 100644
--- a/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java
+++ b/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java
@@ -134,9 +134,10 @@ public class ListModelBinder implements ListDataListener
remove((short) lde.getIndex0(), (short) lde.getIndex1());
}
- private interface Renderer
+ public static interface Renderer
{
- String render(Object item);
+
+ public String render(Object item);
}
public static void fillList(Object list, Object[] items, Renderer renderer)
diff --git a/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java b/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java
index 2606155e7bb3..1924573a432b 100644
--- a/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java
+++ b/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java
@@ -33,11 +33,11 @@ import java.lang.reflect.Method;
public class MethodInvocation
{
//the method to invoke.
- private Method mMethod;
+ Method mMethod;
//the object to invoke the method on.
- private Object mObject;
+ Object mObject;
//with one Parameter / without
- private boolean mWithParam;
+ boolean mWithParam;
/** Creates a new instance of MethodInvokation */
public MethodInvocation(String methodName, Object obj) throws NoSuchMethodException
@@ -55,7 +55,7 @@ public class MethodInvocation
this(paramClass == null ? obj.getClass().getMethod(methodName) : obj.getClass().getMethod(methodName, paramClass), obj, paramClass);
}
- private MethodInvocation(Method method, Object obj, Class<?> paramClass)
+ public MethodInvocation(Method method, Object obj, Class<?> paramClass)
{
mMethod = method;
mObject = obj;
@@ -77,5 +77,12 @@ public class MethodInvocation
}
}
-
+ /**
+ * This method is a convenience method.
+ * It is the same as calling invoke(null);
+ */
+ public Object invoke() throws IllegalAccessException, InvocationTargetException
+ {
+ return invoke(null);
+ }
}
diff --git a/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java b/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java
index d0c50f67583d..35505ad3ed14 100644
--- a/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java
+++ b/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java
@@ -39,7 +39,6 @@ public class RadioDataAware extends DataAware
/* (non-Javadoc)
* @see com.sun.star.wizards.ui.DataAware#setToUI(java.lang.Object)
*/
- @Override
protected void setToUI(Object value)
{
int selected = ((Number) value).intValue();
@@ -59,17 +58,16 @@ public class RadioDataAware extends DataAware
/* (non-Javadoc)
* @see com.sun.star.wizards.ui.DataAware#getFromUI()
*/
- @Override
protected Object getFromUI()
{
for (int i = 0; i < radioButtons.length; i++)
{
if (radioButtons[i].getState())
{
- return Integer.valueOf(i);
+ return new Integer(i);
}
}
- return Integer.valueOf(-1);
+ return new Integer(-1);
}
public static DataAware attachRadioButtons(Object data, String dataProp, Object[] buttons, final Listener listener, boolean field)
diff --git a/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java b/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java
index 0595820f4006..96d8451de81b 100644
--- a/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java
+++ b/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java
@@ -31,13 +31,43 @@ public class SimpleDataAware extends DataAware
controlValue = controlValue_;
}
- @Override
+ /*
+ 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);
}
- @Override
+ /**
+ * 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
index 252fa8aad864..b142e2444094 100644
--- a/wizards/com/sun/star/wizards/ui/event/Task.java
+++ b/wizards/com/sun/star/wizards/ui/event/Task.java
@@ -37,9 +37,15 @@ public class Task
max = max_;
}
+ public void start()
+ {
+ fireTaskStarted();
+ }
-
-
+ public void fail()
+ {
+ fireTaskFailed();
+ }
public int getMax()
{
@@ -52,16 +58,45 @@ public class Task
fireTaskStatusChanged();
}
- public int getStatus()
+ public void advance(boolean success_)
{
- return successful + failed;
+ if (success_)
+ {
+ successful++;
+ }
+ else
+ {
+ failed++;
+ }
+ fireTaskStatusChanged();
+ if (failed + successful == max)
+ {
+ fireTaskFinished();
+ }
}
+ public void advance(boolean success_, String nextSubtaskName)
+ {
+ advance(success_);
+ setSubtaskName(nextSubtaskName);
+ }
+ public int getStatus()
+ {
+ return successful + failed;
+ }
+ public void addTaskListener(TaskListener tl)
+ {
+ listeners.add(tl);
+ }
+ public void removeTaskListener(TaskListener tl)
+ {
+ listeners.remove(tl);
+ }
- private void fireTaskStatusChanged()
+ protected void fireTaskStatusChanged()
{
TaskEvent te = new TaskEvent(this, TaskEvent.TASK_STATUS_CHANGED);
@@ -71,7 +106,37 @@ public class Task
}
}
- private void fireSubtaskNameChanged()
+ protected void fireTaskStarted()
+ {
+ TaskEvent te = new TaskEvent(this, TaskEvent.TASK_STARTED);
+
+ for (int i = 0; i < listeners.size(); i++)
+ {
+ listeners.get(i).taskStarted(te);
+ }
+ }
+
+ protected void fireTaskFailed()
+ {
+ TaskEvent te = new TaskEvent(this, TaskEvent.TASK_FAILED);
+
+ for (int i = 0; i < listeners.size(); i++)
+ {
+ listeners.get(i).taskFinished(te);
+ }
+ }
+
+ protected void fireTaskFinished()
+ {
+ TaskEvent te = new TaskEvent(this, TaskEvent.TASK_FINISHED);
+
+ for (int i = 0; i < listeners.size(); i++)
+ {
+ listeners.get(i).taskFinished(te);
+ }
+ }
+
+ protected void fireSubtaskNameChanged()
{
TaskEvent te = new TaskEvent(this, TaskEvent.SUBTASK_NAME_CHANGED);
diff --git a/wizards/com/sun/star/wizards/ui/event/TaskEvent.java b/wizards/com/sun/star/wizards/ui/event/TaskEvent.java
index 1c98cffdfae3..a907df6d59e2 100644
--- a/wizards/com/sun/star/wizards/ui/event/TaskEvent.java
+++ b/wizards/com/sun/star/wizards/ui/event/TaskEvent.java
@@ -29,6 +29,11 @@ public class TaskEvent extends EventObject
public static final int TASK_FAILED = 5;
private int type;
+ /**
+ * general constructor-
+ * @param source
+ * @param type_
+ */
public TaskEvent(Task source, int type_)
{
super(source);
diff --git a/wizards/com/sun/star/wizards/ui/event/TaskListener.java b/wizards/com/sun/star/wizards/ui/event/TaskListener.java
index 61c8b2bfd0d0..ecec8bb17591 100644
--- a/wizards/com/sun/star/wizards/ui/event/TaskListener.java
+++ b/wizards/com/sun/star/wizards/ui/event/TaskListener.java
@@ -22,14 +22,15 @@ import java.util.EventListener;
public interface TaskListener extends EventListener
{
- void taskStarted(TaskEvent te);
+ public void taskStarted(TaskEvent te);
- void taskFinished(TaskEvent te);
+ public void taskFinished(TaskEvent te);
/**
* is called when the status of the task has advanced.
+ * @param te
*/
- void taskStatusChanged(TaskEvent te);
+ public void taskStatusChanged(TaskEvent te);
- void subtaskNameChanged(TaskEvent te);
+ public 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
index 0ef03552b00b..5d3675bc8d09 100644
--- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java
+++ b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java
@@ -35,13 +35,13 @@ import com.sun.star.wizards.common.PropertyNames;
public class UnoDataAware extends DataAware
{
- private Object unoControl;
- private Object unoModel;
- private String unoPropName;
- private Object[] disableObjects = new Object[0];
- private boolean inverse = false;
+ protected Object unoControl;
+ protected Object unoModel;
+ protected String unoPropName;
+ protected Object[] disableObjects = new Object[0];
+ protected boolean inverse = false;
- private UnoDataAware(Object dataObject, Value value, Object unoObject_, String unoPropName_)
+ protected UnoDataAware(Object dataObject, Value value, Object unoObject_, String unoPropName_)
{
super(dataObject, value);
unoControl = unoObject_;
@@ -54,7 +54,6 @@ public class UnoDataAware extends DataAware
inverse = i;
}
- @Override
protected void enableControls(Object value)
{
Boolean b = getBoolean(value);
@@ -68,7 +67,6 @@ public class UnoDataAware extends DataAware
}
}
- @Override
protected void setToUI(Object value)
{
Helper.setUnoPropertyValue(unoModel, unoPropName, value);
@@ -84,7 +82,7 @@ public class UnoDataAware extends DataAware
* @param value
* @return
*/
- private Boolean getBoolean(Object value)
+ protected Boolean getBoolean(Object value)
{
if (value == null)
{
@@ -112,14 +110,75 @@ public class UnoDataAware extends DataAware
}
}
+ public void disableControls(Object[] controls)
+ {
+ disableObjects = controls;
+ }
-
- @Override
protected Object getFromUI()
{
return Helper.getUnoPropertyValue(unoModel, unoPropName);
}
+ private static UnoDataAware attachTextControl(Object data, String prop, Object unoText, final Listener listener, String unoProperty, boolean field, Object value)
+ {
+ XTextComponent text = UnoRuntime.queryInterface(XTextComponent.class, unoText);
+ final UnoDataAware uda = new UnoDataAware(data,
+ field
+ ? DataAwareFields.getFieldValueFor(data, prop, value)
+ : new DataAware.PropertyValue(prop, data),
+ text, unoProperty);
+ text.addTextListener(new XTextListener()
+ {
+
+ public void textChanged(TextEvent te)
+ {
+ uda.updateData();
+ if (listener != null)
+ {
+ listener.eventPerformed(te);
+ }
+ }
+
+ public void disposing(EventObject eo)
+ {
+ }
+ });
+ return uda;
+ }
+
+ public static UnoDataAware attachEditControl(Object data, String prop, Object unoControl, Listener listener, boolean field)
+ {
+ return attachTextControl(data, prop, unoControl, listener, "Text", field, PropertyNames.EMPTY_STRING);
+ }
+
+ public static UnoDataAware attachDateControl(Object data, String prop, Object unoControl, Listener listener, boolean field)
+ {
+ return attachTextControl(data, prop, unoControl, listener, "Date", field, 0);
+ }
+
+ public static UnoDataAware attachTimeControl(Object data, String prop, Object unoControl, Listener listener, boolean field)
+ {
+ return attachTextControl(data, prop, unoControl, listener, "Time", field, 0);
+ }
+
+ public static UnoDataAware attachNumericControl(Object data, String prop, Object unoControl, Listener listener, boolean field)
+ {
+ return attachTextControl(data, prop, unoControl, listener, "Value", field, new Double(0));
+ }
+
+ public static UnoDataAware attachCheckBox(Object data, String prop, Object checkBox, final Listener listener, boolean field)
+ {
+ XCheckBox xcheckBox = UnoRuntime.queryInterface(XCheckBox.class, checkBox);
+ final UnoDataAware uda = new UnoDataAware(data,
+ field
+ ? DataAwareFields.getFieldValueFor(data, prop, new Short((short) 0))
+ : new DataAware.PropertyValue(prop, data),
+ checkBox, PropertyNames.PROPERTY_STATE);
+ xcheckBox.addItemListener(itemListener(uda, listener));
+ return uda;
+ }
+
static XItemListener itemListener(final DataAware da, final Listener listener)
{
return new XItemListener()
@@ -140,18 +199,37 @@ public class UnoDataAware extends DataAware
};
}
+ public static UnoDataAware attachLabel(Object data, String prop, Object label, final Listener listener, boolean field)
+ {
+ return new UnoDataAware(data,
+ field ? DataAwareFields.getFieldValueFor(data, prop, PropertyNames.EMPTY_STRING)
+ : new DataAware.PropertyValue(prop, data),
+ label, PropertyNames.PROPERTY_LABEL);
+ }
-
-
+ public static UnoDataAware attachListBox(Object data, String prop, Object listBox, final Listener listener, boolean field)
+ {
+ XListBox xListBox = UnoRuntime.queryInterface(XListBox.class, listBox);
+ final UnoDataAware uda = new UnoDataAware(data,
+ field
+ ? DataAwareFields.getFieldValueFor(data, prop, new short[0])
+ : new DataAware.PropertyValue(prop, data),
+ listBox, PropertyNames.SELECTED_ITEMS);
+ xListBox.addItemListener(itemListener(uda, listener));
+ return uda;
+ }
public static Object getModel(Object control)
{
return UnoRuntime.queryInterface(XControl.class, control).getModel();
}
+ public static void setEnabled(Object control, boolean enabled)
+ {
+ setEnabled(control, enabled ? Boolean.TRUE : Boolean.FALSE);
+ }
-
- private static void setEnabled(Object control, Boolean enabled)
+ public static void setEnabled(Object control, Boolean enabled)
{
Helper.setUnoPropertyValue(getModel(control), PropertyNames.PROPERTY_ENABLED, enabled);
}