summaryrefslogtreecommitdiffstats
path: root/wizards/com/sun/star/wizards/query
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /wizards/com/sun/star/wizards/query
parentInitial commit. (diff)
downloadlibreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz
libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wizards/com/sun/star/wizards/query')
-rw-r--r--wizards/com/sun/star/wizards/query/CallQueryWizard.java176
-rw-r--r--wizards/com/sun/star/wizards/query/Finalizer.java197
-rw-r--r--wizards/com/sun/star/wizards/query/MANIFEST.MF2
-rw-r--r--wizards/com/sun/star/wizards/query/QuerySummary.java223
-rw-r--r--wizards/com/sun/star/wizards/query/QueryWizard.java470
-rw-r--r--wizards/com/sun/star/wizards/query/query.component26
6 files changed, 1094 insertions, 0 deletions
diff --git a/wizards/com/sun/star/wizards/query/CallQueryWizard.java b/wizards/com/sun/star/wizards/query/CallQueryWizard.java
new file mode 100644
index 000000000..6f92ea445
--- /dev/null
+++ b/wizards/com/sun/star/wizards/query/CallQueryWizard.java
@@ -0,0 +1,176 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package com.sun.star.wizards.query;
+
+import com.sun.star.beans.PropertyAttribute;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.Type;
+import com.sun.star.wizards.common.Properties;
+import com.sun.star.wizards.common.PropertyNames;
+
+/** This class capsulates the class, that implements the minimal component, a
+ * factory for creating the service (<CODE>__getServiceFactory</CODE>).
+ */
+public class CallQueryWizard
+{
+
+ /** Gives a factory for creating the service.
+ * This method is called by the <code>JavaLoader</code>
+ * <p>
+ * @return Returns a <code>XSingleServiceFactory</code> for creating the component.
+ * @see com.sun.star.comp.loader.JavaLoader
+ * @param stringImplementationName The implementation name of the component.
+ * @param xMSF The service manager, who gives access to every known service.
+ * @param xregistrykey Makes structural information (except regarding 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(QueryWizardImplementation.class.getName()))
+ {
+ xsingleservicefactory = com.sun.star.comp.loader.FactoryHelper.getServiceFactory(QueryWizardImplementation.class, QueryWizardImplementation.__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 QueryWizardImplementation extends com.sun.star.lib.uno.helper.PropertySet implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.task.XJobExecutor
+ {
+ private PropertyValue[] m_wizardContext;
+ // the next two fields are accessed by reflection, do not delete!
+ public String Command;
+ public final Integer CommandType = com.sun.star.sdb.CommandType.QUERY;
+
+ /** The constructor of the inner class has a XMultiServiceFactory parameter.
+ * @param i_serviceFactory A special service factory could be introduced while initializing.
+ */
+ public QueryWizardImplementation( XMultiServiceFactory i_serviceFactory )
+ {
+ super();
+ m_serviceFactory = i_serviceFactory;
+ registerProperty( PropertyNames.COMMAND, (short)( PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID ) );
+ registerProperty( PropertyNames.COMMAND_TYPE, PropertyAttribute.READONLY );
+ }
+
+ public void trigger(String sEvent)
+ {
+ try
+ {
+ if (sEvent.equals(PropertyNames.START))
+ {
+ QueryWizard CurQueryWizard = new QueryWizard( m_serviceFactory, m_wizardContext );
+ CurQueryWizard.start();
+ }
+ }
+ 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.query.CallQueryWizard";
+ /** The service manager, that gives access to all registered services.
+ */
+ private final 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 com.sun.star.uno.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[] { __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;
+ }
+
+ @Override
+ public byte[] getImplementationId()
+ {
+ return new byte[0];
+ }
+
+ /** Return the class name of the component.
+ * @return Class name of the component.
+ */
+ public java.lang.String getImplementationName()
+ {
+ return QueryWizardImplementation.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.
+ */
+ @Override
+ 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.lang.XInitialization.class)
+ };
+ }
+ catch (Exception exception)
+ {
+ System.err.println(exception);
+ }
+
+ return typeReturn;
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/query/Finalizer.java b/wizards/com/sun/star/wizards/query/Finalizer.java
new file mode 100644
index 000000000..6a556beff
--- /dev/null
+++ b/wizards/com/sun/star/wizards/query/Finalizer.java
@@ -0,0 +1,197 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package com.sun.star.wizards.query;
+
+import com.sun.star.awt.TextEvent;
+import com.sun.star.awt.XRadioButton;
+import com.sun.star.awt.XTextComponent;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.sdb.CommandType;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.wizards.common.HelpIds;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.PropertyNames;
+import com.sun.star.wizards.ui.UIConsts;
+import com.sun.star.wizards.ui.UnoDialog;
+import com.sun.star.wizards.ui.event.XTextListenerAdapter;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class Finalizer
+{
+ private final QueryWizard m_queryWizard;
+ private final String resQuery;
+ private final XTextComponent m_aTxtTitle;
+ private final XRadioButton xRadioDisplayQuery;
+ private final QuerySummary CurDBMetaData;
+
+ public Finalizer( QueryWizard i_queryWizard, QuerySummary _CurDBMetaData )
+ {
+ short curtabindex = (short) (100 * QueryWizard.SOSUMMARY_PAGE);
+ String reslblQueryTitle;
+ String resoptDisplayQuery;
+ String resoptModifyQuery;
+ String resflnSummary;
+ String reslblHowGoOn;
+ this.m_queryWizard = i_queryWizard;
+ this.CurDBMetaData = _CurDBMetaData;
+ reslblQueryTitle = m_queryWizard.m_oResource.getResText("RID_QUERY_5");
+ resoptDisplayQuery = m_queryWizard.m_oResource.getResText("RID_QUERY_6");
+ resoptModifyQuery = m_queryWizard.m_oResource.getResText("RID_QUERY_7");
+ resflnSummary = m_queryWizard.m_oResource.getResText("RID_QUERY_87");
+ reslblHowGoOn = m_queryWizard.m_oResource.getResText("RID_QUERY_8");
+ resQuery = m_queryWizard.m_oResource.getResText("RID_QUERY_1");
+ int curHelpIndex = 40955;
+
+ m_queryWizard.insertLabel("lblQueryTitle", 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[]
+ {
+ 8, reslblQueryTitle, 95, 27, Integer.valueOf(QueryWizard.SOSUMMARY_PAGE), Short.valueOf(curtabindex++), 52
+ });
+ m_aTxtTitle = m_queryWizard.insertTextField("txtQueryTitle", new XTextListenerAdapter() {
+ @Override
+ public void textChanged(TextEvent event) {
+ changeTitle();
+ }
+ }, new String[]
+ {
+ 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[]
+ {
+ 12, HelpIds.getHelpIdString(curHelpIndex++), 95, 37, Integer.valueOf(QueryWizard.SOSUMMARY_PAGE), Short.valueOf(curtabindex++), 90
+ });
+ m_queryWizard.insertLabel("lblHowGoOn", 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[]
+ {
+ 16, reslblHowGoOn, Boolean.TRUE, 192, 27, Integer.valueOf(QueryWizard.SOSUMMARY_PAGE), Short.valueOf(curtabindex++), 112
+ });
+ this.xRadioDisplayQuery = m_queryWizard.insertRadioButton("optDisplayQuery",
+ 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[]
+ {
+ 9, HelpIds.getHelpIdString(curHelpIndex++), resoptDisplayQuery, 192, 46, Short.valueOf((short) 1), Integer.valueOf(QueryWizard.SOSUMMARY_PAGE), Short.valueOf(curtabindex++), 118
+ });
+
+ m_queryWizard.insertRadioButton("optModifyQuery",
+ 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[]
+ {
+ 10, HelpIds.getHelpIdString(curHelpIndex++), resoptModifyQuery, 192, 56, Integer.valueOf(QueryWizard.SOSUMMARY_PAGE), Short.valueOf(curtabindex++), 118
+ });
+ m_queryWizard.insertFixedLine("flnSummary", 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[]
+ {
+ 10, resflnSummary, 95, 68, 8, Short.valueOf(curtabindex++), 209
+ });
+ m_queryWizard.insertTextField("txtSummary", 0, null, new String[]
+ {
+ PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.READ_ONLY, PropertyNames.PROPERTY_STEP, "VScroll", PropertyNames.PROPERTY_WIDTH
+ },
+ new Object[]
+ {
+ 96, HelpIds.getHelpIdString(curHelpIndex++), Boolean.TRUE, 95, 80, Boolean.TRUE, 8, Boolean.TRUE, 209
+ });
+ }
+
+ private void changeTitle()
+ {
+ final String TitleName = m_aTxtTitle.getText();
+ m_queryWizard.enableFinishButton( TitleName.length() > 0 );
+ }
+
+ /* TODO: The title textbox always has to be updated when
+ a new Table has been selected if it is clear that the user has not made any input meanwhile
+ */
+ protected String initialize()
+ {
+ try
+ {
+ String sCurQueryName = AnyConverter.toString(Helper.getUnoPropertyValue(UnoDialog.getModel(m_aTxtTitle), "Text"));
+ if (sCurQueryName != null && sCurQueryName.equals(PropertyNames.EMPTY_STRING))
+ {
+ String[] sCommandNames = CurDBMetaData.getIncludedCommandNames();
+ sCurQueryName = resQuery + "_" + sCommandNames[0];
+ sCurQueryName = CurDBMetaData.suggestName( CommandType.QUERY, sCurQueryName );
+ Helper.setUnoPropertyValue(UnoDialog.getModel(m_aTxtTitle), "Text", sCurQueryName);
+ }
+ CurDBMetaData.setSummaryString();
+ m_queryWizard.setControlProperty("txtSummary", "Text", CurDBMetaData.getSummaryString());
+ return sCurQueryName;
+ }
+ catch (IllegalArgumentException exception)
+ {
+ exception.printStackTrace(System.err);
+ return PropertyNames.EMPTY_STRING;
+ }
+ catch (SQLException exception)
+ {
+ exception.printStackTrace(System.err);
+ return PropertyNames.EMPTY_STRING;
+ }
+
+ }
+
+ private String getTitle()
+ {
+ return (String) Helper.getUnoPropertyValue(UnoDialog.getModel(m_aTxtTitle), "Text");
+ }
+
+ public String finish()
+ {
+ String queryName = getTitle();
+ if ( CurDBMetaData.getSQLQueryComposer().setQueryCommand( m_queryWizard.xWindow, true, true )
+ && CurDBMetaData.createQuery( CurDBMetaData.getSQLQueryComposer(), queryName )
+ )
+ return queryName;
+
+ return PropertyNames.EMPTY_STRING;
+ }
+
+ public final boolean displayQueryDesign()
+ {
+ try
+ {
+ final short state = AnyConverter.toShort( Helper.getUnoPropertyValue( UnoDialog.getModel( xRadioDisplayQuery ), PropertyNames.PROPERTY_STATE ) );
+ final boolean viewMode = state == (short)1;
+ return !viewMode;
+ }
+ catch ( IllegalArgumentException ex )
+ {
+ Logger.getLogger( Finalizer.class.getName() ).log( Level.SEVERE, null, ex );
+ }
+ return false;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/query/MANIFEST.MF b/wizards/com/sun/star/wizards/query/MANIFEST.MF
new file mode 100644
index 000000000..abb009f22
--- /dev/null
+++ b/wizards/com/sun/star/wizards/query/MANIFEST.MF
@@ -0,0 +1,2 @@
+RegistrationClassName: com.sun.star.wizards.query.CallQueryWizard
+UNO-Type-Path:
diff --git a/wizards/com/sun/star/wizards/query/QuerySummary.java b/wizards/com/sun/star/wizards/query/QuerySummary.java
new file mode 100644
index 000000000..443c96453
--- /dev/null
+++ b/wizards/com/sun/star/wizards/query/QuerySummary.java
@@ -0,0 +1,223 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package com.sun.star.wizards.query;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.PropertyNames;
+import com.sun.star.wizards.common.Resource;
+import com.sun.star.wizards.db.FieldColumn;
+import com.sun.star.wizards.db.QueryMetaData;
+import com.sun.star.wizards.ui.FilterComponent;
+
+public class QuerySummary extends QueryMetaData
+{
+
+ private String sSummary;
+ private Resource oResource;
+ private final String sSeparator;
+ private final String sReturnChar;
+ private final String sAnd;
+ private final String sOr;
+
+ public QuerySummary(XMultiServiceFactory _xMSF, Resource _oResource)
+ {
+ super(_xMSF);
+ this.oResource = _oResource;
+ sAnd = oResource.getResText("RID_QUERY_38");
+ sOr = oResource.getResText("RID_QUERY_39");
+ sSeparator = oResource.getResText("RID_QUERY_91");
+ sReturnChar = String.valueOf((char) 13) + String.valueOf((char) 13);
+ }
+
+ public void setSummaryString()
+ {
+ try
+ {
+ String sFieldNamesFraction = PropertyNames.EMPTY_STRING;
+ String sSortingFraction = PropertyNames.EMPTY_STRING;
+ String sFilterFraction = PropertyNames.EMPTY_STRING;
+ String sAggregateFraction = PropertyNames.EMPTY_STRING;
+ String sGroupByFraction = PropertyNames.EMPTY_STRING;
+ String sHavingFraction = PropertyNames.EMPTY_STRING;
+ sFieldNamesFraction = combineFieldNameFraction() + sReturnChar;
+ sSortingFraction = combinePartString("RID_QUERY_51", getSortFieldNames(), "RID_QUERY_52", "RID_QUERY_93", new String[]
+ {
+ "<FIELDNAME>", "<SORTMODE>"
+ }) + sReturnChar;
+ sFilterFraction = combineFilterNameFraction(this.getFilterConditions(), "RID_QUERY_53", "RID_QUERY_54") + sReturnChar;
+ if (xDBMetaData.supportsGroupBy())
+ {
+ sGroupByFraction = combinePartString("RID_QUERY_57", GroupFieldNames, "RID_QUERY_58") + sReturnChar;
+ sHavingFraction = combineFilterNameFraction(getGroupByFilterConditions(), "RID_QUERY_59", "RID_QUERY_60");
+ }
+ // TODO: remove the last return from the string
+ sSummary = sFieldNamesFraction + sSortingFraction + sFilterFraction + sAggregateFraction + sGroupByFraction + sHavingFraction;
+ sSummary = JavaTools.replaceSubString(sSummary, PropertyNames.EMPTY_STRING, "~");
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ exception.printStackTrace(System.err);
+ }
+ }
+
+ public String getSummaryString()
+ {
+ return sSummary;
+ }
+
+ private String combineFilterNameFraction(PropertyValue[][] _filterconditions, String _InitResID, String _AlternativeResID)
+ {
+ if (_filterconditions != null && _filterconditions.length > 0)
+ {
+ String sconditions = PropertyNames.EMPTY_STRING;
+ String sStart = oResource.getResText(_InitResID);
+ String BaseString = oResource.getResText("RID_QUERY_96");
+ if (_filterconditions.length == 1)
+ {
+ PropertyValue[] curfilterconditions = _filterconditions[0];
+ for (int i = 0; i < curfilterconditions.length; i++)
+ {
+ sconditions += FilterComponent.getDisplayCondition(BaseString, _filterconditions[0][i], this);
+ sconditions = appendClauseSeparator(sconditions, PropertyNames.SPACE + sAnd + PropertyNames.SPACE, i, curfilterconditions.length);
+ }
+ }
+ else
+ {
+
+ for (int i = 0; i < _filterconditions.length; i++)
+ {
+ sconditions += FilterComponent.getDisplayCondition(BaseString, _filterconditions[i][0], this);
+ sconditions = appendClauseSeparator(sconditions, PropertyNames.SPACE + sOr + PropertyNames.SPACE, i, _filterconditions.length);
+ }
+ }
+ return sStart + sconditions;
+ }
+ return oResource.getResText(_AlternativeResID);
+ }
+
+ private String combineFieldNameFraction()
+ {
+ String CurString = PropertyNames.EMPTY_STRING;
+ String sReturn = oResource.getResText("RID_QUERY_50");
+ String BaseString = oResource.getResText("RID_QUERY_92");
+ for (int i = 0; i < FieldColumns.length; i++)
+ {
+ CurString = BaseString;
+ FieldColumn CurDBFieldColumn = super.getFieldColumnByDisplayName(FieldColumns[i].getDisplayFieldName());
+ int iAggregate = getAggregateIndex(FieldColumns[i].getFieldName());
+ if (iAggregate > -1)
+ {
+ String sAggregateDisplay = AggregateFieldNames[iAggregate][1] + "(" + AggregateFieldNames[iAggregate][0] + ")";
+ CurString = JavaTools.replaceSubString(CurString, sAggregateDisplay, "<FIELDNAME>");
+ }
+ else
+ {
+ CurString = JavaTools.replaceSubString(CurString, CurDBFieldColumn.getDisplayFieldName(), "<FIELDNAME>");
+ }
+ sReturn += JavaTools.replaceSubString(CurString, CurDBFieldColumn.getFieldTitle(), "<FIELDTITLE>");
+ sReturn = appendClauseSeparator(sReturn, sSeparator, i, FieldColumns.length);
+ }
+ return sReturn;
+ }
+
+ private String appendClauseSeparator(String _basestring, String _suffix, int _i, int _fieldcount)
+ {
+ if (_i < _fieldcount - 1)
+ {
+ _basestring += _suffix;
+ }
+ return _basestring;
+ }
+ // TODO: How can you merge the following two methods to a single one in a smarter way??
+
+ private String combinePartString(String _InitResID, String[] _FieldNames, String _AlternativeResID)
+ {
+ if (_FieldNames != null && _FieldNames.length > 0)
+ {
+ return ArrayFieldsToString(_InitResID, _FieldNames);
+ }
+ return oResource.getResText(_AlternativeResID);
+ }
+
+ private String ArrayFieldsToString(String _InitResID, String[] _FieldNames)
+ {
+ StringBuilder sReturn = new StringBuilder(oResource.getResText(_InitResID));
+ int FieldCount = _FieldNames.length;
+ for (int i = 0; i < FieldCount; i++)
+ {
+ sReturn.append(this.getFieldColumnByDisplayName(_FieldNames[i]).getFieldTitle());
+ if (i < FieldCount - 1)
+ {
+ sReturn.append(sSeparator);
+ }
+ }
+ return sReturn.toString();
+ }
+
+ private String combinePartString(String _InitResID, String[][] _FieldNames, String _AlternativeResID, String _BaseStringID, String[] _ReplaceTags)
+ {
+ if (_FieldNames != null && _FieldNames.length > 0)
+ {
+ return ArrayFieldsToString(_InitResID, _FieldNames, _BaseStringID, _ReplaceTags);
+ }
+ return oResource.getResText(_AlternativeResID);
+ }
+
+ private String ArrayFieldsToString(String _InitResID, String[][] _FieldNames, String _BaseStringID, String[] _ReplaceTags)
+ {
+ String CurString = PropertyNames.EMPTY_STRING;
+ StringBuilder sReturn = new StringBuilder(oResource.getResText(_InitResID));
+ int FieldCount = _FieldNames.length;
+ if (FieldCount > 0)
+ {
+ int DimCount = _FieldNames[0].length;
+ String BaseString = oResource.getResText(_BaseStringID);
+ for (int i = 0; i < FieldCount; i++)
+ {
+ for (int a = 0; a < DimCount; a++)
+ {
+ if (a == 0)
+ {
+ int iAggregate = getAggregateIndex(this.getFieldColumnByDisplayName(_FieldNames[i][a]).getDisplayFieldName());
+ if (iAggregate > -1)
+ {
+ String sAggregateDisplay = AggregateFieldNames[iAggregate][1] + "(" + AggregateFieldNames[iAggregate][0] + ")";
+ CurString = JavaTools.replaceSubString(BaseString, sAggregateDisplay, _ReplaceTags[a]);
+ }
+ else
+ {
+ CurString = JavaTools.replaceSubString(BaseString, this.getFieldColumnByDisplayName(_FieldNames[i][a]).getFieldTitle(), _ReplaceTags[a]);
+ }
+ }
+ else
+ {
+ CurString = JavaTools.replaceSubString(CurString, _FieldNames[i][a], _ReplaceTags[a]);
+ }
+ }
+ sReturn.append(CurString);
+ if (i < FieldCount - 1)
+ {
+ sReturn.append(sSeparator);
+ }
+ }
+ }
+ return sReturn.toString();
+ }
+}
diff --git a/wizards/com/sun/star/wizards/query/QueryWizard.java b/wizards/com/sun/star/wizards/query/QueryWizard.java
new file mode 100644
index 000000000..8f460e55e
--- /dev/null
+++ b/wizards/com/sun/star/wizards/query/QueryWizard.java
@@ -0,0 +1,470 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package com.sun.star.wizards.query;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.sdb.CommandType;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.wizards.ui.UIConsts;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.PropertyNames;
+import com.sun.star.wizards.common.Resource;
+import com.sun.star.wizards.db.DatabaseObjectWizard;
+import com.sun.star.wizards.db.QueryMetaData;
+import com.sun.star.wizards.ui.AggregateComponent;
+import com.sun.star.wizards.ui.CommandFieldSelection;
+import com.sun.star.wizards.ui.FieldSelection;
+import com.sun.star.wizards.ui.FilterComponent;
+import com.sun.star.wizards.ui.SortingComponent;
+import com.sun.star.wizards.ui.TitlesComponent;
+
+public class QueryWizard extends DatabaseObjectWizard
+{
+
+ private static final int SOFIELDSELECTION_PAGE = 1;
+ private static final int SOSORTING_PAGE = 2;
+ private static final int SOFILTER_PAGE = 3;
+ private static final int SOAGGREGATE_PAGE = 4;
+ private static final int SOGROUPSELECTION_PAGE = 5;
+ private static final int SOGROUPFILTER_PAGE = 6;
+ private static final int SOTITLES_PAGE = 7;
+ protected static final int SOSUMMARY_PAGE = 8;
+ private CommandFieldSelection m_DBCommandFieldSelectio;
+ private SortingComponent m_sortingComponent;
+ private FieldSelection m_groupFieldSelection;
+ private TitlesComponent m_titlesComponent;
+ private FilterComponent m_filterComponent;
+ private FilterComponent m_groupFilterComponent;
+ private AggregateComponent m_aggregateComponent;
+ private Finalizer m_finalizer;
+ private QuerySummary m_DBMetaData;
+ private String reslblFieldHeader;
+ private String reslblAliasHeader;
+ private String reslblFields;
+ private String reslblSelFields;
+ private String reslblTables;
+ private String reslblGroupBy;
+ private String resmsgNonNumericAsGroupBy;
+ private String m_createdQuery;
+
+ public QueryWizard(XMultiServiceFactory xMSF, PropertyValue[] i_wizardContext)
+ {
+ super(xMSF, 40970, i_wizardContext);
+ addResourceHandler();
+ m_DBMetaData = new QuerySummary(xMSF, m_oResource);
+ }
+
+ public static void main(String i_args[])
+ {
+ executeWizardFromCommandLine( i_args, new WizardFromCommandLineStarter() {
+ public void start(XMultiServiceFactory factory, PropertyValue[] curproperties) {
+ QueryWizard wizard = new QueryWizard(factory, curproperties);
+ wizard.start();
+ }
+ });
+ }
+
+ public String start()
+ {
+ try
+ {
+ if (m_DBMetaData.getConnection(m_wizardContext))
+ {
+ reslblFields = m_oResource.getResText("RID_QUERY_4");
+ reslblFieldHeader = m_oResource.getResText("RID_QUERY_19"); //Fieldnames in AliasComponent
+ reslblAliasHeader = m_oResource.getResText("RID_QUERY_20"); //Fieldtitles header in AliasComponent
+ reslblSelFields = m_oResource.getResText("RID_QUERY_50");
+ reslblTables = m_oResource.getResText("RID_QUERY_3");
+ reslblGroupBy = m_oResource.getResText("RID_QUERY_18");
+ String resQueryWizard = m_oResource.getResText("RID_QUERY_2");
+ resmsgNonNumericAsGroupBy = m_oResource.getResText("RID_QUERY_88");
+ Helper.setUnoPropertyValues(xDialogModel, new String[]
+ {
+ PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH
+ },
+ new Object[]
+ {
+ 210, Boolean.TRUE, "DialogQuery", 102, 41, 1, Short.valueOf((short) 0), resQueryWizard, 310
+ });
+ drawNaviBar();
+ setRightPaneHeaders(m_oResource, "RID_QUERY_", 70, 8);
+ this.setMaxStep(8);
+ buildSteps();
+ this.m_DBCommandFieldSelectio.preselectCommand(m_wizardContext, false);
+
+ XWindowPeer windowPeer = UnoRuntime.queryInterface(XWindowPeer.class, m_frame.getContainerWindow());
+ createWindowPeer(windowPeer);
+ m_DBMetaData.setWindowPeer(this.xControl.getPeer());
+ insertQueryRelatedSteps();
+ executeDialog(m_frame.getContainerWindow().getPosSize());
+ }
+ }
+ catch (java.lang.Exception jexception)
+ {
+ jexception.printStackTrace(System.err);
+ }
+ m_groupFilterComponent = null;
+ m_titlesComponent = null;
+ m_aggregateComponent = null;
+ m_DBCommandFieldSelectio = null;
+ xWindowPeer = null;
+ m_finalizer = null;
+ m_DBMetaData.finish();
+ m_DBMetaData = null;
+ System.gc();
+
+ return m_createdQuery;
+ }
+
+ private void enableRoadmapItems(boolean _bEnabled)
+ {
+ try
+ {
+ Object oRoadmapItem;
+ int CurStep = AnyConverter.toInt(Helper.getUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_STEP));
+ boolean bEnabled = false;
+ int CurItemID;
+ for (int i = 0; i < getRMItemCount(); i++)
+ {
+ oRoadmapItem = this.xIndexContRoadmap.getByIndex(i);
+ CurItemID = AnyConverter.toInt(Helper.getUnoPropertyValue(oRoadmapItem, "ID"));
+ switch (CurItemID)
+ {
+ case SOAGGREGATE_PAGE:
+ if (_bEnabled)
+ {
+ bEnabled = ((m_DBMetaData.hasNumericalFields()) && (m_DBMetaData.xDBMetaData.supportsCoreSQLGrammar()));
+ }
+ break;
+ case SOGROUPSELECTION_PAGE:
+ bEnabled = m_DBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY;
+ break;
+ case SOGROUPFILTER_PAGE:
+ bEnabled = false;
+ if (_bEnabled)
+ {
+ bEnabled = (m_DBMetaData.GroupByFilterConditions.length > 0);
+ }
+
+ break;
+ default:
+ if (CurItemID > CurStep)
+ {
+ bEnabled = _bEnabled;
+ }
+ else
+ {
+ bEnabled = true;
+ }
+ break;
+ }
+ super.setStepEnabled(CurItemID, bEnabled);
+ }
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ exception.printStackTrace(System.err);
+ }
+ }
+
+ private void insertQueryRelatedSteps()
+ {
+ try
+ {
+ setRMItemLabels(m_oResource);
+ addRoadmap();
+ int i = 0;
+ i = insertRoadmapItem(0, true, SOFIELDSELECTION_PAGE - 1, SOFIELDSELECTION_PAGE);
+ i = insertRoadmapItem(i, false, SOSORTING_PAGE - 1, SOSORTING_PAGE); // Orderby is always supported
+ i = insertRoadmapItem(i, false, SOFILTER_PAGE - 1, SOFILTER_PAGE);
+ if (m_DBMetaData.xDBMetaData.supportsCoreSQLGrammar())
+ {
+ i = insertRoadmapItem(i, m_DBMetaData.hasNumericalFields(), SOAGGREGATE_PAGE - 1, SOAGGREGATE_PAGE);
+ }
+ if (m_DBMetaData.xDBMetaData.supportsGroupBy())
+ {
+ i = insertRoadmapItem(i, false, SOGROUPSELECTION_PAGE - 1, SOGROUPSELECTION_PAGE);
+ i = insertRoadmapItem(i, false, SOGROUPFILTER_PAGE - 1, SOGROUPFILTER_PAGE);
+ }
+ i = insertRoadmapItem(i, false, SOTITLES_PAGE - 1, SOTITLES_PAGE);
+ i = insertRoadmapItem(i, false, SOSUMMARY_PAGE - 1, SOSUMMARY_PAGE);
+ setRoadmapInteractive(true);
+ setRoadmapComplete(true);
+ setCurrentRoadmapItemID((short) 1);
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ Resource.showCommonResourceError(xMSF);
+ }
+ }
+
+ private void buildSteps()
+ {
+ try
+ {
+ m_DBCommandFieldSelectio = new CommandFieldSelection(
+ this, m_DBMetaData, 120, reslblFields, reslblSelFields, reslblTables,
+ m_DBMetaData.supportsQueriesInFrom(), 40850);
+ m_DBCommandFieldSelectio.setAppendMode(true);
+ m_DBCommandFieldSelectio.addFieldSelectionListener(new FieldSelectionListener());
+ m_sortingComponent = new SortingComponent(this, SOSORTING_PAGE, 95, 27, 210, 40865);
+ m_filterComponent = new FilterComponent(this, SOFILTER_PAGE, 97, 27, 3, m_DBMetaData, 40878);
+ m_filterComponent.addNumberFormats();
+
+ if (m_DBMetaData.xDBMetaData.supportsCoreSQLGrammar())
+ {
+ m_aggregateComponent = new AggregateComponent(this, m_DBMetaData, SOAGGREGATE_PAGE, 97, 69, 209, 5, 40895);
+ }
+ if (m_DBMetaData.xDBMetaData.supportsGroupBy())
+ {
+ m_groupFieldSelection = new FieldSelection(this, SOGROUPSELECTION_PAGE, 95, 27, 210, 150, reslblFields, this.reslblGroupBy, 40915, false);
+ m_groupFieldSelection.addFieldSelectionListener(new FieldSelectionListener());
+ m_groupFilterComponent = new FilterComponent(this, SOGROUPFILTER_PAGE, 97, 27, 3, m_DBMetaData, 40923);
+ }
+ m_titlesComponent = new TitlesComponent(this, SOTITLES_PAGE, 97, 37, 207, 7, reslblFieldHeader, reslblAliasHeader, 40940);
+ m_finalizer = new Finalizer(this, m_DBMetaData);
+ enableNavigationButtons(false, false, false);
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ Resource.showCommonResourceError(xMSF);
+ }
+ }
+
+ @Override
+ public boolean finishWizard()
+ {
+ int ncurStep = getCurrentStep();
+ if ((ncurStep == SOSUMMARY_PAGE)
+ || (switchToStep(ncurStep, SOSUMMARY_PAGE)))
+ {
+ m_createdQuery = m_finalizer.finish();
+ if (m_createdQuery.length() > 0)
+ {
+ loadSubComponent(CommandType.QUERY, m_createdQuery, m_finalizer.displayQueryDesign());
+ xDialog.endExecute();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ protected void enterStep(int nOldStep, int nNewStep)
+ {
+ try
+ {
+ if (nOldStep <= SOGROUPSELECTION_PAGE && nNewStep > SOGROUPSELECTION_PAGE)
+ {
+ if (m_DBMetaData.xDBMetaData.supportsGroupBy())
+ {
+ m_DBMetaData.setGroupFieldNames(m_groupFieldSelection.getSelectedFieldNames());
+ m_DBMetaData.GroupFieldNames = JavaTools.removeOutdatedFields(m_DBMetaData.GroupFieldNames, m_DBMetaData.NonAggregateFieldNames);
+ m_DBMetaData.GroupByFilterConditions = JavaTools.removeOutdatedFields(m_DBMetaData.GroupByFilterConditions, m_DBMetaData.GroupFieldNames);
+ }
+ }
+ switch (nNewStep)
+ {
+ case SOFIELDSELECTION_PAGE:
+ break;
+ case SOSORTING_PAGE:
+ m_sortingComponent.initialize(m_DBMetaData.getDisplayFieldNames(), m_DBMetaData.getSortFieldNames());
+ break;
+ case SOFILTER_PAGE:
+ m_filterComponent.initialize(m_DBMetaData.getFilterConditions(), m_DBMetaData.getDisplayFieldNames());
+ break;
+ case SOAGGREGATE_PAGE:
+ m_aggregateComponent.initialize();
+ break;
+ case SOGROUPSELECTION_PAGE:
+ break;
+ case SOGROUPFILTER_PAGE:
+ m_groupFilterComponent.initialize(m_DBMetaData.GroupByFilterConditions, m_DBMetaData.getGroupFieldNames());
+ break;
+ case SOTITLES_PAGE:
+ m_titlesComponent.initialize(m_DBMetaData.getDisplayFieldNames(), m_DBMetaData.FieldTitleSet);
+ break;
+ case SOSUMMARY_PAGE:
+ m_finalizer.initialize();
+ break;
+ default:
+ break;
+ }
+ }
+ catch (SQLException e)
+ {
+ e.printStackTrace(System.err);
+ }
+ }
+
+ @Override
+ protected void leaveStep(int nOldStep, int nNewStep)
+ {
+ switch (nOldStep)
+ {
+ case SOFIELDSELECTION_PAGE:
+ m_DBMetaData.reorderFieldColumns(m_DBCommandFieldSelectio.getSelectedFieldNames());
+ m_DBMetaData.initializeFieldTitleSet();
+ m_DBMetaData.setNumericFields();
+ searchForOutdatedFields();
+ break;
+ case SOSORTING_PAGE:
+ m_DBMetaData.setSortFieldNames(m_sortingComponent.getSortFieldNames());
+ break;
+ case SOFILTER_PAGE:
+ m_DBMetaData.setFilterConditions(m_filterComponent.getFilterConditions());
+ break;
+ case SOAGGREGATE_PAGE:
+ m_DBMetaData.AggregateFieldNames = m_aggregateComponent.getAggregateFieldNames();
+ break;
+ case SOGROUPSELECTION_PAGE:
+ break;
+ case SOGROUPFILTER_PAGE:
+ m_DBMetaData.setGroupByFilterConditions(this.m_groupFilterComponent.getFilterConditions());
+ break;
+ case SOTITLES_PAGE:
+ m_DBMetaData.setFieldTitles(m_titlesComponent.getFieldTitles());
+ break;
+ case SOSUMMARY_PAGE:
+ break;
+ default:
+ break;
+ }
+ if (nOldStep < SOGROUPSELECTION_PAGE && nNewStep >= SOGROUPSELECTION_PAGE)
+ {
+ try
+ {
+ if (m_DBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY)
+ {
+ if (m_DBMetaData.xDBMetaData.supportsGroupBy())
+ {
+ m_DBMetaData.setNonAggregateFieldNames();
+ m_groupFieldSelection.initialize(m_DBMetaData.getUniqueAggregateFieldNames(), false, m_DBMetaData.xDBMetaData.getMaxColumnsInGroupBy());
+ m_groupFieldSelection.initializeSelectedFields(m_DBMetaData.NonAggregateFieldNames);
+ m_groupFieldSelection.setMultipleMode(false);
+ setStepEnabled(SOGROUPFILTER_PAGE, m_aggregateComponent.isGroupingpossible() && m_DBMetaData.NonAggregateFieldNames.length > 0);
+ }
+ }
+ }
+ catch (SQLException e)
+ {
+ e.printStackTrace( System.err );
+ }
+ }
+ }
+
+ private void searchForOutdatedFields()
+ {
+ String[] sFieldNames = m_DBMetaData.getFieldNames();
+ String[][] sRemovedFields = JavaTools.removeOutdatedFields(m_DBMetaData.getSortFieldNames(), sFieldNames);
+ m_DBMetaData.setSortFieldNames(sRemovedFields);
+ m_DBMetaData.setFilterConditions(JavaTools.removeOutdatedFields(m_DBMetaData.getFilterConditions(), sFieldNames));
+ m_DBMetaData.AggregateFieldNames = JavaTools.removeOutdatedFields(m_DBMetaData.AggregateFieldNames, sFieldNames);
+ }
+
+ private void enableWizardSteps(String[] NewItems)
+ {
+ boolean bEnabled = NewItems.length > 0;
+ setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, bEnabled);
+ setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, bEnabled);
+ enableRoadmapItems(bEnabled); // Note: Performance wise this could be improved
+ }
+
+ private class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener
+ {
+
+ private int ID;
+
+ public void setID(String sIncSuffix)
+ {
+ ID = 1;
+ if (sIncSuffix != null)
+ {
+ if ((!sIncSuffix.equals(PropertyNames.EMPTY_STRING)) && (!sIncSuffix.equals("_")))
+ {
+ String sID = JavaTools.ArrayoutofString(sIncSuffix, "_")[1];
+ ID = Integer.parseInt(sID);
+ }
+ }
+ }
+
+ public void shiftFromLeftToRight(String[] SelItems, String[] NewItems)
+ {
+ if (ID == 1)
+ {
+ m_DBMetaData.addSeveralFieldColumns(SelItems, m_DBCommandFieldSelectio.getSelectedCommandName());
+ enableWizardSteps(NewItems);
+ m_DBCommandFieldSelectio.changeSelectedFieldNames(m_DBMetaData.getDisplayFieldNames());
+ m_DBCommandFieldSelectio.toggleCommandListBox(NewItems);
+ }
+ else
+ {
+ boolean bEnabled = (m_groupFieldSelection.getSelectedFieldNames().length > 0);
+ Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPFILTER_PAGE), PropertyNames.PROPERTY_ENABLED, bEnabled);
+ }
+ }
+
+ 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)
+ {
+ enableWizardSteps(NewItems);
+ String[] sSelfieldNames = m_DBMetaData.getFieldNames(SelItems, m_DBCommandFieldSelectio.getSelectedCommandName());
+ m_DBCommandFieldSelectio.addItemsToFieldsListbox(sSelfieldNames);
+ m_DBMetaData.removeSeveralFieldColumnsByDisplayFieldName(SelItems);
+ m_DBCommandFieldSelectio.toggleCommandListBox(NewItems);
+
+ }
+ else
+ {
+ boolean bEnabled = (m_groupFieldSelection.getSelectedFieldNames().length > 0);
+ String CurDisplayFieldName = SelItems[0];
+ if (JavaTools.FieldInList(m_DBMetaData.NonAggregateFieldNames, CurDisplayFieldName) > -1)
+ {
+ showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, resmsgNonNumericAsGroupBy);
+ m_groupFieldSelection.xSelectedFieldsListBox.addItems(SelItems, m_groupFieldSelection.xSelectedFieldsListBox.getItemCount());
+ String FieldList[] = m_groupFieldSelection.xFieldsListBox.getItems();
+ int index = JavaTools.FieldInList(FieldList, CurDisplayFieldName);
+ if (index > -1)
+ {
+ m_groupFieldSelection.xFieldsListBox.removeItems((short) index, (short) 1);
+ }
+ }
+ else
+ {
+ Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPFILTER_PAGE), PropertyNames.PROPERTY_ENABLED, bEnabled);
+ }
+ }
+ }
+
+ public void moveItemDown(String item)
+ {
+ }
+
+ public void moveItemUp(String item)
+ {
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/query/query.component b/wizards/com/sun/star/wizards/query/query.component
new file mode 100644
index 000000000..c349617d8
--- /dev/null
+++ b/wizards/com/sun/star/wizards/query/query.component
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ -->
+
+<component loader="com.sun.star.loader.Java2"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name=
+ "com.sun.star.wizards.query.CallQueryWizard$QueryWizardImplementation">
+ <service name="com.sun.star.wizards.query.CallQueryWizard"/>
+ </implementation>
+</component>