summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2011-04-14 15:29:52 +0200
committerKurt Zenker <kz@openoffice.org>2011-04-14 15:29:52 +0200
commit630fd697a97b139f0c7055cdcbb35d0615fb9eb9 (patch)
tree5f7c50678e4c8d8e0c27f45fe65f2d735ccae54d
parent59a357571a3329f000fe564a7ba75094cca9c4b1 (diff)
parente53f121afac0f85d0dc1c20c044253ad32b671bd (diff)
CWS-TOOLING: integrate CWS fs34b_OOO340
-rw-r--r--forms/qa/integration/forms/XMLFormSettings.java11
-rw-r--r--forms/qa/org/openoffice/xforms/Instance.java17
-rw-r--r--forms/source/xforms/submission/serialization_app_xml.cxx126
-rw-r--r--forms/source/xforms/submission/serialization_app_xml.hxx5
-rw-r--r--forms/source/xforms/submission/submission_put.cxx10
-rw-r--r--wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java83
-rw-r--r--wizards/com/sun/star/wizards/document/FormHandler.java27
-rw-r--r--wizards/com/sun/star/wizards/form/CallFormWizard.java2
-rw-r--r--wizards/com/sun/star/wizards/form/FormDocument.java8
-rw-r--r--wizards/com/sun/star/wizards/form/FormWizard.java20
-rw-r--r--wizards/com/sun/star/wizards/form/StyleApplier.java2
-rw-r--r--wizards/com/sun/star/wizards/query/CallQueryWizard.java2
-rw-r--r--wizards/com/sun/star/wizards/query/QueryWizard.java91
-rw-r--r--wizards/com/sun/star/wizards/report/ReportTextImplementation.java32
14 files changed, 215 insertions, 221 deletions
diff --git a/forms/qa/integration/forms/XMLFormSettings.java b/forms/qa/integration/forms/XMLFormSettings.java
index e3881bfa861d..d7c98fdf17ce 100644
--- a/forms/qa/integration/forms/XMLFormSettings.java
+++ b/forms/qa/integration/forms/XMLFormSettings.java
@@ -85,17 +85,14 @@ public class XMLFormSettings extends complexlib.ComplexTestCase
// create a simple structure in the DOM tree: an element with two attributes
String[] modelNames = m_document.getXFormModelNames();
m_defaultModel = m_document.getXFormModel( modelNames[0] );
- Instance defaultInstance = m_defaultModel.getDefaultInstance();
+ final Instance defaultInstance = m_defaultModel.getDefaultInstance();
+ // remove the default root node
+ defaultInstance.removeNode( "instanceData" );
+ // create test structures
XNode stringElement = defaultInstance.createElement( "stringElement" );
XNode booleanAttrib = defaultInstance.createAttribute( stringElement, "booleanAttribute", "true" );
XNode dateAttrib = defaultInstance.createAttribute( stringElement, "dateAttribute" );
- // when it comes to saving and loading, only one child of the root element of the instance
- // is handled (is this a bug? see xmloff/source/xforms/XFormsInstanceContext.cxx, method
- // CreateChildContext).
- // So, we remove the default node of the instance which it has all the time
- defaultInstance.removeNode( "instanceData" );
-
assure( "booleanAttrib's parent is wrong",
UnoRuntime.areSame( stringElement, booleanAttrib.getParentNode() ) );
assure( "dateAttrib's parent is wrong",
diff --git a/forms/qa/org/openoffice/xforms/Instance.java b/forms/qa/org/openoffice/xforms/Instance.java
index 5e4e04741995..954ca6157f83 100644
--- a/forms/qa/org/openoffice/xforms/Instance.java
+++ b/forms/qa/org/openoffice/xforms/Instance.java
@@ -43,23 +43,6 @@ public class Instance
/** creates a new element in the instance
*
- * The element will be inserted immediately below the root node of the instance.
- *
- * @param _elementName
- * the name of the to-be-created element
- * @param _initialNodeValue
- * the initial value to set at the node. Might be null, in this case no value is set.
- * @return
- * the node of the newly created element
- * @throws com.sun.star.xml.dom.DOMException
- */
- public XNode createElement( String _elementName, String _initialNodeValue ) throws DOMException
- {
- return createElement( m_domInstance, _elementName, _initialNodeValue );
- }
-
- /** creates a new element in the instance
- *
* The element will be inserted immediately below a given XNode.
*
* @param _parentElement
diff --git a/forms/source/xforms/submission/serialization_app_xml.cxx b/forms/source/xforms/submission/serialization_app_xml.cxx
index 85cf066d6343..63ef50cdc454 100644
--- a/forms/source/xforms/submission/serialization_app_xml.cxx
+++ b/forms/source/xforms/submission/serialization_app_xml.cxx
@@ -31,91 +31,117 @@
#include "serialization.hxx"
#include "serialization_app_xml.hxx"
-#include <unotools/processfactory.hxx>
+/** === begin UNO includes === **/
#include <com/sun/star/xml/dom/XNode.hpp>
#include <com/sun/star/xml/dom/XDocument.hpp>
#include <com/sun/star/xml/dom/XNodeList.hpp>
#include <com/sun/star/xml/dom/NodeType.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/xml/xpath/XPathObjectType.hpp>
+#include <com/sun/star/xml/sax/XSAXSerializable.hpp>
+#include <com/sun/star/beans/StringPair.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
+/** === end UNO includes === **/
-#include <libxml/tree.h>
+#include <tools/diagnose_ex.h>
+#include <comphelper/processfactory.hxx>
+
+#include <boost/scoped_ptr.hpp>
+#include <limits>
+
+/** === begin UNO using === **/
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::UNO_SET_THROW;
+using ::com::sun::star::xml::dom::XNode;
+using ::com::sun::star::xml::dom::XDocument;
+using ::com::sun::star::xml::sax::XSAXSerializable;
+using ::com::sun::star::beans::StringPair;
+using ::com::sun::star::io::XActiveDataSource;
+using ::com::sun::star::xml::dom::NodeType_DOCUMENT_NODE;
+using ::com::sun::star::xml::dom::NodeType_ELEMENT_NODE;
+using ::com::sun::star::xml::dom::XDocumentBuilder;
+using ::com::sun::star::xml::sax::XDocumentHandler;
+/** === end UNO using === **/
CSerializationAppXML::CSerializationAppXML()
- : m_aFactory(utl::getProcessServiceFactory())
- , m_aPipe(CSS::uno::Reference< CSS::io::XOutputStream > (m_aFactory->createInstance(
- rtl::OUString::createFromAscii("com.sun.star.io.Pipe")), CSS::uno::UNO_QUERY))
+ :m_aContext( ::comphelper::getProcessServiceFactory() )
{
- OSL_ENSURE(m_aPipe.is(), "cannot create Pipe");
+ m_aContext.createComponent( "com.sun.star.io.Pipe", m_xBuffer );
}
-CSS::uno::Reference< CSS::io::XInputStream >
+Reference< CSS::io::XInputStream >
CSerializationAppXML::getInputStream()
{
// The pipes output is provided through it's
// XOutputStream interface aspect
- return CSS::uno::Reference< CSS::io::XInputStream >(m_aPipe, CSS::uno::UNO_QUERY);
+ return Reference< CSS::io::XInputStream >(m_xBuffer, UNO_QUERY);
}
void
-CSerializationAppXML::serialize_node(const CSS::uno::Reference< CSS::xml::dom::XNode >& rNode)
+CSerializationAppXML::serialize_node(const Reference< XNode >& rNode)
{
- CSS::uno::Reference< CSS::xml::dom::XNode > aNode = rNode;
- if (aNode->getNodeType() == CSS::xml::dom::NodeType_DOCUMENT_NODE)
+ try
{
- CSS::uno::Reference< CSS::xml::dom::XDocument > aDoc(rNode, CSS::uno::UNO_QUERY_THROW);
- aNode = CSS::uno::Reference< CSS::xml::dom::XNode >(aDoc->getDocumentElement(), CSS::uno::UNO_QUERY_THROW);
- }
- if (aNode->getNodeType() != CSS::xml::dom::NodeType_ELEMENT_NODE)
- return;
+ Reference< XSAXSerializable > xSerializer( rNode, UNO_QUERY );
+ if ( !xSerializer.is() )
+ {
+ // ensure we have a "real" node
+ Reference< XNode > xNode = rNode;
+ if ( xNode->getNodeType() == NodeType_DOCUMENT_NODE )
+ {
+ Reference< XDocument > const xDoc( xNode, UNO_QUERY_THROW );
+ xNode.set( xDoc->getDocumentElement(), UNO_QUERY_THROW );
+ }
+ ENSURE_OR_RETURN_VOID( xNode->getNodeType() == NodeType_ELEMENT_NODE,
+ "CSerializationAppXML::serialize_node: invalid node type!" );
- // clone the node to a new document and serialize that document
- CSS::uno::Reference< CSS::lang::XUnoTunnel > aTunnel(aNode, CSS::uno::UNO_QUERY);
- if (aTunnel.is())
- {
- xmlNodePtr aNodePtr = reinterpret_cast< xmlNodePtr >( aTunnel->getSomething(CSS::uno::Sequence< sal_Int8 >()) );
- xmlDocPtr aDocPtr = xmlNewDoc((xmlChar*)"1.0");
- xmlNodePtr aDocNodePtr = xmlDocCopyNode(aNodePtr, aDocPtr, 1);
- if (aDocNodePtr != NULL) {
- xmlAddChild((xmlNodePtr)aDocPtr, aDocNodePtr);
- xmlChar *buffer = NULL;
- sal_Int32 size = 0;
- xmlDocDumpMemory(aDocPtr, &buffer, (int*)&size);
-
- // write the xml into the pipe through it's XOutputStream interface
- m_aPipe->writeBytes(CSS::uno::Sequence< sal_Int8 >((sal_Int8*)buffer, size));
- xmlFree(buffer);
+ // create a new document
+ Reference< XDocumentBuilder > const xDocBuilder(
+ m_aContext.createComponent( "com.sun.star.xml.dom.DocumentBuilder" ), UNO_QUERY_THROW );
+ Reference< XDocument > const xDocument( xDocBuilder->newDocument(), UNO_SET_THROW );
+
+ // copy the to-be-serialized node
+ Reference< XNode > const xImportedNode( xDocument->importNode( xNode, true ), UNO_SET_THROW );
+ xDocument->appendChild( xImportedNode );
+
+ // ask the doc for the serializer
+ xSerializer.set( xDocument, UNO_QUERY );
}
- } else {
- // can't get tunnel to native backend
- // logic for generic implementation could be implemented here...
- OSL_ENSURE(sal_False, "unkown dom implementation, cannot serialize");
- return;
- }
-}
+ ENSURE_OR_RETURN_VOID( xSerializer.is(),
+ "CSerializationAppXML::serialize_node: no serialization access to the node/document!" );
-/*
-void
-CSerializationAppXML::serialize_nodeset()
-{
- CSS::uno::Reference< CSS::xml::dom::XNodeList > aNodeList = m_aXPathObject->getNodeList();
- for (sal_Int32 i=0; i<aNodeList->getLength(); i++)
- serialize_node(aNodeList->item(i));
- m_aPipe->closeOutput();
+ // create a SAXWriter to take the serialization events, and connect it to our pipe
+ Reference< XDocumentHandler > const xSaxWriter(
+ m_aContext.createComponent( "com.sun.star.xml.sax.Writer" ), UNO_QUERY_THROW );
+ Reference< XActiveDataSource > const xDataSource( xSaxWriter, UNO_QUERY_THROW );
+ xDataSource->setOutputStream( m_xBuffer );
+
+ // do the serialization
+ xSerializer->serialize( xSaxWriter, Sequence< StringPair >() );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
-*/
void
CSerializationAppXML::serialize()
{
if (!m_aFragment.is()) return;
- CSS::uno::Reference< CSS::xml::dom::XNode > cur = m_aFragment->getFirstChild();
+ Reference< XNode > cur = m_aFragment->getFirstChild();
while (cur.is())
{
serialize_node(cur);
cur = cur->getNextSibling();
}
- m_aPipe->closeOutput();
+ m_xBuffer->closeOutput();
}
diff --git a/forms/source/xforms/submission/serialization_app_xml.hxx b/forms/source/xforms/submission/serialization_app_xml.hxx
index 338df6aea083..7380b5834ed1 100644
--- a/forms/source/xforms/submission/serialization_app_xml.hxx
+++ b/forms/source/xforms/submission/serialization_app_xml.hxx
@@ -33,12 +33,13 @@
#include "serialization.hxx"
+#include <comphelper/componentcontext.hxx>
class CSerializationAppXML : public CSerialization
{
private:
- CSS::uno::Reference< CSS::lang::XMultiServiceFactory > m_aFactory;
- CSS::uno::Reference< CSS::io::XOutputStream > m_aPipe;
+ ::comphelper::ComponentContext m_aContext;
+ CSS::uno::Reference< CSS::io::XOutputStream > m_xBuffer;
void serialize_node(const CSS::uno::Reference< CSS::xml::dom::XNode >& aNode);
void serialize_nodeset();
diff --git a/forms/source/xforms/submission/submission_put.cxx b/forms/source/xforms/submission/submission_put.cxx
index 9ed37470ba93..02bd1f485091 100644
--- a/forms/source/xforms/submission/submission_put.cxx
+++ b/forms/source/xforms/submission/submission_put.cxx
@@ -35,6 +35,7 @@
#include "serialization_urlencoded.hxx"
#include <osl/file.hxx>
+#include <tools/diagnose_ex.h>
#include <unotools/processfactory.hxx>
#include <ucbhelper/content.hxx>
@@ -58,7 +59,8 @@ CSubmission::SubmissionResult CSubmissionPut::submit(const CSS::uno::Reference<
CSS::uno::Reference< XCommandEnvironment > aEnvironment;
auto_ptr< CSerialization > apSerialization(createSerialization(aInteractionHandler,aEnvironment));
- try {
+ try
+ {
ucbhelper::Content aContent(m_aURLObj.GetMainURL(INetURLObject::NO_DECODE), aEnvironment);
// insert serialized data to content -> PUT
@@ -68,10 +70,10 @@ CSubmission::SubmissionResult CSubmissionPut::submit(const CSS::uno::Reference<
// no content as a result of put...
- } catch (Exception&)
+ }
+ catch ( const Exception& )
{
- // XXX
- OSL_ENSURE(sal_False, "Exception during UCB operatration.");
+ DBG_UNHANDLED_EXCEPTION();
return UNKNOWN_ERROR;
}
diff --git a/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java b/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java
index e03323c6ebbc..cd9b0771fc4e 100644
--- a/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java
+++ b/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java
@@ -16,7 +16,10 @@ import com.sun.star.sdbc.SQLException;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.wizards.common.Desktop;
import com.sun.star.wizards.common.NamedValueCollection;
+import com.sun.star.wizards.common.Properties;
import com.sun.star.wizards.ui.WizardDialog;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -73,4 +76,84 @@ public abstract class DatabaseObjectWizard extends WizardDialog
Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, null, ex );
}
}
+
+ protected static void executeWizardFromCommandLine( final String i_args[], final String i_className )
+ {
+ final String settings[] = new String[] { null, null, null };
+ final int IDX_PIPE_NAME = 0;
+ final int IDX_LOCATION = 1;
+ final int IDX_DSN = 2;
+
+ // some simple parsing
+ boolean failure = false;
+ int settingsIndex = -1;
+ for ( int i=0; i<i_args.length; ++i )
+ {
+ if ( settingsIndex >= 0 )
+ {
+ settings[ settingsIndex ] = i_args[i];
+ settingsIndex = -1;
+ continue;
+ }
+
+ if ( i_args[i].equals( "--pipe-name" ) )
+ {
+ settingsIndex = IDX_PIPE_NAME;
+ continue;
+ }
+
+ if ( i_args[i].equals( "--database-location" ) )
+ {
+ settingsIndex = IDX_LOCATION;
+ continue;
+ }
+
+ if ( i_args[i].equals( "--data-source-name" ) )
+ {
+ settingsIndex = IDX_DSN;
+ continue;
+ }
+
+ failure = true;
+ }
+
+ if ( settings[ IDX_PIPE_NAME ] == null )
+ failure = true;
+
+ if ( ( settings[ IDX_DSN ] == null ) && ( settings[ IDX_LOCATION ] == null ) )
+ failure = true;
+
+ if ( failure )
+ {
+ System.err.println( "supported arguments: " );
+ System.err.println( " --pipe-name <name> : specifies the name of the pipe to connect to the running OOo instance" );
+ System.err.println( " --database-location <url> : specifies the URL of the database document to work with" );
+ System.err.println( " --data-source-name <name> : specifies the name of the data source to work with" );
+ return;
+ }
+
+ final String ConnectStr = "uno:pipe,name=" + settings[IDX_PIPE_NAME] + ";urp;StarOffice.ServiceManager";
+ try
+ {
+ final XMultiServiceFactory serviceFactory = Desktop.connect(ConnectStr);
+ if (serviceFactory != null)
+ {
+ PropertyValue[] curproperties = new PropertyValue[1];
+ if ( settings[ IDX_LOCATION ] != null )
+ curproperties[0] = Properties.createProperty( "DatabaseLocation", settings[ IDX_LOCATION ] );
+ else
+ curproperties[0] = Properties.createProperty( "DataSourceName", settings[ IDX_DSN ] );
+
+ final Class wizardClass = Class.forName( i_className );
+ final Constructor ctor = wizardClass.getConstructor( XMultiServiceFactory.class, PropertyValue[].class );
+ final Method invokeMethod = wizardClass.getMethod( "start", new Class[0] );
+ final Object wizardInstance = ctor.newInstance( serviceFactory, curproperties );
+ invokeMethod.invoke( wizardInstance );
+ }
+ }
+ catch (java.lang.Exception jexception)
+ {
+ jexception.printStackTrace(System.out);
+ }
+ }
}
diff --git a/wizards/com/sun/star/wizards/document/FormHandler.java b/wizards/com/sun/star/wizards/document/FormHandler.java
index 828ae4fc67f0..8ca665273d74 100644
--- a/wizards/com/sun/star/wizards/document/FormHandler.java
+++ b/wizards/com/sun/star/wizards/document/FormHandler.java
@@ -219,23 +219,21 @@ public class FormHandler
return xFormsSupplier.getForms();
}
- public String getValueofHiddenControl(XNameAccess xNamedForm, String ControlName, String sMsg) throws com.sun.star.wizards.document.FormHandler.UnknownHiddenControlException
+ public String getValueofHiddenControl(XNameAccess xNamedForm, String ControlName)
{
+ String value = "";
try
{
if (xNamedForm.hasByName(ControlName))
{
- return AnyConverter.toString(com.sun.star.wizards.common.Helper.getUnoPropertyValue(xNamedForm.getByName(ControlName), "HiddenValue"));
- }
- else
- {
- throw new UnknownHiddenControlException(xNamedForm, ControlName, sMsg);
+ value = AnyConverter.toString(com.sun.star.wizards.common.Helper.getUnoPropertyValue(xNamedForm.getByName(ControlName), "HiddenValue"));
}
}
- catch (Exception exception)
+ catch (Exception ex)
{
- throw new UnknownHiddenControlException(xNamedForm, ControlName, sMsg);
+ Logger.getLogger( FormHandler.class.getName() ).log( Level.SEVERE, null, ex );
}
+ return value;
}
public void insertHiddenControl(XNameAccess xNameAccess, XNameContainer xNamedForm, String ControlName, String ControlValue)
@@ -260,19 +258,6 @@ public class FormHandler
}
}
- public class UnknownHiddenControlException extends java.lang.Throwable
- {
-
- public UnknownHiddenControlException(XNameAccess xNamedForm, String ControlName, String sMsgHiddenControlisMissing)
- {
- XNamed xNamed = UnoRuntime.queryInterface(XNamed.class, xNamedForm);
- String FormName = xNamed.getName();
- sMsgHiddenControlisMissing = JavaTools.replaceSubString(sMsgHiddenControlisMissing, FormName, "<REPORTFORM>");
- sMsgHiddenControlisMissing = JavaTools.replaceSubString(sMsgHiddenControlisMissing, ControlName, "<CONTROLNAME>");
- SystemDialog.showMessageBox(xMSFDoc, "ErrorBox", VclWindowPeerAttribute.OK, sMsgHiddenControlisMissing);
- }
- }
-
public boolean hasFormByName(String _FormName)
{
xNamedFormContainer = getDocumentForms();
diff --git a/wizards/com/sun/star/wizards/form/CallFormWizard.java b/wizards/com/sun/star/wizards/form/CallFormWizard.java
index 543a521c6ce7..59b51e63bca7 100644
--- a/wizards/com/sun/star/wizards/form/CallFormWizard.java
+++ b/wizards/com/sun/star/wizards/form/CallFormWizard.java
@@ -85,7 +85,7 @@ public class CallFormWizard
if (sEvent.compareTo(PropertyNames.START) == 0)
{
FormWizard CurFormWizard = new FormWizard( m_serviceFactory, m_wizardContext );
- CurFormWizard.startFormWizard();
+ CurFormWizard.start();
}
}
catch (Exception exception)
diff --git a/wizards/com/sun/star/wizards/form/FormDocument.java b/wizards/com/sun/star/wizards/form/FormDocument.java
index f12455c264d5..2f331f40bcfd 100644
--- a/wizards/com/sun/star/wizards/form/FormDocument.java
+++ b/wizards/com/sun/star/wizards/form/FormDocument.java
@@ -389,7 +389,7 @@ public class FormDocument extends TextDocument
public void initialize(int _curArrangement, Short _NBorderType)
{
- boolean badaptControlStyles = false;
+ boolean adaptControlStyles = false;
xTextDocument.lockControllers();
curArrangement = _curArrangement;
if (oGridControl != null)
@@ -413,14 +413,14 @@ public class FormDocument extends TextDocument
if (curArrangement == FormWizard.AS_GRID)
{
insertGridControl(_NBorderType);
- badaptControlStyles = true;
+ adaptControlStyles = true;
}
else
{
- badaptControlStyles = !oFormController.areControlsexisting();
+ adaptControlStyles = !oFormController.areControlsexisting();
oFormController.positionControls(_curArrangement, aStartPoint, getAvailableFormSize(), curUIControlArranger.getAlignValue(), _NBorderType);
}
- if (badaptControlStyles)
+ if (adaptControlStyles)
{
curStyleApplier.applyStyle(false, true);
}
diff --git a/wizards/com/sun/star/wizards/form/FormWizard.java b/wizards/com/sun/star/wizards/form/FormWizard.java
index cff52f46229b..2d4b33b0992c 100644
--- a/wizards/com/sun/star/wizards/form/FormWizard.java
+++ b/wizards/com/sun/star/wizards/form/FormWizard.java
@@ -29,7 +29,6 @@ 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;
@@ -95,6 +94,11 @@ public class FormWizard extends DatabaseObjectWizard
}
}
+ public static void main(String i_args[])
+ {
+ executeWizardFromCommandLine( i_args, FormWizard.class.getName() );
+ }
+
// @Override
protected void enterStep(int nOldStep, int nNewStep)
{
@@ -334,7 +338,7 @@ public class FormWizard extends DatabaseObjectWizard
setCurrentRoadmapItemID((short) 1);
}
- public void startFormWizard()
+ public void start()
{
try
{
@@ -459,14 +463,14 @@ public class FormWizard extends DatabaseObjectWizard
private void toggleMainFormSteps()
{
curDBCommandFieldSelection.setModified(true);
- boolean benable = curDBCommandFieldSelection.getSelectedFieldNames().length > 0;
- enablefromStep(SOSUBFORM_PAGE, benable);
- setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benable));
- if (benable)
+ boolean enabled = curDBCommandFieldSelection.getSelectedFieldNames().length > 0;
+ enablefromStep(SOSUBFORM_PAGE, enabled);
+ setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, enabled);
+ if (enabled)
{
if (curFormConfiguration.hasSubForm())
{
- benable = toggleSubFormSteps();
+ enabled = toggleSubFormSteps();
}
else
{
@@ -474,7 +478,7 @@ public class FormWizard extends DatabaseObjectWizard
setStepEnabled(SOFIELDLINKER_PAGE, false);
}
}
- setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benable));
+ setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, enabled);
}
}
}
diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java
index 9f6f6d6160dd..bf1b165250c4 100644
--- a/wizards/com/sun/star/wizards/form/StyleApplier.java
+++ b/wizards/com/sun/star/wizards/form/StyleApplier.java
@@ -343,7 +343,7 @@ public class StyleApplier
String[] sPropList = JavaTools.ArrayoutofString(scurline, ":");
String sPropValue = sPropList[1];
sPropValue = sPropValue.trim();
- if (sPropValue.indexOf("#") > 0)
+ if (sPropValue.indexOf("#") > -1)
{
sPropValue = JavaTools.replaceSubString(sPropValue, PropertyNames.EMPTY_STRING, PropertyNames.SEMI_COLON);
sPropValue = JavaTools.replaceSubString(sPropValue, PropertyNames.EMPTY_STRING, PropertyNames.SPACE);
diff --git a/wizards/com/sun/star/wizards/query/CallQueryWizard.java b/wizards/com/sun/star/wizards/query/CallQueryWizard.java
index 84870f99646e..41ec462f46b4 100644
--- a/wizards/com/sun/star/wizards/query/CallQueryWizard.java
+++ b/wizards/com/sun/star/wizards/query/CallQueryWizard.java
@@ -93,7 +93,7 @@ public class CallQueryWizard
if (sEvent.compareTo(PropertyNames.START) == 0)
{
QueryWizard CurQueryWizard = new QueryWizard( m_serviceFactory, m_wizardContext );
- Command = CurQueryWizard.startQueryWizard();
+ Command = CurQueryWizard.start();
}
}
catch (Exception exception)
diff --git a/wizards/com/sun/star/wizards/query/QueryWizard.java b/wizards/com/sun/star/wizards/query/QueryWizard.java
index f4dd3296dbce..fb1fa8f6a0b8 100644
--- a/wizards/com/sun/star/wizards/query/QueryWizard.java
+++ b/wizards/com/sun/star/wizards/query/QueryWizard.java
@@ -36,10 +36,8 @@ 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.Desktop;
import com.sun.star.wizards.common.Helper;
import com.sun.star.wizards.common.JavaTools;
-import com.sun.star.wizards.common.Properties;
import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.common.Resource;
import com.sun.star.wizards.db.DatabaseObjectWizard;
@@ -90,90 +88,7 @@ public class QueryWizard extends DatabaseObjectWizard
public static void main(String i_args[])
{
- final String settings[] = new String[]
- {
- null, null, null
- };
- final int IDX_PIPE_NAME = 0;
- final int IDX_LOCATION = 1;
- final int IDX_DSN = 2;
-
- // some simple parsing
- boolean failure = false;
- int settingsIndex = -1;
- for (int i = 0; i < i_args.length; ++i)
- {
- if (settingsIndex >= 0)
- {
- settings[ settingsIndex] = i_args[i];
- settingsIndex = -1;
- continue;
- }
-
- if (i_args[i].equals("--pipe-name"))
- {
- settingsIndex = IDX_PIPE_NAME;
- continue;
- }
-
- if (i_args[i].equals("--database-location"))
- {
- settingsIndex = IDX_LOCATION;
- continue;
- }
-
- if (i_args[i].equals("--data-source-name"))
- {
- settingsIndex = IDX_DSN;
- continue;
- }
-
- failure = true;
- }
-
- if (settings[ IDX_PIPE_NAME] == null)
- {
- failure = true;
- }
-
- if ((settings[ IDX_DSN] == null) && (settings[ IDX_LOCATION] == null))
- {
- failure = true;
- }
-
- if (failure)
- {
- System.err.println("supported arguments: ");
- System.err.println(" --pipe-name <name> : specifies the name of the pipe to connect to the running OOo instance");
- System.err.println(" --database-location <url> : specifies the URL of the database document to work with");
- System.err.println(" --data-source-name <name> : specifies the name of the data source to work with");
- return;
- }
-
- final String ConnectStr = "uno:pipe,name=" + settings[IDX_PIPE_NAME] + ";urp;StarOffice.ServiceManager";
- try
- {
- final XMultiServiceFactory serviceFactory = Desktop.connect(ConnectStr);
- if (serviceFactory != null)
- {
- PropertyValue[] curproperties = new PropertyValue[1];
- if (settings[ IDX_LOCATION] != null)
- {
- curproperties[0] = Properties.createProperty("DatabaseLocation", settings[ IDX_LOCATION]);
- }
- else
- {
- curproperties[0] = Properties.createProperty("DataSourceName", settings[ IDX_DSN]);
- }
-
- QueryWizard CurQueryWizard = new QueryWizard(serviceFactory, curproperties);
- CurQueryWizard.startQueryWizard();
- }
- }
- catch (java.lang.Exception jexception)
- {
- jexception.printStackTrace(System.out);
- }
+ executeWizardFromCommandLine( i_args, QueryWizard.class.getName() );
}
public final XFrame getFrame()
@@ -181,7 +96,7 @@ public class QueryWizard extends DatabaseObjectWizard
return m_frame;
}
- public String startQueryWizard()
+ public String start()
{
try
{
@@ -463,7 +378,7 @@ public class QueryWizard extends DatabaseObjectWizard
}
catch (SQLException e)
{
- e.printStackTrace();
+ e.printStackTrace( System.err );
}
}
}
diff --git a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
index 6a79d0f37d84..28379de73909 100644
--- a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
+++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
@@ -224,24 +224,27 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
XNameContainer xNamedForms = getDoc().oFormHandler.getDocumentForms();
Object oDBForm = Helper.getUnoObjectbyName(xNamedForms, ReportWizard.SOREPORTFORMNAME);
boolean bgetConnection;
- String sQueryName = PropertyNames.EMPTY_STRING;
if (oDBForm != null)
{
String sMsg = sMsgHiddenControlMissing + (char) 13 + sMsgEndAutopilot;
XNameAccess xNamedForm = UnoRuntime.queryInterface( XNameAccess.class, oDBForm );
- getRecordParser().Command = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, PropertyNames.COMMAND, sMsg);
- String sCommandType = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, PropertyNames.COMMAND_TYPE, sMsg);
- String sGroupFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "GroupFieldNames", sMsg);
- String sFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "FieldNames", sMsg);
- final String sorting = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "Sorting", sMsg);
- String sRecordFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "RecordFieldNames", sMsg);
- if (xNamedForm.hasByName("QueryName"))
- {
- sQueryName = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "QueryName", sMsg);
- }
+ getRecordParser().Command = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, PropertyNames.COMMAND);
+ String sCommandType = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, PropertyNames.COMMAND_TYPE);
+ String sGroupFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "GroupFieldNames");
+ String sFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "FieldNames");
+ String sRecordFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "RecordFieldNames");
+
+ String sorting = PropertyNames.EMPTY_STRING;
+ if ( xNamedForm.hasByName( "Sorting" ) )
+ sorting = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "Sorting");
+
+ String sQueryName = PropertyNames.EMPTY_STRING;
+ if ( xNamedForm.hasByName( "QueryName" ) )
+ sQueryName = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "QueryName");
+
String[] sFieldNameList = JavaTools.ArrayoutofString(sFieldNames, PropertyNames.SEMI_COLON);
String[] sNewList = JavaTools.ArrayoutofString(sRecordFieldNames, PropertyNames.SEMI_COLON);
- if ( !PropertyNames.EMPTY_STRING.equals(sorting))
+ if ( sorting.length() > 0)
{
String[] sortList = JavaTools.ArrayoutofString(sorting, PropertyNames.SEMI_COLON);
ArrayList<String[]> aSortFields = new ArrayList<String[]>();
@@ -308,11 +311,6 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex );
return false;
}
- catch (com.sun.star.wizards.document.FormHandler.UnknownHiddenControlException ex)
- {
- Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex );
- return false;
- }
}
private boolean m_bStopProcess;