summaryrefslogtreecommitdiff
path: root/wizards/com/sun/star/wizards/form
diff options
context:
space:
mode:
Diffstat (limited to 'wizards/com/sun/star/wizards/form')
-rw-r--r--wizards/com/sun/star/wizards/form/CallFormWizard.java206
-rw-r--r--wizards/com/sun/star/wizards/form/DataEntrySetter.java148
-rw-r--r--wizards/com/sun/star/wizards/form/FieldLinker.java314
-rw-r--r--wizards/com/sun/star/wizards/form/Finalizer.java140
-rw-r--r--wizards/com/sun/star/wizards/form/FormConfiguration.java242
-rw-r--r--wizards/com/sun/star/wizards/form/FormControlArranger.java732
-rw-r--r--wizards/com/sun/star/wizards/form/FormDocument.java596
-rw-r--r--wizards/com/sun/star/wizards/form/FormWizard.java482
-rw-r--r--wizards/com/sun/star/wizards/form/MANIFEST.MF2
-rw-r--r--wizards/com/sun/star/wizards/form/StyleApplier.java495
-rw-r--r--wizards/com/sun/star/wizards/form/UIControlArranger.java505
-rw-r--r--wizards/com/sun/star/wizards/form/form.component35
-rw-r--r--wizards/com/sun/star/wizards/form/makefile.mk70
13 files changed, 3967 insertions, 0 deletions
diff --git a/wizards/com/sun/star/wizards/form/CallFormWizard.java b/wizards/com/sun/star/wizards/form/CallFormWizard.java
new file mode 100644
index 000000000000..0538eb5fa1b3
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/CallFormWizard.java
@@ -0,0 +1,206 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.wizards.form;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.uno.Type;
+import com.sun.star.wizards.common.Properties;
+
+/** This class capsulates the class, that implements the minimal component, a
+ * factory for creating the service (<CODE>__getServiceFactory</CODE>).
+ * @author Bertram Nolte
+ */
+public class CallFormWizard
+{
+
+ /** Gives a factory for creating the service.
+ * This method is called by the <code>JavaLoader</code>
+ * <p>
+ * @return Returns a <code>XSingleServiceFactory</code> for creating the
+ * component.
+ * @see com.sun.star.comp.loader.JavaLoader#
+ * @param stringImplementationName The implementation name of the component.
+ * @param xmultiservicefactory The service manager, who gives access to every
+ * known service.
+ * @param xregistrykey Makes structural information (except regarding tree
+ * structures) of a single
+ * registry key accessible.
+ */
+ public static com.sun.star.lang.XSingleServiceFactory __getServiceFactory(String stringImplementationName, com.sun.star.lang.XMultiServiceFactory xMSF, com.sun.star.registry.XRegistryKey xregistrykey)
+ {
+ com.sun.star.lang.XSingleServiceFactory xsingleservicefactory = null;
+ if (stringImplementationName.equals(FormWizardImplementation.class.getName()))
+ {
+ xsingleservicefactory = com.sun.star.comp.loader.FactoryHelper.getServiceFactory(FormWizardImplementation.class, FormWizardImplementation.__serviceName, xMSF, xregistrykey);
+ }
+ return xsingleservicefactory;
+ }
+
+ /** This class implements the component. At least the interfaces XServiceInfo,
+ * XTypeProvider, and XInitialization should be provided by the service.
+ */
+ public static class FormWizardImplementation extends com.sun.star.lib.uno.helper.PropertySet implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.lang.XTypeProvider, com.sun.star.task.XJobExecutor
+ {
+ private PropertyValue[] m_wizardContext;
+
+ /** The constructor of the inner class has a XMultiServiceFactory parameter.
+ * @param xmultiservicefactoryInitialization A special service factory
+ * could be introduced while initializing.
+ */
+ public FormWizardImplementation(com.sun.star.lang.XMultiServiceFactory xmultiservicefactoryInitialization)
+ {
+ super();
+ m_serviceFactory = xmultiservicefactoryInitialization;
+ }
+
+ public void trigger(String sEvent)
+ {
+ try
+ {
+ if (sEvent.compareTo("start") == 0)
+ {
+ FormWizard CurFormWizard = new FormWizard( m_serviceFactory, m_wizardContext );
+ CurFormWizard.startFormWizard();
+ }
+ }
+ catch (Exception exception)
+ {
+ System.err.println(exception);
+ }
+ System.gc();
+ }
+ /** The service name, that must be used to get an instance of this service.
+ */
+ private static final String __serviceName = "com.sun.star.wizards.form.CallFormWizard";
+ /** The service manager, that gives access to all registered services.
+ */
+ private com.sun.star.lang.XMultiServiceFactory m_serviceFactory;
+
+ /** This method is a member of the interface for initializing an object
+ * directly after its creation.
+ * @param object This array of arbitrary objects will be passed to the
+ * component after its creation.
+ * @throws Exception Every exception will not be handled, but will be
+ * passed to the caller.
+ */
+ public void initialize(Object[] object) throws com.sun.star.uno.Exception
+ {
+ m_wizardContext = Properties.convertToPropertyValueArray(object);
+ }
+
+ /** This method returns an array of all supported service names.
+ * @return Array of supported service names.
+ */
+ public java.lang.String[] getSupportedServiceNames()
+ {
+ String[] stringSupportedServiceNames = new String[1];
+
+ stringSupportedServiceNames[0] = __serviceName;
+
+ return (stringSupportedServiceNames);
+ }
+
+ /** This method returns true, if the given service will be
+ * supported by the component.
+ * @param stringService Service name.
+ * @return True, if the given service name will be supported.
+ */
+ public boolean supportsService(String stringService)
+ {
+ boolean booleanSupportsService = false;
+
+ if (stringService.equals(__serviceName))
+ {
+ booleanSupportsService = true;
+ }
+ return (booleanSupportsService);
+ }
+
+ /** This method returns an array of bytes, that can be used to
+ * unambiguously distinguish between two sets of types, e.g.
+ * to realise hashing functionality when the object is introspected.
+ * Two objects that return the same ID also have to return
+ * the same set of types in getTypes(). If an unique
+ * implementation Id cannot be provided this method has to
+ * return an empty sequence. Important: If the object
+ * aggregates other objects the ID has to be unique for the
+ * whole combination of objects.
+ * @return Array of bytes, in order to distinguish between two sets.
+ */
+ public byte[] getImplementationId()
+ {
+ byte[] byteReturn =
+ {
+ };
+
+ try
+ {
+ byteReturn = new String("" + this.hashCode()).getBytes();
+ }
+ catch (Exception exception)
+ {
+ System.err.println(exception);
+ }
+
+ return (byteReturn);
+ }
+
+ /** Return the class name of the component.
+ * @return Class name of the component.
+ */
+ public java.lang.String getImplementationName()
+ {
+ return (FormWizardImplementation.class.getName());
+ }
+
+ /** Provides a sequence of all types (usually interface types)
+ * provided by the object.
+ * @return Sequence of all types (usually interface types) provided by the
+ * service.
+ */
+ public Type[] getTypes()
+ {
+ 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)
+ };
+ }
+ catch (Exception exception)
+ {
+ System.err.println(exception);
+ }
+
+ return (typeReturn);
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/form/DataEntrySetter.java b/wizards/com/sun/star/wizards/form/DataEntrySetter.java
new file mode 100644
index 000000000000..ae042fa7de76
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/DataEntrySetter.java
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.wizards.form;
+
+import com.sun.star.awt.XCheckBox;
+import com.sun.star.awt.XRadioButton;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.Properties;
+import com.sun.star.wizards.ui.UnoDialog;
+import com.sun.star.wizards.ui.WizardDialog;
+import com.sun.star.wizards.ui.UIConsts;
+import com.sun.star.wizards.common.PropertyNames;
+
+public class DataEntrySetter
+{
+
+ private WizardDialog CurUnoDialog;
+ private short curtabindex;
+ private XRadioButton optNewDataOnly;
+ private XRadioButton optDisplayAllData;
+ private XCheckBox chknomodification;
+ private XCheckBox chknodeletion;
+ private XCheckBox chknoaddition;
+
+ public DataEntrySetter(WizardDialog _CurUnoDialog)
+ {
+ this.CurUnoDialog = _CurUnoDialog;
+ curtabindex = (short) (FormWizard.SODATA_PAGE * 100);
+ 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
+ String sNoDeletion = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 48); // AllowDeletes
+ String sNoAddition = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 49); // AlowInserts
+ String sdontdisplayExistingData = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 45);
+
+ optNewDataOnly = CurUnoDialog.insertRadioButton("optNewDataOnly", "toggleCheckBoxes", this,
+ 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_DLGFORM_OPTNEWDATAONLY", sNewDataOnly, new Integer(98), new Integer(25), IDataStep, new Short(curtabindex++), new Integer(195)
+ });
+
+ optDisplayAllData = CurUnoDialog.insertRadioButton("optDisplayAllData", "toggleCheckBoxes", this,
+ 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[]
+ {
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTDISPLAYALLDATA", sDisplayAllData, new Integer(98), new Integer(50), new Short((short) 1), IDataStep, new Short(curtabindex++), new Integer(197)
+ });
+ chknomodification = CurUnoDialog.insertCheckBox("chknomodification", null,
+ 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[]
+ {
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKNOMODIFICATION", sNoModification, new Integer(108), new Integer(62), new Short((short) 0), IDataStep, new Short(curtabindex++), new Integer(189)
+ });
+ chknodeletion = CurUnoDialog.insertCheckBox("chknodeletion", null,
+ 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[]
+ {
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKNODELETION", sNoDeletion, new Integer(108), new Integer(74), new Short((short) 0), IDataStep, new Short(curtabindex++), new Integer(189)
+ });
+ chknoaddition = CurUnoDialog.insertCheckBox("chknoaddition", null,
+ 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[]
+ {
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKNOADDITION", sNoAddition, new Integer(108), new Integer(86), new Short((short) 0), IDataStep, new Short(curtabindex++), new Integer(191)
+ });
+ CurUnoDialog.insertLabel("lbldontdisplayExistingData",
+ new String[]
+ {
+ PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ },
+ new Object[]
+ {
+ new Integer(8), sdontdisplayExistingData, new Integer(108), new Integer(33), IDataStep, new Short(curtabindex++), new Integer(134)
+ });
+ }
+
+ public PropertyValue[] getFormProperties()
+ {
+ PropertyValue[] retProperties;
+ if (optDisplayAllData.getState())
+ {
+ retProperties = new PropertyValue[3];
+ boolean bAllowUpdates = (((Short) Helper.getUnoPropertyValue(UnoDialog.getModel(chknomodification), PropertyNames.PROPERTY_STATE)).shortValue()) != 1;
+ boolean bAllowDeletes = (((Short) Helper.getUnoPropertyValue(UnoDialog.getModel(chknodeletion), PropertyNames.PROPERTY_STATE)).shortValue()) != 1;
+ boolean bAllowInserts = (((Short) Helper.getUnoPropertyValue(UnoDialog.getModel(chknoaddition), PropertyNames.PROPERTY_STATE)).shortValue()) != 1;
+ retProperties[0] = Properties.createProperty("AllowUpdates", new Boolean(bAllowUpdates));
+ retProperties[1] = Properties.createProperty("AllowDeletes", new Boolean(bAllowDeletes));
+ retProperties[2] = Properties.createProperty("AllowInserts", new Boolean(bAllowInserts));
+ }
+ else
+ {
+ retProperties = new PropertyValue[1];
+ retProperties[0] = Properties.createProperty("IgnoreResult", new Boolean(true));
+ }
+ return retProperties;
+
+ }
+
+ public void toggleCheckBoxes()
+ {
+ boolean bdisplayalldata = optDisplayAllData.getState();
+ Helper.setUnoPropertyValue(UnoDialog.getModel(chknomodification), PropertyNames.PROPERTY_ENABLED, new Boolean(bdisplayalldata));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(chknodeletion), PropertyNames.PROPERTY_ENABLED, new Boolean(bdisplayalldata));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(chknoaddition), PropertyNames.PROPERTY_ENABLED, new Boolean(bdisplayalldata));
+ }
+}
diff --git a/wizards/com/sun/star/wizards/form/FieldLinker.java b/wizards/com/sun/star/wizards/form/FieldLinker.java
new file mode 100644
index 000000000000..b0fecf192bb8
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/FieldLinker.java
@@ -0,0 +1,314 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.wizards.form;
+
+import com.sun.star.awt.ItemEvent;
+import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.awt.XFixedText;
+import com.sun.star.awt.XListBox;
+import com.sun.star.uno.Exception;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.HelpIds;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.db.RelationController;
+import com.sun.star.wizards.ui.UnoDialog;
+import com.sun.star.wizards.ui.WizardDialog;
+import com.sun.star.wizards.ui.UIConsts;
+import com.sun.star.wizards.ui.DBLimitedFieldSelection;
+import com.sun.star.wizards.common.PropertyNames;
+
+public class FieldLinker extends DBLimitedFieldSelection
+{
+
+ private XFixedText[] lblSlaveFields;
+ private XFixedText[] lblMasterFields;
+ private XListBox[] lstSlaveFields;
+ private XListBox[] lstMasterFields;
+ private final int SOMASTERINDEX = 1;
+ private final int SOSLAVEINDEX = 0;
+ private int SOFIRSTLINKLST = 0;
+ private int SOSECLINKLST = 1;
+ private int SOTHIRDLINKLST = 2;
+ private int SOFOURTHLINKLST = 3;
+ private int[] SOLINKLST = null;
+ private String[] sSlaveListHeader;
+ private String[] sMasterListHeader; //CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40);
+ private String sSlaveHidString;
+ private String sMasterHidString;
+ private Integer IListBoxPosX;
+
+ public FieldLinker(WizardDialog _CurUnoDialog, int iStep, int iCompPosX, int iCompPosY, int iCompWidth, int _firsthelpid)
+ {
+ super(_CurUnoDialog, iStep, iCompPosX, iCompPosY, iCompWidth, _firsthelpid);
+ }
+
+ protected void insertControlGroup(int i)
+ {
+ try
+ {
+ if (i == 0)
+ {
+ lblSlaveFields = new XFixedText[rowcount];
+ lblMasterFields = new XFixedText[rowcount];
+ lstSlaveFields = new XListBox[rowcount];
+ lstMasterFields = new XListBox[rowcount];
+ SOFIRSTLINKLST = 0;
+ SOSECLINKLST = 1;
+ SOTHIRDLINKLST = 2;
+ SOFOURTHLINKLST = 3;
+ IListBoxPosX = new Integer(iCompPosX + 6);
+ sSlaveListHeader = CurUnoDialog.m_oResource.getResArray(UIConsts.RID_FORM + 20, 4); //new String[rowcount];""; //CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40);
+ sMasterListHeader = CurUnoDialog.m_oResource.getResArray(UIConsts.RID_FORM + 24, 4);// new String[rowcount];""; //CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40);
+ SOLINKLST = new int[]
+ {
+ SOFIRSTLINKLST, SOSECLINKLST, SOTHIRDLINKLST, SOFOURTHLINKLST
+ };
+ }
+ sSlaveHidString = HelpIds.getHelpIdString(FirstHelpIndex + (i * 2));
+ sMasterHidString = HelpIds.getHelpIdString(FirstHelpIndex + (i * 2) + 1);
+ boolean bDoEnable = (i < 2);
+ lblSlaveFields[i] = CurUnoDialog.insertLabel("lblSlaveFieldLink" + new Integer(i + 1).toString(),
+ new String[]
+ {
+ PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ },
+ new Object[]
+ {
+ new Boolean(bDoEnable), new Integer(8), sSlaveListHeader[i], new Integer(97), new Integer(iCurPosY), IStep, new Short(curtabindex++), new Integer(97)
+ });
+ lstSlaveFields[i] = CurUnoDialog.insertListBox("lstSlaveFieldLink" + new Integer(i + 1).toString(), SOLINKLST[i], null, new ItemListenerImpl(),
+ new String[]
+ {
+ "Dropdown",
+ PropertyNames.PROPERTY_ENABLED,
+ PropertyNames.PROPERTY_HEIGHT,
+ PropertyNames.PROPERTY_HELPURL,
+ "LineCount",
+ PropertyNames.PROPERTY_POSITION_X,
+ PropertyNames.PROPERTY_POSITION_Y,
+ PropertyNames.PROPERTY_STEP,
+ PropertyNames.PROPERTY_TABINDEX,
+ PropertyNames.PROPERTY_WIDTH
+ },
+ new Object[]
+ {
+ Boolean.TRUE,
+ new Boolean(bDoEnable),
+ UIConsts.INTEGER_12,
+ sSlaveHidString,
+ Short.valueOf(UnoDialog.getListBoxLineCount()),
+ new Integer(97),
+ new Integer(iCurPosY + 10),
+ IStep,
+ new Short(curtabindex++),
+ new Integer(97)
+ });
+
+ lblMasterFields[i] = CurUnoDialog.insertLabel("lblMasterFieldLink" + new Integer(i + 1).toString(),
+ new String[]
+ {
+ PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ },
+ new Object[]
+ {
+ new Boolean(bDoEnable), new Integer(8), sMasterListHeader[i], new Integer(206), new Integer(iCurPosY), IStep, new Short(curtabindex++), new Integer(97)
+ });
+
+ lstMasterFields[i] = CurUnoDialog.insertListBox("lstMasterFieldLink" + new Integer(i + 1).toString(), SOLINKLST[i], null, new ItemListenerImpl(),
+ new String[]
+ {
+ "Dropdown",
+ PropertyNames.PROPERTY_ENABLED,
+ PropertyNames.PROPERTY_HEIGHT,
+ PropertyNames.PROPERTY_HELPURL,
+ "LineCount",
+ PropertyNames.PROPERTY_POSITION_X,
+ PropertyNames.PROPERTY_POSITION_Y,
+ PropertyNames.PROPERTY_STEP,
+ PropertyNames.PROPERTY_TABINDEX,
+ PropertyNames.PROPERTY_WIDTH
+ },
+ new Object[]
+ {
+ Boolean.TRUE,
+ new Boolean(bDoEnable),
+ UIConsts.INTEGER_12,
+ sMasterHidString,
+ Short.valueOf(UnoDialog.getListBoxLineCount()),
+ new Integer(206),
+ new Integer(iCurPosY + 10),
+ IStep,
+ new Short(curtabindex++),
+ new Integer(97)
+ });
+ iCurPosY = iCurPosY + 38;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ protected void enableNextControlRow(int curindex)
+ {
+ // setMaxSelIndex();
+ boolean bSlaveField = lstSlaveFields[curindex].getSelectedItemPos() > 0;
+ boolean bMasterField = lstMasterFields[curindex].getSelectedItemPos() > 0;
+ boolean bDoEnable = (bSlaveField && bMasterField);
+ if (!bDoEnable)
+ {
+ moveupSelectedItems(curindex, bDoEnable);
+ }
+ else
+ {
+ toggleControlRow(curindex + 1, true);
+ }
+ }
+
+ protected int getMaxSelIndex()
+ {
+ int MaxSelIndex = -1;
+ for (int i = 0; i < rowcount; i++)
+ {
+ if ((lstSlaveFields[i].getSelectedItemPos() > 0) && (lstMasterFields[i].getSelectedItemPos() > 0))
+ {
+ MaxSelIndex += 1;
+ }
+ }
+ return MaxSelIndex;
+ }
+
+ protected void toggleControlRow(int i, boolean bDoEnable)
+ {
+ if (i < rowcount)
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lblSlaveFields[i]), PropertyNames.PROPERTY_ENABLED, new Boolean(bDoEnable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[i]), PropertyNames.PROPERTY_ENABLED, new Boolean(bDoEnable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lblMasterFields[i]), PropertyNames.PROPERTY_ENABLED, new Boolean(bDoEnable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[i]), PropertyNames.PROPERTY_ENABLED, new Boolean(bDoEnable));
+ if (bDoEnable == false)
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[i]), "SelectedItems", new short[] { 0 });
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[i]), "SelectedItems", new short[] { 0 });
+ }
+ }
+ }
+
+ protected void updateFromNextControlRow(int curindex)
+ {
+ short iNextMasterItemPos = lstMasterFields[curindex + 1].getSelectedItemPos();
+ short iNextSlaveItemPos = lstSlaveFields[curindex + 1].getSelectedItemPos();
+
+ if ((iNextMasterItemPos != 0) && (iNextSlaveItemPos != 0))
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[curindex]), "SelectedItems", new short[] {iNextMasterItemPos });
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[curindex]), "SelectedItems", new short[] {iNextSlaveItemPos});
+
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[curindex + 1]), "SelectedItems", new short[] { 0 });
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[curindex + 1]), "SelectedItems", new short[] { 0 });
+ toggleControlRow(curindex, true);
+ }
+ }
+
+ public void initialize(String[] _AllMasterFieldNames, String[] _AllSlaveFieldNames, String[][] _LinkFieldNames)
+ {
+ // short[] MasterSelList = null;
+ // short[] SlaveSelList = null;
+ String[] MasterLinkNames = JavaTools.ArrayOutOfMultiDimArray(_LinkFieldNames, SOMASTERINDEX);
+ String[] SlaveLinkNames = JavaTools.ArrayOutOfMultiDimArray(_LinkFieldNames, SOSLAVEINDEX);
+ String[] ViewMasterFieldNames = addNoneFieldItemToList(_AllMasterFieldNames); // add '-undefiened-'
+ String[] ViewSlaveFieldNames = addNoneFieldItemToList(_AllSlaveFieldNames);
+ for (int i = 0; i < super.rowcount; i++)
+ {
+ super.initializeListBox(lstMasterFields[i], ViewMasterFieldNames, MasterLinkNames, i);
+ super.initializeListBox(lstSlaveFields[i], ViewSlaveFieldNames, SlaveLinkNames, i);
+ if (_LinkFieldNames != null)
+ {
+ toggleControlRow(i, (i <= _LinkFieldNames.length));
+ }
+ else
+ {
+ toggleControlRow(i, i == 0);
+ }
+ }
+ }
+
+ public String[][] getLinkFieldNames(RelationController _oRelationController, String _sReferencedTableName)
+ {
+ return _oRelationController.getImportedKeyColumns(_sReferencedTableName);
+ }
+
+ /**
+ * @return the LinkFieldnames of the joins. When no LinkFieldNames were selected the returned Array is empty.
+ * When Joins were assigned duplicate a null value is returned
+ *
+ */
+ public String[][] getLinkFieldNames()
+ {
+ // setMaxSelIndex();
+ int nSelectedIndex = getMaxSelIndex();
+ String[][] LinkFieldNames = new String[2][nSelectedIndex + 1];
+ for (int i = 0; i <= nSelectedIndex; i++)
+ {
+ LinkFieldNames[0][i] = lstSlaveFields[i].getSelectedItem();
+ LinkFieldNames[1][i] = lstMasterFields[i].getSelectedItem();
+ }
+ int iduplicate = JavaTools.getDuplicateFieldIndex(LinkFieldNames);
+ if (iduplicate != -1)
+ {
+ String sLinkFieldsAreDuplicate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 19);
+ String sLocLinkFieldsAreDuplicate = JavaTools.replaceSubString(sLinkFieldsAreDuplicate, LinkFieldNames[0][iduplicate], "<FIELDNAME1>");
+ sLocLinkFieldsAreDuplicate = JavaTools.replaceSubString(sLocLinkFieldsAreDuplicate, LinkFieldNames[1][iduplicate], "<FIELDNAME2>");
+ CurUnoDialog.setCurrentStep(FormWizard.SOFIELDLINKER_PAGE);
+ CurUnoDialog.enableNavigationButtons(true, true, true);
+ CurUnoDialog.showMessageBox("WarningBox", VclWindowPeerAttribute.OK, sLocLinkFieldsAreDuplicate);
+ CurUnoDialog.setFocus("lstSlaveFieldLink" + (iduplicate + 1));
+ return null;
+ }
+ return LinkFieldNames;
+
+ }
+
+ public void enable(boolean _bdoenable)
+ {
+ CurUnoDialog.setStepEnabled(IStep.intValue(), _bdoenable);
+ }
+
+ class ItemListenerImpl implements com.sun.star.awt.XItemListener
+ {
+
+ public void itemStateChanged(ItemEvent EventObject)
+ {
+ int ikey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList);
+ enableNextControlRow(ikey);
+ }
+
+ public void disposing(com.sun.star.lang.EventObject eventObject)
+ {
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/form/Finalizer.java b/wizards/com/sun/star/wizards/form/Finalizer.java
new file mode 100644
index 000000000000..c5f12728e527
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/Finalizer.java
@@ -0,0 +1,140 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.wizards.form;
+
+import com.sun.star.awt.XRadioButton;
+import com.sun.star.awt.XTextComponent;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.PropertyNames;
+import com.sun.star.wizards.ui.*;
+
+/**
+ * @author Administrator
+ *
+ * To change the template for this generated type comment go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+public class Finalizer
+{
+
+ WizardDialog CurUnoDialog;
+ short curtabindex;
+ XRadioButton optModifyForm;
+ XRadioButton optWorkWithForm;
+ XTextComponent txtFormName;
+ FormDocument oFormDocument;
+
+ public Finalizer(WizardDialog _CurUnoDialog)
+ {
+ this.CurUnoDialog = _CurUnoDialog;
+ curtabindex = (short) (FormWizard.SOSTORE_PAGE * 100);
+
+ String slblFormName = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 50);
+ String slblProceed = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 51);
+ String sWorkWithForm = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 52);
+ String sModifyForm = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 53);
+ CurUnoDialog.insertLabel("lblFormName",
+ new String[]
+ {
+ 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[]
+ {
+ UIConsts.INTEGERS[8], slblFormName, new Integer(97), new Integer(25), UIConsts.INTEGERS[8], new Short(curtabindex++), new Integer(111)
+ });
+ txtFormName = CurUnoDialog.insertTextField("txtFormName", "toggleFinishButton", this,
+ new String[]
+ {
+ PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Text", PropertyNames.PROPERTY_WIDTH
+ },
+ new Object[]
+ {
+ UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGFORM_TXTPATH", new Integer(97), new Integer(35), UIConsts.INTEGERS[8], new Short((short) 82), "", new Integer(185)
+ });
+ CurUnoDialog.insertLabel("lblProceed",
+ new String[]
+ {
+ 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[]
+ {
+ UIConsts.INTEGERS[8], slblProceed, new Integer(97), new Integer(62), UIConsts.INTEGERS[8], new Short(curtabindex++), new Integer(185)
+ });
+ CurUnoDialog.insertRadioButton("optWorkWithForm", null,
+ 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[]
+ {
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTWORKWITHFORM", sWorkWithForm, new Integer(101), new Integer(77), new Short((short) 1), UIConsts.INTEGERS[8], new Short(curtabindex++), new Integer(107)
+ });
+ optModifyForm = CurUnoDialog.insertRadioButton("optModifyForm", 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_DLGFORM_OPTMODIFYFORM", sModifyForm, new Integer(101), new Integer(89), UIConsts.INTEGERS[8], new Short(curtabindex++), new Integer(107)
+ });
+ }
+
+ public void initialize(String _formname, FormDocument _oFormDocument)
+ {
+ if (oFormDocument == null)
+ {
+ oFormDocument = _oFormDocument;
+ }
+ if (txtFormName.getText().length() == 0)
+ {
+ txtFormName.setText(Desktop.getUniqueName(_oFormDocument.oMainFormDBMetaData.getFormDocuments(), _formname));
+ }
+ }
+
+ public void toggleFinishButton()
+ {
+ CurUnoDialog.enableFinishButton(txtFormName.getText().length() > 0);
+ }
+
+ public String getName()
+ {
+ return txtFormName.getText();
+ }
+
+ public boolean getOpenForEditing()
+ {
+ return optModifyForm.getState() ? true : false;
+ }
+
+ public boolean finish()
+ {
+// if (!oFormDocument.oMainFormDBMetaData.hasFormDocumentByName(sFormName)){
+ return oFormDocument.oMainFormDBMetaData.storeDatabaseDocumentToTempPath(this.oFormDocument.xComponent, getName());
+// }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/form/FormConfiguration.java b/wizards/com/sun/star/wizards/form/FormConfiguration.java
new file mode 100644
index 000000000000..9c18ab47d79d
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/FormConfiguration.java
@@ -0,0 +1,242 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.wizards.form;
+
+import com.sun.star.awt.XCheckBox;
+import com.sun.star.awt.XFixedText;
+import com.sun.star.awt.XListBox;
+import com.sun.star.awt.XRadioButton;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.PropertyNames;
+import com.sun.star.wizards.ui.CommandFieldSelection;
+import com.sun.star.wizards.ui.UIConsts;
+import com.sun.star.wizards.ui.UnoDialog;
+import com.sun.star.wizards.ui.WizardDialog;
+import com.sun.star.wizards.db.RelationController;
+
+/**
+ * @author Administrator
+ *
+ * To change the template for this generated type comment go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+public class FormConfiguration
+{
+
+ WizardDialog CurUnoDialog;
+ short curtabindex;
+ XRadioButton optOnExistingRelation;
+ XCheckBox chkcreateSubForm;
+ XRadioButton optSelectManually;
+ XFixedText lblSubFormDescription;
+ XFixedText lblRelations;
+ XListBox lstRelations;
+ String[] sreferencedTables;
+ // Integer ISubFormStep;
+ 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 = 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);
+ String sSelectRelation = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 8);
+ String sSubFormDescription = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 3);
+
+ // CheckBox 'Add sub form'
+ chkcreateSubForm = CurUnoDialog.insertCheckBox("chkcreateSubForm", SSUBFORMMODE, this,
+ 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_DLGFORM_CHKCREATESUBFORM", sSelectManually, new Integer(97), new Integer(26), ISubFormStep, new Short(curtabindex++), new Integer(160)
+ });
+ optOnExistingRelation = CurUnoDialog.insertRadioButton("optOnExistingRelation", STOGGLESTEPS, 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.FALSE, UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTONEXISTINGRELATION", sOnExistingRelation, new Integer(107), new Integer(43), ISubFormStep, new Short(curtabindex++), new Integer(160)
+ });
+ optSelectManually = CurUnoDialog.insertRadioButton("optSelectManually", STOGGLESTEPS, 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_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ },
+ new Object[]
+ {
+ Boolean.FALSE, UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTSELECTMANUALLY", sOnManualRelation, new Integer(107), new Integer(99), new Short((short) 1), ISubFormStep, new Short(curtabindex++), new Integer(160)
+ });
+ lblRelations = CurUnoDialog.insertLabel("lblSelectRelation",
+ new String[]
+ {
+ PropertyNames.PROPERTY_ENABLED, 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[]
+ {
+ Boolean.FALSE, new Integer(19), sSelectRelation, Boolean.TRUE, new Integer(119), new Integer(56), ISubFormStep, new Short(curtabindex++), new Integer(80)
+ });
+ lstRelations = CurUnoDialog.insertListBox("lstrelations", SONEXISTINGRELATIONSELECTION, SONEXISTINGRELATIONSELECTION, this,
+ new String[]
+ {
+ PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ },
+ new Object[]
+ {
+ Boolean.FALSE, new Integer(37), "HID:WIZARDS_HID_DLGFORM_lstRELATIONS", new Integer(201), new Integer(55), ISubFormStep, new Short(curtabindex++), new Integer(103)
+ });
+ 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[]
+ {
+ new Integer(59), sSubFormDescription, Boolean.TRUE, new Integer(110), new Integer(120), ISubFormStep, new Short(curtabindex++), new Integer(190)
+ });
+ CurUnoDialog.insertInfoImage(97, 120, ISubFormStep.intValue());
+ }
+
+ // public void disableSubFormCheckBox()
+ // {
+ // Helper.setUnoPropertyValue(UnoDialog.getModel(chkcreateSubForm), PropertyNames.PROPERTY_ENABLED, Boolean.FALSE);
+ // }
+
+ public RelationController getRelationController()
+ {
+ return oRelationController;
+ }
+
+ public boolean areexistingRelationsdefined()
+ {
+ return ((chkcreateSubForm.getState() == 1) && (optOnExistingRelation.getState()));
+ }
+
+ public void toggleSubFormMode()
+ {
+ boolean bdoEnable = (this.chkcreateSubForm.getState() == 1);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(optOnExistingRelation), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoEnable && bsupportsRelations));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(optSelectManually), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoEnable));
+ toggleSteps();
+ }
+
+ public void initialize(CommandFieldSelection _CurSubFormFieldSelection, RelationController _oRelationController)
+ {
+ oRelationController = _oRelationController;
+ sreferencedTables = oRelationController.getExportedKeys();
+ bsupportsRelations = (sreferencedTables.length > 0);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstRelations), "StringItemList", sreferencedTables);
+ this.CurSubFormFieldSelection = _CurSubFormFieldSelection;
+ toggleRelationsListbox();
+ Helper.setUnoPropertyValue(UnoDialog.getModel(optOnExistingRelation), PropertyNames.PROPERTY_ENABLED, new Boolean(bsupportsRelations && (chkcreateSubForm.getState() == 1)));
+ }
+
+ public void toggleSteps()
+ {
+ boolean bDoEnableFollowingSteps;
+ 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())
+ {
+ short[] iselected = (short[]) Helper.getUnoArrayPropertyValue(UnoDialog.getModel(lstRelations), "SelectedItems");
+ if (iselected != null)
+ {
+ if (iselected.length > 0)
+ {
+ return sreferencedTables[iselected[0]];
+ }
+ }
+ }
+ return "";
+ }
+
+ 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);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lblRelations), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoenable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstRelations), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoenable));
+ }
+
+ public boolean hasSubForm()
+ {
+ return (this.chkcreateSubForm.getState() == 1);
+ }
+}
diff --git a/wizards/com/sun/star/wizards/form/FormControlArranger.java b/wizards/com/sun/star/wizards/form/FormControlArranger.java
new file mode 100644
index 000000000000..f5478525eab1
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/FormControlArranger.java
@@ -0,0 +1,732 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.wizards.form;
+
+import com.sun.star.awt.Point;
+import com.sun.star.awt.Size;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sdbc.DataType;
+import com.sun.star.task.XStatusIndicator;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Exception;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.Resource;
+import com.sun.star.wizards.common.PropertyNames;
+import com.sun.star.wizards.db.*;
+import com.sun.star.wizards.document.Control;
+import com.sun.star.wizards.document.DatabaseControl;
+import com.sun.star.wizards.document.FormHandler;
+import com.sun.star.wizards.document.Shape;
+import com.sun.star.wizards.document.TimeStampControl;
+
+public class FormControlArranger
+{
+
+ protected DatabaseControl[] DBControlList = null;
+
+ private XNameContainer xFormName;
+ private XMultiServiceFactory xMSF;
+ private Control[] LabelControlList = null;
+ private XStatusIndicator xProgressBar;
+ private FieldColumn[] FieldColumns;
+ private DatabaseControl curDBControl;
+ // Control curLabelControl;
+ private int icurArrangement;
+ private boolean bIsFirstRun;
+ private boolean bIsVeryFirstRun;
+ private boolean bControlsareCreated;
+ private int cXOffset;
+ private int cYOffset;
+ private static final int cVertDistance = 200;
+ private static final int cHoriDistance = 300;
+ private static final int cLabelGap = 100;
+ private static final double CMAXREDUCTION = 0.7;
+ private FormHandler oFormHandler;
+ private int iReduceWidth;
+ private int nXTCPos;
+ private int nYTCPos;
+ private int nXDBPos;
+ private int nYDBPos;
+ private int nTCHeight;
+ private int nTCWidth;
+ private int nDBHeight;
+ private int nDBWidth;
+ private int nMaxTCWidth;
+ private int nFormWidth;
+ private int nFormHeight;
+ private int nMaxRowY;
+ private int nSecMaxRowY;
+ private int nMaxColRightX;
+ private int a;
+ private int StartA;
+ private int nMaxDBYPos = 0; //the maximum YPosition of a DBControl in the form
+ private Short NBorderType = new Short((short) 1); //3-D Border
+
+ public FormControlArranger(FormHandler _oFormHandler, XNameContainer _xFormName, CommandMetaData oDBMetaData, XStatusIndicator _xProgressBar, Point _StartPoint, Size _FormSize)
+ {
+ FieldColumns = oDBMetaData.FieldColumns;
+ xMSF = oDBMetaData.xMSF;
+ xFormName = _xFormName;
+ xProgressBar = _xProgressBar;
+ LabelControlList = new Control[FieldColumns.length];
+ DBControlList = new DatabaseControl[FieldColumns.length];
+ oFormHandler = _oFormHandler;
+ cXOffset = _StartPoint.X;
+ cYOffset = _StartPoint.Y;
+ setFormSize(_FormSize);
+ }
+ // Note: on all Controls except for the checkbox the Label has to be set
+ // a bit under the DBControl because its Height is also smaller
+ private int getLabelDiffHeight(int _index)
+ {
+ if (curDBControl != null)
+ {
+ if (curDBControl.getControlType() == FormHandler.SOCHECKBOX)
+ {
+ return getCheckBoxDiffHeight(_index);
+ }
+ }
+ return oFormHandler.getBasicLabelDiffHeight();
+ }
+
+ public void setBorderType(short _nBorderType)
+ {
+ NBorderType = new Short(_nBorderType);
+ }
+
+ public Control[] getLabelControlList()
+ {
+ return LabelControlList;
+ }
+
+ private int getCheckBoxDiffHeight(int LastIndex)
+ {
+ if ((LastIndex < DBControlList.length))
+ {
+ if (DBControlList[LastIndex].getControlType() == FormHandler.SOCHECKBOX)
+ {
+ return (int) ((oFormHandler.getControlReferenceHeight() - DBControlList[LastIndex].getControlHeight()) / 2);
+ }
+ }
+ return 0;
+ }
+
+ private boolean isReducable(int _index)
+ {
+ boolean bisreducable = false;
+ int ntype = this.FieldColumns[_index].getFieldType();
+ switch (ntype)
+ {
+ case DataType.TINYINT:
+ case DataType.SMALLINT:
+ case DataType.INTEGER:
+ case DataType.FLOAT:
+ case DataType.DATE:
+ case DataType.TIME:
+ case DataType.TIMESTAMP:
+ case DataType.REAL:
+ case DataType.DOUBLE:
+ case DataType.NUMERIC:
+ case DataType.DECIMAL:
+ case DataType.BIT:
+ case DataType.BOOLEAN:
+ bisreducable = false;
+ break;
+ case DataType.VARCHAR:
+ short nTextLen;
+ try
+ {
+ nTextLen = AnyConverter.toShort(DBControlList[_index].xPropertySet.getPropertyValue("MaxTextLen"));
+ if ((nTextLen == 0) || (nTextLen > 20))
+ {
+ bisreducable = true;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ break;
+ case DataType.BIGINT:
+ bisreducable = true;
+ break;
+ default:
+ bisreducable = true;
+ }
+ if (nTCWidth > 0.9 * CMAXREDUCTION * nDBWidth)
+ {
+ bisreducable = false;
+ }
+ return bisreducable;
+ }
+
+ private int getControlGroupWidth()
+ {
+ if (nDBWidth > nTCWidth)
+ {
+ return nDBWidth;
+ }
+ else
+ {
+ return nTCWidth;
+ }
+ }
+
+ private void checkJustifiedPosition(int a)
+ {
+ int nBaseWidth = nFormWidth + cXOffset;
+ int nLeftDist = nMaxColRightX - nBaseWidth;
+ int nRightDist = nBaseWidth - (DBControlList[a].getPosition().X - this.cHoriDistance);
+ if (nLeftDist < 0.5 * nRightDist)
+ {
+ // Fieldwidths in the line can be made smaller..
+ adjustLineWidth(StartA, a, nLeftDist, -1);
+ nYTCPos = nMaxRowY + cVertDistance;
+ nYDBPos = nYTCPos + nTCHeight;
+// if ((nYDBPos + nDBHeight) > nMaxDBYPos)
+// nMaxDBYPos = nYDBPos + nDBHeight;
+ nXTCPos = cXOffset;
+ nXDBPos = cXOffset;
+ bIsFirstRun = true;
+ StartA = a + 1;
+ }
+ else
+ {
+ // FieldWidths in the line can be made wider...
+ if (nYDBPos + nDBHeight == nMaxRowY)
+ {
+ // The last Control was the highest in the row
+ nYTCPos = nSecMaxRowY + cVertDistance;
+ }
+ else
+ {
+ nYTCPos = nMaxRowY + cVertDistance;
+ }
+ nYDBPos = nYTCPos + nTCHeight;
+ nXDBPos = cXOffset;
+ nXTCPos = cXOffset;
+ this.LabelControlList[a].setPosition(new Point(cXOffset, nYTCPos));
+ this.DBControlList[a].setPosition(new Point(cXOffset, nYDBPos));
+ bIsFirstRun = true;
+ if (nDBWidth > nTCWidth)
+ {
+ checkOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, true);
+ }
+ else
+ {
+ checkOuterPoints(nXDBPos, nTCWidth, nYDBPos, nDBHeight, true);
+ }
+ nXTCPos = nMaxColRightX + cHoriDistance;
+ nXDBPos = nXTCPos;
+ adjustLineWidth(StartA, a - 1, nRightDist, 1);
+ StartA = a;
+ }
+ }
+
+ private int getCorrWidth(int StartIndex, int EndIndex, int nDist, int Widthfactor)
+ {
+ int ShapeCount;
+ if (Widthfactor > 0)
+ {
+ // shapes are made wide
+ ShapeCount = EndIndex - StartIndex + 1;
+ }
+ else
+ {
+ // shapes are made more narrow
+ ShapeCount = iReduceWidth;
+ }
+ return (nDist) / ShapeCount;
+ }
+
+ /**
+ *
+ * @param StartIndex
+ * @param EndIndex
+ * @param nDist
+ * @param WidthFactor is either '+1' or '-1' and determines whether the control shapes widths are to be made smaller or larger
+ */
+ private void adjustLineWidth(int StartIndex, int EndIndex, int nDist, int WidthFactor)
+ {
+ int CorrWidth = getCorrWidth(StartIndex, EndIndex, nDist, WidthFactor);
+ int iLocTCPosX = cXOffset;
+ for (int i = StartIndex; i <= EndIndex; i++)
+ {
+ int nControlBaseWidth = 0;
+ curDBControl = this.DBControlList[i];
+ Control curLabelControl = this.LabelControlList[i];
+ if (i != StartIndex)
+ {
+ curLabelControl.setPosition(new Point(iLocTCPosX, curLabelControl.getPosition().Y));
+ curDBControl.setPosition(new Point(iLocTCPosX, curLabelControl.getPosition().Y + nTCHeight));
+ }
+ if (((curLabelControl.getSize().Width > curDBControl.getSize().Width)) && (WidthFactor > 0))
+ {
+ nControlBaseWidth = curLabelControl.getSize().Width;
+ }
+ else
+ {
+ nControlBaseWidth = curDBControl.getSize().Width;
+ }
+ if (FieldColumns[i].getFieldType() == DataType.TIMESTAMP)
+ {
+ TimeStampControl oDBTimeStampControl = (TimeStampControl) curDBControl;
+ nControlBaseWidth = oDBTimeStampControl.getSize().Width;
+ if (this.isReducable(i) || WidthFactor > 0)
+ {
+ oDBTimeStampControl.setSize(new Size(nControlBaseWidth + WidthFactor * CorrWidth, oDBTimeStampControl.getSize().Height));
+ }
+ }
+ else
+ {
+ if (this.isReducable(i) || WidthFactor > 0)
+ {
+ curDBControl.setSize(new Size(nControlBaseWidth + WidthFactor * CorrWidth, curDBControl.getSize().Height));
+ }
+ }
+ iLocTCPosX = curDBControl.getPosition().X + curDBControl.getSize().Width + cHoriDistance;
+ if (curLabelControl.getSize().Width > curDBControl.getSize().Width)
+ {
+ iLocTCPosX = curLabelControl.getPosition().X + curLabelControl.getSize().Width + cHoriDistance;
+ }
+ }
+ if (WidthFactor > 0)
+ {
+ iReduceWidth = 1;
+ }
+ else
+ {
+ iReduceWidth = 0;
+ }
+ }
+
+ private void checkOuterPoints(int nXPos, int nWidth, int nYPos, int nHeight, boolean bIsDBField)
+ {
+ int nColRightX;
+ if (icurArrangement == FormWizard.SOTOPJUSTIFIED)
+ {
+ if (bIsDBField)
+ {
+ // Only at DBControls you can measure the Value of nMaxRowY
+ if (bIsFirstRun)
+ {
+ nMaxRowY = nYPos + nHeight;
+ nSecMaxRowY = nMaxRowY;
+ }
+ else
+ {
+ int nRowY = nYPos + nHeight;
+ if (nRowY >= nMaxRowY)
+ {
+ int nOldMaxRowY = nMaxRowY;
+ nSecMaxRowY = nOldMaxRowY;
+ nMaxRowY = nRowY;
+ }
+ }
+ }
+ }
+ // Find the outer right point
+ if (bIsFirstRun)
+ {
+ nMaxColRightX = nXPos + nWidth;
+ bIsFirstRun = false;
+ }
+ else
+ {
+ nColRightX = nXPos + nWidth;
+ if (nColRightX > nMaxColRightX)
+ {
+ nMaxColRightX = nColRightX;
+ }
+ }
+ }
+
+ public void positionControls(int _icurArrangement, Point _aStartPoint, Size _aFormSize, short _iAlign, Short _NBorderType)
+ {
+ try
+ {
+ this.NBorderType = _NBorderType;
+ this.setStartPoint(_aStartPoint);
+ icurArrangement = _icurArrangement;
+ initializePosSizes();
+ initializeControlColumn(-1);
+ bIsVeryFirstRun = true;
+ nMaxRowY = 0;
+ nSecMaxRowY = 0;
+ this.nMaxColRightX = 0;
+ xProgressBar.start("", FieldColumns.length);
+ for (int i = 0; i < FieldColumns.length; i++)
+ {
+ try
+ {
+ insertLabel(i, _iAlign);
+ insertDBControl(i);
+ bIsVeryFirstRun = false;
+ DBControlList[i].setPropertyValue("LabelControl", LabelControlList[i].xPropertySet);
+ resetPosSizes(i);
+ xProgressBar.setValue(i + 1);
+ }
+ catch (RuntimeException e)
+ {
+ int dummy = 0;
+ }
+ }
+ xProgressBar.end();
+ bControlsareCreated = true;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public boolean areControlsexisting()
+ {
+ if (DBControlList != null)
+ {
+ if (DBControlList.length > 0)
+ {
+ return (DBControlList[0] != null);
+ }
+ }
+ return false;
+ }
+
+ private void initializeControlColumn(int LastIndex)
+ {
+ bIsFirstRun = true;
+ StartA = LastIndex + 1;
+ a = 0;
+ }
+
+ private void resetPosSizes(int LastIndex)
+ {
+ int nYRefPos = nYDBPos;
+ switch (icurArrangement)
+ {
+ case FormWizard.SOCOLUMNARLEFT:
+ nYDBPos = nYDBPos + nDBHeight + cVertDistance + getCheckBoxDiffHeight(LastIndex);
+ nYRefPos = nYDBPos;
+ if ((nYDBPos > cYOffset + nFormHeight) || (LastIndex == (FieldColumns.length - 1)))
+ {
+ repositionColumnarLeftControls(LastIndex);
+ nXTCPos = nMaxColRightX + 2 * cHoriDistance;
+ nXDBPos = nXTCPos + this.cLabelGap + nMaxTCWidth;
+ nYDBPos = cYOffset;
+ nYRefPos = nYDBPos;
+ initializeControlColumn(LastIndex);
+ }
+ else
+ {
+ /*a = a + 1;*/
+ /* a += 1;*/
+ ++a;
+ }
+ nYTCPos = nYDBPos + this.getLabelDiffHeight(LastIndex);
+ if ((nYRefPos + nDBHeight) > nMaxDBYPos)
+ {
+ nMaxDBYPos = nYRefPos + nDBHeight;
+ }
+
+ break;
+ case FormWizard.SOCOLUMNARTOP:
+ nYTCPos = nYDBPos + nDBHeight + cVertDistance + getCheckBoxDiffHeight(LastIndex);
+ ;
+ if ((nYTCPos > cYOffset + nFormHeight) || (LastIndex == (FieldColumns.length - 1)))
+ {
+ nXDBPos = nMaxColRightX + cHoriDistance;
+ nXTCPos = nXDBPos;
+ nYRefPos = nYDBPos;
+ nYDBPos = cYOffset + nTCHeight + cVertDistance;
+ nYTCPos = cYOffset;
+ initializeControlColumn(LastIndex);
+ }
+ else
+ {
+ a = a + 1;
+ }
+ if ((nYRefPos + nDBHeight + cVertDistance) > nMaxDBYPos)
+ {
+ nMaxDBYPos = nYRefPos + nDBHeight + cVertDistance;
+ }
+ break;
+
+ case FormWizard.SOTOPJUSTIFIED:
+ if (this.isReducable(a))
+ {
+ iReduceWidth = iReduceWidth + 1;
+ }
+ if (nMaxColRightX > cXOffset + nFormWidth)
+ {
+ int nOldYTCPos = nYTCPos;
+ checkJustifiedPosition(a);
+ nYRefPos = nYDBPos;
+ }
+ else
+ {
+ nXTCPos = nMaxColRightX + cHoriDistance;
+ }
+ a = a + 1;
+ if ((nYRefPos + nDBHeight) > nMaxDBYPos)
+ {
+ nMaxDBYPos = nYRefPos + nDBHeight;
+ }
+ break;
+ }
+// if ((nYRefPos + nDBHeight) > nMaxDBYPos)
+// nMaxDBYPos = nYRefPos + nDBHeight;
+ }
+
+ private void repositionColumnarLeftControls(int LastIndex)
+ {
+ bIsFirstRun = true;
+ for (int i = StartA; i <= LastIndex; i++)
+ {
+ if (i == StartA)
+ {
+ nXTCPos = LabelControlList[i].getPosition().X;
+ nXDBPos = nXTCPos + nMaxTCWidth + cHoriDistance;
+ }
+ LabelControlList[i].setSize(new Size(nMaxTCWidth, nTCHeight));
+ resetDBShape(DBControlList[i], nXDBPos);
+ checkOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, true);
+ }
+ }
+
+ private void resetDBShape(Shape _curDBControl, int iXPos)
+ {
+ int nYDBPos = _curDBControl.getPosition().Y;
+ nDBWidth = _curDBControl.getSize().Width;
+ nDBHeight = _curDBControl.getSize().Height;
+ _curDBControl.setPosition(new Point(iXPos, nYDBPos));
+ }
+
+ private void initializePosSizes()
+ {
+ this.nMaxDBYPos = 0;
+ nXTCPos = cXOffset;
+ nTCWidth = 2000;
+ nDBWidth = 2000;
+ nDBHeight = oFormHandler.getControlReferenceHeight();
+ nTCHeight = oFormHandler.getLabelHeight();
+ iReduceWidth = 0;
+ if (icurArrangement == FormWizard.SOCOLUMNARLEFT)
+ {
+ nYTCPos = cYOffset + this.getLabelDiffHeight(0);
+ nXDBPos = cXOffset + 3050;
+ nYDBPos = cYOffset;
+ }
+ else
+ {
+ nXDBPos = cXOffset;
+ nYTCPos = cYOffset;
+ }
+ }
+
+ private void insertLabel(int i, int _iAlign)
+ {
+ try
+ {
+ if (bControlsareCreated)
+ {
+ LabelControlList[i].setPosition(new Point(nXTCPos, nYTCPos));
+ if (icurArrangement != FormWizard.SOCOLUMNARLEFT)
+ {
+ nTCWidth = LabelControlList[i].getPreferredWidth(FieldColumns[i].getFieldTitle());
+ LabelControlList[i].setSize(new Size(nTCWidth, nTCHeight));
+ }
+ else
+ {
+ nTCWidth = LabelControlList[i].getSize().Width;
+ }
+ }
+ else
+ {
+ Point aPoint = new Point(nXTCPos, nYTCPos);
+ Size aSize = new Size(nTCWidth, nTCHeight);
+ final String sFieldName = FieldColumns[i].getFieldName();
+ this.LabelControlList[i] = new Control(oFormHandler, xFormName, FormHandler.SOLABEL, sFieldName, aPoint, aSize);
+ if (bIsVeryFirstRun)
+ {
+ if (icurArrangement == FormWizard.SOCOLUMNARTOP)
+ {
+ nYDBPos = nYTCPos + nTCHeight;
+ }
+ }
+ String sTitle = FieldColumns[i].getFieldTitle();
+ nTCWidth = LabelControlList[i].getPreferredWidth(sTitle);
+ }
+ Control curLabelControl = LabelControlList[i];
+ if (icurArrangement == FormWizard.SOCOLUMNARLEFT)
+ {
+ // Note This If Sequence must be called before retrieving the outer Points
+ if (bIsFirstRun)
+ {
+ nMaxTCWidth = nTCWidth;
+ bIsFirstRun = false;
+ }
+ else if (nTCWidth > nMaxTCWidth)
+ {
+ nMaxTCWidth = nTCWidth;
+ }
+ }
+ checkOuterPoints(nXTCPos, nTCWidth, nYTCPos, nTCHeight, false);
+ if ((icurArrangement == FormWizard.SOCOLUMNARTOP) || (icurArrangement == FormWizard.SOTOPJUSTIFIED))
+ {
+ nXDBPos = nXTCPos;
+ nYDBPos = nYTCPos + nTCHeight;
+ curLabelControl.xPropertySet.setPropertyValue("Align", new Short((short) com.sun.star.awt.TextAlign.LEFT));
+ }
+ else
+ {
+ curLabelControl.xPropertySet.setPropertyValue("Align", new Short((short) _iAlign));
+ }
+ if (!bControlsareCreated)
+ {
+ curLabelControl.setSize(new Size(nTCWidth, nTCHeight));
+ }
+// if (CurHelpText != ""){
+// oModel.HelpText = CurHelptext;
+// }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ private void insertDBControl(int i)
+ {
+ try
+ {
+ String sFieldName = FieldColumns[i].getFieldName();
+ int nFieldType = FieldColumns[i].getFieldType();
+
+ Point aPoint = new Point(nXDBPos, nYDBPos);
+ if (bControlsareCreated)
+ {
+ DBControlList[i].setPosition(aPoint);
+ }
+ else
+ {
+ if (nFieldType == DataType.TIMESTAMP)
+ {
+ DBControlList[i] = new TimeStampControl(new Resource(xMSF, "FormWizard", "dbw"), oFormHandler, xFormName, sFieldName, aPoint);
+ }
+ else
+ {
+ DBControlList[i] = new DatabaseControl(oFormHandler, xFormName, sFieldName, nFieldType, aPoint);
+ if (DBControlList[i].getControlType() == FormHandler.SOCHECKBOX)
+ {
+ // Checkboxes have no Label near by
+ DBControlList[i].setPropertyValue(PropertyNames.PROPERTY_LABEL, "");
+ }
+ }
+ }
+ DatabaseControl aDBControl = DBControlList[i];
+ nDBHeight = aDBControl.getControlHeight();
+ nDBWidth = aDBControl.getControlWidth();
+ if (nFieldType != DataType.TIMESTAMP)
+ {
+ aDBControl.setSize(new Size(nDBWidth, nDBHeight));
+ }
+ if (aDBControl.getControlType() == FormHandler.SOCHECKBOX)
+ {
+ nYDBPos = nYDBPos + /*(int)*/ ((oFormHandler.getControlReferenceHeight() - nDBHeight) / 2);
+ aPoint = new Point(nXDBPos, nYDBPos);
+ aDBControl.setPosition(aPoint);
+ }
+ if (nFieldType == DataType.LONGVARCHAR) /* memo */
+ {
+ Helper.setUnoPropertyValue(LabelControlList[i], PropertyNames.PROPERTY_MULTILINE, Boolean.TRUE);
+ }
+ checkOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, true);
+ aDBControl.setPropertyValue("Border", NBorderType);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ private int assignFieldLength(int _fieldlength)
+ {
+ if (_fieldlength >= 65535)
+ {
+ return -1;
+ }
+ else
+ {
+ return _fieldlength;
+ }
+ }
+
+ public int getFormHeight()
+ {
+ return nMaxDBYPos - this.cYOffset;
+ }
+
+ public int getEntryPointY()
+ {
+ if (this.icurArrangement == FormWizard.SOCOLUMNARTOP)
+ {
+ Control curLabelControl2 = LabelControlList[0];
+ return curLabelControl2.getPosition().Y;
+ }
+ else
+ {
+ DatabaseControl curDBControl2 = DBControlList[0];
+ return curDBControl2.getPosition().Y;
+ }
+ }
+
+ public void setStartPoint(Point _aPoint)
+ {
+ this.cXOffset = _aPoint.X;
+ this.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 = this.LabelControlList[i].getPosition();
+ LabelControlList[i].setPosition(new Point(aPoint.X, aPoint.Y - _diffY));
+ }
+ nMaxDBYPos = -_diffY;
+ cYOffset = -_diffY;
+ }
+
+ public void setFormSize(Size _FormSize)
+ {
+ nFormHeight = _FormSize.Height;
+ nFormWidth = _FormSize.Width;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/form/FormDocument.java b/wizards/com/sun/star/wizards/form/FormDocument.java
new file mode 100644
index 000000000000..0070fed3ada1
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/FormDocument.java
@@ -0,0 +1,596 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.wizards.form;
+
+import java.util.Vector;
+
+import com.sun.star.wizards.text.TextDocument;
+import com.sun.star.awt.Point;
+import com.sun.star.awt.Size;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.db.*;
+import com.sun.star.wizards.common.*;
+import com.sun.star.wizards.ui.*;
+import com.sun.star.wizards.text.TextStyleHandler;
+import com.sun.star.wizards.text.ViewHandler;
+import com.sun.star.wizards.document.Control;
+import com.sun.star.wizards.document.DatabaseControl;
+import com.sun.star.wizards.document.FormHandler;
+import com.sun.star.wizards.document.GridControl;
+
+public class FormDocument extends TextDocument
+{
+ protected Vector oControlForms = new Vector();
+ protected CommandMetaData oMainFormDBMetaData;
+ protected CommandMetaData oSubFormDBMetaData;
+ protected String[][] LinkFieldNames;
+
+ private FormHandler oFormHandler;
+ private ViewHandler oViewHandler;
+ private TextStyleHandler oTextStyleHandler;
+ private XPropertySet xPropPageStyle;
+ private final int SOFORMGAP = 2000;
+ private boolean bhasSubForm;
+ private UIControlArranger curUIControlArranger;
+ private StyleApplier curStyleApplier;
+ private int nPageWidth;
+ private int nPageHeight;
+ private int nFormWidth;
+ private int nFormHeight;
+ private Point aMainFormPoint;
+ private final static String SOMAINFORM = "MainForm";
+ private final static String SOSUBFORM = "SubForm";
+
+ public FormDocument(XMultiServiceFactory xMSF)
+ {
+ super(xMSF, new TextDocument.ModuleIdentifier("com.sun.star.sdb.FormDesign"), true);
+ try
+ {
+ oFormHandler = new FormHandler(xMSF, xTextDocument);
+ oFormHandler.setDrawObjectsCaptureMode(false);
+ oTextStyleHandler = new TextStyleHandler(xMSFDoc, xTextDocument);
+ oViewHandler = new ViewHandler(xMSFDoc, xTextDocument);
+ oMainFormDBMetaData = new CommandMetaData(xMSF);// , CharLocale);
+ oSubFormDBMetaData = new CommandMetaData(xMSF);// , CharLocale);
+ 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);
+ xPropPageStyle = oTextStyleSupplier.getStyleByName("PageStyles", "Standard");
+ Size aSize = oTextStyleHandler.changePageAlignment(xPropPageStyle, true);
+ nPageWidth = aSize.Width;
+ nPageHeight = aSize.Height;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public void addUIFormController(UIControlArranger _curUIControlArranger)
+ {
+ this.curUIControlArranger = _curUIControlArranger;
+ }
+
+ public void addStyleApplier(StyleApplier _curStyleApplier)
+ {
+ this.curStyleApplier = _curStyleApplier;
+ }
+
+ private String getDataSourceName()
+ {
+ return this.oMainFormDBMetaData.DataSourceName;
+ }
+
+ private void adjustPageStyle()
+ {
+ try
+ {
+ int nMargin;
+ int totfieldcount = getMainFieldCount() + getSubFieldCount();
+ if (totfieldcount > 30)
+ {
+ nMargin = 500;
+ }
+ else if (totfieldcount > 20)
+ {
+ nMargin = 750;
+ }
+ else
+ {
+ nMargin = 1000;
+ }
+ 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 * (double) nPageWidth) - 2 * nMargin;
+ nFormHeight = (int) (0.65 * (double) nPageHeight) - 2 * nMargin;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public void initialize(boolean _baddParentForm, boolean _bShouldHaveSubForm, boolean _bModifySubForm, Short _NBorderType)
+ {
+ bhasSubForm = _bShouldHaveSubForm;
+ adjustPageStyle();
+ if (_baddParentForm)
+ {
+ if (oControlForms.size() == 0)
+ {
+ final ControlForm aMainControlForm = new ControlForm(this, SOMAINFORM, aMainFormPoint, getMainFormSize(FormWizard.SOGRID));
+ oControlForms.addElement(aMainControlForm);
+ }
+ else
+ {
+ oFormHandler.removeControlsofForm(SOMAINFORM);
+ ((ControlForm) oControlForms.get(0)).oFormController = null;
+ }
+ ((ControlForm) oControlForms.get(0)).initialize(curUIControlArranger.getSelectedArrangement(0), _NBorderType);
+ }
+ if (_bShouldHaveSubForm)
+ {
+ if (oControlForms.size() == 1)
+ {
+ adjustMainFormSize(_NBorderType);
+ final ControlForm aSubControlForm = new ControlForm(this, SOSUBFORM, getSubFormPoint(), getSubFormSize());
+ oControlForms.addElement(aSubControlForm);
+ /* ((ControlForm) oControlForms.get(1))*/
+ aSubControlForm.initialize(curUIControlArranger.getSelectedArrangement(1), _NBorderType);
+ }
+ else if (_bModifySubForm)
+ {
+ if (oControlForms.size() > 1)
+ {
+ oFormHandler.removeControlsofForm(SOSUBFORM);
+ ((ControlForm) oControlForms.get(1)).oFormController = null;
+ ((ControlForm) oControlForms.get(1)).initialize(curUIControlArranger.getSelectedArrangement(1), _NBorderType);
+ }
+ }
+ }
+ else
+ {
+ ControlForm aMainForm = (ControlForm) oControlForms.get(0);
+ // boolean bHasSubForm = aMainForm.xFormContainer.hasByName(SOSUBFORM);
+ // WRONG if (oFormHandler.hasFormByName(SOSUBFORM))
+ if (aMainForm.xFormContainer != null && aMainForm.xFormContainer.hasByName(SOSUBFORM))
+ {
+ oFormHandler.removeControlsofForm(SOSUBFORM);
+ oFormHandler.removeElement( aMainForm.xFormContainer, SOSUBFORM );
+ ((ControlForm) oControlForms.get(1)).oFormController = null;
+ // aMainForm.xFormContainer = null; // .removeFormByName(SOSUBFORM);
+ oControlForms.remove(1);
+ adjustMainFormSize(_NBorderType);
+ }
+ }
+ }
+
+ private int getMainFieldCount()
+ {
+ return oMainFormDBMetaData.getFieldNames().length;
+ }
+ private int getSubFieldCount()
+ {
+ return oSubFormDBMetaData.getFieldNames().length;
+ }
+
+ private Size getMainFormSize(int _curArrangement)
+ {
+ int nMainFormHeight = nFormHeight;
+ if (bhasSubForm)
+ {
+ if (_curArrangement == FormWizard.SOGRID)
+ {
+ nMainFormHeight = (int) ((double) (nFormHeight - SOFORMGAP) / 2);
+ }
+ else
+ {
+ int nTotalFieldCount = getMainFieldCount() + getSubFieldCount();
+ nMainFormHeight = (int) (((double) getMainFieldCount() / (double) nTotalFieldCount) * ((double) (nFormHeight - SOFORMGAP) / 2));
+ }
+ }
+ Size aMainFormSize = new Size(nFormWidth, nMainFormHeight);
+ return aMainFormSize;
+ }
+
+ private Size getSubFormSize()
+ {
+// int nSubFormHeight = (int) ((double)nFormHeight/2) - SOFORMGAP;
+// int nSubFormFieldCount = this.oSubFormDBMetaData.FieldNames.length;
+// int totfieldcount = oMainFormDBMetaData.FieldNames.length + nSubFormFieldCount;
+ int nMainFormHeight = ((ControlForm) oControlForms.get(0)).getActualFormHeight();
+ Size aSubFormSize = new Size(nFormWidth, nFormHeight - nMainFormHeight - SOFORMGAP);
+ return aSubFormSize;
+ }
+
+ private Point getSubFormPoint()
+ {
+ ControlForm curMainControlForm = ((ControlForm) oControlForms.get(0));
+ return new Point(curMainControlForm.aStartPoint.X,
+ (curMainControlForm.aStartPoint.Y + curMainControlForm.getFormSize().Height + SOFORMGAP));
+ }
+
+ private void adjustMainFormSize(Short _NBorderType)
+ {
+ ControlForm oMainControlForm = (ControlForm) oControlForms.get(0);
+ oMainControlForm.setFormSize(getMainFormSize(oMainControlForm.curArrangement));
+ if (oMainControlForm.curArrangement == FormWizard.SOGRID)
+ {
+ oMainControlForm.oGridControl.setSize(oMainControlForm.getFormSize());
+ }
+ else
+ {
+ oMainControlForm.oFormController.positionControls(oMainControlForm.curArrangement,
+ oMainControlForm.aStartPoint,
+ oMainControlForm.getFormSize(),
+ curUIControlArranger.getAlignValue(), _NBorderType);
+ }
+ }
+
+ private void adjustSubFormPosSize(Short _NBorderType)
+ {
+ ControlForm oMainControlForm = (ControlForm) oControlForms.get(0);
+ ControlForm oSubControlForm = (ControlForm) oControlForms.get(1);
+ oSubControlForm.setFormSize(new Size(nFormWidth, (int) nFormHeight - oMainControlForm.getFormSize().Height));
+ if (oSubControlForm.curArrangement == FormWizard.SOGRID)
+ {
+ Point aPoint = oSubControlForm.oGridControl.getPosition();
+ int idiffheight = oSubControlForm.getEntryPointY() - oMainControlForm.getActualFormHeight() - oMainControlForm.aStartPoint.Y - SOFORMGAP;
+ oSubControlForm.setStartPoint(new Point(aPoint.X, (aPoint.Y - idiffheight)));
+ oSubControlForm.oGridControl.setPosition(oSubControlForm.aStartPoint);
+ oSubControlForm.oGridControl.setSize(getSubFormSize());
+ }
+ 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, oSubControlForm.getAvailableFormSize(), curUIControlArranger.getAlignValue(), _NBorderType);
+ }
+ }
+
+ public ControlForm getControlFormByName(String _sname)
+ {
+ for (int i = 0; i < oControlForms.size(); i++)
+ {
+ ControlForm curControlForm = ((ControlForm) oControlForms.get(i));
+ if (curControlForm.Name.equals(_sname))
+ {
+ return curControlForm;
+ }
+ }
+ return null;
+ }
+
+ public ControlForm[] getControlForms()
+ {
+ ControlForm[] aResult = new ControlForm[oControlForms.size()];
+ oControlForms.toArray( aResult );
+ return aResult;
+ }
+
+ public boolean finalizeForms(DataEntrySetter _curDataEntrySetter, FieldLinker _curFieldLinker, FormConfiguration _curFormConfiguration)
+ {
+ try
+ {
+ this.xTextDocument.lockControllers();
+ PropertyValue[] aFormProperties = _curDataEntrySetter.getFormProperties();
+ ControlForm oMasterControlForm = getControlFormByName(SOMAINFORM);
+ oMasterControlForm.setFormProperties(aFormProperties, oMainFormDBMetaData);
+ oMasterControlForm.finalizeControls();
+ if (oMasterControlForm.xFormContainer.hasByName(SOSUBFORM))
+ {
+ ControlForm oSubControlForm = getControlFormByName(SOSUBFORM);
+ oSubControlForm.setFormProperties(aFormProperties, oSubFormDBMetaData);
+ String sRefTableName = _curFormConfiguration.getreferencedTableName();
+ if (sRefTableName.equals(""))
+ {
+ LinkFieldNames = _curFieldLinker.getLinkFieldNames();
+ }
+ else
+ {
+ LinkFieldNames = _curFieldLinker.getLinkFieldNames(_curFormConfiguration.getRelationController(), sRefTableName);
+ }
+ if (LinkFieldNames != null)
+ {
+ if (LinkFieldNames.length > 0)
+ {
+ oSubControlForm.xPropertySet.setPropertyValue("DetailFields", LinkFieldNames[0]);
+ oSubControlForm.xPropertySet.setPropertyValue("MasterFields", LinkFieldNames[1]);
+ oSubControlForm.finalizeControls();
+ return true;
+ }
+ }
+ return false;
+ }
+ return true;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ return false;
+ }
+ finally
+ {
+ unlockallControllers();
+ }
+ }
+
+ public class ControlForm
+ {
+
+ XNameContainer xFormContainer;
+ GridControl oGridControl;
+ FormControlArranger oFormController;
+ int curArrangement;
+ FormDocument oFormDocument;
+ String Name;
+ Point aStartPoint;
+ private Size aFormSize;
+ CommandMetaData oDBMetaData;
+ XPropertySet xPropertySet;
+
+ public ControlForm(FormDocument _oFormDocument, String _sname, Point _astartPoint, Size _aFormSize)
+ {
+ aStartPoint = _astartPoint;
+ aFormSize = _aFormSize;
+ oFormDocument = _oFormDocument;
+ Name = _sname;
+ if (_sname.equals(SOSUBFORM))
+ {
+ ControlForm oMainControlForm = ((ControlForm) oControlForms.get(0));
+ xFormContainer = oFormHandler.insertFormbyName(_sname, oMainControlForm.xFormContainer);
+ }
+ else
+ {
+ xFormContainer = oFormHandler.insertFormbyName(_sname);
+ }
+ xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xFormContainer);
+ if (_sname.equals(SOMAINFORM))
+ {
+ oDBMetaData = oFormDocument.oMainFormDBMetaData;
+ }
+ else
+ {
+ oDBMetaData = oFormDocument.oSubFormDBMetaData;
+ }
+ }
+
+ public void initialize(int _curArrangement, Short _NBorderType)
+ {
+ boolean badaptControlStyles = false;
+ xTextDocument.lockControllers();
+ curArrangement = _curArrangement;
+ if (oGridControl != null)
+ {
+ oFormHandler.xDrawPage.remove(oGridControl.xShape);
+ oGridControl.xComponent.dispose();
+ oGridControl = null;
+ }
+ if (oFormController == null)
+ {
+ oFormController = new FormControlArranger(oFormHandler, xFormContainer, oDBMetaData, xProgressBar, aStartPoint, aFormSize);
+ }
+ else
+ {
+ if (curArrangement == FormWizard.SOGRID)
+ {
+ oFormHandler.moveShapesToNirwana(getLabelControls());
+ oFormHandler.moveShapesToNirwana(getDatabaseControls());
+ }
+ }
+ if (curArrangement == FormWizard.SOGRID)
+ {
+ insertGridControl(_NBorderType);
+ badaptControlStyles = true;
+ }
+ else
+ {
+ badaptControlStyles = !oFormController.areControlsexisting();
+ oFormController.positionControls(_curArrangement, aStartPoint, getAvailableFormSize(), curUIControlArranger.getAlignValue(), _NBorderType);
+ }
+ if (badaptControlStyles)
+ {
+ curStyleApplier.applyStyle(false, true);
+ }
+ if ((Name.equals(SOMAINFORM)) && (oControlForms.size() > 1))
+ {
+ ControlForm curSubControlForm = ((ControlForm) oControlForms.get(1));
+ if (curSubControlForm != null)
+ {
+ adjustSubFormPosSize(_NBorderType);
+ }
+ }
+ setFormSize(new Size(aFormSize.Width, getActualFormHeight()));
+ unlockallControllers();
+ }
+
+ public Control[] getLabelControls()
+ {
+ if (oFormController != null)
+ {
+ return oFormController.getLabelControlList();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public Size getFormSize()
+ {
+ 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;
+ oFormController.setFormSize(aFormSize);
+ }
+
+ private void setStartPoint(Point _aPoint)
+ {
+ aStartPoint = _aPoint;
+ if (oFormController != null)
+ {
+ oFormController.setStartPoint(_aPoint);
+ }
+ }
+
+ private int getActualFormHeight()
+ {
+ if (curArrangement == FormWizard.SOGRID)
+ {
+ return oGridControl.xShape.getSize().Height;
+ }
+ else
+ {
+ return oFormController.getFormHeight();
+ }
+ }
+
+ private int getEntryPointY()
+ {
+ if (curArrangement == FormWizard.SOGRID)
+ {
+ return oGridControl.xShape.getPosition().Y;
+ }
+ else
+ {
+ return oFormController.getEntryPointY();
+ }
+ }
+
+ private void setFormProperties(PropertyValue[] _aPropertySetList, CommandMetaData _oDBMetaData)
+ {
+ try
+ {
+ xPropertySet.setPropertyValue("DataSourceName", getDataSourceName());
+ xPropertySet.setPropertyValue("Command", _oDBMetaData.getCommandName());
+ xPropertySet.setPropertyValue("CommandType", new Integer(_oDBMetaData.getCommandType()));
+ for (int i = 0; i < _aPropertySetList.length; i++)
+ {
+ xPropertySet.setPropertyValue(_aPropertySetList[i].Name, _aPropertySetList[i].Value);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public DatabaseControl[] getDatabaseControls()
+ {
+ if (oFormController != null)
+ {
+ return oFormController.DBControlList;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public GridControl getGridControl()
+ {
+ return oGridControl;
+ }
+
+ public int getArrangemode()
+ {
+ return curArrangement;
+ }
+
+ private void insertGridControl(Short _NBorderType)
+ {
+ try
+ {
+ curArrangement = FormWizard.SOGRID;
+ if (Name.equals(SOMAINFORM))
+ {
+ oGridControl = new GridControl(xMSF, Name + "_Grid", oFormHandler, xFormContainer, oDBMetaData.FieldColumns, aStartPoint, getMainFormSize(FormWizard.SOGRID));
+ }
+ else
+ {
+ oGridControl = new GridControl(xMSF, Name + "_Grid", oFormHandler, xFormContainer, oDBMetaData.FieldColumns, aStartPoint, getSubFormSize());
+ }
+ oGridControl.xPropertySet.setPropertyValue("Border", _NBorderType);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public void finalizeControls()
+ {
+ Control[] oLabelControls = getLabelControls();
+ Control[] oDBControls = getDatabaseControls();
+ if (oLabelControls != null)
+ {
+ for (int i = 0; i < getLabelControls().length; i++)
+ {
+ if (curArrangement == FormWizard.SOGRID)
+ {
+ if ((oLabelControls[i] != null) && (oDBControls[i] != null))
+ {
+ oFormHandler.removeShape(oLabelControls[i].xShape);
+ oFormHandler.removeShape(oDBControls[i].xShape);
+ }
+ }
+ else
+ {
+ oFormHandler.groupShapesTogether(xMSF, oLabelControls[i].xShape, oDBControls[i].xShape);
+ }
+
+ }
+ }
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/form/FormWizard.java b/wizards/com/sun/star/wizards/form/FormWizard.java
new file mode 100644
index 000000000000..f75f3e1b84ab
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/FormWizard.java
@@ -0,0 +1,482 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.wizards.form;
+
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XComponent;
+import com.sun.star.sdb.application.DatabaseObject;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.PropertyNames;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.NoValidPathException;
+import com.sun.star.wizards.common.Properties;
+import com.sun.star.wizards.db.DatabaseObjectWizard;
+import com.sun.star.wizards.db.RelationController;
+import com.sun.star.wizards.document.OfficeDocument;
+import com.sun.star.wizards.ui.CommandFieldSelection;
+import com.sun.star.wizards.ui.UIConsts;
+
+public class FormWizard extends DatabaseObjectWizard
+{
+
+ private CommandFieldSelection curDBCommandFieldSelection;
+ private FormConfiguration curFormConfiguration;
+ private CommandFieldSelection curSubFormFieldSelection;
+ private FormDocument curFormDocument;
+ private FieldLinker curFieldLinker;
+ private UIControlArranger curControlArranger;
+ private DataEntrySetter CurDataEntrySetter;
+ private StyleApplier curStyleApplier;
+ private Finalizer curFinalizer;
+ private static String slblFields;
+ private static String slblSelFields;
+ private String sShowBinaryFields = "";
+ private String serrFormNameexists = "";
+ 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;
+ public static final int SOCONTROL_PAGE = 5;
+ public static final int SODATA_PAGE = 6;
+ public static final int SOSTYLE_PAGE = 7;
+ public static final int SOSTORE_PAGE = 8;
+ public static final int SOCOLUMNARLEFT = 1;
+ public static final int SOCOLUMNARTOP = 2;
+ public static final int SOGRID = 3;
+ public static final int SOTOPJUSTIFIED = 4;
+ private String slblTables;
+ private boolean m_openForEditing;
+ private boolean m_success = false;
+ private String FormName;
+
+ public FormWizard( XMultiServiceFactory i_servicFactory, final PropertyValue[] i_wizardContext )
+ {
+ super( i_servicFactory, 34400, i_wizardContext );
+ super.addResourceHandler("FormWizard", "dbw");
+ Helper.setUnoPropertyValues(xDialogModel,
+ new String[]
+ {
+ PropertyNames.PROPERTY_HEIGHT, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Title", PropertyNames.PROPERTY_WIDTH
+ },
+ new Object[]
+ {
+ new Integer(210), Boolean.TRUE, "DialogForm", new Integer(102), new Integer(41), new Integer(1), new Short((short) 0), m_oResource.getResText(UIConsts.RID_FORM), new Integer(310)
+ });
+ drawNaviBar();
+ if (getFormResources() == true)
+ {
+ setRightPaneHeaders(m_oResource, UIConsts.RID_FORM + 90, 8);
+ }
+ }
+
+ // @Override
+ protected void enterStep(int nOldStep, int nNewStep)
+ {
+ try
+ {
+ if ((nOldStep < SOCONTROL_PAGE) && (nNewStep >= SOCONTROL_PAGE))
+ {
+ curFormDocument.initialize(curDBCommandFieldSelection.isModified(), curFormConfiguration.hasSubForm(), curSubFormFieldSelection.isModified(), getBorderType());
+ curDBCommandFieldSelection.setModified(false);
+ curSubFormFieldSelection.setModified(false);
+ }
+ switch (nNewStep)
+ {
+ case SOMAIN_PAGE:
+ curDBCommandFieldSelection.setModified(false);
+ break;
+ case SOSUBFORM_PAGE:
+ {
+ final String sCommandName = curDBCommandFieldSelection.getSelectedCommandName();
+ RelationController oRelationController = new RelationController(curFormDocument.oMainFormDBMetaData, sCommandName);
+ curFormConfiguration.initialize(curSubFormFieldSelection, oRelationController);
+ }
+ break;
+ case SOSUBFORMFIELDS_PAGE:
+ {
+ String sPreSelectedTableName = curFormConfiguration.getreferencedTableName();
+ boolean bReadOnly = (sPreSelectedTableName.length() > 0);
+ if (sPreSelectedTableName.length() == 0)
+ {
+ final String sTableName = curSubFormFieldSelection.getSelectedCommandName();
+ String[] aFieldNames = curSubFormFieldSelection.getSelectedFieldNames();
+ curFormDocument.oSubFormDBMetaData.initializeFieldColumns(true, sTableName, aFieldNames);
+ }
+ else
+ {
+ curSubFormFieldSelection.preselectCommand(sPreSelectedTableName, bReadOnly);
+ }
+ }
+ break;
+ case SOFIELDLINKER_PAGE:
+ {
+ final String[] aMainFieldNames = curFormDocument.oMainFormDBMetaData.getFieldNames();
+ final String[] aSubFieldNames = curFormDocument.oSubFormDBMetaData.getFieldNames();
+ curFieldLinker.initialize(aMainFieldNames, aSubFieldNames, curFormDocument.LinkFieldNames);
+ }
+ break;
+ case SOCONTROL_PAGE:
+ curControlArranger.enableSubFormImageList(curFormConfiguration.hasSubForm());
+ break;
+ case SODATA_PAGE:
+ break;
+ case SOSTYLE_PAGE:
+ break;
+ case SOSTORE_PAGE:
+ {
+ String sTableName = this.curDBCommandFieldSelection.getSelectedCommandName();
+ this.curFinalizer.initialize(sTableName, curFormDocument);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ protected Short getBorderType()
+ {
+ return curStyleApplier.getBorderType();
+ }
+
+ // @Override
+ protected void leaveStep(int nOldStep, int nNewStep)
+ {
+ switch (nOldStep)
+ {
+ case SOMAIN_PAGE:
+ {
+ final String sTableName = curDBCommandFieldSelection.getSelectedCommandName();
+ final String[] aFieldNames = curDBCommandFieldSelection.getSelectedFieldNames();
+ curFormDocument.oMainFormDBMetaData.initializeFieldColumns(true, sTableName, aFieldNames);
+
+ final String[] aMainFieldNames = curFormDocument.oMainFormDBMetaData.getFieldNames();
+ try
+ {
+ curFormDocument.LinkFieldNames = JavaTools.removeOutdatedFields(curFormDocument.LinkFieldNames, aMainFieldNames, 1);
+ }
+ catch (java.lang.Exception e)
+ {}
+ }
+ break;
+ case SOSUBFORM_PAGE:
+ break;
+ case SOSUBFORMFIELDS_PAGE:
+ {
+ final String sTableName = curSubFormFieldSelection.getSelectedCommandName();
+ final String[] aFieldNames = curSubFormFieldSelection.getSelectedFieldNames();
+ curFormDocument.oSubFormDBMetaData.initializeFieldColumns(true, sTableName, aFieldNames);
+
+ final String[] aSubFieldNames = curFormDocument.oSubFormDBMetaData.getFieldNames();
+ try
+ {
+ curFormDocument.LinkFieldNames = JavaTools.removeOutdatedFields(curFormDocument.LinkFieldNames, aSubFieldNames, 0);
+ }
+ catch (java.lang.Exception e)
+ {}
+ }
+ break;
+ case SOFIELDLINKER_PAGE:
+ curFormDocument.LinkFieldNames = curFieldLinker.getLinkFieldNames();
+ break;
+ case SOCONTROL_PAGE:
+ break;
+ case SODATA_PAGE:
+ break;
+ case SOSTYLE_PAGE:
+ break;
+ case SOSTORE_PAGE:
+ break;
+ default:
+ break;
+ }
+ }
+
+ public void buildSteps() throws NoValidPathException
+ {
+ curDBCommandFieldSelection = new CommandFieldSelection(this, curFormDocument.oMainFormDBMetaData, 92, slblFields, slblSelFields, slblTables, true, 34411);
+ curDBCommandFieldSelection.addFieldSelectionListener(new FieldSelectionListener());
+ curFormDocument.xProgressBar.setValue(20);
+ // Label Help Text
+ insertLabel("lblBinaryHelpText",
+ new String[]
+ {
+ PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH
+ },
+ new Object[]
+ {
+ new Integer(28), sShowBinaryFields, Boolean.TRUE, new Integer(95), new Integer(154), new Integer(SOMAIN_PAGE), new Integer(210)
+ });
+
+ curFormConfiguration = new FormConfiguration(this);
+ curFormDocument.xProgressBar.setValue(30);
+
+ curSubFormFieldSelection = new CommandFieldSelection(this, curFormDocument.oSubFormDBMetaData, SOSUBFORMFIELDS_PAGE, 92, slblFields, slblSelFields, slblTables, true, 34431);
+ curSubFormFieldSelection.addFieldSelectionListener(new FieldSelectionListener());
+ insertLabel("lblSubFormBinaryHelpText",
+ new String[]
+ {
+ PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH
+ },
+ new Object[]
+ {
+ new Integer(28), sShowBinaryFields, Boolean.TRUE, new Integer(95), new Integer(154), new Integer(SOSUBFORMFIELDS_PAGE), new Integer(210)
+ });
+
+ curFormDocument.xProgressBar.setValue(40);
+
+ curFieldLinker = new FieldLinker(this, SOFIELDLINKER_PAGE, 95, 30, 210, 34441);
+ curFormDocument.xProgressBar.setValue(50);
+
+ curControlArranger = new UIControlArranger(this, curFormDocument);
+ curFormDocument.addUIFormController(curControlArranger);
+ curFormDocument.xProgressBar.setValue(60);
+
+ CurDataEntrySetter = new DataEntrySetter(this);
+ curFormDocument.xProgressBar.setValue(70);
+
+ curStyleApplier = new StyleApplier(this, curFormDocument);
+ curFormDocument.addStyleApplier(curStyleApplier);
+ curFormDocument.xProgressBar.setValue(80);
+
+ curFinalizer = new Finalizer(this);
+ curFormDocument.xProgressBar.setValue(100);
+
+ enableNavigationButtons(false, false, false);
+ curFormDocument.xProgressBar.end();
+ }
+
+ // @Override
+ public boolean finishWizard()
+ {
+ int ncurStep = getCurrentStep();
+ if ((switchToStep(ncurStep, SOSTORE_PAGE)) || (ncurStep == SOSTORE_PAGE))
+ {
+ this.curFinalizer.initialize(curDBCommandFieldSelection.getSelectedCommandName(), this.curFormDocument);
+ String sNewFormName = curFinalizer.getName();
+ if (!curFormDocument.oMainFormDBMetaData.hasFormDocumentByName(sNewFormName))
+ {
+ m_openForEditing = curFinalizer.getOpenForEditing();
+ FormName = curFinalizer.getName();
+ if (curFormDocument.finalizeForms(CurDataEntrySetter, curFieldLinker, curFormConfiguration))
+ {
+
+ if (curFinalizer.finish())
+ {
+ m_success = true;
+ xDialog.endExecute();
+ return true;
+ }
+ }
+ }
+ else
+ {
+ String smessage = JavaTools.replaceSubString(serrFormNameexists, sNewFormName, "%FORMNAME");
+ showMessageBox("WarningBox", com.sun.star.awt.VclWindowPeerAttribute.OK, smessage);
+ }
+ }
+ return false;
+ }
+
+ // @Override
+ public void cancelWizard()
+ {
+ m_success = false;
+ xDialog.endExecute();
+ }
+
+ public void insertFormRelatedSteps()
+ {
+ addRoadmap();
+ int i = 0;
+ i = insertRoadmapItem(0, true, m_oResource.getResText(UIConsts.RID_FORM + 80), SOMAIN_PAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 81), SOSUBFORM_PAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 82), SOSUBFORMFIELDS_PAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 83), SOFIELDLINKER_PAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 84), SOCONTROL_PAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 85), SODATA_PAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 86), SOSTYLE_PAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 87), SOSTORE_PAGE);
+ setRoadmapInteractive(true);
+ setRoadmapComplete(true);
+ setCurrentRoadmapItemID((short) 1);
+ }
+
+ public void startFormWizard()
+ {
+ try
+ {
+ curFormDocument = new FormDocument(xMSF);
+ if ( curFormDocument.oMainFormDBMetaData.getConnection( m_wizardContext ) )
+ {
+ curFormDocument.oSubFormDBMetaData.getConnection(new PropertyValue[]
+ {
+ Properties.createProperty("ActiveConnection", curFormDocument.oMainFormDBMetaData.DBConnection)
+ });
+ curFormDocument.xProgressBar.setValue(20);
+ buildSteps();
+ this.curDBCommandFieldSelection.preselectCommand( m_wizardContext, false );
+ XWindowPeer xWindowPeer2 = createWindowPeer(curFormDocument.xWindowPeer);
+ curFormDocument.oMainFormDBMetaData.setWindowPeer( xWindowPeer2 );
+ insertFormRelatedSteps();
+ short dialogReturn = executeDialog(curFormDocument.xFrame);
+ xComponent.dispose();
+ if ( ( dialogReturn == 0 ) && m_success )
+ {
+ curFormDocument.oMainFormDBMetaData.addFormDocument( curFormDocument.xComponent );
+ loadSubComponent( DatabaseObject.FORM, FormName, m_openForEditing );
+ }
+ }
+ }
+ catch (java.lang.Exception jexception)
+ {
+ jexception.printStackTrace(System.out);
+ }
+ if ((!m_success) && (curFormDocument != null))
+ {
+ OfficeDocument.close(curFormDocument.xComponent);
+ }
+ }
+
+ private boolean getFormResources()
+ {
+ sShowBinaryFields = m_oResource.getResText(UIConsts.RID_FORM + 2);
+ slblTables = m_oResource.getResText(UIConsts.RID_FORM + 6);
+ slblFields = m_oResource.getResText(UIConsts.RID_FORM + 12);
+ slblSelFields = m_oResource.getResText(UIConsts.RID_FORM + 1);
+ serrFormNameexists = m_oResource.getResText(UIConsts.RID_FORM + 98);
+
+ return true;
+ }
+
+ public class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener
+ {
+
+ protected int ID;
+
+ // @Override
+ public int getID()
+ {
+ return ID;
+ }
+
+ // @Override
+ public void setID(String sIncSuffix)
+ {
+ ID = 1;
+ if (sIncSuffix != null)
+ {
+ if ((!sIncSuffix.equals("")) && (!sIncSuffix.equals("_")))
+ {
+ String sID = JavaTools.ArrayoutofString(sIncSuffix, "_")[1];
+ ID = Integer.parseInt(sID);
+ int a = 0;
+ }
+ }
+ }
+
+ // @Override
+ public void shiftFromLeftToRight(String[] SelItems, String[] NewItems)
+ {
+ if (ID == 1)
+ {
+ toggleMainFormSteps();
+ }
+ else
+ {
+ toggleSubFormSteps();
+ }
+ }
+
+ // @Override
+ public void shiftFromRightToLeft(String[] SelItems, String[] NewItems)
+ {
+ // TODO When the ListFieldbox is refilled only fields of the current Command may be merged into the Listbox
+ if (ID == 1)
+ {
+ toggleMainFormSteps();
+ }
+ else
+ {
+ toggleSubFormSteps();
+ }
+ }
+ // @Override
+ public void moveItemDown(String item)
+ {
+ }
+
+ // @Override
+ public void moveItemUp(String item)
+ {
+ }
+
+ private boolean toggleSubFormSteps()
+ {
+ curSubFormFieldSelection.setModified(true);
+ boolean benable = curSubFormFieldSelection.getSelectedFieldNames().length > 0;
+ enablefromStep(SOFIELDLINKER_PAGE, benable);
+ if (benable)
+ {
+ curFieldLinker.enable(!curFormConfiguration.areexistingRelationsdefined());
+ }
+ return benable;
+ }
+
+ private void toggleMainFormSteps()
+ {
+ curDBCommandFieldSelection.setModified(true);
+ boolean benable = curDBCommandFieldSelection.getSelectedFieldNames().length > 0;
+ enablefromStep(SOSUBFORM_PAGE, benable);
+ setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, new Boolean(benable));
+ if (benable)
+ {
+ if (curFormConfiguration.hasSubForm())
+ {
+ benable = toggleSubFormSteps();
+ }
+ else
+ {
+ setStepEnabled(SOSUBFORMFIELDS_PAGE, false);
+ setStepEnabled(SOFIELDLINKER_PAGE, false);
+ }
+ }
+ setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, new Boolean(benable));
+ }
+ }
+}
+
+
+
+
+
diff --git a/wizards/com/sun/star/wizards/form/MANIFEST.MF b/wizards/com/sun/star/wizards/form/MANIFEST.MF
new file mode 100644
index 000000000000..af4c0a07d529
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/MANIFEST.MF
@@ -0,0 +1,2 @@
+RegistrationClassName: com.sun.star.wizards.form.CallFormWizard
+UNO-Type-Path:
diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java
new file mode 100644
index 000000000000..5098a1ffbb74
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/StyleApplier.java
@@ -0,0 +1,495 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.wizards.form;
+
+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;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.wizards.common.Configuration;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+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.*;
+import com.sun.star.wizards.ui.UIConsts;
+import java.util.ArrayList;
+
+// TODO: Style Templates fuer OOo?
+
+public class StyleApplier
+{
+
+ private WizardDialog CurUnoDialog;
+ private XPropertySet xPageStylePropertySet;
+ private XMultiServiceFactory xMSF;
+ private short curtabindex;
+ private XRadioButton optNoBorder;
+ private XRadioButton opt3DLook;
+ private XRadioButton optFlat;
+ private XListBox lstStyles;
+ private Desktop.OfficePathRetriever curofficepath;// String[][] sLayoutFiles;
+ private FormDocument curFormDocument;
+ private short iOldLayoutPos;
+ private int SOLAYOUTLST = 0;
+ private static final String SCHANGELAYOUT = "changeLayout";
+ private static final String SCHANGEBORDERTYPE = "changeBorderLayouts";
+ private String[] StyleNames;
+ private String[] StyleNodeNames;
+ private String[] FileNames;
+ // private String StylesPath;
+ private final static int SOBACKGROUNDCOLOR = 0;
+ private final static int SODBTEXTCOLOR = 1;
+ private final static int SOLABELTEXTCOLOR = 2;
+// final static int SODBCONTROLBACKGROUNDCOLOR = 3;
+ private final static int SOLABELBACKGROUNDCOLOR = 4;
+ private final static int SOBORDERCOLOR = 5;
+ private Short IBorderValue = new Short((short) 1);
+
+ public StyleApplier(WizardDialog _CurUnoDialog, FormDocument _curFormDocument) throws NoValidPathException
+ {
+// try
+// {
+ this.curFormDocument = _curFormDocument;
+ xMSF = curFormDocument.xMSF;
+
+ TextStyleHandler oTextStyleHandler = new TextStyleHandler(xMSF, curFormDocument.xTextDocument);
+ xPageStylePropertySet = oTextStyleHandler.getStyleByName("PageStyles", "Standard");
+ this.CurUnoDialog = _CurUnoDialog;
+ curtabindex = (short) (FormWizard.SOSTYLE_PAGE * 100);
+ 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);
+ String sFlat = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 31);
+ String sFieldBorder = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 28);
+// XInterface xUcbInterface = (XInterface) _curFormDocument.xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
+ setStyles();
+ short[] SelLayoutPos;
+ SelLayoutPos = new short[]
+ {
+ 0
+ };
+
+ CurUnoDialog.insertLabel("lblStyles",
+ new String[]
+ {
+ 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[]
+ {
+ UIConsts.INTEGERS[8], sPageStyles, new Integer(92), new Integer(25), IStyleStep, new Short(curtabindex++), new Integer(90)
+ });
+
+ lstStyles = CurUnoDialog.insertListBox("lstStyles", null, SCHANGELAYOUT, this,
+ new String[]
+ {
+ PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "SelectedItems", PropertyNames.PROPERTY_STEP, "StringItemList", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ },
+ new Object[]
+ {
+ new Integer(143), "HID:WIZARDS_HID_DLGFORM_LSTSTYLES", new Integer(92), new Integer(35), SelLayoutPos, IStyleStep, this.StyleNames, new Short(curtabindex++), new Integer(90)
+ });
+
+ optNoBorder = CurUnoDialog.insertRadioButton("otpNoBorder", SCHANGEBORDERTYPE, this,
+ 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, "Tag", PropertyNames.PROPERTY_WIDTH
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDNOBORDER", sNoBorder, new Integer(196), new Integer(39), IStyleStep, new Short(curtabindex++), "0", new Integer(93)
+ });
+
+ opt3DLook = CurUnoDialog.insertRadioButton("otp3DLook", SCHANGEBORDERTYPE, this,
+ 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, "Tag", PropertyNames.PROPERTY_WIDTH
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMD3DBORDER", s3DLook, new Integer(196), new Integer(53), new Short((short) 1), IStyleStep, new Short(curtabindex++), "1", new Integer(93)
+ });
+
+ optFlat = CurUnoDialog.insertRadioButton("otpFlat", SCHANGEBORDERTYPE, this,
+ 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, "Tag", PropertyNames.PROPERTY_WIDTH
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDSIMPLEBORDER", sFlat, new Integer(196), new Integer(67), IStyleStep, new Short(curtabindex++), "2", new Integer(93)
+ });
+
+ CurUnoDialog.insertFixedLine("lnFieldBorder",
+ new String[]
+ {
+ 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[]
+ {
+ UIConsts.INTEGERS[8], sFieldBorder, new Integer(192), new Integer(25), IStyleStep, new Short(curtabindex++), new Integer(98)
+ });
+// }
+// catch (Exception e)
+// {
+// e.printStackTrace(System.out);
+// }
+ }
+
+ /* public void initialize(short _iStyleindex){
+ if (_iStyleindex < lstStyles.getItemCount()){
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstStyles), "SelectedItems", new short[]{_iStyleindex});
+ applyStyle(true, false);
+ }
+ }
+ */
+ private void setStyles()
+ {
+ try
+ {
+ Object oRootNode = Configuration.getConfigurationRoot(xMSF, "org.openoffice.Office.FormWizard/FormWizard/Styles", false);
+ XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oRootNode);
+ StyleNodeNames = xNameAccess.getElementNames();
+ StyleNames = new String[StyleNodeNames.length];
+ FileNames = new String[StyleNodeNames.length];
+ for (int i = 0; i < StyleNodeNames.length; i++)
+ {
+ Object oStyleNode = xNameAccess.getByName(StyleNodeNames[i]);
+ StyleNames[i] = (String) Helper.getUnoPropertyValue(oStyleNode, PropertyNames.PROPERTY_NAME);
+ FileNames[i] = (String) Helper.getUnoPropertyValue(oStyleNode, "CssHref");
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ private short getStyleIndex()
+ {
+ try
+ {
+ short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(lstStyles), "SelectedItems"));
+ if (SelFields != null)
+ {
+ return SelFields[0];
+ }
+ }
+ catch (IllegalArgumentException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return (short) -1;
+ }
+
+ public void applyStyle(boolean _bmodifyBackground, boolean _bapplyalways)
+ {
+ short iStyle = getStyleIndex();
+ if ((iStyle != iOldLayoutPos) || _bapplyalways)
+ {
+ if (iStyle > -1)
+ {
+ iOldLayoutPos = iStyle;
+ String sFileName = FileNames[iStyle]; //Style = lstStyles.getSelectedItem();
+ int[] iStyles = getStyleColors(sFileName);
+ applyDBControlProperties(iStyles);
+ }
+ }
+ }
+
+ public void changeLayout()
+ {
+ short iPos = lstStyles.getSelectedItemPos();
+ if (iPos != iOldLayoutPos)
+ {
+ iOldLayoutPos = iPos;
+ String sFileName = FileNames[iPos]; //Style = lstStyles.getSelectedItem();
+ int[] iStyles = getStyleColors(sFileName);
+ applyDBControlProperties(iStyles);
+ }
+ curFormDocument.unlockallControllers();
+ }
+
+ /* public void changeLayout(){
+ / curFormDocument.xTextDocument.lockControllers();
+ applyStyle(true, false);
+ 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 = ((FormDocument.ControlForm) curFormDocument.oControlForms.get(m));
+ if (curControlForm.getArrangemode() == FormWizard.SOGRID)
+ {
+ GridControl oGridControl = curControlForm.getGridControl();
+ oGridControl.xPropertySet.setPropertyValue("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("Border"))
+ {
+ xPropertySet.setPropertyValue("Border", IBorderValue);
+ }
+ }
+ }
+ else
+ {
+ if (DBControls[n].xPropertySet.getPropertySetInfo().hasPropertyByName("Border"))
+ {
+ DBControls[n].xPropertySet.setPropertyValue("Border", IBorderValue);
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ curFormDocument.unlockallControllers();
+ }
+
+ public void disposing(EventObject eventObject)
+ {
+ }
+
+ private int getStyleColor(String[] _sDataList, String _sHeader, String _sPropertyDescription)
+ {
+ int iColor = -1;
+ int index = JavaTools.FieldInList(_sDataList, _sHeader);
+ if (index > -1)
+ {
+ String sPropName = "";
+ int iStyleColor;
+ while (((sPropName.indexOf("}") < 0) && (index < _sDataList.length - 1)))
+ {
+ String scurline = _sDataList[index++];
+ if ((scurline.indexOf(_sPropertyDescription)) > 0)
+ {
+ if (scurline.indexOf(":") > 0)
+ {
+ String[] sPropList = JavaTools.ArrayoutofString(scurline, ":");
+ String sPropValue = sPropList[1];
+ sPropValue = sPropValue.trim();
+ if (sPropValue.indexOf("#") > 0)
+ {
+ sPropValue = JavaTools.replaceSubString(sPropValue, "", ";");
+ sPropValue = JavaTools.replaceSubString(sPropValue, "", " ");
+ return Integer.decode(sPropValue).intValue();
+ }
+ }
+ }
+ }
+ }
+ return -1;
+ }
+
+ private XMultiServiceFactory getMSF()
+ {
+ return xMSF;
+ }
+
+ private ArrayList<String> getStylePaths()
+ {
+ ArrayList<String> aStylePaths = new ArrayList<String>();
+ try
+ {
+ // TODO: check different languages in header layouts
+ aStylePaths = FileAccess.getOfficePaths(getMSF(), "Config", "", "");
+ FileAccess.combinePaths(getMSF(), aStylePaths, "/wizard/form/styles");
+
+ String[][] LayoutFiles = FileAccess.getFolderTitles(getMSF(), null, aStylePaths, ".css");
+
+ }
+ catch (com.sun.star.wizards.common.NoValidPathException e)
+ {
+ // if there are problems, don't show anything is a little bit hard.
+ aStylePaths.add("default");
+ }
+ return aStylePaths;
+ }
+
+ private String getStylePath()
+ {
+// TODO: umstellen auf mehrere Pfade
+ String StylesPath = "";
+ try
+ {
+ StylesPath = FileAccess.getOfficePath(xMSF, "Config", "", "");
+ StylesPath = FileAccess.combinePaths(xMSF, StylesPath, "/wizard/form/styles");
+ }
+ catch (NoValidPathException e)
+ {
+ }
+ return StylesPath;
+ }
+
+ private int[] getStyleColors(String _filename)
+ {
+ String sFilePath = getStylePath() + "/" + _filename;
+ int[] oStylePropList = new int[6];
+ String[] sData = FileAccess.getDataFromTextFile(xMSF, sFilePath);
+ oStylePropList[SOBACKGROUNDCOLOR] = getStyleColor(sData, ".toctitle {", "background-color:");
+ oStylePropList[SODBTEXTCOLOR] = getStyleColor(sData, ".doctitle {", "color:");
+ oStylePropList[SOLABELTEXTCOLOR] = getStyleColor(sData, ".toctitle {", "color:");
+// oStylePropList[SODBCONTROLBACKGROUNDCOLOR] = getStyleColor(sData, "body {", "background-color:");
+// oStylePropList[SOLABELBACKGROUNDCOLOR] = getStyleColor(sData, ".toctitle {", "background-color:");
+ oStylePropList[SOBORDERCOLOR] = getStyleColor(sData, ".tcolor {", "border-color:");
+ return oStylePropList;
+ }
+
+ private void setDBControlColors(XPropertySet xPropertySet, int[] _iStyleColors)
+ {
+ try
+ {
+ if (xPropertySet.getPropertySetInfo().hasPropertyByName("TextColor"))
+ {
+ if (_iStyleColors[SODBTEXTCOLOR] > -1)
+ {
+ xPropertySet.setPropertyValue("TextColor", Integer.decode("#00000"));
+ }
+ }
+ if (xPropertySet.getPropertySetInfo().hasPropertyByName("BackgroundColor"))
+ {
+ xPropertySet.setPropertyValue("BackgroundColor", Integer.decode("#DDDDDD"));
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public void applyDBControlProperties(int[] _iStyleColors)
+ {
+ try
+ {
+ for (int m = 0; m < curFormDocument.oControlForms.size(); m++)
+ {
+ FormDocument.ControlForm curControlForm = ((FormDocument.ControlForm) curFormDocument.oControlForms.get(m));
+ if (curControlForm.getArrangemode() == FormWizard.SOGRID)
+ {
+ if (_iStyleColors[SOLABELTEXTCOLOR] > -1)
+ {
+ curControlForm.oGridControl.xPropertySet.setPropertyValue("TextColor", new Integer(_iStyleColors[SODBTEXTCOLOR]));
+ }
+ curControlForm.oGridControl.xPropertySet.setPropertyValue("BackgroundColor", Integer.decode("#DDDDDD"));
+ }
+ else
+ {
+ DatabaseControl[] DBControls = curControlForm.getDatabaseControls();
+ for (int n = 0; n < DBControls.length; n++)
+ {
+ if (_iStyleColors[SODBTEXTCOLOR] > -1)
+ {
+ DatabaseControl aDBControl = DBControls[n];
+ if (aDBControl != null)
+ {
+ if (aDBControl.xServiceInfo.supportsService("com.sun.star.drawing.ShapeCollection"))
+ {
+ TimeStampControl oTimeStampControl = (TimeStampControl) aDBControl;
+ for (int i = 0; i < 2; i++)
+ {
+ XPropertySet xPropertySet = oTimeStampControl.getControlofGroupShapeByIndex(i);
+ setDBControlColors(xPropertySet, _iStyleColors);
+ }
+ }
+ else
+ {
+ setDBControlColors(aDBControl.xPropertySet, _iStyleColors);
+ }
+ }
+ }
+ }
+ Control[] LabelControls = curControlForm.getLabelControls();
+ for (int n = 0; n < LabelControls.length; n++)
+ {
+ if (_iStyleColors[SOLABELTEXTCOLOR] > -1)
+ {
+ LabelControls[n].xPropertySet.setPropertyValue("TextColor", new Integer(_iStyleColors[SOLABELTEXTCOLOR]));
+// if (_iStyleColors[SOCONTROLBACKGROUNDCOLOR] > -1)
+// LabelControls[n].xPropertySet.setPropertyValue("BackgroundColor", new Integer(_iStyleColors[SOCONTROLBACKGROUNDCOLOR]));
+ }
+ }
+ }
+ }
+ xPageStylePropertySet.setPropertyValue("BackColor", new Integer(_iStyleColors[SOBACKGROUNDCOLOR]));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/form/UIControlArranger.java b/wizards/com/sun/star/wizards/form/UIControlArranger.java
new file mode 100644
index 000000000000..d4cd1ccc7cb6
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/UIControlArranger.java
@@ -0,0 +1,505 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package com.sun.star.wizards.form;
+
+import com.sun.star.awt.ItemEvent;
+
+import com.sun.star.awt.Size;
+import com.sun.star.awt.XControl;
+import com.sun.star.awt.XItemListener;
+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.common.NoValidPathException;
+import com.sun.star.wizards.document.Control;
+// import com.sun.star.wizards.ui.ImageList;
+import com.sun.star.wizards.ui.ButtonList;
+import com.sun.star.wizards.ui.UIConsts;
+import com.sun.star.wizards.ui.UnoDialog;
+
+import javax.swing.DefaultListModel;
+import javax.swing.ListModel;
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
+
+public class UIControlArranger
+{
+
+ private FormWizard CurUnoDialog;
+ private FormDocument curFormDocument;
+ private short curtabindex;
+ private XRadioButton optAlignLeft;
+ private XRadioButton optAlignRight;
+ private XControl flnLabelPlacement;
+ private String[] HelpTexts = new String[4];
+ // private String[] sArrangementHeader = new String[2];
+ // private ArrangeImageList[] m_aArrangeList = new ArrangeImageList[2];
+ private ArrangeButtonList[] m_aArrangeList = new ArrangeButtonList[2];
+ private Integer IControlStep;
+ private final int SOBASEIMAGEYPOSITION = 66;
+ private final int SOIMAGELISTHEIGHT = 60;
+ private final String SOALIGNMETHOD = "alignLabelControls";
+
+ public UIControlArranger(FormWizard _CurUnoDialog, FormDocument _curFormDocument) throws NoValidPathException
+ {
+ this.CurUnoDialog = _CurUnoDialog;
+ this.curFormDocument = _curFormDocument;
+ curtabindex = (short) (FormWizard.SOCONTROL_PAGE * 100);
+ 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);
+
+ // Label "Label Placement" -----------------
+ flnLabelPlacement = CurUnoDialog.insertFixedLine("lnLabelPlacement",
+ new String[]
+ {
+ 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[]
+ {
+ UIConsts.INTEGERS[8], sLabelPlacment, new Integer(97), new Integer(25), IControlStep, new Short(curtabindex++), new Integer(207)
+ });
+ // Radio Button "Align Left"
+ optAlignLeft = CurUnoDialog.insertRadioButton("optAlignLeft", SOALIGNMETHOD, this,
+ 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[]
+ {
+ UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDALIGNLEFT", sAlignLeft, new Integer(107), new Integer(38), new Short((short) 1), IControlStep, new Short(curtabindex++), new Integer(171)
+ });
+ // Radio Button "Align Right"
+ optAlignRight = CurUnoDialog.insertRadioButton("optAlignRight", SOALIGNMETHOD, this,
+ 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[]
+ {
+ UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDALIGNRIGHT", sAlignRight, Boolean.TRUE, new Integer(107), new Integer(50), IControlStep, new Short(curtabindex++), new Integer(171)
+ });
+
+
+ HelpTexts[0] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 36); // "Columnar - Labels Left"
+ HelpTexts[1] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 37); // "Columnar - Labels of Top"
+ HelpTexts[2] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40); // "As Data Sheet"
+ HelpTexts[3] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 39); // In Blocks - Labels Above"
+
+// flnLabelPlacement = CurUnoDialog.insertFixedLine("lnArrangementHeader1",
+// new String[]
+// {
+// 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[]
+// {
+// UIConsts.INTEGERS[8], sArrangementHeader[0], new Integer(97), new Integer(60), IControlStep, new Short(curtabindex++), new Integer(207)
+// });
+//
+// boolean bEnabled = true;
+// int nBtnWidth = 16;
+// int nXPos = 97;
+// int nYPos = 70;
+// CurUnoDialog.insertButton("btnLayout1", "btnLayout1",
+// 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(bEnabled),
+// new Integer(14),
+///* TODO: WRONG!*/ "HID:WIZARDS_HID_DLGFORM_CMDALIGNRIGHT",
+// "1",
+// new Integer(nXPos + nBtnWidth),
+// new Integer(nYPos),
+// IControlStep,
+// new Short(curtabindex++),
+// new Integer(16)
+// });
+
+ DefaultListModel imageModel = new DefaultListModel();
+ for (int i = 0; i < HelpTexts.length; 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);
+
+ String sSubArrangementHeader = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 42); // "Arrangement of the sub form"
+ m_aArrangeList[1] = new ArrangeButtonList(1, imageModel, sSubArrangementHeader);
+ enableAlignControlGroup(false);
+ }
+
+ public int getSelectedArrangement(int _formindex)
+ {
+ return m_aArrangeList[_formindex].m_aButtonList.getSelected() + 1;
+ }
+
+ private class LayoutRenderer implements ButtonList.IImageRenderer
+ {
+ int Index = 1;
+
+ public Object[] getImageUrls(Object listitem)
+ {
+
+ int ResId = UIConsts.RID_IMG_FORM + (2 * ((Integer) listitem).intValue());
+ Index++;
+ return new Integer[]
+ {
+ new Integer(ResId), new Integer(ResId + 1)
+ };
+// String s = CurUnoDialog.getWizardImageUrl(ResId, ResId + 1); //((Integer)listitem).intValue(), )sBitmapPath + "/Arrange_" + (((Integer)listitem).intValue() + 1) + ".gif";
+// return s;
+ }
+
+ public String render(Object listItem)
+ {
+ if (listItem == null)
+ {
+ return "";
+ }
+ return HelpTexts[((Integer) listItem).intValue()];
+
+ }
+ }
+
+ public void enableSubFormImageList(boolean _bdoEnable)
+ {
+ m_aArrangeList[1].m_aButtonList.setenabled(_bdoEnable);
+ CurUnoDialog.setControlProperty("lnLabelPlacment_2", PropertyNames.PROPERTY_ENABLED, new Boolean(_bdoEnable));
+ }
+
+ public short getAlignValue()
+ {
+ Short IAlignValue = null;
+ if (optAlignLeft.getState())
+ {
+ IAlignValue = new Short((short) 0);
+ }
+ else
+ {
+ IAlignValue = new Short((short) 2);
+ }
+ return IAlignValue.shortValue();
+ }
+
+ public void alignLabelControls()
+ {
+ try
+ {
+ short iAlignValue = getAlignValue();
+ for (int m = 0; m < curFormDocument.oControlForms.size(); m++)
+ {
+ FormDocument.ControlForm curControlForm = (FormDocument.ControlForm) curFormDocument.oControlForms.get(m);
+ if (curControlForm.getArrangemode() == FormWizard.SOCOLUMNARLEFT)
+ {
+ Control[] LabelControls = curControlForm.getLabelControls();
+ for (int n = 0; n < LabelControls.length; n++)
+ {
+ LabelControls[n].xPropertySet.setPropertyValue("Align", new Short(iAlignValue));
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ private void enableAlignControlGroup(boolean _bEnableAlignControlGroup)
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(flnLabelPlacement), PropertyNames.PROPERTY_ENABLED, new Boolean(_bEnableAlignControlGroup));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(optAlignLeft), PropertyNames.PROPERTY_ENABLED, new Boolean(_bEnableAlignControlGroup));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(optAlignRight), PropertyNames.PROPERTY_ENABLED, new Boolean(_bEnableAlignControlGroup));
+ }
+
+// private class ArrangeImageList implements XItemListener
+// {
+//
+// private int formindex;
+// private ImageList m_aButtonList = null; // new ImageList();
+//
+// public ArrangeImageList(int _formindex, ListModel model, String _sArrangementHeader)
+// {
+// formindex = _formindex;
+// Integer YPos = new Integer(SOBASEIMAGEYPOSITION + _formindex * SOIMAGELISTHEIGHT);
+// // Label ArrangementHeader ----------------------
+// CurUnoDialog.insertFixedLine("lnLabelPlacment_" + (_formindex + 1),
+// new String[]
+// {
+// 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[]
+// {
+// UIConsts.INTEGERS[8], _sArrangementHeader, new Integer(97), YPos, IControlStep, new Short(curtabindex++), new Integer(207)
+// });
+//
+// int nypos = SOBASEIMAGEYPOSITION + 12 + _formindex * SOIMAGELISTHEIGHT;
+// m_aButtonList = new ImageList();
+// m_aButtonList.setPos(new Size(107, nypos));
+// m_aButtonList.setImageSize(new Size(26, 26));
+// m_aButtonList.setCols(4);
+// m_aButtonList.setRows(1);
+// m_aButtonList.m_aControlName = "ImageList_" + formindex;
+// m_aButtonList.setStep(new Short((short) FormWizard.SOCONTROL_PAGE));
+// m_aButtonList.setShowButtons(false);
+// m_aButtonList.setRenderer(new LayoutRenderer());
+// m_aButtonList.setSelectionGap(new Size(2, 2));
+// m_aButtonList.setGap(new Size(3, 3));
+// m_aButtonList.scaleImages = Boolean.FALSE;
+// m_aButtonList.tabIndex = (int) curtabindex++;
+// m_aButtonList.helpURL = 34453 + (formindex * 4);
+//
+// m_aButtonList.setListModel(model);
+// m_aButtonList.create(CurUnoDialog);
+// m_aButtonList.setSelected(FormWizard.SOGRID - 1);
+// m_aButtonList.addItemListener(this);
+// }
+//
+// public void setToLeftAlign()
+// {
+// Helper.setUnoPropertyValue(UnoDialog.getModel(optAlignLeft), PropertyNames.PROPERTY_STATE, new Short((short) 1));
+// }
+//
+// /* (non-Javadoc)
+// * @see javax.swing.ListModel#addListDataListener(javax.swing.event.ListDataListener)
+// */
+// public void addListDataListener(ListDataListener arg0)
+// {
+// // TODO Auto-generated method stub
+// }
+//
+// public void itemStateChanged(ItemEvent arg0)
+// {
+// try
+// {
+// if (m_aArrangeList[formindex].m_aButtonList.isenabled())
+// {
+// boolean bEnableAlignControlGroup;
+// if (curFormDocument.oControlForms.size() == 2)
+// {
+// final int nSelected0 = (m_aArrangeList[0].m_aButtonList.getSelected() + 1);
+// final int nSelected1 = (m_aArrangeList[1].m_aButtonList.getSelected() + 1);
+//
+// bEnableAlignControlGroup = ((nSelected0 == FormWizard.SOCOLUMNARLEFT) ||
+// (nSelected1 == FormWizard.SOCOLUMNARLEFT));
+// }
+// else
+// {
+// final int nSelected0 = (m_aArrangeList[0].m_aButtonList.getSelected() + 1);
+// bEnableAlignControlGroup = (nSelected0 == FormWizard.SOCOLUMNARLEFT);
+// }
+// enableAlignControlGroup(bEnableAlignControlGroup);
+// final Short nBorderType = CurUnoDialog.getBorderType();
+// final int nSelected = m_aButtonList.getSelected() + 1;
+// ((FormDocument.ControlForm) curFormDocument.oControlForms.get(formindex)).initialize(nSelected, nBorderType);
+// }
+// }
+// catch (RuntimeException e)
+// {
+// e.printStackTrace();
+// }
+// }
+//
+// /* (non-Javadoc)
+// * @see javax.swing.event.ListDataListener#contentsChanged(javax.swing.event.ListDataEvent)
+// */
+// public void contentsChanged(ListDataEvent arg0)
+// {
+// // TODO Auto-generated method stub
+// }
+//
+// /* (non-Javadoc)
+// * @see javax.swing.event.ListDataListener#intervalAdded(javax.swing.event.ListDataEvent)
+// */
+// public void intervalAdded(ListDataEvent arg0)
+// {
+// // TODO Auto-generated method stub
+// }
+//
+// /* (non-Javadoc)
+// * @see javax.swing.event.ListDataListener#intervalRemoved(javax.swing.event.ListDataEvent)
+// */
+// public void intervalRemoved(ListDataEvent arg0)
+// {
+// // TODO Auto-generated method stub
+// }
+//
+// /* (non-Javadoc)
+// * @see com.sun.star.lang.XEventListener#disposing(com.sun.star.lang.EventObject)
+// */
+// public void disposing(EventObject arg0)
+// {
+// // TODO Auto-generated method stub
+// }
+// }
+
+ private class ArrangeButtonList implements XItemListener
+ {
+
+ private int formindex;
+ private ButtonList m_aButtonList = null; // new ImageList();
+
+ public ArrangeButtonList(int _formindex, ListModel model, String _sArrangementHeader)
+ {
+ formindex = _formindex;
+ Integer YPos = new Integer(SOBASEIMAGEYPOSITION + _formindex * SOIMAGELISTHEIGHT);
+ // Label ArrangementHeader ----------------------
+ CurUnoDialog.insertFixedLine("lnLabelPlacment_" + (_formindex + 1),
+ new String[]
+ {
+ 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[]
+ {
+ UIConsts.INTEGERS[8],
+ _sArrangementHeader,
+ new Integer(97),
+ YPos,
+ IControlStep,
+ new Short(curtabindex++),
+ new Integer(207)
+ });
+
+ int nypos = SOBASEIMAGEYPOSITION + 12 - 5 + _formindex * SOIMAGELISTHEIGHT;
+ m_aButtonList = new ButtonList();
+ m_aButtonList.setPos(new Size(107, nypos));
+ m_aButtonList.setButtonSize(new Size(26 + 6, 26 + 5));
+ m_aButtonList.setCols(4);
+ m_aButtonList.setRows(1);
+ m_aButtonList.setName( "ButtonList_" + formindex );
+ m_aButtonList.setStep(Short.valueOf((short) FormWizard.SOCONTROL_PAGE));
+ m_aButtonList.setShowButtons(false); // shows a button line at ''wrong'' position like |<| 1..4/4 |>|
+ m_aButtonList.setRenderer(new LayoutRenderer());
+ m_aButtonList.setSelectionGap(new Size(2, 2));
+ m_aButtonList.setGap(new Size(3, 3));
+// m_aButtonList.scaleImages = Boolean.FALSE;
+ m_aButtonList.tabIndex = (int) curtabindex++;
+ m_aButtonList.helpURL = 34453 + (formindex * 4);
+
+ m_aButtonList.setListModel(model);
+ m_aButtonList.create(CurUnoDialog);
+ m_aButtonList.setSelected(FormWizard.SOGRID - 1);
+ m_aButtonList.addItemListener(this);
+ }
+
+ public void setToLeftAlign()
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(optAlignLeft), PropertyNames.PROPERTY_STATE, new Short((short) 1));
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.ListModel#addListDataListener(javax.swing.event.ListDataListener)
+ */
+ public void addListDataListener(ListDataListener arg0)
+ {
+ // TODO Auto-generated method stub
+ }
+
+ public void itemStateChanged(ItemEvent arg0)
+ {
+ try
+ {
+ if (m_aArrangeList[formindex].m_aButtonList.isenabled())
+ {
+ boolean bEnableAlignControlGroup;
+ if (curFormDocument.oControlForms.size() == 2)
+ {
+ final int nSelected0 = (m_aArrangeList[0].m_aButtonList.getSelected() + 1);
+ final int nSelected1 = (m_aArrangeList[1].m_aButtonList.getSelected() + 1);
+
+ bEnableAlignControlGroup = ((nSelected0 == FormWizard.SOCOLUMNARLEFT) ||
+ (nSelected1 == FormWizard.SOCOLUMNARLEFT));
+ }
+ else
+ {
+ final int nSelected0 = (m_aArrangeList[0].m_aButtonList.getSelected() + 1);
+ bEnableAlignControlGroup = (nSelected0 == FormWizard.SOCOLUMNARLEFT);
+ }
+ enableAlignControlGroup(bEnableAlignControlGroup);
+ final Short nBorderType = CurUnoDialog.getBorderType();
+ final int nSelected = m_aButtonList.getSelected() + 1;
+ ((FormDocument.ControlForm) curFormDocument.oControlForms.get(formindex)).initialize(nSelected, nBorderType);
+ }
+ }
+ catch (RuntimeException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.event.ListDataListener#contentsChanged(javax.swing.event.ListDataEvent)
+ */
+ public void contentsChanged(ListDataEvent arg0)
+ {
+ // TODO Auto-generated method stub
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.event.ListDataListener#intervalAdded(javax.swing.event.ListDataEvent)
+ */
+ public void intervalAdded(ListDataEvent arg0)
+ {
+ // TODO Auto-generated method stub
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.event.ListDataListener#intervalRemoved(javax.swing.event.ListDataEvent)
+ */
+ public void intervalRemoved(ListDataEvent arg0)
+ {
+ // TODO Auto-generated method stub
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.star.lang.XEventListener#disposing(com.sun.star.lang.EventObject)
+ */
+ public void disposing(EventObject arg0)
+ {
+ // TODO Auto-generated method stub
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/form/form.component b/wizards/com/sun/star/wizards/form/form.component
new file mode 100644
index 000000000000..3f010d8bc88f
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/form.component
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.Java2"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation
+ name="com.sun.star.wizards.form.CallFormWizard$FormWizardImplementation">
+ <service name="com.sun.star.wizards.form.CallFormWizard"/>
+ </implementation>
+</component>
diff --git a/wizards/com/sun/star/wizards/form/makefile.mk b/wizards/com/sun/star/wizards/form/makefile.mk
new file mode 100644
index 000000000000..abd66032dda2
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/makefile.mk
@@ -0,0 +1,70 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..$/..$/..
+PRJNAME = wizards
+TARGET = form
+PACKAGE = com$/sun$/star$/wizards$/form
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+JARFILES= unoil.jar jurt.jar ridl.jar juh.jar java_uno.jar commonwizards.jar
+CUSTOMMANIFESTFILE= MANIFEST.MF
+
+JARCLASSDIRS = com$/sun$/star$/wizards$/form
+JARTARGET = $(TARGET).jar
+JARCLASSPATH = commonwizards.jar
+
+# --- Files --------------------------------------------------------
+
+JAVAFILES= \
+ CallFormWizard.java \
+ Finalizer.java \
+ FormWizard.java \
+ DataEntrySetter.java \
+ FieldLinker.java \
+ FormConfiguration.java \
+ FormControlArranger.java\
+ FormDocument.java \
+ StyleApplier.java \
+ UIControlArranger.java \
+
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/form.component
+
+$(MISC)/form.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ form.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_JAVA)$(JARTARGET)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt form.component