summaryrefslogtreecommitdiff
path: root/forms
diff options
context:
space:
mode:
Diffstat (limited to 'forms')
-rw-r--r--forms/inc/pch/precompiled_forms.hxx18
-rw-r--r--forms/prj/build.lst2
-rwxr-xr-xforms/qa/complex/forms/makefile.mk2
-rw-r--r--forms/qa/forms_all.sce1
-rw-r--r--forms/qa/integration/forms/DocumentViewHelper.java7
-rw-r--r--forms/qa/integration/forms/FormControlTest.java11
-rw-r--r--forms/qa/integration/forms/FormLayer.java48
-rw-r--r--forms/qa/integration/forms/FormPropertyBags.java10
-rw-r--r--forms/qa/integration/forms/ListBox.java290
-rw-r--r--forms/qa/integration/forms/ListSelection.java86
-rw-r--r--forms/qa/integration/forms/MasterDetailForms.java334
-rw-r--r--forms/qa/integration/forms/TestCase.java13
-rw-r--r--forms/qa/integration/forms/dbfTools.java9
-rw-r--r--forms/qa/org/openoffice/complex/forms/tools/ResultSet.java264
-rw-r--r--forms/source/component/Button.cxx14
-rw-r--r--forms/source/component/Button.hxx10
-rw-r--r--forms/source/component/Columns.cxx16
-rw-r--r--forms/source/component/ComboBox.cxx7
-rw-r--r--forms/source/component/ComboBox.hxx2
-rw-r--r--forms/source/component/Currency.cxx9
-rw-r--r--forms/source/component/Currency.hxx2
-rw-r--r--forms/source/component/DatabaseForm.cxx155
-rw-r--r--forms/source/component/Date.cxx7
-rw-r--r--forms/source/component/Date.hxx2
-rw-r--r--forms/source/component/Edit.cxx7
-rw-r--r--forms/source/component/Edit.hxx2
-rw-r--r--forms/source/component/FormComponent.cxx24
-rw-r--r--forms/source/component/FormattedField.cxx13
-rw-r--r--forms/source/component/FormattedField.hxx1
-rw-r--r--forms/source/component/ImageControl.cxx3
-rw-r--r--forms/source/component/ListBox.cxx21
-rw-r--r--forms/source/component/ListBox.hxx1
-rw-r--r--forms/source/component/Numeric.cxx7
-rw-r--r--forms/source/component/Numeric.hxx1
-rw-r--r--forms/source/component/Pattern.cxx7
-rw-r--r--forms/source/component/Pattern.hxx1
-rw-r--r--forms/source/component/Time.cxx7
-rw-r--r--forms/source/component/Time.hxx1
-rw-r--r--forms/source/component/clickableimage.cxx5
-rw-r--r--forms/source/cppugen/makefile.mk68
-rw-r--r--forms/source/helper/commanddescriptionprovider.cxx139
-rw-r--r--forms/source/helper/commandimageprovider.cxx180
-rw-r--r--forms/source/helper/formnavigation.cxx162
-rw-r--r--forms/source/helper/makefile.mk2
-rw-r--r--forms/source/inc/FormComponent.hxx106
-rw-r--r--forms/source/inc/commanddescriptionprovider.hxx68
-rw-r--r--forms/source/inc/commandimageprovider.hxx77
-rw-r--r--forms/source/inc/featuredispatcher.hxx12
-rw-r--r--forms/source/inc/formnavigation.hxx24
-rw-r--r--forms/source/inc/frm_resource.hrc2
-rw-r--r--forms/source/inc/frm_strings.hxx2
-rw-r--r--forms/source/inc/property.hrc2
-rw-r--r--forms/source/resource/frm_resource.cxx2
-rw-r--r--forms/source/richtext/parametrizedattributedispatcher.cxx4
-rw-r--r--forms/source/richtext/richtextcontrol.cxx33
-rw-r--r--forms/source/richtext/richtextcontrol.hxx3
-rw-r--r--forms/source/richtext/richtextengine.cxx6
-rw-r--r--forms/source/richtext/richtextimplcontrol.cxx29
-rw-r--r--forms/source/richtext/richtextmodel.cxx12
-rw-r--r--forms/source/richtext/richtextmodel.hxx3
-rw-r--r--forms/source/richtext/richtextvclcontrol.cxx6
-rw-r--r--forms/source/richtext/richtextvclcontrol.hxx4
-rw-r--r--forms/source/richtext/rtattributehandler.cxx4
-rw-r--r--forms/source/richtext/rtattributes.hxx2
-rw-r--r--forms/source/runtime/formoperations.cxx2
-rw-r--r--forms/source/runtime/formoperations.hxx20
-rw-r--r--forms/source/solar/component/navbarcontrol.cxx79
-rw-r--r--forms/source/solar/component/navbarcontrol.hxx22
-rw-r--r--forms/source/solar/control/navtoolbar.cxx254
-rw-r--r--forms/source/solar/inc/navtoolbar.hxx46
70 files changed, 2050 insertions, 745 deletions
diff --git a/forms/inc/pch/precompiled_forms.hxx b/forms/inc/pch/precompiled_forms.hxx
index 734020cc1613..402323630361 100644
--- a/forms/inc/pch/precompiled_forms.hxx
+++ b/forms/inc/pch/precompiled_forms.hxx
@@ -335,15 +335,15 @@
#include "svtools/cliplistener.hxx"
#include "svtools/imageresourceaccess.hxx"
-#include "svtools/inetstrm.hxx"
-#include "svtools/inettype.hxx"
-#include "svtools/itempool.hxx"
-#include "svtools/itemset.hxx"
-#include "svtools/languageoptions.hxx"
-#include "svtools/lingucfg.hxx"
-#include "svtools/numuno.hxx"
-#include "svtools/poolitem.hxx"
-#include "svtools/solar.hrc"
+#include "svl/inetstrm.hxx"
+#include "svl/inettype.hxx"
+#include "svl/itempool.hxx"
+#include "svl/itemset.hxx"
+#include "svl/languageoptions.hxx"
+#include "unotools/lingucfg.hxx"
+#include "svl/numuno.hxx"
+#include "svl/poolitem.hxx"
+#include "svl/solar.hrc"
#include "svtools/transfer.hxx"
#include "svx/editdata.hxx"
diff --git a/forms/prj/build.lst b/forms/prj/build.lst
index 3a4182b82c99..4e59eecd0365 100644
--- a/forms/prj/build.lst
+++ b/forms/prj/build.lst
@@ -1,4 +1,4 @@
-fm forms : l10n svx sfx2 ucb configmgr fileaccess QADEVOOO:qadevOOo NULL
+fm forms : l10n svx sfx2 QADEVOOO:qadevOOo NULL
fm forms usr1 - all fm_mkofrm NULL
fm forms\inc nmake - all fm_inc NULL
fm forms\source\inc get - all fm_sinc NULL
diff --git a/forms/qa/complex/forms/makefile.mk b/forms/qa/complex/forms/makefile.mk
index 7333c58e2381..2ed9c6a512d8 100755
--- a/forms/qa/complex/forms/makefile.mk
+++ b/forms/qa/complex/forms/makefile.mk
@@ -40,7 +40,7 @@ PACKAGE = complex$/forms
#----- compile .java files -----------------------------------------
-JARFILES = sandbox.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar mysql.jar
+JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar mysql.jar
JAVAFILES = CheckOGroupBoxModel.java
JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
diff --git a/forms/qa/forms_all.sce b/forms/qa/forms_all.sce
index 6b5344f60f6a..3aef2c95ecc1 100644
--- a/forms/qa/forms_all.sce
+++ b/forms/qa/forms_all.sce
@@ -5,3 +5,4 @@
-o integration.forms.ListSelection
-o integration.forms.MasterDetailForms
-o integration.forms.XMLFormSettings
+-o integration.forms.ListBox
diff --git a/forms/qa/integration/forms/DocumentViewHelper.java b/forms/qa/integration/forms/DocumentViewHelper.java
index f106ba070f8c..9f46e006609a 100644
--- a/forms/qa/integration/forms/DocumentViewHelper.java
+++ b/forms/qa/integration/forms/DocumentViewHelper.java
@@ -39,7 +39,7 @@ import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XIndexContainer;
import com.sun.star.form.FormComponentType;
import com.sun.star.form.XForm;
-import com.sun.star.form.XFormController;
+import com.sun.star.form.runtime.XFormController;
import com.sun.star.frame.XController;
import com.sun.star.frame.XDispatch;
import com.sun.star.frame.XDispatchProvider;
@@ -190,10 +190,9 @@ public class DocumentViewHelper
/* ------------------------------------------------------------------ */
/** retrieves the form controller for a given logical form
*/
- public XFormController getFormController( XPropertySet _form )
+ public XFormController getFormController( Object _form )
{
- XFormLayerAccess formLayerAccess = (XFormLayerAccess)query( XFormLayerAccess.class );
- return formLayerAccess.getFormController( (XForm)UnoRuntime.queryInterface( XForm.class, _form ) );
+ return getFormController( UnoRuntime.queryInterface( XForm.class, _form ));
}
/* ------------------------------------------------------------------ */
diff --git a/forms/qa/integration/forms/FormControlTest.java b/forms/qa/integration/forms/FormControlTest.java
index 91193ff479e5..d561ac28ef2c 100644
--- a/forms/qa/integration/forms/FormControlTest.java
+++ b/forms/qa/integration/forms/FormControlTest.java
@@ -33,7 +33,7 @@ import com.sun.star.awt.XImageProducer;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XNameAccess;
-import com.sun.star.form.XFormController;
+import com.sun.star.form.runtime.XFormController;
import com.sun.star.form.XImageProducerSupplier;
import com.sun.star.frame.XDispatch;
import com.sun.star.lang.EventObject;
@@ -52,6 +52,7 @@ import com.sun.star.util.URL;
import com.sun.star.util.XCloseable;
import com.sun.star.util.XURLTransformer;
import connectivity.tools.HsqlDatabase;
+import connectivity.tools.sdb.Connection;
import java.io.FileOutputStream;
@@ -609,8 +610,8 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE
/* ------------------------------------------------------------------ */
private boolean ensureTables() throws com.sun.star.uno.Exception, java.lang.Exception
{
- XConnection xConn = m_dataSource.getConnection( "", "" );
- assure( "could not connect to the data source", xConn != null );
+ Connection connection = new Connection( m_dataSource.getConnection( "", "" ) );
+ assure( "could not connect to the data source", connection != null );
// drop the table, if it already exists
if ( !implExecuteStatement( "DROP TABLE \"" + s_tableName + "\" IF EXISTS" )
@@ -630,10 +631,10 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE
return false;
}
- m_databaseDocument.getDataSource().refreshTables( xConn );
+ connection.refreshTables();
// do not need the connection anymore
- dbfTools.disposeComponent( xConn );
+ connection.close();
return true;
}
diff --git a/forms/qa/integration/forms/FormLayer.java b/forms/qa/integration/forms/FormLayer.java
index 032ca5e7331a..8d31542fe191 100644
--- a/forms/qa/integration/forms/FormLayer.java
+++ b/forms/qa/integration/forms/FormLayer.java
@@ -31,7 +31,6 @@ package integration.forms;
import com.sun.star.accessibility.XAccessible;
import com.sun.star.accessibility.XAccessibleEditableText;
-import com.sun.star.container.XNameAccess;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.beans.XPropertySet;
@@ -42,7 +41,9 @@ import com.sun.star.drawing.XControlShape;
import com.sun.star.drawing.XShapes;
import com.sun.star.awt.Size;
import com.sun.star.awt.Point;
+import com.sun.star.awt.VisualEffect;
import com.sun.star.awt.XControlModel;
+import com.sun.star.container.XNameAccess;
import com.sun.star.text.TextContentAnchorType;
import com.sun.star.drawing.XDrawPage;
@@ -95,12 +96,12 @@ public class FormLayer
the property access to the control's model
*/
public XPropertySet createControlAndShape( String sFormComponentService, int nXPos,
- int nYPos, int nWidth, int nHeight, XIndexContainer xParentForm ) throws java.lang.Exception
+ int nYPos, int nWidth, int nHeight, Object _parentForm ) throws java.lang.Exception
{
// let the document create a shape
- XMultiServiceFactory xDocAsFactory = (XMultiServiceFactory)UnoRuntime.queryInterface(
+ XMultiServiceFactory xDocAsFactory = UnoRuntime.queryInterface(
XMultiServiceFactory.class, m_document.getDocument() );
- XControlShape xShape = (XControlShape)UnoRuntime.queryInterface( XControlShape.class,
+ XControlShape xShape = UnoRuntime.queryInterface( XControlShape.class,
xDocAsFactory.createInstance( "com.sun.star.drawing.ControlShape" ) );
// position and size of the shape
@@ -114,13 +115,18 @@ public class FormLayer
// create the form component (the model of a form control)
String sQualifiedComponentName = "com.sun.star.form.component." + sFormComponentService;
- XControlModel xModel = (XControlModel)UnoRuntime.queryInterface( XControlModel.class,
+ XControlModel xModel = UnoRuntime.queryInterface( XControlModel.class,
m_document.getOrb().createInstance( sQualifiedComponentName ) );
// insert the model into the form component hierarchy, if the caller gave us a location
- if ( null != xParentForm )
+ if ( null != _parentForm )
{
- xParentForm.insertByIndex( xParentForm.getCount(), xModel );
+ XIndexContainer parentForm = null;
+ if ( _parentForm instanceof XIndexContainer )
+ parentForm = (XIndexContainer)_parentForm;
+ else
+ parentForm = UnoRuntime.queryInterface( XIndexContainer.class, _parentForm );
+ parentForm.insertByIndex( parentForm.getCount(), xModel );
}
// knitt them
@@ -129,7 +135,7 @@ public class FormLayer
// add the shape to the shapes collection of the document
XDrawPage pageWhereToInsert = ( m_page != null ) ? m_page : m_document.getMainDrawPage();
- XShapes xDocShapes = (XShapes)UnoRuntime.queryInterface( XShapes.class, pageWhereToInsert );
+ XShapes xDocShapes = UnoRuntime.queryInterface( XShapes.class, pageWhereToInsert );
xDocShapes.add( xShape );
// and outta here with the XPropertySet interface of the model
@@ -220,7 +226,7 @@ public class FormLayer
@return
the control model of the created data input field
*/
- public XPropertySet insertControlLine( String sControlType, String sFieldName, String sControlNamePostfix,
+ public XPropertySet insertControlLine( String sControlType, String sFieldName, String _controlNamePostfix,
int nXPos, int nYPos, int nHeight )
throws java.lang.Exception
{
@@ -231,12 +237,20 @@ public class FormLayer
// insert the text field control
XPropertySet xFieldModel = createControlAndShape( sControlType, nXPos + 26, nYPos, 40, nHeight );
xFieldModel.setPropertyValue( "DataField", sFieldName );
+ if ( xFieldModel.getPropertySetInfo().hasPropertyByName( "Border" ) )
+ {
+ xFieldModel.setPropertyValue( "Border", new Short( VisualEffect.FLAT ) );
+ if ( xFieldModel.getPropertySetInfo().hasPropertyByName( "BorderColor" ) )
+ xFieldModel.setPropertyValue( "BorderColor", new Integer( 0x00C0C0C0 ) );
+ }
// knit it to it's label component
xFieldModel.setPropertyValue( "LabelControl", xLabelModel );
// some names, so later on we can find them
- xLabelModel.setPropertyValue( "Name", sFieldName + sControlNamePostfix + "_Label" );
- xFieldModel.setPropertyValue( "Name", sFieldName + sControlNamePostfix );
+ if ( _controlNamePostfix == null )
+ _controlNamePostfix = "";
+ xLabelModel.setPropertyValue( "Name", sFieldName + _controlNamePostfix + "_Label" );
+ xFieldModel.setPropertyValue( "Name", sFieldName + _controlNamePostfix );
return xFieldModel;
}
@@ -256,7 +270,7 @@ public class FormLayer
public XPropertySet insertControlLine( String sControlType, String sFieldName, String sControlNamePostfix, int nYPos )
throws java.lang.Exception
{
- return insertControlLine( sControlType, sFieldName, sControlNamePostfix, 2, nYPos, 6 );
+ return insertControlLine( sControlType, sFieldName, sControlNamePostfix, 10, nYPos, 6 );
}
/* ------------------------------------------------------------------ */
@@ -270,8 +284,7 @@ public class FormLayer
*/
public XPropertySet getRadioModelByRefValue( XPropertySet form, String name, String refValue ) throws com.sun.star.uno.Exception, java.lang.Exception
{
- XIndexAccess indexAccess = (XIndexAccess)UnoRuntime.queryInterface( XIndexAccess.class,
- form );
+ XIndexAccess indexAccess = UnoRuntime.queryInterface( XIndexAccess.class, form );
for ( int i=0; i<indexAccess.getCount(); ++i )
{
@@ -295,8 +308,7 @@ public class FormLayer
*/
public XPropertySet getRadioModelByTag( XPropertySet form, String name, String tag ) throws com.sun.star.uno.Exception, java.lang.Exception
{
- XIndexAccess indexAccess = (XIndexAccess)UnoRuntime.queryInterface( XIndexAccess.class,
- form );
+ XIndexAccess indexAccess = UnoRuntime.queryInterface( XIndexAccess.class, form );
for ( int i=0; i<indexAccess.getCount(); ++i )
{
@@ -357,10 +369,10 @@ public class FormLayer
// doing a user input, as the latter will trigger a lot of notifications, which the forms runtime environment
// (namely the FormController) relies on to notice that the control changed.
// Instead, we use the Accessibility interfaces of the control to simulate text input
- XAccessible formattedAccessible = (XAccessible)UnoRuntime.queryInterface( XAccessible.class,
+ XAccessible formattedAccessible = UnoRuntime.queryInterface( XAccessible.class,
m_document.getCurrentView().getControl( controlModel )
);
- XAccessibleEditableText textAccess = (XAccessibleEditableText)UnoRuntime.queryInterface( XAccessibleEditableText.class,
+ XAccessibleEditableText textAccess = UnoRuntime.queryInterface( XAccessibleEditableText.class,
formattedAccessible.getAccessibleContext() );
textAccess.setText( text );
}
diff --git a/forms/qa/integration/forms/FormPropertyBags.java b/forms/qa/integration/forms/FormPropertyBags.java
index 4adb04796030..9558464f5b20 100644
--- a/forms/qa/integration/forms/FormPropertyBags.java
+++ b/forms/qa/integration/forms/FormPropertyBags.java
@@ -47,8 +47,6 @@ import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.util.XCloseable;
-import integration.forms.DocumentHelper;
-
public class FormPropertyBags extends complexlib.ComplexTestCase implements XPropertyChangeListener
{
private DocumentHelper m_document;
@@ -90,8 +88,7 @@ public class FormPropertyBags extends complexlib.ComplexTestCase implements XPro
{
if ( m_document != null )
{
- XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class,
- m_document.getDocument() );
+ XCloseable closeDoc = UnoRuntime.queryInterface( XCloseable.class, m_document.getDocument() );
closeDoc.close( true );
}
}
@@ -108,7 +105,7 @@ public class FormPropertyBags extends complexlib.ComplexTestCase implements XPro
XPropertySet textFieldModel = m_formLayer.createControlAndShape( "DatabaseTextField", 10, 10, 25, 6 );
// check whether adding new properties is successful
- XPropertyContainer propContainer = (XPropertyContainer)UnoRuntime.queryInterface(
+ XPropertyContainer propContainer = UnoRuntime.queryInterface(
XPropertyContainer.class, textFieldModel );
assure("XPropertyContainer not supported!", propContainer != null );
@@ -166,8 +163,7 @@ public class FormPropertyBags extends complexlib.ComplexTestCase implements XPro
private void impl_checkPropertyPersistence() throws com.sun.star.uno.Exception
{
// store the document
- XStorable store = (XStorable)UnoRuntime.queryInterface( XStorable.class,
- m_document.getDocument() );
+ XStorable store = UnoRuntime.queryInterface( XStorable.class, m_document.getDocument() );
String documentURL = util.utils.getOfficeTemp( m_orb ) + "document.odt";
PropertyValue[] storeArguments = new PropertyValue[] { new PropertyValue() };
storeArguments[0].Name = "FilterName";
diff --git a/forms/qa/integration/forms/ListBox.java b/forms/qa/integration/forms/ListBox.java
new file mode 100644
index 000000000000..8fcec383c656
--- /dev/null
+++ b/forms/qa/integration/forms/ListBox.java
@@ -0,0 +1,290 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * 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 integration.forms;
+
+import com.sun.star.awt.XListBox;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XChild;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.form.ListSourceType;
+import com.sun.star.form.runtime.FormFeature;
+import com.sun.star.form.runtime.XFormController;
+import com.sun.star.form.runtime.XFormOperations;
+import com.sun.star.sdb.CommandType;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XParameters;
+import com.sun.star.sdbc.XPreparedStatement;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import connectivity.tools.HsqlColumnDescriptor;
+import connectivity.tools.HsqlDatabase;
+import connectivity.tools.HsqlTableDescriptor;
+import connectivity.tools.sdb.Connection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Vector;
+
+public class ListBox extends TestCase
+{
+ HsqlDatabase m_database = null;
+ private final String m_foreignKeyTableName = "foreign_keys";
+
+ public ListBox()
+ {
+ super( DocumentType.WRITER );
+ }
+
+ /* ------------------------------------------------------------------ */
+ public String[] getTestMethodNames()
+ {
+ return new String[] {
+ "checkForeignKeys"
+ };
+ }
+
+ /* ------------------------------------------------------------------ */
+ public void checkForeignKeys() throws com.sun.star.uno.Exception, java.lang.Exception
+ {
+ try
+ {
+ // create the form document
+ prepareDocument();
+
+ final XIndexAccess formsCollection = UnoRuntime.queryInterface( XIndexAccess.class,
+ m_document.getFormComponentTreeRoot() );
+ final XNameAccess form = UnoRuntime.queryInterface( XNameAccess.class, formsCollection.getByIndex(0) );
+
+ final DocumentViewHelper view = m_document.getCurrentView();
+ final XFormController formController = view.getFormController( form );
+ final XFormOperations formOperations = formController.getFormOperations();
+
+ // move through all records, and check that the display values in the list boxes are as expected
+ final String[][] fieldTypesDefinitions = impl_getFieldTypeDefinitions();
+ final String[] fieldTypes = fieldTypesDefinitions[0];
+
+ final String[] displayValues = impl_getDisplayValues();
+
+ formOperations.execute( FormFeature.MoveToFirst );
+ for ( int row=0; row<2; ++row )
+ {
+ StringBuffer failedFieldTypes = new StringBuffer();
+ for ( int i=0; i<fieldTypes.length; ++i )
+ {
+ final String columnFKName = fieldTypes[i] + "_fk";
+ Object listBoxModel = form.getByName( columnFKName );
+ XListBox listBoxControl = UnoRuntime.queryInterface( XListBox.class,
+ view.getControl( listBoxModel ) );
+ if ( !listBoxControl.getSelectedItem().equals( displayValues[row] ) )
+ {
+ if ( failedFieldTypes.length() > 0 )
+ failedFieldTypes.append( ", " );
+ failedFieldTypes.append( fieldTypes[i] );
+ }
+ }
+ /*assure( "The following field types do not work when used as bound list box fields: " + failedFieldTypes.toString() +
+ " (row " + row + ")", failedFieldTypes.length() == 0 );*/
+
+ formOperations.execute( FormFeature.MoveToNext );
+ }
+
+ }
+ finally
+ {
+ closeDocument();
+ }
+ }
+
+ /* ------------------------------------------------------------------ */
+ public void before() throws Exception, java.lang.Exception
+ {
+ super.before();
+ impl_createDatabase();
+ }
+
+ /* ------------------------------------------------------------------ */
+ protected void prepareDocument() throws com.sun.star.uno.Exception, java.lang.Exception
+ {
+ super.prepareDocument();
+ impl_createForm();
+ }
+
+ /* ------------------------------------------------------------------ */
+ private String[][] impl_getFieldTypeDefinitions()
+ {
+ return new String[][] {
+ new String[] {
+ "bigint", "boolean", "date", "decimal", "double", "float", "numeric", "time", "timestamp", "tinyint", "varchar"
+ },
+ new String[] {
+ null, null, null, "(10,2)", null, null, "(10,2)", null, null, null, "(50)"
+ }
+ };
+ }
+
+ /* ------------------------------------------------------------------ */
+ private String[] impl_getTypedValue( final String _asType, final int _rowNum ) throws SQLException
+ {
+ Map< String, String[] > valueMap = new HashMap< String, String[] >();
+ valueMap.put( "bigint", new String[] { "1111111111", "222222222" } );
+ valueMap.put( "boolean", new String[] { "false", "true" } );
+ valueMap.put( "date", new String[] { "2001-01-01", "2002-02-02" } );
+ valueMap.put( "decimal", new String[] { "1.11", "2.22" } );
+ valueMap.put( "double", new String[] { "1.11", "2.22" } );
+ valueMap.put( "float", new String[] { "1.11", "2.22" } );
+ valueMap.put( "numeric", new String[] { "1.11", "2.22" } );
+ valueMap.put( "time", new String[] { "01:01:01", "02:02:02" } );
+ valueMap.put( "timestamp", new String[] { "2001-01-01 01:01:01", "2002-02-02 02:02:02" } );
+ valueMap.put( "tinyint", new String[] { "1", "2" } );
+ valueMap.put( "varchar", new String[] { "first", "second" } );
+
+ return valueMap.get( _asType );
+ }
+
+ /* ------------------------------------------------------------------ */
+ private String[] impl_getDisplayValues()
+ {
+ return new String[] { "one", "two" };
+ }
+
+ /* ------------------------------------------------------------------ */
+ private void impl_createDatabase() throws java.lang.Exception
+ {
+ try
+ {
+ m_database = new HsqlDatabase( m_orb );
+ Connection connection = m_database.defaultConnection();
+ System.out.println( m_database.getDocumentURL() );
+
+ final String[][] fieldDefinitions = impl_getFieldTypeDefinitions();
+ final String[] keyTypes = fieldDefinitions[0];
+ final String[] keyCreationArgs = fieldDefinitions[1];
+
+ Vector< HsqlColumnDescriptor > foreignKeyColumns = new Vector< HsqlColumnDescriptor >();
+ foreignKeyColumns.add( new HsqlColumnDescriptor( "ID", "integer", HsqlColumnDescriptor.PRIMARY ) );
+
+ Vector< String[] > foreignKeyValues = new Vector< String[] >();
+
+ StringBuffer foreignKeyInsertSQL = new StringBuffer();
+ foreignKeyInsertSQL.append( "INSERT INTO \"" + m_foreignKeyTableName + "\" VALUES (?" );
+
+ final String[] displayValues = impl_getDisplayValues();
+
+ for ( int i=0; i<keyTypes.length; ++i )
+ {
+ final String tableName = keyTypes[i] + "_pk";
+ final String columnPKName = keyTypes[i] + "_pk";
+ final String columnFKName = keyTypes[i] + "_fk";
+ final String columnType = keyTypes[i] + ( keyCreationArgs[i] != null ? keyCreationArgs[i] : "" );
+ m_database.createTable( new HsqlTableDescriptor( tableName,
+ new HsqlColumnDescriptor[] {
+ new HsqlColumnDescriptor( columnPKName, columnType, HsqlColumnDescriptor.PRIMARY ),
+ new HsqlColumnDescriptor( "content", "varchar(50)" )
+ }
+ ) );
+
+ // insert a few rows
+ StringBuffer sql = new StringBuffer();
+ sql.append( "INSERT INTO \"" );
+ sql.append( tableName );
+ sql.append( "\" VALUES (?, ?)");
+ XPreparedStatement statement = connection.prepareStatement( sql.toString() );
+ XParameters statementParameters = UnoRuntime.queryInterface( XParameters.class, statement );
+
+ final String[] keyValues = impl_getTypedValue( keyTypes[i], 0 );
+
+ for ( int row=0; row<displayValues.length; ++row )
+ {
+ statementParameters.setString( 1, keyValues[row] );
+ statementParameters.setString( 2, displayValues[row] );
+ statement.execute();
+ }
+
+ // remember a column descriptor for later creation of the table with the foreign keys
+ foreignKeyColumns.add( new HsqlColumnDescriptor( columnFKName, columnType, HsqlColumnDescriptor.REQUIRED,
+ tableName, columnPKName ) );
+
+ // remember the data to fill into this table
+ foreignKeyValues.add( keyValues );
+ foreignKeyInsertSQL.append( ", ?" );
+ }
+
+ // create the table taking all those foreign keys
+ m_database.createTable( new HsqlTableDescriptor( m_foreignKeyTableName, foreignKeyColumns.toArray( new HsqlColumnDescriptor[0] ) ) );
+ // fill in some data
+ foreignKeyInsertSQL.append( ")" );
+ XPreparedStatement statement = connection.prepareStatement( foreignKeyInsertSQL.toString() );
+ XParameters statementParameters = UnoRuntime.queryInterface( XParameters.class, statement );
+ for ( int row=0; row<2; ++row )
+ {
+ statementParameters.setInt( 1, row );
+ for ( int i=0; i<keyTypes.length; ++i )
+ {
+ statementParameters.setString( i+2, foreignKeyValues.get(i)[row] );
+ }
+ statement.execute();
+ }
+
+ m_database.defaultConnection().refreshTables();
+ }
+ finally
+ {
+ if ( m_database != null )
+ m_database.store();
+ }
+ }
+
+ /* ------------------------------------------------------------------ */
+ private void impl_createForm() throws java.lang.Exception
+ {
+ // a single control for the ID field
+ XPropertySet controlModel = m_formLayer.insertControlLine( "DatabaseNumericField", "ID", null, 10, 10, 6 );
+ // bind the form to the foreign_keys table
+ XPropertySet form = dbfTools.queryPropertySet( dbfTools.getParent( controlModel, XChild.class ) );
+ form.setPropertyValue( "Command", m_foreignKeyTableName );
+ form.setPropertyValue( "CommandType", CommandType.TABLE );
+ form.setPropertyValue( "DataSourceName", m_database.getDocumentURL() );
+
+ // create list boxes for the different foreign keys
+ final String[][] fieldDefinitions = impl_getFieldTypeDefinitions();
+ final String[] fieldTypes = fieldDefinitions[0];
+ for ( int i=0; i<fieldTypes.length; ++i )
+ {
+ final String tableName = fieldTypes[i] + "_pk";
+ final String columnFKName = fieldTypes[i] + "_fk";
+ final String columnPKName = fieldTypes[i] + "_pk";
+ XPropertySet listBoxModel = m_formLayer.insertControlLine( "DatabaseListBox", columnFKName, null, 10, 20 + 10*i, 6 );
+ listBoxModel.setPropertyValue( "Dropdown", new Boolean( true ) );
+ listBoxModel.setPropertyValue( "ListSourceType", ListSourceType.SQL );
+ listBoxModel.setPropertyValue( "ListSource", new String[] { "SELECT \"content\", \"" + columnPKName +
+ "\" FROM \"" + tableName + "\"" } );
+ listBoxModel.setPropertyValue( "BoundColumn", new Short( (short)1 ) );
+ }
+
+ m_document.getCurrentView().toggleFormDesignMode();
+ }
+ }
diff --git a/forms/qa/integration/forms/ListSelection.java b/forms/qa/integration/forms/ListSelection.java
index 110380cc660f..818fc262e51c 100644
--- a/forms/qa/integration/forms/ListSelection.java
+++ b/forms/qa/integration/forms/ListSelection.java
@@ -30,7 +30,6 @@
package integration.forms;
import com.sun.star.uno.UnoRuntime;
-import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.beans.XPropertySet;
import com.sun.star.sheet.XSpreadsheet;
import com.sun.star.sheet.XSpreadsheets;
@@ -48,15 +47,10 @@ import com.sun.star.script.ScriptEventDescriptor;
import com.sun.star.accessibility.XAccessible;
import com.sun.star.accessibility.XAccessibleContext;
import com.sun.star.accessibility.XAccessibleSelection;
-import com.sun.star.accessibility.XAccessibleAction;
import com.sun.star.frame.XStorable;
-import integration.forms.DocumentHelper;
-
-public class ListSelection extends integration.forms.TestCase implements com.sun.star.awt.XItemListener
+public class ListSelection extends integration.forms.TestCase
{
- private final static boolean m_useJavaCallbacks = false;
-
/** Creates a new instance of ListSelection */
public ListSelection()
{
@@ -98,7 +92,7 @@ public class ListSelection extends integration.forms.TestCase implements com.sun
{
log.println( "Round " + ( i + 1 ) + " of " + runs );
prepareDocument();
- clickTheListBox();
+ impl_clickListBox();
synchronized( this ) { this.wait( 1000 ); }
closeDocument();
}
@@ -106,7 +100,7 @@ public class ListSelection extends integration.forms.TestCase implements com.sun
}
/* ------------------------------------------------------------------ */
- final protected void clickTheListBox()
+ final private void impl_clickListBox()
{
try
{
@@ -123,13 +117,6 @@ public class ListSelection extends integration.forms.TestCase implements com.sun
XAccessible.class, getListBoxControl( activeSheet ) );
XAccessibleContext context = accessibleListBox.getAccessibleContext();
- // open the popup of the list box (not really necessary, but to better
- // simlate user action ...)
-/* XAccessibleAction listBoxActions = (XAccessibleAction)UnoRuntime.queryInterface(
- XAccessibleAction.class, context );
- listBoxActions.doAccessibleAction( 0 );
-*/
-
// the first "accessible child" of a list box is its list
XAccessibleSelection accessibleList = (XAccessibleSelection)UnoRuntime.queryInterface(
XAccessibleSelection.class, context.getAccessibleChild( 1 ) );
@@ -158,7 +145,7 @@ public class ListSelection extends integration.forms.TestCase implements com.sun
}
/* ------------------------------------------------------------------ */
- final protected void createListenerScript()
+ final private void impl_setupListenerScript()
{
try
{
@@ -203,7 +190,7 @@ public class ListSelection extends integration.forms.TestCase implements com.sun
}
/* ------------------------------------------------------------------ */
- final protected void assignCallbackScript( XPropertySet controlModel, String interfaceName, String interfaceMethod, String scriptCode )
+ final private void impl_assignStarBasicScript( XPropertySet controlModel, String interfaceName, String interfaceMethod, String scriptCode )
{
try
{
@@ -240,8 +227,7 @@ public class ListSelection extends integration.forms.TestCase implements com.sun
protected void prepareDocument() throws com.sun.star.uno.Exception, java.lang.Exception
{
super.prepareDocument();
- if ( !m_useJavaCallbacks )
- createListenerScript();
+ impl_setupListenerScript();
SpreadsheetDocument document = (SpreadsheetDocument)m_document;
XSpreadsheets sheets = document.getSheets();
@@ -264,7 +250,7 @@ public class ListSelection extends integration.forms.TestCase implements com.sun
for ( int i = 0; i < 4; ++i )
{
XPropertySet buttonModel = m_formLayer.createControlAndShape( "CommandButton", 10, 10 + i * 10, 30, 8 );
- assignCallbackScript( buttonModel, "XActionListener", "actionPerformed", "document:default.callbacks.onButtonClicked" );
+ impl_assignStarBasicScript( buttonModel, "XActionListener", "actionPerformed", "document:default.callbacks.onButtonClicked" );
}
// and a list box
@@ -273,25 +259,15 @@ public class ListSelection extends integration.forms.TestCase implements com.sun
listBox.setPropertyValue( "StringItemList", newSheetNames );
listBox.setPropertyValue( "Name", "ListBox" );
- if ( !m_useJavaCallbacks )
- assignCallbackScript( listBox, "XItemListener", "itemStateChanged", "document:default.callbacks.onListBoxSelected" );
+ impl_assignStarBasicScript( listBox, "XItemListener", "itemStateChanged", "document:default.callbacks.onListBoxSelected" );
// clone this sheet
for ( short i = 1; i < newSheetNames.length; ++i )
- sheets.copyByName( newSheetNames[0], newSheetNames[i], (short)i );
+ sheets.copyByName( newSheetNames[0], newSheetNames[i], i );
// switch the thing to alive mode
m_document.getCurrentView().toggleFormDesignMode();
- // add to the list box control as item listener
- if ( m_useJavaCallbacks )
- {
- XControl control = m_document.getCurrentView().getControl( listBox );
- XListBox listBoxControl = (XListBox)UnoRuntime.queryInterface(
- XListBox.class, control );
- listBoxControl.addItemListener( this );
- }
-
try
{
XStorable storable = (XStorable)m_document.query( XStorable.class );
@@ -322,48 +298,4 @@ public class ListSelection extends integration.forms.TestCase implements com.sun
return (XListBox)UnoRuntime.queryInterface(
XListBox.class, m_document.getCurrentView().getControl( getListBoxModel( sheet ) ) );
}
-
- /* ------------------------------------------------------------------ */
- public void itemStateChanged( com.sun.star.awt.ItemEvent event ) throws com.sun.star.uno.RuntimeException
- {
- try
- {
- // get the selected string
- XControl control = (XControl)UnoRuntime.queryInterface( XControl.class,
- event.Source );
- XPropertySet model = dbfTools.queryPropertySet( control.getModel() );
- String[] entries = (String[])model.getPropertyValue( "StringItemList" );
- String selectedEntry = entries[ event.Selected ];
-
- // activate this sheet
- SpreadsheetDocument document = (SpreadsheetDocument)m_document;
- XSpreadsheet sheet = (XSpreadsheet)UnoRuntime.queryInterface(
- XSpreadsheet.class, document.getSheets().getByName( selectedEntry ) );
- XSpreadsheetView view = (XSpreadsheetView)m_document.getCurrentView().query( XSpreadsheetView.class );
- view.setActiveSheet( sheet );
-
- if ( m_useJavaCallbacks )
- {
- // after we switched to another sheet, we need to register at its list box
- // control, again. The reason is that controls exist as long as their sheet is active.
- XListBox listBoxControl = getListBoxControl( sheet );
- listBoxControl.addItemListener( this );
-
- // in the list box of this new sheet, select its name. Everything else
- // is way too confusing
- listBoxControl.selectItem( selectedEntry, true );
- // don't do it. It deadlocks :(
- }
- }
- catch( com.sun.star.uno.Exception e )
- {
- e.printStackTrace( System.err );
- }
- }
-
- /* ------------------------------------------------------------------ */
- public void disposing( com.sun.star.lang.EventObject rEvent ) throws com.sun.star.uno.RuntimeException
- {
- // not interested in by now
- }
}
diff --git a/forms/qa/integration/forms/MasterDetailForms.java b/forms/qa/integration/forms/MasterDetailForms.java
index 2b83a11dd223..3bf14aae70cd 100644
--- a/forms/qa/integration/forms/MasterDetailForms.java
+++ b/forms/qa/integration/forms/MasterDetailForms.java
@@ -30,67 +30,77 @@
package integration.forms;
+import com.sun.star.beans.NamedValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexContainer;
import java.lang.reflect.Method;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.beans.*;
import com.sun.star.container.XNameContainer;
+import com.sun.star.embed.XComponentSupplier;
+import com.sun.star.form.XGridColumnFactory;
+import com.sun.star.form.XGridFieldDataSupplier;
import com.sun.star.form.XLoadable;
-import com.sun.star.sdbc.*;
-
-import connectivity.tools.*;
+import com.sun.star.lang.XComponent;
+import com.sun.star.sdb.CommandType;
+import com.sun.star.sdb.XFormDocumentsSupplier;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XColumnLocate;
+import com.sun.star.ucb.Command;
+import com.sun.star.ucb.OpenMode;
+import com.sun.star.ucb.XCommandProcessor;
+import com.sun.star.uno.Type;
+import com.sun.star.util.XModifiable;
+import connectivity.tools.CRMDatabase;
+import connectivity.tools.HsqlColumnDescriptor;
+import connectivity.tools.HsqlDatabase;
+import connectivity.tools.HsqlTableDescriptor;
+import org.openoffice.complex.forms.tools.ResultSet;
public class MasterDetailForms extends complexlib.ComplexTestCase implements com.sun.star.form.XLoadListener
{
private XMultiServiceFactory m_orb;
- private HsqlDatabase m_databaseDocument;
private XPropertySet m_masterForm;
private XPropertySet m_detailForm;
- private XResultSet m_masterSet;
- private XResultSet m_detailSet;
- private XRow m_masterRow;
- private XRow m_detailRow;
+ private ResultSet m_masterResult;
+ private ResultSet m_detailResult;
- private Object m_waitForLoad;
- private boolean m_loaded;
+ final private Object m_waitForLoad = new Object();
+ private boolean m_loaded = false;
- /** Creates a new instance of ValueBinding */
+ /** Creates a new instance of MasterDetailForms */
public MasterDetailForms()
{
- m_loaded = false;
- m_waitForLoad = new Object();
}
/* ------------------------------------------------------------------ */
public String[] getTestMethodNames()
{
return new String[] {
- "checkMultipleKeys"
+ "checkMultipleKeys",
+ "checkDetailFormDefaults"
};
}
/* ------------------------------------------------------------------ */
- public String getTestObjectName()
+ public void before()
{
- return "Form Control Spreadsheet Cell Binding Test";
+ m_orb = (XMultiServiceFactory)param.getMSF();
}
/* ------------------------------------------------------------------ */
- public void before() throws java.lang.Exception
+ public String getTestObjectName()
{
- m_orb = (XMultiServiceFactory)param.getMSF();
- m_databaseDocument = new HsqlDatabase( m_orb );
- createTableStructure();
- createForms();
+ return "Form Control Spreadsheet Cell Binding Test";
}
/* ------------------------------------------------------------------ */
/** creates the table structure needed for the test
*/
- private void createTableStructure() throws SQLException
+ private void impl_createTableStructure( final HsqlDatabase _databaseDocument ) throws SQLException
{
HsqlColumnDescriptor[] masterColumns = {
new HsqlColumnDescriptor( "ID1", "INTEGER", HsqlColumnDescriptor.PRIMARY ),
@@ -103,46 +113,37 @@ public class MasterDetailForms extends complexlib.ComplexTestCase implements com
new HsqlColumnDescriptor( "FK_ID2", "INTEGER", HsqlColumnDescriptor.REQUIRED, "master", "ID2" ),
new HsqlColumnDescriptor( "name", "VARCHAR(50)" ),
};
- m_databaseDocument.createTable( new HsqlTableDescriptor( "master", masterColumns ) );
- m_databaseDocument.createTable( new HsqlTableDescriptor( "detail", detailColumns ) );
+ _databaseDocument.createTable( new HsqlTableDescriptor( "master", masterColumns ) );
+ _databaseDocument.createTable( new HsqlTableDescriptor( "detail", detailColumns ) );
- m_databaseDocument.executeSQL( "INSERT INTO \"master\" VALUES ( 1, 1, 'First Record' )" );
- m_databaseDocument.executeSQL( "INSERT INTO \"master\" VALUES ( 1, 2, 'Second Record' )" );
- m_databaseDocument.executeSQL( "INSERT INTO \"detail\" VALUES ( 1, 1, 1, 'record 1.1 (1)')");
- m_databaseDocument.executeSQL( "INSERT INTO \"detail\" VALUES ( 2, 1, 1, 'record 1.1 (2)')");
- m_databaseDocument.executeSQL( "INSERT INTO \"detail\" VALUES ( 3, 1, 2, 'record 1.2 (1)')");
+ _databaseDocument.executeSQL( "INSERT INTO \"master\" VALUES ( 1, 1, 'First Record' )" );
+ _databaseDocument.executeSQL( "INSERT INTO \"master\" VALUES ( 1, 2, 'Second Record' )" );
+ _databaseDocument.executeSQL( "INSERT INTO \"detail\" VALUES ( 1, 1, 1, 'record 1.1 (1)')");
+ _databaseDocument.executeSQL( "INSERT INTO \"detail\" VALUES ( 2, 1, 1, 'record 1.1 (2)')");
+ _databaseDocument.executeSQL( "INSERT INTO \"detail\" VALUES ( 3, 1, 2, 'record 1.2 (1)')");
- m_databaseDocument.getDataSource().refreshTables( m_databaseDocument.defaultConnection() );
+ _databaseDocument.defaultConnection().refreshTables();
}
/* ------------------------------------------------------------------ */
- public void createForms() throws com.sun.star.uno.Exception
+ private void impl_createForms( final HsqlDatabase _databaseDocument ) throws com.sun.star.uno.Exception
{
m_masterForm = dbfTools.queryPropertySet( m_orb.createInstance( "com.sun.star.form.component.DataForm" ) );
- m_masterRow = (XRow)UnoRuntime.queryInterface( XRow.class, m_masterForm );
- m_masterSet = (XResultSet)UnoRuntime.queryInterface( XResultSet.class, m_masterForm );
- m_masterForm.setPropertyValue( "ActiveConnection", m_databaseDocument.defaultConnection() );
+ m_masterForm.setPropertyValue( "ActiveConnection", _databaseDocument.defaultConnection().getXConnection() );
m_masterForm.setPropertyValue( "CommandType", new Integer( com.sun.star.sdb.CommandType.TABLE ) );
m_masterForm.setPropertyValue( "Command", "master" );
+ m_masterResult = new ResultSet( m_masterForm );
+
m_detailForm = dbfTools.queryPropertySet( m_orb.createInstance( "com.sun.star.form.component.DataForm" ) );
- m_detailRow = (XRow)UnoRuntime.queryInterface( XRow.class, m_detailForm );
- m_detailSet = (XResultSet)UnoRuntime.queryInterface( XResultSet.class, m_detailForm );
- m_detailForm.setPropertyValue( "ActiveConnection", m_databaseDocument.defaultConnection() );
+ m_detailForm.setPropertyValue( "ActiveConnection", _databaseDocument.defaultConnection().getXConnection() );
m_detailForm.setPropertyValue( "CommandType", new Integer( com.sun.star.sdb.CommandType.TABLE ) );
m_detailForm.setPropertyValue( "Command", "detail" );
- XNameContainer masterContainer = (XNameContainer)UnoRuntime.queryInterface( XNameContainer.class,
- m_masterForm );
- masterContainer.insertByName( "slave", m_detailForm );
- }
+ m_detailResult = new ResultSet( m_detailForm );
- /* ------------------------------------------------------------------ */
- public void after() throws com.sun.star.uno.Exception, java.lang.Exception
- {
- m_databaseDocument.closeAndDelete();
- dbfTools.disposeComponent( m_masterForm );
- dbfTools.disposeComponent( m_detailForm );
+ XNameContainer masterContainer = UnoRuntime.queryInterface( XNameContainer.class, m_masterForm );
+ masterContainer.insertByName( "slave", m_detailForm );
}
/* ------------------------------------------------------------------ */
@@ -150,47 +151,211 @@ public class MasterDetailForms extends complexlib.ComplexTestCase implements com
*/
public void checkMultipleKeys() throws com.sun.star.uno.Exception, java.lang.Exception
{
- m_detailForm.setPropertyValue( "MasterFields", new String[] { "ID1", "ID2" } );
- m_detailForm.setPropertyValue( "DetailFields", new String[] { "FK_ID1", "FK_ID2" } );
+ HsqlDatabase databaseDocument = null;
+ try
+ {
+ databaseDocument = new HsqlDatabase( m_orb );
+ impl_createTableStructure( databaseDocument );
+ impl_createForms( databaseDocument );
+
+ m_detailForm.setPropertyValue( "MasterFields", new String[] { "ID1", "ID2" } );
+ m_detailForm.setPropertyValue( "DetailFields", new String[] { "FK_ID1", "FK_ID2" } );
- XLoadable loadMaster = (XLoadable)UnoRuntime.queryInterface( XLoadable.class, m_masterForm );
- XLoadable loadDetail = (XLoadable)UnoRuntime.queryInterface( XLoadable.class, m_detailForm );
- loadDetail.addLoadListener( this );
+ XLoadable loadMaster = UnoRuntime.queryInterface( XLoadable.class, m_masterForm );
+ XLoadable loadDetail = UnoRuntime.queryInterface( XLoadable.class, m_detailForm );
+ loadDetail.addLoadListener( this );
- // wait until the detail form is loaded
- operateMasterAndWaitForDetailForm( loadMaster.getClass().getMethod( "load", new Class[] {} ), loadMaster, new Object[] { } );
+ // wait until the detail form is loaded
+ operateMasterAndWaitForDetailForm( loadMaster.getClass().getMethod( "load", new Class[] {} ), loadMaster, new Object[] { } );
- // okay, now the master form should be on the first record
- assure( "wrong form state after loading (ID1)", m_masterRow.getInt(1) == 1 );
- assure( "wrong form state after loading (ID2)", m_masterRow.getInt(2) == 1 );
- assure( "wrong form state after loading (value)", m_masterRow.getString(3).equals( "First Record" ) );
+ // okay, now the master form should be on the first record
+ assure( "wrong form state after loading (ID1)", m_masterResult.getInt(1) == 1 );
+ assure( "wrong form state after loading (ID2)", m_masterResult.getInt(2) == 1 );
+ assure( "wrong form state after loading (value)", m_masterResult.getString(3).equals( "First Record" ) );
- // the "XResultSet.next" method
- Method methodNext = m_masterSet.getClass().getMethod( "next" , new Class[] {} );
+ // the "XResultSet.next" method
+ Method methodNext = m_masterResult.getClass().getMethod( "next" , new Class[] {} );
+
+ // the values in the linked fields should be identical
+ int expectedDetailRowCounts[] = { 2, 1 };
+ do
+ {
+ verifyColumnValueIdentity( "ID1", "FK_ID1" );
+ verifyColumnValueIdentity( "ID2", "FK_ID2" );
+
+ m_detailResult.last();
+ int masterPos = m_masterResult.getRow();
+ assure( "wrong number of records in detail form, for master form at pos " + masterPos,
+ ((Integer)m_detailForm.getPropertyValue( "RowCount" )).intValue() == expectedDetailRowCounts[ masterPos - 1 ] );
+
+ operateMasterAndWaitForDetailForm( methodNext, m_masterResult, new Object[] {} );
+ }
+ while ( !m_masterResult.isAfterLast() );
+ assure( "wrong number of records in master form", 2 == ((Integer)m_masterForm.getPropertyValue( "RowCount" )).intValue() );
+ }
+ finally
+ {
+ if ( databaseDocument != null )
+ databaseDocument.closeAndDelete();
+ impl_cleanUpStep();
+ }
+ }
+
+ /* ------------------------------------------------------------------ */
+ private final void impl_cleanUpStep()
+ {
+ if ( m_masterForm != null )
+ dbfTools.disposeComponent( m_masterForm );
+ if ( m_detailForm != null )
+ dbfTools.disposeComponent( m_detailForm );
+ m_masterForm = m_detailForm = null;
+ }
- // the values in the linked fields should be identical
- int expectedDetailRowCounts[] = { 2, 1 };
- do
+ /* ------------------------------------------------------------------ */
+ /** checks whether default values in detail forms work as expected.
+ *
+ * Effectively, this test case verifies the issues #i106574# and #i105235# did not creep back in.
+ */
+ public void checkDetailFormDefaults() throws Exception
+ {
+ CRMDatabase database = null;
+ XCommandProcessor subComponentCommands = null;
+ try
+ {
+ // create our standard CRM database document
+ database = new CRMDatabase( m_orb, true );
+
+ // create a form document therein
+ XFormDocumentsSupplier formDocSupp = UnoRuntime.queryInterface( XFormDocumentsSupplier.class, database.getDatabase().getModel() );
+ XMultiServiceFactory formFactory = UnoRuntime.queryInterface( XMultiServiceFactory.class, formDocSupp.getFormDocuments() );
+ NamedValue[] loadArgs = new NamedValue[] {
+ new NamedValue( "ActiveConnection", database.getConnection().getXConnection() ),
+ new NamedValue( "MediaType", "application/vnd.oasis.opendocument.text" )
+ };
+
+ subComponentCommands = UnoRuntime.queryInterface(
+ XCommandProcessor.class,
+ formFactory.createInstanceWithArguments( "com.sun.star.sdb.DocumentDefinition", loadArgs ) );
+ Command command = new Command();
+ command.Name = "openDesign";
+ command.Argument = new Short( OpenMode.DOCUMENT );
+
+ DocumentHelper subDocument = new DocumentHelper( m_orb,
+ UnoRuntime.queryInterface( XComponent.class,
+ subComponentCommands.execute( command, subComponentCommands.createCommandIdentifier(), null )
+ )
+ );
+ FormLayer formLayer = new FormLayer( subDocument );
+ XPropertySet controlModel = formLayer.insertControlLine( "DatabaseNumericField", "ID", "", 10 );
+ formLayer.insertControlLine( "DatabaseTextField", "Name", "", 20 );
+ formLayer.insertControlLine( "DatabaseTextField", "Description", "", 30 );
+
+ m_masterForm = (XPropertySet)dbfTools.getParent( controlModel, XPropertySet.class );
+ m_masterForm.setPropertyValue( "Command", "categories" );
+ m_masterForm.setPropertyValue( "CommandType", new Integer( CommandType.TABLE ) );
+
+ // create a detail form
+ m_detailForm = UnoRuntime.queryInterface( XPropertySet.class, subDocument.createSubForm( m_masterForm, "products" ) );
+ m_detailForm.setPropertyValue( "Command", "SELECT \"ID\", \"Name\", \"CategoryID\" FROM \"products\"" );
+ m_detailForm.setPropertyValue( "CommandType", new Integer( CommandType.COMMAND ) );
+ m_detailForm.setPropertyValue( "MasterFields", new String[] { "ID" } );
+ m_detailForm.setPropertyValue( "DetailFields", new String[] { "CategoryID" } );
+
+ // create a grid control in the detail form, with some columns
+ XPropertySet gridControlModel = formLayer.createControlAndShape( "GridControl", 20, 40, 130, 50, m_detailForm );
+ gridControlModel.setPropertyValue( "Name", "product list" );
+ XIndexContainer gridColumns = UnoRuntime.queryInterface( XIndexContainer.class, gridControlModel );
+ impl_createGridColumn( gridColumns, "TextField", "ID" );
+ XPropertySet nameColumn = impl_createGridColumn( gridColumns, "TextField", "Name" );
+ nameColumn.setPropertyValue( "Width", new Integer( 600 ) ); // 6 cm
+ nameColumn.setPropertyValue( "DefaultText", "default text" );
+
+ // go live
+ m_masterResult = new ResultSet( m_masterForm );
+ m_detailResult = new ResultSet( m_detailForm );
+
+ XLoadable loadDetail = UnoRuntime.queryInterface( XLoadable.class, m_detailForm );
+ loadDetail.addLoadListener( this );
+
+ subDocument.getCurrentView().toggleFormDesignMode();
+ impl_waitForLoadedEvent();
+
+ // now that we set up this, do the actual tests
+ // First, http://www.openoffice.org/issues/show_bug.cgi?id=105235 described the problem
+ // that default values in the sub form didn't work when the master form was navigated to a row
+ // for which no detail records were present, and the default of the column/control is the same
+ // as the last known value.
+
+ // so, take the current value of the "Name" column, and set it as default value ...
+ String defaultValue = m_detailResult.getString( 2 );
+ nameColumn.setPropertyValue( "DefaultText", defaultValue );
+ // ... then move to the second main form row ...
+ m_masterResult.absolute( 2 );
+ impl_waitForLoadedEvent();
+ // ... which should result in an empty sub form ...
+ assure( "test precondition not met: The second master form record is expected to have no detail records, " +
+ "else the test becomes meaningless", impl_isNewRecord( m_detailForm ) );
+ // ... and in the "Name" column having the proper text
+ String actualValue = (String)nameColumn.getPropertyValue( "Text" );
+ assureEquals( "#i105235#: default value in sub form not working (not propagated to column model)", defaultValue, actualValue );
+ // However, checking the column model's value alone is not enough - we need to ensure it is properly
+ // propagated to the control.
+ XGridFieldDataSupplier gridData = (XGridFieldDataSupplier)subDocument.getCurrentView().getControl(
+ gridControlModel, XGridFieldDataSupplier.class );
+ actualValue = (String)(gridData.queryFieldData( 0, Type.STRING )[1]);
+ assureEquals( "#i105235#: default value in sub form not working (not propagated to column)", defaultValue, actualValue );
+ }
+ finally
{
- verifyColumnValueIdentity( "ID1", "FK_ID1" );
- verifyColumnValueIdentity( "ID2", "FK_ID2" );
+ if ( subComponentCommands != null )
+ {
+ XComponentSupplier componentSupplier = UnoRuntime.queryInterface( XComponentSupplier.class, subComponentCommands );
+ XModifiable modifySubComponent = UnoRuntime.queryInterface( XModifiable.class, componentSupplier.getComponent() );
+ modifySubComponent.setModified( false );
+ Command command = new Command();
+ command.Name = "close";
+ subComponentCommands.execute( command, subComponentCommands.createCommandIdentifier(), null );
+ }
- m_detailSet.last();
- int masterPos = m_masterSet.getRow();
- assure( "wrong number of records in detail form, for master form at pos " + masterPos,
- ((Integer)m_detailForm.getPropertyValue( "RowCount" )).intValue() == expectedDetailRowCounts[ masterPos - 1 ] );
+ if ( database != null )
+ database.saveAndClose();
- operateMasterAndWaitForDetailForm( methodNext, m_masterSet, new Object[] {} );
+ impl_cleanUpStep();
}
- while ( !m_masterSet.isAfterLast() );
- assure( "wrong number of records in master form", 2 == ((Integer)m_masterForm.getPropertyValue( "RowCount" )).intValue() );
}
+ /* ------------------------------------------------------------------ */
+ private boolean impl_isNewRecord( final XPropertySet _rowSet )
+ {
+ boolean isNew = false;
+ try
+ {
+ isNew = ((Boolean)_rowSet.getPropertyValue( "IsNew" )).booleanValue();
+ }
+ catch ( Exception ex )
+ {
+ failed( "obtaining the IsNew property failed" );
+ }
+ return isNew;
+ }
+
+ /* ------------------------------------------------------------------ */
+ private XPropertySet impl_createGridColumn( final XIndexContainer _gridModel, final String _columnType, final String _boundField ) throws Exception
+ {
+ final XGridColumnFactory columnFactory = UnoRuntime.queryInterface( XGridColumnFactory.class, _gridModel );
+ XPropertySet column = columnFactory.createColumn( _columnType );
+ column.setPropertyValue( "DataField", _boundField );
+ column.setPropertyValue( "Name", _boundField );
+ column.setPropertyValue( "Label", _boundField );
+ _gridModel.insertByIndex( _gridModel.getCount(), column );
+ return column;
+ }
+
+ /* ------------------------------------------------------------------ */
/** executes an operation on the master, and waits until the detail form has been (re)loaded aferwards
*/
private void operateMasterAndWaitForDetailForm( Method _masterMethod, Object _masterInterface, Object[] _methodParameters ) throws SQLException
{
- m_loaded = false;
Object result;
try
{
@@ -205,28 +370,35 @@ public class MasterDetailForms extends complexlib.ComplexTestCase implements com
if ( !((Boolean)result).booleanValue() )
return;
+ impl_waitForLoadedEvent();
+ }
+
+ private void impl_waitForLoadedEvent()
+ {
synchronized( m_waitForLoad )
{
- if ( !m_loaded )
+ while ( !m_loaded )
{
try { m_waitForLoad.wait(); }
catch( java.lang.InterruptedException e ) { }
}
+ // reset the flag for the next time
+ m_loaded = false;
}
}
/** assures that the (integer) values in the given columns of our master and detail forms are identical
*/
- public void verifyColumnValueIdentity( String masterColName, String detailColName ) throws SQLException
+ private void verifyColumnValueIdentity( final String masterColName, final String detailColName ) throws SQLException
{
- XColumnLocate locateMasterCols = (XColumnLocate)UnoRuntime.queryInterface( XColumnLocate.class, m_masterForm );
- XColumnLocate locateDetailCols = (XColumnLocate)UnoRuntime.queryInterface( XColumnLocate.class, m_detailForm );
+ XColumnLocate locateMasterCols = UnoRuntime.queryInterface( XColumnLocate.class, m_masterForm );
+ XColumnLocate locateDetailCols = UnoRuntime.queryInterface( XColumnLocate.class, m_detailForm );
- int masterValue = m_masterRow.getInt( locateMasterCols.findColumn( masterColName ) );
- int detailValue = m_detailRow.getInt( locateDetailCols.findColumn( detailColName ) );
+ int masterValue = m_masterResult.getInt( locateMasterCols.findColumn( masterColName ) );
+ int detailValue = m_detailResult.getInt( locateDetailCols.findColumn( detailColName ) );
assure( "values in linked column pair " + detailColName + "->" + masterColName + " (" +
- detailValue + "->" + masterValue + ") do not match (master position: " + m_masterSet.getRow() + ")!",
+ detailValue + "->" + masterValue + ") do not match (master position: " + m_masterResult.getRow() + ")!",
masterValue == detailValue );
}
diff --git a/forms/qa/integration/forms/TestCase.java b/forms/qa/integration/forms/TestCase.java
index 1f019d6fa278..7ebcb56a54bd 100644
--- a/forms/qa/integration/forms/TestCase.java
+++ b/forms/qa/integration/forms/TestCase.java
@@ -30,11 +30,9 @@
package integration.forms;
-import com.sun.star.uno.*;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.util.XCloseable;
import com.sun.star.util.XModifiable;
-import integration.forms.DocumentType;
public abstract class TestCase extends complexlib.ComplexTestCase implements com.sun.star.lang.XEventListener
{
@@ -50,12 +48,23 @@ public abstract class TestCase extends complexlib.ComplexTestCase implements com
}
/* ------------------------------------------------------------------ */
+ public String getTestObjectName()
+ {
+ return this.getClass().getName();
+ }
+
+ /* ------------------------------------------------------------------ */
public void before() throws com.sun.star.uno.Exception, java.lang.Exception
{
m_orb = (XMultiServiceFactory)param.getMSF();
}
/* ------------------------------------------------------------------ */
+ public void after() throws com.sun.star.uno.Exception, java.lang.Exception
+ {
+ }
+
+ /* ------------------------------------------------------------------ */
/** closes our document, if we have an open one, via (simulated) user input
*/
protected void closeDocumentByUI()
diff --git a/forms/qa/integration/forms/dbfTools.java b/forms/qa/integration/forms/dbfTools.java
index 2f100a2c2128..8588cf8a0f55 100644
--- a/forms/qa/integration/forms/dbfTools.java
+++ b/forms/qa/integration/forms/dbfTools.java
@@ -24,7 +24,7 @@ class dbfTools
*/
static public XPropertySet queryPropertySet( Object aComp )
{
- return (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, aComp );
+ return UnoRuntime.queryInterface( XPropertySet.class, aComp );
}
/* ------------------------------------------------------------------ */
@@ -32,7 +32,7 @@ class dbfTools
*/
static public XIndexContainer queryIndexContainer( Object aComp )
{
- return (XIndexContainer)UnoRuntime.queryInterface( XIndexContainer.class, aComp );
+ return UnoRuntime.queryInterface( XIndexContainer.class, aComp );
}
/* ------------------------------------------------------------------ */
@@ -40,15 +40,16 @@ class dbfTools
*/
static public XComponent queryComponent( Object aComp )
{
- return (XComponent)UnoRuntime.queryInterface( XComponent.class, aComp );
+ return UnoRuntime.queryInterface( XComponent.class, aComp );
}
/* ------------------------------------------------------------------ */
/** retrieves the parent of the given object
*/
+ @SuppressWarnings("unchecked")
static Object getParent( Object aComponent, Class aInterfaceClass )
{
- XChild xAsChild = (XChild)UnoRuntime.queryInterface( XChild.class, aComponent );
+ XChild xAsChild = UnoRuntime.queryInterface( XChild.class, aComponent );
return UnoRuntime.queryInterface( aInterfaceClass, xAsChild.getParent() );
}
};
diff --git a/forms/qa/org/openoffice/complex/forms/tools/ResultSet.java b/forms/qa/org/openoffice/complex/forms/tools/ResultSet.java
new file mode 100644
index 000000000000..7763afe6b262
--- /dev/null
+++ b/forms/qa/org/openoffice/complex/forms/tools/ResultSet.java
@@ -0,0 +1,264 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.openoffice.complex.forms.tools;
+
+import com.sun.star.container.XNameAccess;
+import com.sun.star.io.XInputStream;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XArray;
+import com.sun.star.sdbc.XBlob;
+import com.sun.star.sdbc.XClob;
+import com.sun.star.sdbc.XRef;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.sdbc.XRow;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.Date;
+import com.sun.star.util.DateTime;
+import com.sun.star.util.Time;
+
+/**
+ *
+ * @author frank.schoenheit@sun.com
+ */
+public class ResultSet implements XResultSet, XRow
+{
+ private final XResultSet m_resultSet;
+ private final XRow m_row;
+
+ public ResultSet( final Object _resultSet )
+ {
+ m_resultSet = (XResultSet)UnoRuntime.queryInterface( XResultSet.class, _resultSet );
+ m_row = (XRow)UnoRuntime.queryInterface( XRow.class, _resultSet );
+ }
+
+ public
+ boolean next() throws SQLException
+ {
+ return m_resultSet.next();
+ }
+
+ public
+ boolean isBeforeFirst() throws SQLException
+ {
+ return m_resultSet.isBeforeFirst();
+ }
+
+ public
+ boolean isAfterLast() throws SQLException
+ {
+ return m_resultSet.isAfterLast();
+ }
+
+ public
+ boolean isFirst() throws SQLException
+ {
+ return m_resultSet.isFirst();
+ }
+
+ public
+ boolean isLast() throws SQLException
+ {
+ return m_resultSet.isLast();
+ }
+
+ public
+ void beforeFirst() throws SQLException
+ {
+ m_resultSet.beforeFirst();
+ }
+
+ public
+ void afterLast() throws SQLException
+ {
+ m_resultSet.afterLast();
+ }
+
+ public
+ boolean first() throws SQLException
+ {
+ return m_resultSet.first();
+ }
+
+ public
+ boolean last() throws SQLException
+ {
+ return m_resultSet.last();
+ }
+
+ public
+ int getRow() throws SQLException
+ {
+ return m_resultSet.getRow();
+ }
+
+ public
+ boolean absolute( int _row ) throws SQLException
+ {
+ return m_resultSet.absolute( _row );
+ }
+
+ public
+ boolean relative( int _offset ) throws SQLException
+ {
+ return m_resultSet.relative( _offset );
+ }
+
+ public
+ boolean previous() throws SQLException
+ {
+ return m_resultSet.previous();
+ }
+
+ public
+ void refreshRow() throws SQLException
+ {
+ m_resultSet.refreshRow();
+ }
+
+ public
+ boolean rowUpdated() throws SQLException
+ {
+ return m_resultSet.rowUpdated();
+ }
+
+ public
+ boolean rowInserted() throws SQLException
+ {
+ return m_resultSet.rowInserted();
+ }
+
+ public
+ boolean rowDeleted() throws SQLException
+ {
+ return m_resultSet.rowDeleted();
+ }
+
+ public
+ Object getStatement() throws SQLException
+ {
+ return m_resultSet.getStatement();
+ }
+
+ public
+ boolean wasNull() throws SQLException
+ {
+ return m_row.wasNull();
+ }
+
+ public
+ String getString( int _colIndex ) throws SQLException
+ {
+ return m_row.getString( _colIndex );
+ }
+
+ public
+ boolean getBoolean( int _colIndex ) throws SQLException
+ {
+ return m_row.getBoolean( _colIndex );
+ }
+
+ public
+ byte getByte( int _colIndex ) throws SQLException
+ {
+ return m_row.getByte( _colIndex );
+ }
+
+ public
+ short getShort( int _colIndex ) throws SQLException
+ {
+ return m_row.getShort( _colIndex );
+ }
+
+ public
+ int getInt( int _colIndex ) throws SQLException
+ {
+ return m_row.getInt( _colIndex );
+ }
+
+ public
+ long getLong( int _colIndex ) throws SQLException
+ {
+ return m_row.getLong( _colIndex );
+ }
+
+ public
+ float getFloat( int _colIndex ) throws SQLException
+ {
+ return m_row.getFloat( _colIndex );
+ }
+
+ public
+ double getDouble( int _colIndex ) throws SQLException
+ {
+ return m_row.getDouble( _colIndex );
+ }
+
+ public
+ byte[] getBytes( int _colIndex ) throws SQLException
+ {
+ return m_row.getBytes( _colIndex );
+ }
+
+ public
+ Date getDate( int _colIndex ) throws SQLException
+ {
+ return m_row.getDate( _colIndex );
+ }
+
+ public
+ Time getTime( int _colIndex ) throws SQLException
+ {
+ return m_row.getTime( _colIndex );
+ }
+
+ public
+ DateTime getTimestamp( int _colIndex ) throws SQLException
+ {
+ return m_row.getTimestamp( _colIndex );
+ }
+
+ public
+ XInputStream getBinaryStream( int _colIndex ) throws SQLException
+ {
+ return m_row.getBinaryStream( _colIndex );
+ }
+
+ public
+ XInputStream getCharacterStream( int _colIndex ) throws SQLException
+ {
+ return m_row.getCharacterStream( _colIndex );
+ }
+
+ public
+ Object getObject( int _colIndex, XNameAccess _typeMap ) throws SQLException
+ {
+ return m_row.getObject( _colIndex, _typeMap );
+ }
+
+ public
+ XRef getRef( int _colIndex ) throws SQLException
+ {
+ return m_row.getRef( _colIndex );
+ }
+
+ public
+ XBlob getBlob( int _colIndex ) throws SQLException
+ {
+ return m_row.getBlob( _colIndex );
+ }
+
+ public
+ XClob getClob( int _colIndex ) throws SQLException
+ {
+ return m_row.getClob( _colIndex );
+ }
+
+ public
+ XArray getArray( int _colIndex ) throws SQLException
+ {
+ return m_row.getArray( _colIndex );
+ }
+}
diff --git a/forms/source/component/Button.cxx b/forms/source/component/Button.cxx
index 8907dcd82712..575f842da4d0 100644
--- a/forms/source/component/Button.cxx
+++ b/forms/source/component/Button.cxx
@@ -509,7 +509,7 @@ IMPL_LINK( OButtonControl, OnClick, void*, EMPTYARG )
void OButtonControl::actionPerformed_Impl( sal_Bool _bNotifyListener, const ::com::sun::star::awt::MouseEvent& _rEvt )
{
{
- sal_Int32 nFeatureId = -1;
+ sal_Int16 nFeatureId = -1;
{
::osl::MutexGuard aGuard( m_aMutex );
nFeatureId = m_nTargetUrlFeatureId;
@@ -636,7 +636,7 @@ sal_Bool SAL_CALL OButtonControl::setModel( const Reference< XControlModel >& _r
//------------------------------------------------------------------------------
void OButtonControl::modelFeatureUrlPotentiallyChanged( )
{
- sal_Int32 nOldUrlFeatureId = m_nTargetUrlFeatureId;
+ sal_Int16 nOldUrlFeatureId = m_nTargetUrlFeatureId;
// doe we have another TargetURL now? If so, we need to update our dispatches
m_nTargetUrlFeatureId = getModelUrlFeatureId( );
@@ -675,9 +675,9 @@ namespace
}
//------------------------------------------------------------------------------
-sal_Int32 OButtonControl::getModelUrlFeatureId( ) const
+sal_Int16 OButtonControl::getModelUrlFeatureId( ) const
{
- sal_Int32 nFeatureId = -1;
+ sal_Int16 nFeatureId = -1;
// some URL related properties of the model
::rtl::OUString sUrl;
@@ -717,14 +717,14 @@ void SAL_CALL OButtonControl::setDesignMode( sal_Bool _bOn ) throw( RuntimeExcep
}
//------------------------------------------------------------------------------
-void OButtonControl::getSupportedFeatures( ::std::vector< sal_Int32 >& /* [out] */ _rFeatureIds )
+void OButtonControl::getSupportedFeatures( ::std::vector< sal_Int16 >& /* [out] */ _rFeatureIds )
{
if ( -1 != m_nTargetUrlFeatureId )
_rFeatureIds.push_back( m_nTargetUrlFeatureId );
}
//------------------------------------------------------------------
-void OButtonControl::featureStateChanged( sal_Int32 _nFeatureId, sal_Bool _bEnabled )
+void OButtonControl::featureStateChanged( sal_Int16 _nFeatureId, sal_Bool _bEnabled )
{
if ( _nFeatureId == m_nTargetUrlFeatureId )
{
@@ -754,7 +754,7 @@ void OButtonControl::allFeatureStatesChanged( )
}
//------------------------------------------------------------------
-bool OButtonControl::isEnabled( sal_Int32 _nFeatureId ) const
+bool OButtonControl::isEnabled( sal_Int16 _nFeatureId ) const
{
if ( const_cast< OButtonControl* >( this )->isDesignMode() )
// TODO: the model property?
diff --git a/forms/source/component/Button.hxx b/forms/source/component/Button.hxx
index 5bbb7f387f85..3ca5154a9279 100644
--- a/forms/source/component/Button.hxx
+++ b/forms/source/component/Button.hxx
@@ -131,7 +131,7 @@ class OButtonControl :public OButtonControl_BASE
{
private:
sal_uInt32 m_nClickEvent;
- sal_Int32 m_nTargetUrlFeatureId;
+ sal_Int16 m_nTargetUrlFeatureId;
/// caches the value of the "Enabled" property of our model
sal_Bool m_bEnabledByPropertyValue;
@@ -176,10 +176,10 @@ public:
protected:
// OFormNavigationHelper overriables
- virtual void getSupportedFeatures( ::std::vector< sal_Int32 >& /* [out] */ _rFeatureIds );
- virtual void featureStateChanged( sal_Int32 _nFeatureId, sal_Bool _bEnabled );
+ virtual void getSupportedFeatures( ::std::vector< sal_Int16 >& /* [out] */ _rFeatureIds );
+ virtual void featureStateChanged( sal_Int16 _nFeatureId, sal_Bool _bEnabled );
virtual void allFeatureStatesChanged( );
- virtual bool isEnabled( sal_Int32 _nFeatureId ) const;
+ virtual bool isEnabled( sal_Int16 _nFeatureId ) const;
// XDispatchProviderInterception disambiguaiton
virtual void SAL_CALL registerDispatchProviderInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException);
@@ -198,7 +198,7 @@ private:
/** retrieves the feature id (see OFormNavigationHelper) of the TargetURL of
the model.
*/
- sal_Int32 getModelUrlFeatureId( ) const;
+ sal_Int16 getModelUrlFeatureId( ) const;
/** starts or stops listening for changes in model properties we're interested in
*/
diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx
index c307783f179b..29d6f1130509 100644
--- a/forms/source/component/Columns.cxx
+++ b/forms/source/component/Columns.cxx
@@ -342,7 +342,7 @@ void OGridColumn::clearAggregateProperties( Sequence< Property >& _rProps, sal_B
aForbiddenProperties.insert( PROPERTY_VSCROLL );
aForbiddenProperties.insert( PROPERTY_CONTROLLABEL );
aForbiddenProperties.insert( PROPERTY_RICH_TEXT );
- aForbiddenProperties.insert( PROPERTY_VERTICALALIGN );
+ aForbiddenProperties.insert( PROPERTY_VERTICAL_ALIGN );
aForbiddenProperties.insert( PROPERTY_IMAGE_URL );
aForbiddenProperties.insert( PROPERTY_IMAGE_POSITION );
aForbiddenProperties.insert( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableVisible" ) ) );
@@ -416,14 +416,14 @@ sal_Bool OGridColumn::convertFastPropertyValue( Any& rConvertedValue, Any& rOldV
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aWidth, ::getCppuType((const sal_Int32*)NULL));
break;
case PROPERTY_ID_ALIGN:
- try
+ bModified = tryPropertyValue( rConvertedValue, rOldValue, rValue, m_aAlign, ::getCppuType( (const sal_Int32*)NULL ) );
+ // strange enough, css.awt.TextAlign is a 32-bit integer, while the Align property (both here for grid controls
+ // and for ordinary toolkit controls) is a 16-bit integer. So, allow for 32 bit, but normalize it to 16 bit
+ if ( bModified )
{
- bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aAlign, ::getCppuType((const sal_Int16*)NULL));
- }
- catch(starlang::IllegalArgumentException&)
- {
- OSL_ENSURE(0,"OGridColumn::convertFastPropertyValue: TextAlign must be casted to sal_Int16!");
- throw;
+ sal_Int32 nAlign( 0 );
+ if ( rConvertedValue >>= nAlign )
+ rConvertedValue <<= (sal_Int16)nAlign;
}
break;
case PROPERTY_ID_HIDDEN:
diff --git a/forms/source/component/ComboBox.cxx b/forms/source/component/ComboBox.cxx
index 1d6d204ea977..432bc5124775 100644
--- a/forms/source/component/ComboBox.cxx
+++ b/forms/source/component/ComboBox.cxx
@@ -747,6 +747,13 @@ void SAL_CALL OComboBoxModel::reloaded( const EventObject& aEvent ) throw(Runtim
loadData( false );
}
+//------------------------------------------------------------------------------
+void OComboBoxModel::resetNoBroadcast()
+{
+ OBoundControlModel::resetNoBroadcast();
+ m_aLastKnownValue.clear();
+}
+
//-----------------------------------------------------------------------------
sal_Bool OComboBoxModel::commitControlValueToDbColumn( bool _bPostReset )
{
diff --git a/forms/source/component/ComboBox.hxx b/forms/source/component/ComboBox.hxx
index 835099a7637c..068f4fd97163 100644
--- a/forms/source/component/ComboBox.hxx
+++ b/forms/source/component/ComboBox.hxx
@@ -145,6 +145,8 @@ protected:
virtual ::com::sun::star::uno::Any
getDefaultForReset() const;
+ virtual void resetNoBroadcast();
+
// OEntryListHelper overriables
virtual void stringItemListChanged( ControlModelLock& _rInstanceLock );
virtual void connectedExternalListSource( );
diff --git a/forms/source/component/Currency.cxx b/forms/source/component/Currency.cxx
index 1b19b794d273..5af83ca2fba1 100644
--- a/forms/source/component/Currency.cxx
+++ b/forms/source/component/Currency.cxx
@@ -34,7 +34,7 @@
#include <tools/debug.hxx>
#include <unotools/localedatawrapper.hxx>
#include <vcl/svapp.hxx>
-#include <svtools/syslocale.hxx>
+#include <unotools/syslocale.hxx>
//.........................................................................
namespace frm
@@ -257,6 +257,13 @@ Any OCurrencyModel::getDefaultForReset() const
return aValue;
}
+//------------------------------------------------------------------------------
+void OCurrencyModel::resetNoBroadcast()
+{
+ OEditBaseModel::resetNoBroadcast();
+ m_aSaveValue.clear();
+}
+
//.........................................................................
} // namespace frm
//.........................................................................
diff --git a/forms/source/component/Currency.hxx b/forms/source/component/Currency.hxx
index 91eb109d6a14..3e968dcf3bc7 100644
--- a/forms/source/component/Currency.hxx
+++ b/forms/source/component/Currency.hxx
@@ -73,6 +73,8 @@ protected:
virtual ::com::sun::star::uno::Any
getDefaultForReset() const;
+ virtual void resetNoBroadcast();
+
protected:
DECLARE_XCLONEABLE();
diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx
index 96412feed10a..54225d6095a6 100644
--- a/forms/source/component/DatabaseForm.cxx
+++ b/forms/source/component/DatabaseForm.cxx
@@ -31,72 +31,71 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_forms.hxx"
-#include "componenttools.hxx"
-#include "DatabaseForm.hxx"
-#include "EventThread.hxx"
-#include "frm_module.hxx"
-#include "frm_resource.hrc"
-#include "frm_resource.hxx"
-#include "GroupManager.hxx"
-#include "property.hrc"
-#include "property.hxx"
-#include "services.hxx"
-
-#include <com/sun/star/awt/XControlContainer.hpp>
-#include <com/sun/star/awt/XTextComponent.hpp>
-#include <com/sun/star/form/DataSelectionType.hpp>
-#include <com/sun/star/form/FormComponentType.hpp>
-#include <com/sun/star/form/TabulatorCycle.hpp>
-#include <com/sun/star/frame/FrameSearchFlag.hpp>
-#include <com/sun/star/frame/XDispatch.hpp>
-#include <com/sun/star/frame/XDispatchProvider.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/io/XObjectInputStream.hpp>
-#include <com/sun/star/io/XObjectOutputStream.hpp>
-#include <com/sun/star/sdb/CommandType.hpp>
-#include <com/sun/star/sdb/RowSetVetoException.hpp>
-#include <com/sun/star/sdb/SQLContext.hpp>
-#include <com/sun/star/sdb/XColumnUpdate.hpp>
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/XRowSet.hpp>
-#include <com/sun/star/sdbcx/Privilege.hpp>
-#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
-#include <com/sun/star/util/XCancellable.hpp>
-#include <com/sun/star/util/XURLTransformer.hpp>
+#include "componenttools.hxx"
+#include "DatabaseForm.hxx"
+#include "EventThread.hxx"
+#include "frm_module.hxx"
+#include "frm_resource.hrc"
+#include "frm_resource.hxx"
+#include "GroupManager.hxx"
+#include "property.hrc"
+#include "property.hxx"
+#include "services.hxx"
+
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/awt/XTextComponent.hpp>
+#include <com/sun/star/form/DataSelectionType.hpp>
+#include <com/sun/star/form/FormComponentType.hpp>
+#include <com/sun/star/form/TabulatorCycle.hpp>
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/io/XObjectInputStream.hpp>
+#include <com/sun/star/io/XObjectOutputStream.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdb/RowSetVetoException.hpp>
+#include <com/sun/star/sdb/SQLContext.hpp>
+#include <com/sun/star/sdb/XColumnUpdate.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
+#include <com/sun/star/sdbc/ResultSetType.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <com/sun/star/sdbcx/Privilege.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/util/XCancellable.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/util/XModifiable2.hpp>
-
-#include <comphelper/basicio.hxx>
-#include <comphelper/container.hxx>
-#include <comphelper/enumhelper.hxx>
-#include <comphelper/extract.hxx>
-#include <comphelper/seqstream.hxx>
-#include <comphelper/sequence.hxx>
-#include <comphelper/stl_types.hxx>
-#include <comphelper/uno3.hxx>
-#include <connectivity/dbtools.hxx>
-#include <cppuhelper/exc_hlp.hxx>
-#include <cppuhelper/implbase2.hxx>
-#include <osl/mutex.hxx>
-#include <rtl/math.hxx>
-#include <rtl/tencinfo.h>
-#include <svtools/inetstrm.hxx>
-#include <svtools/inettype.hxx>
-#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
-#include <tools/fsys.hxx>
-#include <tools/inetmsg.hxx>
-#include <tools/urlobj.hxx>
-#include <unotools/ucblockbytes.hxx>
-#include <unotools/ucbstreamhelper.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/timer.hxx>
-#include <vos/mutex.hxx>
-
-#include <ctype.h>
-#include <hash_map>
-//#include <stdio.h>
+
+#include <comphelper/basicio.hxx>
+#include <comphelper/container.hxx>
+#include <comphelper/enumhelper.hxx>
+#include <comphelper/extract.hxx>
+#include <comphelper/seqstream.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/stl_types.hxx>
+#include <comphelper/uno3.hxx>
+#include <connectivity/dbtools.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <osl/mutex.hxx>
+#include <rtl/math.hxx>
+#include <rtl/tencinfo.h>
+#include <svl/inetstrm.hxx>
+#include <svl/inettype.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <tools/fsys.hxx>
+#include <tools/inetmsg.hxx>
+#include <tools/urlobj.hxx>
+#include <unotools/ucblockbytes.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/timer.hxx>
+#include <vos/mutex.hxx>
+
+#include <ctype.h>
+#include <hash_map>
// compatiblity: DatabaseCursorType is dead, but for compatiblity reasons we still have to write it ...
namespace com {
@@ -152,7 +151,6 @@ public:
DocumentModifyGuard( const Reference< XInterface >& _rxFormComponent )
:m_xDocumentModify( getXModel( _rxFormComponent ), UNO_QUERY )
{
- OSL_ENSURE( m_xDocumentModify.is(), "DocumentModifyGuard::DocumentModifyGuard: no document, or no XModifiable2!" );
impl_changeModifiableFlag_nothrow( false );
}
~DocumentModifyGuard()
@@ -2630,16 +2628,15 @@ void ODatabaseForm::impl_createLoadTimer()
//------------------------------------------------------------------------------
void SAL_CALL ODatabaseForm::loaded(const EventObject& /*aEvent*/) throw( RuntimeException )
{
- // now start the rowset listening to recover cursor events
- load_impl(sal_True);
{
- ::osl::MutexGuard aGuard(m_aMutex);
- Reference<XRowSet> xParentRowSet(m_xParent, UNO_QUERY);
- if (xParentRowSet.is())
- xParentRowSet->addRowSetListener(this);
+ ::osl::MutexGuard aGuard( m_aMutex );
+ Reference< XRowSet > xParentRowSet( m_xParent, UNO_QUERY_THROW );
+ xParentRowSet->addRowSetListener( this );
impl_createLoadTimer();
}
+
+ load_impl( sal_True );
}
//------------------------------------------------------------------------------
@@ -2647,12 +2644,14 @@ void SAL_CALL ODatabaseForm::unloading(const EventObject& /*aEvent*/) throw( Run
{
{
// now stop the rowset listening if we are a subform
- ::osl::MutexGuard aGuard(m_aMutex);
- DELETEZ(m_pLoadTimer);
+ ::osl::MutexGuard aGuard( m_aMutex );
- Reference<XRowSet> xParentRowSet(m_xParent, UNO_QUERY);
- if (xParentRowSet.is())
- xParentRowSet->removeRowSetListener(this);
+ if ( m_pLoadTimer && m_pLoadTimer->IsActive() )
+ m_pLoadTimer->Stop();
+ DELETEZ( m_pLoadTimer );
+
+ Reference< XRowSet > xParentRowSet( m_xParent, UNO_QUERY_THROW );
+ xParentRowSet->removeRowSetListener( this );
}
unload();
@@ -2880,7 +2879,7 @@ sal_Bool ODatabaseForm::implEnsureConnection()
}
catch( Exception )
{
- DBG_ERROR( "ODatabaseForm::implEnsureConnection: caught an exception which I cannot handle!" );
+ DBG_UNHANDLED_EXCEPTION();
}
return sal_False;
diff --git a/forms/source/component/Date.cxx b/forms/source/component/Date.cxx
index 33332ae82908..5d0d3f21ce7a 100644
--- a/forms/source/component/Date.cxx
+++ b/forms/source/component/Date.cxx
@@ -348,6 +348,13 @@ Any ODateModel::getDefaultForReset() const
}
//------------------------------------------------------------------------------
+void ODateModel::resetNoBroadcast()
+{
+ OEditBaseModel::resetNoBroadcast();
+ m_aSaveValue.clear();
+}
+
+//------------------------------------------------------------------------------
Sequence< Type > ODateModel::getSupportedBindingTypes()
{
return Sequence< Type >( &::getCppuType( static_cast< util::Date* >( NULL ) ), 1 );
diff --git a/forms/source/component/Date.hxx b/forms/source/component/Date.hxx
index 4c4e84e2822f..7eb1acfabf75 100644
--- a/forms/source/component/Date.hxx
+++ b/forms/source/component/Date.hxx
@@ -96,6 +96,8 @@ protected:
virtual ::com::sun::star::uno::Any
getDefaultForReset() const;
+ virtual void resetNoBroadcast();
+
virtual void onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm );
protected:
diff --git a/forms/source/component/Edit.cxx b/forms/source/component/Edit.cxx
index 0f4abd687d65..4eca9402fef8 100644
--- a/forms/source/component/Edit.cxx
+++ b/forms/source/component/Edit.cxx
@@ -675,6 +675,13 @@ sal_Bool OEditModel::approveDbColumnType( sal_Int32 _nColumnType )
}
//------------------------------------------------------------------------------
+void OEditModel::resetNoBroadcast()
+{
+ OEditBaseModel::resetNoBroadcast();
+ m_aLastKnownValue.clear();
+}
+
+//------------------------------------------------------------------------------
sal_Bool OEditModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
{
Any aNewValue( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) );
diff --git a/forms/source/component/Edit.hxx b/forms/source/component/Edit.hxx
index cb8d5c6300e4..774944eda939 100644
--- a/forms/source/component/Edit.hxx
+++ b/forms/source/component/Edit.hxx
@@ -118,6 +118,8 @@ protected:
virtual sal_Bool approveDbColumnType( sal_Int32 _nColumnType );
+ virtual void resetNoBroadcast();
+
protected:
virtual sal_uInt16 getPersistenceFlags() const;
diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx
index 3b6a6afaf5de..4a612642bbff 100644
--- a/forms/source/component/FormComponent.cxx
+++ b/forms/source/component/FormComponent.cxx
@@ -2216,7 +2216,7 @@ sal_Bool OBoundControlModel::approveDbColumnType(sal_Int32 _nColumnType)
|| (_nColumnType == DataType::LONGVARBINARY) || (_nColumnType == DataType::OTHER)
|| (_nColumnType == DataType::OBJECT) || (_nColumnType == DataType::DISTINCT)
|| (_nColumnType == DataType::STRUCT) || (_nColumnType == DataType::ARRAY)
- || (_nColumnType == DataType::BLOB) || (_nColumnType == DataType::CLOB)
+ || (_nColumnType == DataType::BLOB) /*|| (_nColumnType == DataType::CLOB)*/
|| (_nColumnType == DataType::REF) || (_nColumnType == DataType::SQLNULL))
return sal_False;
@@ -2266,14 +2266,6 @@ void OBoundControlModel::impl_connectDatabaseColumn_noNotify( bool _bFromReload
m_bLoaded = sal_True;
onConnectedDbColumn( xRowSet );
- // Some derived classes decide to cache the "current" (resp. "last known") control value, so operations like
- // commitControlValueToDbColumn can be made a no-op when nothing actually changed.
- // Normally, this cache is kept in sync with the column value, but during a reload, this synchronization is
- // temporarily disable. To allow the derived classes to update their cache from the current column value,
- // we call translateDbColumnToControlValue.
- if ( _bFromReload && hasField() )
- translateDbColumnToControlValue();
-
// initially transfer the db column value to the control, if we successfully connected to a database column
if ( hasField() )
initFromField( xRowSet );
@@ -2559,10 +2551,11 @@ void OBoundControlModel::reset() throw (RuntimeException)
|| ( nFieldType == DataType::VARBINARY )
|| ( nFieldType == DataType::LONGVARBINARY )
|| ( nFieldType == DataType::OBJECT )
- || ( nFieldType == DataType::BLOB )
- || ( nFieldType == DataType::CLOB )
+ /*|| ( nFieldType == DataType::CLOB )*/
)
m_xColumn->getBinaryStream();
+ else if ( nFieldType == DataType::BLOB )
+ m_xColumn->getBlob();
else
m_xColumn->getString();
@@ -2811,7 +2804,14 @@ void SAL_CALL OBoundControlModel::modified( const EventObject& _rEvent ) throw (
//--------------------------------------------------------------------
void OBoundControlModel::transferDbValueToControl( )
{
- setControlValue( translateDbColumnToControlValue(), eDbColumnBinding );
+ try
+ {
+ setControlValue( translateDbColumnToControlValue(), eDbColumnBinding );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
//------------------------------------------------------------------------------
diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx
index bc0e952f1735..77a108f300f9 100644
--- a/forms/source/component/FormattedField.cxx
+++ b/forms/source/component/FormattedField.cxx
@@ -42,8 +42,8 @@
#include <comphelper/numbers.hxx>
#include <connectivity/dbtools.hxx>
#include <connectivity/dbconversion.hxx>
-#include <svtools/zforlist.hxx>
-#include <svtools/numuno.hxx>
+#include <svl/zforlist.hxx>
+#include <svl/numuno.hxx>
#include <vcl/svapp.hxx>
#include <tools/debug.hxx>
#include <vcl/wintypes.hxx>
@@ -583,7 +583,7 @@ void OFormattedModel::_propertyChanged( const com::sun::star::beans::PropertyCha
// as m_aSaveValue (which is used by commitControlValueToDbColumn) is format dependent we have
// to recalc it, which is done by translateDbColumnToControlValue
- if ( m_xColumn.is() && m_xAggregateFastSet.is() )
+ if ( m_xColumn.is() && m_xAggregateFastSet.is() && !m_xCursor->isBeforeFirst() && !m_xCursor->isAfterLast())
{
setControlValue( translateDbColumnToControlValue(), eOther );
}
@@ -1248,6 +1248,13 @@ Any OFormattedModel::getDefaultForReset() const
return m_xAggregateSet->getPropertyValue( PROPERTY_EFFECTIVE_DEFAULT );
}
+//------------------------------------------------------------------------------
+void OFormattedModel::resetNoBroadcast()
+{
+ OEditBaseModel::resetNoBroadcast();
+ m_aSaveValue.clear();
+}
+
//.........................................................................
}
//.........................................................................
diff --git a/forms/source/component/FormattedField.hxx b/forms/source/component/FormattedField.hxx
index 0e728288aaba..4a25d10c5c81 100644
--- a/forms/source/component/FormattedField.hxx
+++ b/forms/source/component/FormattedField.hxx
@@ -141,6 +141,7 @@ namespace frm
virtual ::com::sun::star::uno::Any
getDefaultForReset() const;
+ virtual void resetNoBroadcast();
virtual void onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm );
virtual void onDisconnectedDbColumn();
diff --git a/forms/source/component/ImageControl.cxx b/forms/source/component/ImageControl.cxx
index 5d30c2776659..fbcc59271e00 100644
--- a/forms/source/component/ImageControl.cxx
+++ b/forms/source/component/ImageControl.cxx
@@ -65,7 +65,7 @@
#include <comphelper/extract.hxx>
#include <comphelper/guarding.hxx>
#include <unotools/ucbstreamhelper.hxx>
-#include <svtools/urihelper.hxx>
+#include <svl/urihelper.hxx>
#include <memory>
@@ -115,6 +115,7 @@ namespace
|| ( _nFieldType == DataType::OBJECT )
|| ( _nFieldType == DataType::BLOB )
|| ( _nFieldType == DataType::LONGVARCHAR )
+ || ( _nFieldType == DataType::CLOB )
)
return ImageStoreBinary;
diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx
index ec953f66c6f6..4bbf42381900 100644
--- a/forms/source/component/ListBox.cxx
+++ b/forms/source/component/ListBox.cxx
@@ -1003,23 +1003,23 @@ namespace frm
sal_Bool OListBoxModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
{
// current selektion list
- const ORowSetValue rCurrentValue( getFirstSelectedValue() );
- if ( rCurrentValue != m_aSaveValue )
+ const ORowSetValue aCurrentValue( getFirstSelectedValue() );
+ if ( aCurrentValue != m_aSaveValue )
{
- if ( rCurrentValue.isNull() )
+ if ( aCurrentValue.isNull() )
m_xColumnUpdate->updateNull();
else
{
try
{
- m_xColumnUpdate->updateObject( rCurrentValue.makeAny() );
+ m_xColumnUpdate->updateObject( aCurrentValue.makeAny() );
}
catch ( const Exception& )
{
return sal_False;
}
}
- m_aSaveValue = rCurrentValue;
+ m_aSaveValue = aCurrentValue;
}
return sal_True;
}
@@ -1037,10 +1037,10 @@ namespace frm
Sequence< sal_Int16 > aSelectionIndicies;
- // Bei NULL-Eintraegen Selektion aufheben!
ORowSetValue aCurrentValue;
- aCurrentValue.fill( xBoundField->getPropertyValue( PROPERTY_VALUE ) );
+ aCurrentValue.fill( getFieldType(), m_xColumn );
+ // reset selection for NULL values
if ( aCurrentValue.isNull() )
{
if ( m_nNULLPos != -1 )
@@ -1088,6 +1088,13 @@ namespace frm
}
//--------------------------------------------------------------------
+ void OListBoxModel::resetNoBroadcast()
+ {
+ OBoundControlModel::resetNoBroadcast();
+ m_aSaveValue.setNull();
+ }
+
+ //--------------------------------------------------------------------
void SAL_CALL OListBoxModel::disposing( const EventObject& _rSource ) throw ( RuntimeException )
{
if ( !OEntryListHelper::handleDisposing( _rSource ) )
diff --git a/forms/source/component/ListBox.hxx b/forms/source/component/ListBox.hxx
index 60bd63b3712d..308fb618e18a 100644
--- a/forms/source/component/ListBox.hxx
+++ b/forms/source/component/ListBox.hxx
@@ -157,6 +157,7 @@ protected:
virtual ::com::sun::star::uno::Any
getDefaultForReset() const;
+ virtual void resetNoBroadcast();
virtual ::com::sun::star::uno::Any
getCurrentFormComponentValue() const;
diff --git a/forms/source/component/Numeric.cxx b/forms/source/component/Numeric.cxx
index 2ec1f0cfcfdc..2eba2daae067 100644
--- a/forms/source/component/Numeric.cxx
+++ b/forms/source/component/Numeric.cxx
@@ -212,6 +212,13 @@ Any ONumericModel::getDefaultForReset() const
return aValue;
}
+//------------------------------------------------------------------------------
+void ONumericModel::resetNoBroadcast()
+{
+ OEditBaseModel::resetNoBroadcast();
+ m_aSaveValue.clear();
+}
+
//.........................................................................
} // namespace frm
//.........................................................................
diff --git a/forms/source/component/Numeric.hxx b/forms/source/component/Numeric.hxx
index 45b096afef50..5599707e86d5 100644
--- a/forms/source/component/Numeric.hxx
+++ b/forms/source/component/Numeric.hxx
@@ -72,6 +72,7 @@ protected:
virtual ::com::sun::star::uno::Any
getDefaultForReset() const;
+ virtual void resetNoBroadcast();
protected:
DECLARE_XCLONEABLE();
diff --git a/forms/source/component/Pattern.cxx b/forms/source/component/Pattern.cxx
index 64f5ea0e5e75..166522c18359 100644
--- a/forms/source/component/Pattern.cxx
+++ b/forms/source/component/Pattern.cxx
@@ -252,6 +252,13 @@ Any OPatternModel::getDefaultForReset() const
return makeAny( m_aDefaultText );
}
+//------------------------------------------------------------------------------
+void OPatternModel::resetNoBroadcast()
+{
+ OEditBaseModel::resetNoBroadcast();
+ m_aLastKnownValue.clear();
+}
+
//.........................................................................
} // namespace frm
//.........................................................................
diff --git a/forms/source/component/Pattern.hxx b/forms/source/component/Pattern.hxx
index 8b2bf3b878c2..9e0bc3b68d77 100644
--- a/forms/source/component/Pattern.hxx
+++ b/forms/source/component/Pattern.hxx
@@ -81,6 +81,7 @@ protected:
virtual ::com::sun::star::uno::Any
getDefaultForReset() const;
+ virtual void resetNoBroadcast();
protected:
DECLARE_XCLONEABLE();
diff --git a/forms/source/component/Time.cxx b/forms/source/component/Time.cxx
index 85ce1670572d..6a63724829d1 100644
--- a/forms/source/component/Time.cxx
+++ b/forms/source/component/Time.cxx
@@ -350,6 +350,13 @@ Any OTimeModel::getDefaultForReset() const
}
//------------------------------------------------------------------------------
+void OTimeModel::resetNoBroadcast()
+{
+ OEditBaseModel::resetNoBroadcast();
+ m_aSaveValue.clear();
+}
+
+//------------------------------------------------------------------------------
Sequence< Type > OTimeModel::getSupportedBindingTypes()
{
return Sequence< Type >( &::getCppuType( static_cast< util::Time* >( NULL ) ), 1 );
diff --git a/forms/source/component/Time.hxx b/forms/source/component/Time.hxx
index d2ba5381f466..7a7ce373b363 100644
--- a/forms/source/component/Time.hxx
+++ b/forms/source/component/Time.hxx
@@ -96,6 +96,7 @@ protected:
virtual ::com::sun::star::uno::Any
getDefaultForReset() const;
+ virtual void resetNoBroadcast();
virtual void onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm );
diff --git a/forms/source/component/clickableimage.cxx b/forms/source/component/clickableimage.cxx
index b9738ddd49ae..79d28727b5d5 100644
--- a/forms/source/component/clickableimage.cxx
+++ b/forms/source/component/clickableimage.cxx
@@ -435,6 +435,11 @@ namespace frm
// allowed to leave
throw;
}
+ catch( const WrappedTargetException& e )
+ {
+ // allowed to leave
+ throw;
+ }
catch( const Exception& e )
{
OSL_ENSURE( sal_False, "OClickableImageBaseControl::implSubmit: caught an unknown exception!" );
diff --git a/forms/source/cppugen/makefile.mk b/forms/source/cppugen/makefile.mk
deleted file mode 100644
index aa65a7122a33..000000000000
--- a/forms/source/cppugen/makefile.mk
+++ /dev/null
@@ -1,68 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2008 by Sun Microsystems, Inc.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# $RCSfile: makefile.mk,v $
-#
-# $Revision: 1.6 $
-#
-# 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=..$/..
-PRJINC=$(PRJ)$/source$/inc
-PRJNAME=forms
-TARGET=fm_cppugen
-
-# --- Settings ----------------------------------
-
-.INCLUDE : settings.mk
-.INCLUDE: $(PRJ)$/makefile.pmk
-
-# --- Types -------------------------------------
-
-
-
-# --- Types -------------------------------------
-
-UNOTYPES+= \
- com.sun.star.form.binding.XBindableValue \
- com.sun.star.form.binding.XValueBinding \
- com.sun.star.form.binding.XListEntrySink \
- com.sun.star.form.binding.XListEntrySource \
- com.sun.star.form.binding.XListEntryListener \
- com.sun.star.form.validation.XValidator \
- com.sun.star.form.validation.XValidatable \
- com.sun.star.form.validation.XValidityConstraintListener \
- com.sun.star.form.validation.XValidatableFormComponent \
- com.sun.star.form.submission.XSubmissionSupplier \
- com.sun.star.xforms.XModel \
- com.sun.star.xforms.XFormsSupplier \
- com.sun.star.xforms.XSubmission \
- com.sun.star.xsd.WhiteSpaceTreatment \
- com.sun.star.xsd.XDataType \
-
-# --- Targets ----------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/forms/source/helper/commanddescriptionprovider.cxx b/forms/source/helper/commanddescriptionprovider.cxx
new file mode 100644
index 000000000000..87692c5b5b82
--- /dev/null
+++ b/forms/source/helper/commanddescriptionprovider.cxx
@@ -0,0 +1,139 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* 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.
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_forms.hxx"
+
+#include "commanddescriptionprovider.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/namedvaluecollection.hxx>
+#include <tools/diagnose_ex.h>
+
+//........................................................................
+namespace frm
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ 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::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::frame::XModel;
+ using ::com::sun::star::container::XNameAccess;
+ using ::com::sun::star::frame::XModuleManager;
+ using ::com::sun::star::beans::PropertyValue;
+ /** === end UNO using === **/
+
+ //====================================================================
+ //= DefaultCommandDescriptionProvider
+ //====================================================================
+ class DefaultCommandDescriptionProvider : public ICommandDescriptionProvider
+ {
+ public:
+ DefaultCommandDescriptionProvider( const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument )
+ {
+ impl_init_nothrow( _rContext, _rxDocument );
+ }
+
+ ~DefaultCommandDescriptionProvider()
+ {
+ }
+
+ // ICommandDescriptionProvider
+ virtual ::rtl::OUString getCommandDescription( const ::rtl::OUString& _rCommandURL ) const;
+
+ private:
+ void impl_init_nothrow( const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument );
+
+ private:
+ Reference< XNameAccess > m_xCommandAccess;
+ };
+
+
+ //--------------------------------------------------------------------
+ void DefaultCommandDescriptionProvider::impl_init_nothrow( const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument )
+ {
+ OSL_ENSURE( _rxDocument.is(), "DefaultCommandDescriptionProvider::impl_init_nothrow: no document => no command descriptions!" );
+ if ( !_rxDocument.is() )
+ return;
+
+ try
+ {
+ Reference< XModuleManager > xModuleManager( _rContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW );
+ ::rtl::OUString sModuleID = xModuleManager->identify( _rxDocument );
+
+ Reference< XNameAccess > xUICommandDescriptions( _rContext.createComponent( "com.sun.star.frame.UICommandDescription" ), UNO_QUERY_THROW );
+ m_xCommandAccess.set( xUICommandDescriptions->getByName( sModuleID ), UNO_QUERY_THROW );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString DefaultCommandDescriptionProvider::getCommandDescription( const ::rtl::OUString& _rCommandURL ) const
+ {
+ if ( !m_xCommandAccess.is() )
+ return ::rtl::OUString();
+
+ try
+ {
+ ::comphelper::NamedValueCollection aCommandProperties( m_xCommandAccess->getByName( _rCommandURL ) );
+ return aCommandProperties.getOrDefault( "Name", ::rtl::OUString() );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return ::rtl::OUString();
+ }
+
+ //--------------------------------------------------------------------
+ PCommandDescriptionProvider createDocumentCommandDescriptionProvider(
+ const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument )
+ {
+ PCommandDescriptionProvider pDescriptionProvider( new DefaultCommandDescriptionProvider( _rContext, _rxDocument ) );
+ return pDescriptionProvider;
+ }
+
+//........................................................................
+} // namespace frm
+//........................................................................
diff --git a/forms/source/helper/commandimageprovider.cxx b/forms/source/helper/commandimageprovider.cxx
new file mode 100644
index 000000000000..7240a7073943
--- /dev/null
+++ b/forms/source/helper/commandimageprovider.cxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* 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.
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_forms.hxx"
+
+#include "commandimageprovider.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/ui/XImageManager.hpp>
+#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/ui/ImageType.hpp>
+/** === end UNO includes === **/
+
+#include <tools/diagnose_ex.h>
+
+//........................................................................
+namespace frm
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ 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::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::frame::XModel;
+ using ::com::sun::star::ui::XImageManager;
+ using ::com::sun::star::ui::XUIConfigurationManagerSupplier;
+ using ::com::sun::star::ui::XUIConfigurationManager;
+ using ::com::sun::star::ui::XModuleUIConfigurationManagerSupplier;
+ using ::com::sun::star::frame::XModuleManager;
+ using ::com::sun::star::graphic::XGraphic;
+ /** === end UNO using === **/
+ namespace ImageType = ::com::sun::star::ui::ImageType;
+
+ //====================================================================
+ //= DocumentCommandImageProvider
+ //====================================================================
+ class DocumentCommandImageProvider : public ICommandImageProvider
+ {
+ public:
+ DocumentCommandImageProvider( const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument )
+ {
+ impl_init_nothrow( _rContext, _rxDocument );
+ }
+ virtual ~DocumentCommandImageProvider()
+ {
+ }
+
+ // ICommandImageProvider
+ virtual CommandImages getCommandImages( const CommandURLs& _rCommandURLs, const bool _bLarge, const bool _bHiContrast ) const;
+
+ private:
+ void impl_init_nothrow( const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument );
+
+ private:
+ Reference< XImageManager > m_xDocumentImageManager;
+ Reference< XImageManager > m_xModuleImageManager;
+ };
+
+ //--------------------------------------------------------------------
+ void DocumentCommandImageProvider::impl_init_nothrow( const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument )
+ {
+ OSL_ENSURE( _rxDocument.is(), "DocumentCommandImageProvider::impl_init_nothrow: no document => no images!" );
+ if ( !_rxDocument.is() )
+ return;
+
+ // obtain the image manager of the document
+ try
+ {
+ Reference< XUIConfigurationManagerSupplier > xSuppUIConfig( _rxDocument, UNO_QUERY_THROW );
+ Reference< XUIConfigurationManager > xUIConfig( xSuppUIConfig->getUIConfigurationManager(), UNO_QUERY );
+ m_xDocumentImageManager.set( xUIConfig->getImageManager(), UNO_QUERY_THROW );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ // obtain the image manager or the module
+ try
+ {
+ Reference< XModuleManager > xModuleManager( _rContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW );
+ ::rtl::OUString sModuleID = xModuleManager->identify( _rxDocument );
+
+ Reference< XModuleUIConfigurationManagerSupplier > xSuppUIConfig(
+ _rContext.createComponent( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ), UNO_QUERY_THROW );
+ Reference< XUIConfigurationManager > xUIConfig(
+ xSuppUIConfig->getUIConfigurationManager( sModuleID ), UNO_SET_THROW );
+ m_xModuleImageManager.set( xUIConfig->getImageManager(), UNO_QUERY_THROW );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ CommandImages DocumentCommandImageProvider::getCommandImages( const CommandURLs& _rCommandURLs, const bool _bLarge, const bool _bHiContrast ) const
+ {
+ const size_t nCommandCount = _rCommandURLs.getLength();
+ CommandImages aImages( nCommandCount );
+ try
+ {
+ const sal_Int16 nImageType =
+ ( _bLarge ? ImageType::SIZE_LARGE : ImageType::SIZE_DEFAULT )
+ + ( _bHiContrast ? ImageType::COLOR_HIGHCONTRAST : ImageType::COLOR_NORMAL );
+
+ Sequence< Reference< XGraphic > > aDocImages( nCommandCount );
+ Sequence< Reference< XGraphic > > aModImages( nCommandCount );
+
+ // first try the document image manager
+ if ( m_xDocumentImageManager.is() )
+ aDocImages = m_xDocumentImageManager->getImages( nImageType, _rCommandURLs );
+
+ // then the module's image manager
+ if ( m_xModuleImageManager.is() )
+ aModImages = m_xModuleImageManager->getImages( nImageType, _rCommandURLs );
+
+ ENSURE_OR_THROW( (size_t)aDocImages.getLength() == nCommandCount, "illegal array size returned by getImages (document image manager)" );
+ ENSURE_OR_THROW( (size_t)aModImages.getLength() == nCommandCount, "illegal array size returned by getImages (module image manager)" );
+
+ for ( size_t i=0; i<nCommandCount; ++i )
+ {
+ if ( aDocImages[i].is() )
+ aImages[i] = Image( aDocImages[i] );
+ else
+ aImages[i] = Image( aModImages[i] );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return aImages;
+ }
+
+ //--------------------------------------------------------------------
+ PCommandImageProvider createDocumentCommandImageProvider(
+ const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument )
+ {
+ PCommandImageProvider pImageProvider( new DocumentCommandImageProvider( _rContext, _rxDocument ) );
+ return pImageProvider;
+ }
+
+//........................................................................
+} // namespace frm
+//........................................................................
diff --git a/forms/source/helper/formnavigation.cxx b/forms/source/helper/formnavigation.cxx
index 895b48a563f8..8f3d14df4657 100644
--- a/forms/source/helper/formnavigation.cxx
+++ b/forms/source/helper/formnavigation.cxx
@@ -33,12 +33,13 @@
#include "formnavigation.hxx"
#include "urltransformer.hxx"
#include "controlfeatureinterception.hxx"
-#include <tools/debug.hxx>
-#ifndef _SVX_SVXIDS_HRC
-#include <svx/svxids.hrc>
-#endif
#include "frm_strings.hxx"
+#include <com/sun/star/form/runtime/FormFeature.hpp>
+
+#include <tools/debug.hxx>
+
+
//.........................................................................
namespace frm
{
@@ -49,6 +50,7 @@ namespace frm
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::frame;
+ namespace FormFeature = ::com::sun::star::form::runtime::FormFeature;
//==================================================================
//= OFormNavigationHelper
@@ -83,7 +85,7 @@ namespace frm
}
//------------------------------------------------------------------
- void OFormNavigationHelper::featureStateChanged( sal_Int32 /*_nFeatureId*/, sal_Bool /*_bEnabled*/ )
+ void OFormNavigationHelper::featureStateChanged( sal_Int16 /*_nFeatureId*/, sal_Bool /*_bEnabled*/ )
{
// not interested in
}
@@ -270,12 +272,12 @@ namespace frm
if ( m_aSupportedFeatures.empty() )
{
// ask the derivee which feature ids it wants us to support
- ::std::vector< sal_Int32 > aFeatureIds;
+ ::std::vector< sal_Int16 > aFeatureIds;
getSupportedFeatures( aFeatureIds );
OFormNavigationMapper aUrlMapper( m_xORB );
- for ( ::std::vector< sal_Int32 >::const_iterator aLoop = aFeatureIds.begin();
+ for ( ::std::vector< sal_Int16 >::const_iterator aLoop = aFeatureIds.begin();
aLoop != aFeatureIds.end();
++aLoop
)
@@ -300,7 +302,7 @@ namespace frm
}
//------------------------------------------------------------------
- void OFormNavigationHelper::dispatchWithArgument( sal_Int32 _nFeatureId, const sal_Char* _pParamAsciiName,
+ void OFormNavigationHelper::dispatchWithArgument( sal_Int16 _nFeatureId, const sal_Char* _pParamAsciiName,
const Any& _rParamValue ) const
{
FeatureMap::const_iterator aInfo = m_aSupportedFeatures.find( _nFeatureId );
@@ -318,7 +320,7 @@ namespace frm
}
//------------------------------------------------------------------
- void OFormNavigationHelper::dispatch( sal_Int32 _nFeatureId ) const
+ void OFormNavigationHelper::dispatch( sal_Int16 _nFeatureId ) const
{
FeatureMap::const_iterator aInfo = m_aSupportedFeatures.find( _nFeatureId );
if ( m_aSupportedFeatures.end() != aInfo )
@@ -332,7 +334,7 @@ namespace frm
}
//------------------------------------------------------------------
- bool OFormNavigationHelper::isEnabled( sal_Int32 _nFeatureId ) const
+ bool OFormNavigationHelper::isEnabled( sal_Int16 _nFeatureId ) const
{
FeatureMap::const_iterator aInfo = m_aSupportedFeatures.find( _nFeatureId );
if ( m_aSupportedFeatures.end() != aInfo )
@@ -342,7 +344,7 @@ namespace frm
}
//------------------------------------------------------------------
- bool OFormNavigationHelper::getBooleanState( sal_Int32 _nFeatureId ) const
+ bool OFormNavigationHelper::getBooleanState( sal_Int16 _nFeatureId ) const
{
sal_Bool bState = sal_False;
@@ -354,7 +356,7 @@ namespace frm
}
//------------------------------------------------------------------
- ::rtl::OUString OFormNavigationHelper::getStringState( sal_Int32 _nFeatureId ) const
+ ::rtl::OUString OFormNavigationHelper::getStringState( sal_Int16 _nFeatureId ) const
{
::rtl::OUString sState;
@@ -366,7 +368,7 @@ namespace frm
}
//------------------------------------------------------------------
- sal_Int32 OFormNavigationHelper::getIntegerState( sal_Int32 _nFeatureId ) const
+ sal_Int32 OFormNavigationHelper::getIntegerState( sal_Int16 _nFeatureId ) const
{
sal_Int32 nState = 0;
@@ -382,7 +384,7 @@ namespace frm
{
disconnectDispatchers( );
// no supported features anymore:
- FeatureMap aEmpty;
+ FeatureMap aEmpty;
m_aSupportedFeatures.swap( aEmpty );
}
@@ -401,7 +403,7 @@ namespace frm
}
//------------------------------------------------------------------
- bool OFormNavigationMapper::getFeatureURL( sal_Int32 _nFeatureId, URL& /* [out] */ _rURL )
+ bool OFormNavigationMapper::getFeatureURL( sal_Int16 _nFeatureId, URL& /* [out] */ _rURL )
{
// get the ascii version of the URL
const char* pAsciiURL = getFeatureURLAscii( _nFeatureId );
@@ -412,84 +414,72 @@ namespace frm
}
//------------------------------------------------------------------
- const char* OFormNavigationMapper::getFeatureURLAscii( sal_Int32 _nFeatureId )
+ namespace
{
- const char* pAsciiURL = NULL;
-
- switch ( _nFeatureId )
+ struct FeatureURL
{
- case SID_FM_RECORD_ABSOLUTE : pAsciiURL = URL_FORM_POSITION; break;
- case SID_FM_RECORD_TOTAL : pAsciiURL = URL_FORM_RECORDCOUNT; break;
- case SID_FM_RECORD_FIRST : pAsciiURL = URL_RECORD_FIRST; break;
- case SID_FM_RECORD_PREV : pAsciiURL = URL_RECORD_PREV; break;
- case SID_FM_RECORD_NEXT : pAsciiURL = URL_RECORD_NEXT; break;
- case SID_FM_RECORD_LAST : pAsciiURL = URL_RECORD_LAST; break;
- case SID_FM_RECORD_SAVE : pAsciiURL = URL_RECORD_SAVE; break;
- case SID_FM_RECORD_UNDO : pAsciiURL = URL_RECORD_UNDO; break;
- case SID_FM_RECORD_NEW : pAsciiURL = URL_RECORD_NEW; break;
- case SID_FM_RECORD_DELETE : pAsciiURL = URL_RECORD_DELETE; break;
- case SID_FM_REFRESH : pAsciiURL = URL_FORM_REFRESH; break;
- case SID_FM_REFRESH_FORM_CONTROL: pAsciiURL = URL_FORM_REFRESH_CURRENT_CONTROL; break;
-
- case SID_FM_SORTUP : pAsciiURL = URL_FORM_SORT_UP; break;
- case SID_FM_SORTDOWN : pAsciiURL = URL_FORM_SORT_DOWN; break;
- case SID_FM_ORDERCRIT : pAsciiURL = URL_FORM_SORT; break;
- case SID_FM_AUTOFILTER : pAsciiURL = URL_FORM_AUTO_FILTER; break;
- case SID_FM_FILTERCRIT : pAsciiURL = URL_FORM_FILTER; break;
- case SID_FM_FORM_FILTERED : pAsciiURL = URL_FORM_APPLY_FILTER; break;
- case SID_FM_REMOVE_FILTER_SORT : pAsciiURL = URL_FORM_REMOVE_FILTER; break;
+ const sal_Int16 nFormFeature;
+ const sal_Char* pAsciiURL;
+
+ FeatureURL( const sal_Int16 _nFormFeature, const sal_Char* _pAsciiURL )
+ :nFormFeature( _nFormFeature )
+ ,pAsciiURL( _pAsciiURL )
+ {
+ }
};
- return pAsciiURL;
+ const FeatureURL* lcl_getFeatureTable()
+ {
+ static const FeatureURL s_aFeatureURLs[] =
+ {
+ FeatureURL( FormFeature::MoveAbsolute, URL_FORM_POSITION ),
+ FeatureURL( FormFeature::TotalRecords, URL_FORM_RECORDCOUNT ),
+ FeatureURL( FormFeature::MoveToFirst, URL_RECORD_FIRST ),
+ FeatureURL( FormFeature::MoveToPrevious, URL_RECORD_PREV ),
+ FeatureURL( FormFeature::MoveToNext, URL_RECORD_NEXT ),
+ FeatureURL( FormFeature::MoveToLast, URL_RECORD_LAST ),
+ FeatureURL( FormFeature::SaveRecordChanges, URL_RECORD_SAVE ),
+ FeatureURL( FormFeature::UndoRecordChanges, URL_RECORD_UNDO ),
+ FeatureURL( FormFeature::MoveToInsertRow, URL_RECORD_NEW ),
+ FeatureURL( FormFeature::DeleteRecord, URL_RECORD_DELETE ),
+ FeatureURL( FormFeature::ReloadForm, URL_FORM_REFRESH ),
+ FeatureURL( FormFeature::RefreshCurrentControl, URL_FORM_REFRESH_CURRENT_CONTROL ),
+ FeatureURL( FormFeature::SortAscending, URL_FORM_SORT_UP ),
+ FeatureURL( FormFeature::SortDescending, URL_FORM_SORT_DOWN ),
+ FeatureURL( FormFeature::InteractiveSort, URL_FORM_SORT ),
+ FeatureURL( FormFeature::AutoFilter, URL_FORM_AUTO_FILTER ),
+ FeatureURL( FormFeature::InteractiveFilter, URL_FORM_FILTER ),
+ FeatureURL( FormFeature::ToggleApplyFilter, URL_FORM_APPLY_FILTER ),
+ FeatureURL( FormFeature::RemoveFilterAndSort, URL_FORM_REMOVE_FILTER ),
+ FeatureURL( 0, NULL )
+ };
+ return s_aFeatureURLs;
+ }
+ }
+
+ //------------------------------------------------------------------
+ const char* OFormNavigationMapper::getFeatureURLAscii( sal_Int16 _nFeatureId )
+ {
+ const FeatureURL* pFeatures = lcl_getFeatureTable();
+ while ( pFeatures->pAsciiURL )
+ {
+ if ( pFeatures->nFormFeature == _nFeatureId )
+ return pFeatures->pAsciiURL;
+ ++pFeatures;
+ }
+ return NULL;
}
//------------------------------------------------------------------
- sal_Int32 OFormNavigationMapper::getFeatureId( const ::rtl::OUString& _rCompleteURL )
+ sal_Int16 OFormNavigationMapper::getFeatureId( const ::rtl::OUString& _rCompleteURL )
{
- sal_Int32 nFeatureId = -1;
-
- if ( _rCompleteURL == URL_FORM_POSITION )
- nFeatureId = SID_FM_RECORD_ABSOLUTE;
- else if ( _rCompleteURL == URL_FORM_RECORDCOUNT )
- nFeatureId = SID_FM_RECORD_TOTAL;
- else if ( _rCompleteURL == URL_RECORD_FIRST )
- nFeatureId = SID_FM_RECORD_FIRST;
- else if ( _rCompleteURL == URL_RECORD_PREV )
- nFeatureId = SID_FM_RECORD_PREV;
- else if ( _rCompleteURL == URL_RECORD_NEXT )
- nFeatureId = SID_FM_RECORD_NEXT;
- else if ( _rCompleteURL == URL_RECORD_LAST )
- nFeatureId = SID_FM_RECORD_LAST;
- else if ( _rCompleteURL == URL_RECORD_SAVE )
- nFeatureId = SID_FM_RECORD_SAVE;
- else if ( _rCompleteURL == URL_RECORD_UNDO )
- nFeatureId = SID_FM_RECORD_UNDO;
- else if ( _rCompleteURL == URL_RECORD_NEW )
- nFeatureId = SID_FM_RECORD_NEW;
- else if ( _rCompleteURL == URL_RECORD_DELETE )
- nFeatureId = SID_FM_RECORD_DELETE;
- else if ( _rCompleteURL == URL_FORM_REFRESH )
- nFeatureId = SID_FM_REFRESH;
- else if ( _rCompleteURL == URL_FORM_REFRESH_CURRENT_CONTROL )
- nFeatureId = SID_FM_REFRESH_FORM_CONTROL;
- else if ( _rCompleteURL == URL_FORM_SORT_UP )
- nFeatureId = SID_FM_SORTUP;
- else if ( _rCompleteURL == URL_FORM_SORT_DOWN )
- nFeatureId = SID_FM_SORTDOWN;
- else if ( _rCompleteURL == URL_FORM_SORT )
- nFeatureId = SID_FM_ORDERCRIT;
- else if ( _rCompleteURL == URL_FORM_AUTO_FILTER )
- nFeatureId = SID_FM_AUTOFILTER;
- else if ( _rCompleteURL == URL_FORM_FILTER )
- nFeatureId = SID_FM_FILTERCRIT;
- else if ( _rCompleteURL == URL_FORM_APPLY_FILTER )
- nFeatureId = SID_FM_FORM_FILTERED;
- else if ( _rCompleteURL == URL_FORM_REMOVE_FILTER )
- nFeatureId = SID_FM_REMOVE_FILTER_SORT;
-
- DBG_ASSERT( ( -1 == nFeatureId ) || _rCompleteURL.equalsAscii( getFeatureURLAscii( nFeatureId ) ),
- "OFormNavigationMapper::getFeatureId: inconsistent maps!" );
-
- return nFeatureId;
+ const FeatureURL* pFeatures = lcl_getFeatureTable();
+ while ( pFeatures->pAsciiURL )
+ {
+ if ( _rCompleteURL.compareToAscii( pFeatures->pAsciiURL ) == 0 )
+ return pFeatures->nFormFeature;
+ ++pFeatures;
+ }
+ return -1;
}
//.........................................................................
diff --git a/forms/source/helper/makefile.mk b/forms/source/helper/makefile.mk
index 5739d1fcb6d0..e451048dd0de 100644
--- a/forms/source/helper/makefile.mk
+++ b/forms/source/helper/makefile.mk
@@ -53,6 +53,8 @@ SLOFILES= $(SLO)$/formnavigation.obj \
$(SLO)$/urltransformer.obj \
$(SLO)$/windowstateguard.obj \
$(SLO)$/resettable.obj \
+ $(SLO)$/commandimageprovider.obj \
+ $(SLO)$/commanddescriptionprovider.obj \
# --- Targets ----------------------------------
diff --git a/forms/source/inc/FormComponent.hxx b/forms/source/inc/FormComponent.hxx
index 05c8ad587902..2cc91945ae3d 100644
--- a/forms/source/inc/FormComponent.hxx
+++ b/forms/source/inc/FormComponent.hxx
@@ -31,61 +31,61 @@
#ifndef _FORMS_FORMCOMPONENT_HXX_
#define _FORMS_FORMCOMPONENT_HXX_
-#include "cloneable.hxx"
-#include "ids.hxx"
-#include "property.hrc"
-#include "property.hxx"
-#include "propertybaghelper.hxx"
+#include "cloneable.hxx"
+#include "ids.hxx"
+#include "property.hrc"
+#include "property.hxx"
+#include "propertybaghelper.hxx"
#include "resettable.hxx"
-#include "services.hxx"
-#include "windowstateguard.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/awt/XControl.hpp>
-#include <com/sun/star/beans/XPropertyAccess.hpp>
-#include <com/sun/star/beans/XPropertyContainer.hpp>
-#include <com/sun/star/container/XChild.hpp>
-#include <com/sun/star/container/XNamed.hpp>
-#include <com/sun/star/form/binding/XBindableValue.hpp>
-#include <com/sun/star/form/FormComponentType.hpp>
-#include <com/sun/star/form/validation/XValidatableFormComponent.hpp>
-#include <com/sun/star/form/validation/XValidityConstraintListener.hpp>
-#include <com/sun/star/form/XBoundComponent.hpp>
-#include <com/sun/star/form/XBoundControl.hpp>
-#include <com/sun/star/form/XFormComponent.hpp>
-#include <com/sun/star/form/XLoadListener.hpp>
-#include <com/sun/star/form/XReset.hpp>
-#include <com/sun/star/io/XMarkableStream.hpp>
-#include <com/sun/star/io/XPersistObject.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/lang/XEventListener.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/sdb/XColumn.hpp>
-#include <com/sun/star/sdb/XColumnUpdate.hpp>
-#include <com/sun/star/sdb/XRowSetChangeListener.hpp>
-#include <com/sun/star/sdbc/XRowSet.hpp>
-#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
-#include <com/sun/star/uno/XAggregation.hpp>
-#include <com/sun/star/util/XCloneable.hpp>
+#include "services.hxx"
+#include "windowstateguard.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/form/binding/XBindableValue.hpp>
+#include <com/sun/star/form/FormComponentType.hpp>
+#include <com/sun/star/form/validation/XValidatableFormComponent.hpp>
+#include <com/sun/star/form/validation/XValidityConstraintListener.hpp>
+#include <com/sun/star/form/XBoundComponent.hpp>
+#include <com/sun/star/form/XBoundControl.hpp>
+#include <com/sun/star/form/XFormComponent.hpp>
+#include <com/sun/star/form/XLoadListener.hpp>
+#include <com/sun/star/form/XReset.hpp>
+#include <com/sun/star/io/XMarkableStream.hpp>
+#include <com/sun/star/io/XPersistObject.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/sdb/XColumn.hpp>
+#include <com/sun/star/sdb/XColumnUpdate.hpp>
+#include <com/sun/star/sdb/XRowSetChangeListener.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/uno/XAggregation.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
#include <com/sun/star/util/XModifyListener.hpp>
-#include <com/sun/star/form/XLoadable.hpp>
-/** === end UNO includes === **/
-
-#include <comphelper/componentcontext.hxx>
-#include <comphelper/propagg.hxx>
-#include <comphelper/propertybag.hxx>
-#include <comphelper/propmultiplex.hxx>
-#include <comphelper/sequence.hxx>
-#include <comphelper/uno3.hxx>
-#include <cppuhelper/component.hxx>
-#include <cppuhelper/implbase1.hxx>
-#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/implbase3.hxx>
-#include <cppuhelper/implbase4.hxx>
-#include <cppuhelper/implbase7.hxx>
-#include <osl/mutex.hxx>
-#include <rtl/ustring.hxx>
+#include <com/sun/star/form/XLoadable.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/propagg.hxx>
+#include <comphelper/propertybag.hxx>
+#include <comphelper/propmultiplex.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/component.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/implbase7.hxx>
+#include <osl/mutex.hxx>
+#include <rtl/ustring.hxx>
#include <memory>
diff --git a/forms/source/inc/commanddescriptionprovider.hxx b/forms/source/inc/commanddescriptionprovider.hxx
new file mode 100644
index 000000000000..64d28e2aabdc
--- /dev/null
+++ b/forms/source/inc/commanddescriptionprovider.hxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* 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.
+************************************************************************/
+
+#ifndef COMMANDDESCRIPTIONPROVIDER_HXX
+#define COMMANDDESCRIPTIONPROVIDER_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/frame/XModel.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/componentcontext.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+//........................................................................
+namespace frm
+{
+//........................................................................
+
+ //====================================================================
+ //= ICommandDescriptionProvider
+ //====================================================================
+ class SAL_NO_VTABLE ICommandDescriptionProvider
+ {
+ public:
+ virtual ::rtl::OUString getCommandDescription( const ::rtl::OUString& _rCommandURL ) const = 0;
+
+ virtual ~ICommandDescriptionProvider() { }
+ };
+
+ typedef ::boost::shared_ptr< const ICommandDescriptionProvider > PCommandDescriptionProvider;
+
+ //=====================================================================
+ //= factory
+ //=====================================================================
+ PCommandDescriptionProvider
+ createDocumentCommandDescriptionProvider(
+ const ::comphelper::ComponentContext& _rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxDocument
+ );
+
+//........................................................................
+} // namespace frm
+//........................................................................
+
+#endif // COMMANDDESCRIPTIONPROVIDER_HXX
diff --git a/forms/source/inc/commandimageprovider.hxx b/forms/source/inc/commandimageprovider.hxx
new file mode 100644
index 000000000000..7bbb719e410d
--- /dev/null
+++ b/forms/source/inc/commandimageprovider.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* 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.
+************************************************************************/
+
+#ifndef COMMANDIMAGEPROVIDER_HXX
+#define COMMANDIMAGEPROVIDER_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/frame/XModel.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/componentcontext.hxx>
+#include <vcl/image.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+//........................................................................
+namespace frm
+{
+//........................................................................
+
+ //=====================================================================
+ //= ICommandImageProvider
+ //=====================================================================
+ typedef ::rtl::OUString CommandURL;
+ typedef ::com::sun::star::uno::Sequence< CommandURL > CommandURLs;
+ typedef ::std::vector< Image > CommandImages;
+
+ class SAL_NO_VTABLE ICommandImageProvider
+ {
+ public:
+ virtual CommandImages getCommandImages(
+ const CommandURLs& _rCommandURLs,
+ const bool _bLarge,
+ const bool _bHiContrast
+ ) const = 0;
+
+ virtual ~ICommandImageProvider() { }
+ };
+
+ typedef ::boost::shared_ptr< const ICommandImageProvider > PCommandImageProvider;
+
+ //=====================================================================
+ //= factory
+ //=====================================================================
+ PCommandImageProvider
+ createDocumentCommandImageProvider(
+ const ::comphelper::ComponentContext& _rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxDocument
+ );
+
+//........................................................................
+} // namespace frm
+//........................................................................
+
+#endif // COMMANDIMAGEPROVIDER_HXX
diff --git a/forms/source/inc/featuredispatcher.hxx b/forms/source/inc/featuredispatcher.hxx
index 27fe022cd0b7..daf6a33eb5ba 100644
--- a/forms/source/inc/featuredispatcher.hxx
+++ b/forms/source/inc/featuredispatcher.hxx
@@ -49,7 +49,7 @@ namespace frm
@param _nFeatureId
the id of the feature to dispatch
*/
- virtual void dispatch( sal_Int32 _nFeatureId ) const = 0;
+ virtual void dispatch( sal_Int16 _nFeatureId ) const = 0;
/** dispatches a feature, with an additional named parameter
@@ -63,14 +63,14 @@ namespace frm
the value of the parameter of the dispatch call
*/
virtual void dispatchWithArgument(
- sal_Int32 _nFeatureId,
+ sal_Int16 _nFeatureId,
const sal_Char* _pParamName,
const ::com::sun::star::uno::Any& _rParamValue
) const = 0;
/** checks whether a given feature is enabled
*/
- virtual bool isEnabled( sal_Int32 _nFeatureId ) const = 0;
+ virtual bool isEnabled( sal_Int16 _nFeatureId ) const = 0;
/** returns the boolean state of a feature
@@ -81,7 +81,7 @@ namespace frm
This method allows retrieving status information about features which have an additional
boolean information associated with it.
*/
- virtual bool getBooleanState( sal_Int32 _nFeatureId ) const = 0;
+ virtual bool getBooleanState( sal_Int16 _nFeatureId ) const = 0;
/** returns the string state of a feature
@@ -92,7 +92,7 @@ namespace frm
This method allows retrieving status information about features which have an additional
string information associated with it.
*/
- virtual ::rtl::OUString getStringState( sal_Int32 _nFeatureId ) const = 0;
+ virtual ::rtl::OUString getStringState( sal_Int16 _nFeatureId ) const = 0;
/** returns the integer state of a feature
@@ -103,7 +103,7 @@ namespace frm
This method allows retrieving status information about features which have an additional
integer information associated with it.
*/
- virtual sal_Int32 getIntegerState( sal_Int32 _nFeatureId ) const = 0;
+ virtual sal_Int32 getIntegerState( sal_Int16 _nFeatureId ) const = 0;
};
//.........................................................................
diff --git a/forms/source/inc/formnavigation.hxx b/forms/source/inc/formnavigation.hxx
index be0512eb0583..05c976dac11a 100644
--- a/forms/source/inc/formnavigation.hxx
+++ b/forms/source/inc/formnavigation.hxx
@@ -71,7 +71,7 @@ namespace frm
FeatureInfo() : bCachedState( sal_False ) { }
};
- typedef ::std::map< sal_Int32, FeatureInfo > FeatureMap;
+ typedef ::std::map< sal_Int16, FeatureInfo > FeatureMap;
private:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
@@ -106,12 +106,12 @@ namespace frm
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
// IFeatureDispatcher
- virtual void dispatch( sal_Int32 _nFeatureId ) const;
- virtual void dispatchWithArgument( sal_Int32 _nFeatureId, const sal_Char* _pParamName, const ::com::sun::star::uno::Any& _rParamValue ) const;
- virtual bool isEnabled( sal_Int32 _nFeatureId ) const;
- virtual bool getBooleanState( sal_Int32 _nFeatureId ) const;
- virtual ::rtl::OUString getStringState( sal_Int32 _nFeatureId ) const;
- virtual sal_Int32 getIntegerState( sal_Int32 _nFeatureId ) const;
+ virtual void dispatch( sal_Int16 _nFeatureId ) const;
+ virtual void dispatchWithArgument( sal_Int16 _nFeatureId, const sal_Char* _pParamName, const ::com::sun::star::uno::Any& _rParamValue ) const;
+ virtual bool isEnabled( sal_Int16 _nFeatureId ) const;
+ virtual bool getBooleanState( sal_Int16 _nFeatureId ) const;
+ virtual ::rtl::OUString getStringState( sal_Int16 _nFeatureId ) const;
+ virtual sal_Int32 getIntegerState( sal_Int16 _nFeatureId ) const;
// own overridables
/** is called when the interceptors have.
@@ -134,7 +134,7 @@ namespace frm
determines if the features is enabled or disabled
@see getBooleanState
*/
- virtual void featureStateChanged( sal_Int32 _nFeatureId, sal_Bool _bEnabled );
+ virtual void featureStateChanged( sal_Int16 _nFeatureId, sal_Bool _bEnabled );
/** notification for (potential) changes in the state of all features
<p>The base class implementation does nothing. Derived classes could force
@@ -149,7 +149,7 @@ namespace frm
the array of features to support. Out parameter to fill by the derivee's implementation
@pure
*/
- virtual void getSupportedFeatures( ::std::vector< sal_Int32 >& /* [out] */ _rFeatureIds ) = 0;
+ virtual void getSupportedFeatures( ::std::vector< sal_Int16 >& /* [out] */ _rFeatureIds ) = 0;
protected:
/** update all our dispatches which are controlled by our dispatch interceptors
@@ -205,7 +205,7 @@ namespace frm
@complexity O(log n)
@return NULL if the given id is not a known feature id (which is a valid usage)
*/
- const char* getFeatureURLAscii( sal_Int32 _nFeatureId );
+ const char* getFeatureURLAscii( sal_Int16 _nFeatureId );
/** retrieves the feature URL belonging to an feature id
@@ -214,7 +214,7 @@ namespace frm
<TRUE/> if and only if the given id is a known feature id
(which is a valid usage)
*/
- bool getFeatureURL( sal_Int32 _nFeatureId, ::com::sun::star::util::URL& /* [out] */ _rURL );
+ bool getFeatureURL( sal_Int16 _nFeatureId, ::com::sun::star::util::URL& /* [out] */ _rURL );
/** retrieves the feature id belonging to an feature URL
@@ -223,7 +223,7 @@ namespace frm
the id of the feature URL, or -1 if the URl is not known
(which is a valid usage)
*/
- sal_Int32 getFeatureId( const ::rtl::OUString& _rCompleteURL );
+ sal_Int16 getFeatureId( const ::rtl::OUString& _rCompleteURL );
private:
OFormNavigationMapper( ); // never implemented
diff --git a/forms/source/inc/frm_resource.hrc b/forms/source/inc/frm_resource.hrc
index b446914fd114..c25ca4f2b6e4 100644
--- a/forms/source/inc/frm_resource.hrc
+++ b/forms/source/inc/frm_resource.hrc
@@ -32,7 +32,7 @@
#define _FRM_RESOURCE_HRC_
#ifndef _SOLAR_HRC
-#include <svtools/solar.hrc>
+#include <svl/solar.hrc>
#endif
//------------------------------------------------------------------------------
diff --git a/forms/source/inc/frm_strings.hxx b/forms/source/inc/frm_strings.hxx
index bf2d5d4d7446..8dd23dacb77f 100644
--- a/forms/source/inc/frm_strings.hxx
+++ b/forms/source/inc/frm_strings.hxx
@@ -153,7 +153,7 @@ namespace frm
FORMS_CONSTASCII_STRING( PROPERTY_DEFAULT_SELECT_SEQ, "DefaultSelection" );
FORMS_CONSTASCII_STRING( PROPERTY_MULTISELECTION, "MultiSelection" );
FORMS_CONSTASCII_STRING( PROPERTY_ALIGN, "Align" );
- FORMS_CONSTASCII_STRING( PROPERTY_VERTICALALIGN, "VerticalAlign" );
+ FORMS_CONSTASCII_STRING( PROPERTY_VERTICAL_ALIGN, "VerticalAlign" );
FORMS_CONSTASCII_STRING( PROPERTY_DEFAULT_DATE, "DefaultDate" );
FORMS_CONSTASCII_STRING( PROPERTY_DEFAULT_TIME, "DefaultTime" );
FORMS_CONSTASCII_STRING( PROPERTY_DEFAULT_VALUE, "DefaultValue" );
diff --git a/forms/source/inc/property.hrc b/forms/source/inc/property.hrc
index df94d1575a5a..624e4c2f1ce0 100644
--- a/forms/source/inc/property.hrc
+++ b/forms/source/inc/property.hrc
@@ -63,7 +63,7 @@ namespace frm
#define PROPERTY_ID_INPUT_REQUIRED (PROPERTY_ID_START + 19)
#define PROPERTY_ID_WRITING_MODE (PROPERTY_ID_START + 20)
#define PROPERTY_ID_CONTEXT_WRITING_MODE (PROPERTY_ID_START + 21)
- // free
+#define PROPERTY_ID_VERTICAL_ALIGN (PROPERTY_ID_START + 22)
// free
// free
// free
diff --git a/forms/source/resource/frm_resource.cxx b/forms/source/resource/frm_resource.cxx
index aa2df00e28c5..b3369b865475 100644
--- a/forms/source/resource/frm_resource.cxx
+++ b/forms/source/resource/frm_resource.cxx
@@ -39,7 +39,7 @@
//---------------------------------------------------
#ifndef _SOLAR_HRC
-#include <svtools/solar.hrc>
+#include <svl/solar.hrc>
#endif
//.........................................................................
diff --git a/forms/source/richtext/parametrizedattributedispatcher.cxx b/forms/source/richtext/parametrizedattributedispatcher.cxx
index 68a3660d65e1..9f6c4c15ed68 100644
--- a/forms/source/richtext/parametrizedattributedispatcher.cxx
+++ b/forms/source/richtext/parametrizedattributedispatcher.cxx
@@ -32,8 +32,8 @@
#include "precompiled_forms.hxx"
#include "parametrizedattributedispatcher.hxx"
#include <svx/editview.hxx>
-#include <svtools/itemset.hxx>
-#include <svtools/itempool.hxx>
+#include <svl/itemset.hxx>
+#include <svl/itempool.hxx>
#ifndef _SVX_SVXIDS_HRC
#include <svx/svxids.hrc>
diff --git a/forms/source/richtext/richtextcontrol.cxx b/forms/source/richtext/richtextcontrol.cxx
index 43f784f2219c..9150eac63e17 100644
--- a/forms/source/richtext/richtextcontrol.cxx
+++ b/forms/source/richtext/richtextcontrol.cxx
@@ -46,13 +46,15 @@
/** === begin UNO includes === **/
#include <com/sun/star/awt/PosSize.hpp>
/** === end UNO includes === **/
+
+#include <toolkit/helper/vclunohelper.hxx>
#include <tools/diagnose_ex.h>
#include <vcl/svapp.hxx>
#include <svx/svxids.hrc>
#include <svx/editview.hxx>
-#include <svtools/itemset.hxx>
-#include <svtools/itempool.hxx>
+#include <svl/itemset.hxx>
+#include <svl/itempool.hxx>
#include <sfx2/msgpool.hxx>
//--------------------------------------------------------------------------
@@ -400,6 +402,33 @@ namespace frm
}
//--------------------------------------------------------------------
+ void SAL_CALL ORichTextPeer::draw( sal_Int32 _nX, sal_Int32 _nY ) throw(::com::sun::star::uno::RuntimeException)
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ RichTextControl* pControl = static_cast< RichTextControl* >( GetWindow() );
+ if ( !pControl )
+ return;
+
+ OutputDevice* pTargetDevice = VCLUnoHelper::GetOutputDevice( getGraphics() );
+ OSL_ENSURE( pTargetDevice != NULL, "ORichTextPeer::draw: no graphics -> no drawing!" );
+ if ( !pTargetDevice )
+ return;
+
+ ::Size aSize = pControl->GetSizePixel();
+ const MapUnit eTargetUnit = pTargetDevice->GetMapMode().GetMapUnit();
+ if ( eTargetUnit != MAP_PIXEL )
+ aSize = pControl->PixelToLogic( aSize, eTargetUnit );
+
+ ::Point aPos( _nX, _nY );
+ // the XView::draw API talks about pixels, always ...
+ if ( eTargetUnit != MAP_PIXEL )
+ aPos = pTargetDevice->PixelToLogic( aPos );
+
+ pControl->Draw( pTargetDevice, aPos, aSize, WINDOW_DRAW_NOCONTROLS );
+ }
+
+ //--------------------------------------------------------------------
void SAL_CALL ORichTextPeer::setProperty( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (RuntimeException)
{
if ( !GetWindow() )
diff --git a/forms/source/richtext/richtextcontrol.hxx b/forms/source/richtext/richtextcontrol.hxx
index 5775e2626d2d..eecff6527eea 100644
--- a/forms/source/richtext/richtextcontrol.hxx
+++ b/forms/source/richtext/richtextcontrol.hxx
@@ -135,6 +135,9 @@ namespace frm
ORichTextPeer();
~ORichTextPeer();
+ // XView
+ void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException);
+
// XVclWindowPeer
virtual void SAL_CALL setProperty( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::uno::RuntimeException);
diff --git a/forms/source/richtext/richtextengine.cxx b/forms/source/richtext/richtextengine.cxx
index b13a6eebc94b..b87d6260b723 100644
--- a/forms/source/richtext/richtextengine.cxx
+++ b/forms/source/richtext/richtextengine.cxx
@@ -31,7 +31,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_forms.hxx"
#include "richtextengine.hxx"
-#include <svtools/itempool.hxx>
+#include <svl/itempool.hxx>
#include <svx/eeitem.hxx>
#include <svx/editobj.hxx>
#define ITEMID_FONTHEIGHT EE_CHAR_FONTHEIGHT
@@ -44,8 +44,8 @@
#include <vcl/mapunit.hxx>
#include <vcl/mapmod.hxx>
#include <vcl/outdev.hxx>
-#include <svtools/lingucfg.hxx>
-#include <svtools/undo.hxx>
+#include <unotools/lingucfg.hxx>
+#include <svl/undo.hxx>
#include <vos/mutex.hxx>
#include <algorithm>
diff --git a/forms/source/richtext/richtextimplcontrol.cxx b/forms/source/richtext/richtextimplcontrol.cxx
index bcfb0fc2ad35..259197ac71d1 100644
--- a/forms/source/richtext/richtextimplcontrol.cxx
+++ b/forms/source/richtext/richtextimplcontrol.cxx
@@ -43,8 +43,8 @@
#include <svx/scripttypeitem.hxx>
#include <svx/editobj.hxx>
-#include <svtools/itempool.hxx>
-#include <svtools/itemset.hxx>
+#include <svl/itempool.hxx>
+#include <svl/itemset.hxx>
#include <vcl/mapunit.hxx>
#include <vcl/window.hxx>
#include <vcl/svapp.hxx>
@@ -605,21 +605,32 @@ namespace frm
_pDev->SetMapMode( aNormalizedMapMode );
// translate coordinates
- Point aPos( OutputDevice::LogicToLogic( _rPos, aOriginalMapMode, aNormalizedMapMode ) );
- Size aSize( OutputDevice::LogicToLogic( _rSize, aOriginalMapMode, aNormalizedMapMode ) );
+ Point aPos( _rPos );
+ Size aSize( _rSize );
+ if ( aOriginalMapMode.GetMapUnit() == MAP_PIXEL )
+ {
+ aPos = _pDev->PixelToLogic( _rPos, aNormalizedMapMode );
+ aSize = _pDev->PixelToLogic( _rSize, aNormalizedMapMode );
+ }
+ else
+ {
+ aPos = OutputDevice::LogicToLogic( _rPos, aOriginalMapMode, aNormalizedMapMode );
+ aSize = OutputDevice::LogicToLogic( _rSize, aOriginalMapMode, aNormalizedMapMode );
+ }
Rectangle aPlayground( aPos, aSize );
Size aOnePixel( _pDev->PixelToLogic( Size( 1, 1 ) ) );
+ aPlayground.Right() -= aOnePixel.Width();
+ aPlayground.Bottom() -= aOnePixel.Height();
// background
_pDev->SetLineColor();
- _pDev->DrawRect( Rectangle( aPlayground.TopLeft(), m_pEngine->GetPaperSize()) );
+ _pDev->DrawRect( aPlayground );
- // possibly with border
+ // do we need to draw a border?
bool bBorder = ( m_pAntiImpl->GetStyle() & WB_BORDER );
if ( bBorder )
- // let's draw a border
- _pDev->SetLineColor( COL_BLACK );
+ _pDev->SetLineColor( m_pAntiImpl->GetSettings().GetStyleSettings().GetMonoColor() );
else
_pDev->SetLineColor();
_pDev->SetFillColor( m_pAntiImpl->GetBackground().GetColor() );
@@ -632,7 +643,9 @@ namespace frm
// leave a space of one pixel between the "surroundings" of the control
// and the content
lcl_inflate( aPlayground, -aOnePixel.Width(), -aOnePixel.Height() );
+ lcl_inflate( aPlayground, -aOnePixel.Width(), -aOnePixel.Height() );
+ // actually draw the content
m_pEngine->Draw( _pDev, aPlayground, Point(), TRUE );
_pDev->Pop();
diff --git a/forms/source/richtext/richtextmodel.cxx b/forms/source/richtext/richtextmodel.cxx
index d38b350ada32..067512d3c659 100644
--- a/forms/source/richtext/richtextmodel.cxx
+++ b/forms/source/richtext/richtextmodel.cxx
@@ -40,7 +40,9 @@
/** === begin UNO includes === **/
#include <com/sun/star/awt/LineEndFormat.hpp>
#include <com/sun/star/text/WritingMode2.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
/** === end UNO includes === **/
+
#include <cppuhelper/typeprovider.hxx>
#include <comphelper/guarding.hxx>
#include <toolkit/awt/vclxdevice.hxx>
@@ -67,6 +69,7 @@ namespace frm
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::form;
using namespace ::com::sun::star::util;
+ using namespace ::com::sun::star::style;
namespace WritingMode2 = ::com::sun::star::text::WritingMode2;
@@ -120,6 +123,7 @@ namespace frm
m_aTabStop = _pOriginal->m_aTabStop;
m_aBackgroundColor = _pOriginal->m_aBackgroundColor;
m_aBorderColor = _pOriginal->m_aBorderColor;
+ m_aVerticalAlignment = _pOriginal->m_aVerticalAlignment;
m_sDefaultControl = _pOriginal->m_sDefaultControl;
m_sHelpText = _pOriginal->m_sHelpText;
m_sHelpURL = _pOriginal->m_sHelpURL;
@@ -201,9 +205,10 @@ namespace frm
REGISTER_PROP_2( RICH_TEXT, m_bReallyActAsRichText, BOUND, MAYBEDEFAULT );
REGISTER_PROP_2( HIDEINACTIVESELECTION, m_bHideInactiveSelection, BOUND, MAYBEDEFAULT );
- REGISTER_VOID_PROP_2( TABSTOP, m_aTabStop, sal_Bool, BOUND, MAYBEDEFAULT );
- REGISTER_VOID_PROP_2( BACKGROUNDCOLOR, m_aBackgroundColor, sal_Int32, BOUND, MAYBEDEFAULT );
- REGISTER_VOID_PROP_2( BORDERCOLOR, m_aBorderColor, sal_Int32, BOUND, MAYBEDEFAULT );
+ REGISTER_VOID_PROP_2( TABSTOP, m_aTabStop, sal_Bool, BOUND, MAYBEDEFAULT );
+ REGISTER_VOID_PROP_2( BACKGROUNDCOLOR, m_aBackgroundColor, sal_Int32, BOUND, MAYBEDEFAULT );
+ REGISTER_VOID_PROP_2( BORDERCOLOR, m_aBorderColor, sal_Int32, BOUND, MAYBEDEFAULT );
+ REGISTER_VOID_PROP_2( VERTICAL_ALIGN, m_aVerticalAlignment, VerticalAlignment, BOUND, MAYBEDEFAULT );
// properties which exist only for compatibility with the css.swt.UnoControlEditModel,
// since we replace the default implementation for this service
@@ -455,6 +460,7 @@ namespace frm
case PROPERTY_ID_TABSTOP:
case PROPERTY_ID_BACKGROUNDCOLOR:
case PROPERTY_ID_BORDERCOLOR:
+ case PROPERTY_ID_VERTICAL_ALIGN:
/* void */
break;
diff --git a/forms/source/richtext/richtextmodel.hxx b/forms/source/richtext/richtextmodel.hxx
index 5e905e2873ad..5cdfe56f0dea 100644
--- a/forms/source/richtext/richtextmodel.hxx
+++ b/forms/source/richtext/richtextmodel.hxx
@@ -74,6 +74,7 @@ namespace frm
::com::sun::star::uno::Any m_aTabStop;
::com::sun::star::uno::Any m_aBackgroundColor;
::com::sun::star::uno::Any m_aBorderColor;
+ ::com::sun::star::uno::Any m_aVerticalAlignment;
::rtl::OUString m_sDefaultControl;
::rtl::OUString m_sHelpText;
::rtl::OUString m_sHelpURL;
@@ -115,7 +116,7 @@ namespace frm
DECLARE_DEFAULT_LEAF_XTOR( ORichTextModel );
// UNO
- DECLARE_UNO3_AGG_DEFAULTS( ONavigationBarModel, OControlModel );
+ DECLARE_UNO3_AGG_DEFAULTS( ORichTextModel, OControlModel );
virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
// XServiceInfo
diff --git a/forms/source/richtext/richtextvclcontrol.cxx b/forms/source/richtext/richtextvclcontrol.cxx
index f3c56cc6cd88..495a85c02162 100644
--- a/forms/source/richtext/richtextvclcontrol.cxx
+++ b/forms/source/richtext/richtextvclcontrol.cxx
@@ -32,9 +32,9 @@
#include "precompiled_forms.hxx"
#include "richtextvclcontrol.hxx"
#include "richtextimplcontrol.hxx"
-#include <svtools/itempool.hxx>
-#include <svtools/itemset.hxx>
-#include <svtools/languageoptions.hxx>
+#include <svl/itempool.hxx>
+#include <svl/itemset.hxx>
+#include <svl/languageoptions.hxx>
#if OSL_DEBUG_LEVEL > 0
#ifndef _TOOLS_TEMPFILE_HXX
#include <tools/tempfile.hxx>
diff --git a/forms/source/richtext/richtextvclcontrol.hxx b/forms/source/richtext/richtextvclcontrol.hxx
index 778d31c3e6e1..a4f49aa2d41c 100644
--- a/forms/source/richtext/richtextvclcontrol.hxx
+++ b/forms/source/richtext/richtextvclcontrol.hxx
@@ -117,13 +117,15 @@ namespace frm
const EditView& getView() const;
EditView& getView();
+ // Window overridables
+ virtual void Draw( OutputDevice* _pDev, const Point& _rPos, const Size& _rSize, ULONG _nFlags );
+
protected:
// Window overridables
virtual void Resize();
virtual void GetFocus();
virtual void StateChanged( StateChangedType nStateChange );
virtual long PreNotify( NotifyEvent& _rNEvt );
- virtual void Draw( OutputDevice* _pDev, const Point& _rPos, const Size& _rSize, ULONG _nFlags );
virtual long Notify( NotifyEvent& _rNEvt );
private:
diff --git a/forms/source/richtext/rtattributehandler.cxx b/forms/source/richtext/rtattributehandler.cxx
index 8760a59bc180..d1090b82d914 100644
--- a/forms/source/richtext/rtattributehandler.cxx
+++ b/forms/source/richtext/rtattributehandler.cxx
@@ -36,8 +36,8 @@
#include <svx/svxids.hrc>
#endif
#include <svx/eeitem.hxx>
-#include <svtools/itemset.hxx>
-#include <svtools/itempool.hxx>
+#include <svl/itemset.hxx>
+#include <svl/itempool.hxx>
#include <vcl/mapunit.hxx>
#include <vcl/mapmod.hxx>
#include <vcl/outdev.hxx>
diff --git a/forms/source/richtext/rtattributes.hxx b/forms/source/richtext/rtattributes.hxx
index 3cc79ad7bef3..d5874ea566c2 100644
--- a/forms/source/richtext/rtattributes.hxx
+++ b/forms/source/richtext/rtattributes.hxx
@@ -33,7 +33,7 @@
#include <tools/solar.h>
#include <sal/types.h>
-#include <svtools/poolitem.hxx>
+#include <svl/poolitem.hxx>
//........................................................................
namespace frm
diff --git a/forms/source/runtime/formoperations.cxx b/forms/source/runtime/formoperations.cxx
index 5416e5d567e9..6b63d4b8a756 100644
--- a/forms/source/runtime/formoperations.cxx
+++ b/forms/source/runtime/formoperations.cxx
@@ -92,7 +92,7 @@ namespace frm
using ::com::sun::star::uno::XInterface;
using ::com::sun::star::sdbc::XRowSet;
using ::com::sun::star::sdbc::XResultSetUpdate;
- using ::com::sun::star::form::XFormController;
+ using ::com::sun::star::form::runtime::XFormController;
using ::com::sun::star::form::runtime::XFeatureInvalidation;
using ::com::sun::star::form::runtime::FeatureState;
using ::com::sun::star::lang::IllegalArgumentException;
diff --git a/forms/source/runtime/formoperations.hxx b/forms/source/runtime/formoperations.hxx
index 211d0be60fd4..3d5eb8fa17ce 100644
--- a/forms/source/runtime/formoperations.hxx
+++ b/forms/source/runtime/formoperations.hxx
@@ -71,16 +71,16 @@ namespace frm
class MethodGuard;
private:
- ::comphelper::ComponentContext m_aContext;
- ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > m_xController;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > m_xCursor;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetUpdate > m_xUpdateCursor;
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xCursorProperties;
- ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable > m_xLoadableForm;
+ ::comphelper::ComponentContext m_aContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > m_xController;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > m_xCursor;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetUpdate > m_xUpdateCursor;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xCursorProperties;
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable > m_xLoadableForm;
::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFeatureInvalidation >
- m_xFeatureInvalidation;
+ m_xFeatureInvalidation;
mutable ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer >
- m_xParser;
+ m_xParser;
bool m_bInitializedParser;
bool m_bActiveControlModified;
@@ -132,7 +132,7 @@ namespace frm
// XFormOperations
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > SAL_CALL getCursor() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetUpdate > SAL_CALL getUpdateCursor() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > SAL_CALL getController() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > SAL_CALL getController() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFeatureInvalidation > SAL_CALL getFeatureInvalidation() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setFeatureInvalidation(const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFeatureInvalidation > & the_value) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::form::runtime::FeatureState SAL_CALL getState(::sal_Int16 Feature) throw (::com::sun::star::uno::RuntimeException);
@@ -163,7 +163,7 @@ namespace frm
private:
// service constructors
- void createWithFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController >& _rxController );
+ void createWithFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >& _rxController );
void createWithForm( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm );
/** determines whether or not we're already disposed
diff --git a/forms/source/solar/component/navbarcontrol.cxx b/forms/source/solar/component/navbarcontrol.cxx
index 88995b49f4a8..eb975910a5da 100644
--- a/forms/source/solar/component/navbarcontrol.cxx
+++ b/forms/source/solar/component/navbarcontrol.cxx
@@ -34,17 +34,23 @@
#include "navbarcontrol.hxx"
#include "frm_strings.hxx"
#include "frm_module.hxx"
-#include "navtoolbar.hxx"
#include "FormComponent.hxx"
+#include "componenttools.hxx"
+#include "navtoolbar.hxx"
+#include "commandimageprovider.hxx"
+#include "commanddescriptionprovider.hxx"
/** === begin UNO includes === **/
#include <com/sun/star/awt/XView.hpp>
#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/form/runtime/FormFeature.hpp>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
/** === end UNO includes === **/
#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
#include <vcl/svapp.hxx>
-#include <svx/svxids.hrc>
//--------------------------------------------------------------------------
extern "C" void SAL_CALL createRegistryInfo_ONavigationBarControl()
@@ -62,6 +68,8 @@ namespace frm
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::frame;
+ using namespace ::com::sun::star::graphic;
+ namespace FormFeature = ::com::sun::star::form::runtime::FormFeature;
#define FORWARD_TO_PEER_1( unoInterface, method, param1 ) \
Reference< unoInterface > xTypedPeer( getPeer(), UNO_QUERY ); \
@@ -129,7 +137,8 @@ namespace frm
//------------------------------------------------------------------
namespace
{
- static WinBits getWinBits( const Reference< XControlModel >& _rxModel )
+ //..............................................................
+ static WinBits lcl_getWinBits_nothrow( const Reference< XControlModel >& _rxModel )
{
WinBits nBits = 0;
try
@@ -149,7 +158,7 @@ namespace frm
}
catch( const Exception& )
{
- DBG_ERROR( "::getWinBits: caught an exception!" );
+ DBG_UNHANDLED_EXCEPTION();
}
return nBits;
}
@@ -175,7 +184,7 @@ namespace frm
}
// create the peer
- ONavigationBarPeer* pPeer = ONavigationBarPeer::Create( m_xORB, pParentWin, getWinBits( getModel() ) );
+ ONavigationBarPeer* pPeer = ONavigationBarPeer::Create( m_xORB, pParentWin, getModel() );
DBG_ASSERT( pPeer, "ONavigationBarControl::createPeer: invalid peer returned!" );
if ( pPeer )
// by definition, the returned component is aquired once
@@ -267,7 +276,7 @@ namespace frm
DBG_NAME( ONavigationBarPeer )
//------------------------------------------------------------------
ONavigationBarPeer* ONavigationBarPeer::Create( const Reference< XMultiServiceFactory >& _rxORB,
- Window* _pParentWindow, WinBits _nStyle )
+ Window* _pParentWindow, const Reference< XControlModel >& _rxModel )
{
DBG_TESTSOLARMUTEX();
@@ -276,7 +285,13 @@ namespace frm
pPeer->acquire(); // by definition, the returned object is aquired once
// the VCL control for the peer
- NavigationToolBar* pNavBar = new NavigationToolBar( _pParentWindow, _nStyle );
+ Reference< XModel > xContextDocument( getXModel( _rxModel ) );
+ NavigationToolBar* pNavBar = new NavigationToolBar(
+ _pParentWindow,
+ lcl_getWinBits_nothrow( _rxModel ),
+ createDocumentCommandImageProvider( _rxORB, xContextDocument ),
+ createDocumentCommandDescriptionProvider( _rxORB, xContextDocument )
+ );
// some knittings
pNavBar->setDispatcher( pPeer );
@@ -456,7 +471,7 @@ namespace frm
}
//------------------------------------------------------------------
- void ONavigationBarPeer::featureStateChanged( sal_Int32 _nFeatureId, sal_Bool _bEnabled )
+ void ONavigationBarPeer::featureStateChanged( sal_Int16 _nFeatureId, sal_Bool _bEnabled )
{
// enable this button on the toolbox
NavigationToolBar* pNavBar = static_cast< NavigationToolBar* >( GetWindow() );
@@ -465,15 +480,15 @@ namespace frm
pNavBar->enableFeature( _nFeatureId, _bEnabled );
// is it a feature with additional state information?
- if ( _nFeatureId == SID_FM_FORM_FILTERED )
+ if ( _nFeatureId == FormFeature::ToggleApplyFilter )
{ // additional boolean state
pNavBar->checkFeature( _nFeatureId, getBooleanState( _nFeatureId ) );
}
- else if ( _nFeatureId == SID_FM_RECORD_TOTAL )
+ else if ( _nFeatureId == FormFeature::TotalRecords )
{
pNavBar->setFeatureText( _nFeatureId, getStringState( _nFeatureId ) );
}
- else if ( _nFeatureId == SID_FM_RECORD_ABSOLUTE )
+ else if ( _nFeatureId == FormFeature::MoveAbsolute )
{
pNavBar->setFeatureText( _nFeatureId, String::CreateFromInt32( getIntegerState( _nFeatureId ) ) );
}
@@ -496,7 +511,7 @@ namespace frm
}
//------------------------------------------------------------------
- bool ONavigationBarPeer::isEnabled( sal_Int32 _nFeatureId ) const
+ bool ONavigationBarPeer::isEnabled( sal_Int16 _nFeatureId ) const
{
if ( const_cast< ONavigationBarPeer* >( this )->isDesignMode() )
return false;
@@ -524,27 +539,27 @@ namespace frm
}
//------------------------------------------------------------------
- void ONavigationBarPeer::getSupportedFeatures( ::std::vector< sal_Int32 >& _rFeatureIds )
+ void ONavigationBarPeer::getSupportedFeatures( ::std::vector< sal_Int16 >& _rFeatureIds )
{
- _rFeatureIds.push_back( SID_FM_RECORD_ABSOLUTE );
- _rFeatureIds.push_back( SID_FM_RECORD_TOTAL );
- _rFeatureIds.push_back( SID_FM_RECORD_FIRST );
- _rFeatureIds.push_back( SID_FM_RECORD_PREV );
- _rFeatureIds.push_back( SID_FM_RECORD_NEXT );
- _rFeatureIds.push_back( SID_FM_RECORD_LAST );
- _rFeatureIds.push_back( SID_FM_RECORD_SAVE );
- _rFeatureIds.push_back( SID_FM_RECORD_UNDO );
- _rFeatureIds.push_back( SID_FM_RECORD_NEW );
- _rFeatureIds.push_back( SID_FM_RECORD_DELETE );
- _rFeatureIds.push_back( SID_FM_REFRESH );
- _rFeatureIds.push_back( SID_FM_REFRESH_FORM_CONTROL );
- _rFeatureIds.push_back( SID_FM_SORTUP );
- _rFeatureIds.push_back( SID_FM_SORTDOWN );
- _rFeatureIds.push_back( SID_FM_ORDERCRIT );
- _rFeatureIds.push_back( SID_FM_AUTOFILTER );
- _rFeatureIds.push_back( SID_FM_FILTERCRIT );
- _rFeatureIds.push_back( SID_FM_FORM_FILTERED );
- _rFeatureIds.push_back( SID_FM_REMOVE_FILTER_SORT );
+ _rFeatureIds.push_back( FormFeature::MoveAbsolute );
+ _rFeatureIds.push_back( FormFeature::TotalRecords );
+ _rFeatureIds.push_back( FormFeature::MoveToFirst );
+ _rFeatureIds.push_back( FormFeature::MoveToPrevious );
+ _rFeatureIds.push_back( FormFeature::MoveToNext );
+ _rFeatureIds.push_back( FormFeature::MoveToLast );
+ _rFeatureIds.push_back( FormFeature::SaveRecordChanges );
+ _rFeatureIds.push_back( FormFeature::UndoRecordChanges );
+ _rFeatureIds.push_back( FormFeature::MoveToInsertRow );
+ _rFeatureIds.push_back( FormFeature::DeleteRecord );
+ _rFeatureIds.push_back( FormFeature::ReloadForm );
+ _rFeatureIds.push_back( FormFeature::RefreshCurrentControl );
+ _rFeatureIds.push_back( FormFeature::SortAscending );
+ _rFeatureIds.push_back( FormFeature::SortDescending );
+ _rFeatureIds.push_back( FormFeature::InteractiveSort );
+ _rFeatureIds.push_back( FormFeature::AutoFilter );
+ _rFeatureIds.push_back( FormFeature::InteractiveFilter );
+ _rFeatureIds.push_back( FormFeature::ToggleApplyFilter );
+ _rFeatureIds.push_back( FormFeature::RemoveFilterAndSort );
}
//.........................................................................
diff --git a/forms/source/solar/component/navbarcontrol.hxx b/forms/source/solar/component/navbarcontrol.hxx
index 0c3f76f315ed..62d44774d0b3 100644
--- a/forms/source/solar/component/navbarcontrol.hxx
+++ b/forms/source/solar/component/navbarcontrol.hxx
@@ -31,14 +31,18 @@
#ifndef FORMS_NAVBARCONTROL_HXX
#define FORMS_NAVBARCONTROL_HXX
+#include "formnavigation.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/frame/XDispatchProviderInterception.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+/** === end UNO includes === **/
+
#include <toolkit/controls/unocontrol.hxx>
#include <toolkit/awt/vclxwindow.hxx>
#include <comphelper/uno3.hxx>
#include <cppuhelper/implbase1.hxx>
#include <vcl/wintypes.hxx>
-#include <com/sun/star/frame/XDispatchProviderInterception.hpp>
-#include <com/sun/star/frame/XStatusListener.hpp>
-#include "formnavigation.hxx"
//.........................................................................
namespace frm
@@ -111,11 +115,13 @@ namespace frm
static ONavigationBarPeer* Create(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
Window* _pParentWindow,
- WinBits _nStyle
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel
);
protected:
- ONavigationBarPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB );
+ ONavigationBarPeer(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
+ );
~ONavigationBarPeer();
public:
@@ -144,12 +150,12 @@ namespace frm
// OFormNavigationHelper overriables
virtual void interceptorsChanged( );
- virtual void featureStateChanged( sal_Int32 _nFeatureId, sal_Bool _bEnabled );
+ virtual void featureStateChanged( sal_Int16 _nFeatureId, sal_Bool _bEnabled );
virtual void allFeatureStatesChanged( );
- virtual void getSupportedFeatures( ::std::vector< sal_Int32 >& /* [out] */ _rFeatureIds );
+ virtual void getSupportedFeatures( ::std::vector< sal_Int16 >& /* [out] */ _rFeatureIds );
// IFeatureDispatcher overriables
- virtual bool isEnabled( sal_Int32 _nFeatureId ) const;
+ virtual bool isEnabled( sal_Int16 _nFeatureId ) const;
};
//.........................................................................
diff --git a/forms/source/solar/control/navtoolbar.cxx b/forms/source/solar/control/navtoolbar.cxx
index 37b9faf8a5f4..58f22f0c95e4 100644
--- a/forms/source/solar/control/navtoolbar.cxx
+++ b/forms/source/solar/control/navtoolbar.cxx
@@ -30,39 +30,41 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_forms.hxx"
+
#include "navtoolbar.hxx"
#include "frm_resource.hxx"
-#ifndef _FRM_RESOURCE_HRC_
-#include "frm_resource.hrc"
-#endif
-#include <vcl/fixed.hxx>
-#ifndef _SVX_SVXIDS_HRC
-#include <svx/svxids.hrc>
-#endif
-#include <sfx2/msgpool.hxx>
-#include <sfx2/imgmgr.hxx>
#include "featuredispatcher.hxx"
+#include "frm_resource.hrc"
+#include "commandimageprovider.hxx"
+#include "commanddescriptionprovider.hxx"
+
#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/form/runtime/FormFeature.hpp>
+
+#include <sfx2/imgmgr.hxx>
+#include <vcl/fixed.hxx>
#include <memory>
-#define LID_RECORD_LABEL 1
-#define LID_RECORD_FILLER 2
+#define LID_RECORD_LABEL 1000
+#define LID_RECORD_FILLER 1001
//.........................................................................
namespace frm
{
//.........................................................................
+ using ::com::sun::star::uno::makeAny;
+ namespace FormFeature = ::com::sun::star::form::runtime::FormFeature;
+
//=====================================================================
//.....................................................................
namespace
{
- static bool isSfxSlot( sal_Int32 _nFeatureId )
+ static bool isArtificialItem( sal_Int16 _nFeatureId )
{
- // everything we use in this class is an SFX-slot - except the LID_* ids
- return ( _nFeatureId != LID_RECORD_LABEL )
- && ( _nFeatureId != LID_RECORD_FILLER );
+ return ( _nFeatureId == LID_RECORD_LABEL )
+ || ( _nFeatureId == LID_RECORD_FILLER );
}
static String getLabelString( USHORT _nResId )
@@ -72,9 +74,37 @@ namespace frm
sLabel += String::CreateFromAscii( " " );
return sLabel;
}
- static bool lcl_isHighContrast( const Color& _rColor )
+
+ ::rtl::OUString lcl_getCommandURL( const sal_Int16 _nFormFeature )
{
- return _rColor.IsDark();
+ const sal_Char* pAsciiCommandName = NULL;
+ switch ( _nFormFeature )
+ {
+ case FormFeature::MoveAbsolute : pAsciiCommandName = "AbsoluteRecord"; break;
+ case FormFeature::TotalRecords : pAsciiCommandName = "RecTotal"; break;
+ case FormFeature::MoveToFirst : pAsciiCommandName = "FirstRecord"; break;
+ case FormFeature::MoveToPrevious : pAsciiCommandName = "PrevRecord"; break;
+ case FormFeature::MoveToNext : pAsciiCommandName = "NextRecord"; break;
+ case FormFeature::MoveToLast : pAsciiCommandName = "LastRecord"; break;
+ case FormFeature::SaveRecordChanges : pAsciiCommandName = "RecSave"; break;
+ case FormFeature::UndoRecordChanges : pAsciiCommandName = "RecUndo"; break;
+ case FormFeature::MoveToInsertRow : pAsciiCommandName = "NewRecord"; break;
+ case FormFeature::DeleteRecord : pAsciiCommandName = "DeleteRecord"; break;
+ case FormFeature::ReloadForm : pAsciiCommandName = "Refresh"; break;
+ case FormFeature::RefreshCurrentControl : pAsciiCommandName = "RefreshFormControl"; break;
+ case FormFeature::SortAscending : pAsciiCommandName = "Sortup"; break;
+ case FormFeature::SortDescending : pAsciiCommandName = "SortDown"; break;
+ case FormFeature::InteractiveSort : pAsciiCommandName = "OrderCrit"; break;
+ case FormFeature::AutoFilter : pAsciiCommandName = "AutoFilter"; break;
+ case FormFeature::InteractiveFilter : pAsciiCommandName = "FilterCrit"; break;
+ case FormFeature::ToggleApplyFilter : pAsciiCommandName = "FormFiltered"; break;
+ case FormFeature::RemoveFilterAndSort : pAsciiCommandName = "RemoveFilterSort"; break;
+ }
+ if ( pAsciiCommandName != NULL )
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:" ) ) + ::rtl::OUString::createFromAscii( pAsciiCommandName );
+
+ OSL_ENSURE( false, "lcl_getCommandURL: unknown FormFeature!" );
+ return ::rtl::OUString();
}
}
@@ -123,9 +153,12 @@ namespace frm
//=====================================================================
DBG_NAME( NavigationToolBar )
//---------------------------------------------------------------------
- NavigationToolBar::NavigationToolBar( Window* _pParent, WinBits _nStyle )
+ NavigationToolBar::NavigationToolBar( Window* _pParent, WinBits _nStyle, const PCommandImageProvider& _pImageProvider,
+ const PCommandDescriptionProvider& _pDescriptionProvider )
:Window( _pParent, _nStyle )
,m_pDispatcher( NULL )
+ ,m_pImageProvider( _pImageProvider )
+ ,m_pDescriptionProvider( _pDescriptionProvider )
,m_eImageSize( eSmall )
,m_pToolbar( NULL )
{
@@ -154,7 +187,7 @@ namespace frm
m_pToolbar->setDispatcher( _pDispatcher );
- RecordPositionInput* pPositionWindow = static_cast< RecordPositionInput* >( m_pToolbar->GetItemWindow( SID_FM_RECORD_ABSOLUTE ) );
+ RecordPositionInput* pPositionWindow = static_cast< RecordPositionInput* >( m_pToolbar->GetItemWindow( FormFeature::MoveAbsolute ) );
OSL_ENSURE( pPositionWindow, "NavigationToolBar::setDispatcher: can't forward the dispatcher to the position window!" );
if ( pPositionWindow )
pPositionWindow->setDispatcher( _pDispatcher );
@@ -183,15 +216,15 @@ namespace frm
{
m_pToolbar->EnableItem( _nItemId, _bEnabled );
- if ( _nItemId == SID_FM_RECORD_ABSOLUTE )
+ if ( _nItemId == FormFeature::MoveAbsolute )
m_pToolbar->EnableItem( LID_RECORD_LABEL, _bEnabled );
- if ( _nItemId == SID_FM_RECORD_TOTAL )
+ if ( _nItemId == FormFeature::TotalRecords )
m_pToolbar->EnableItem( LID_RECORD_FILLER, _bEnabled );
}
//---------------------------------------------------------------------
- void NavigationToolBar::enableFeature( sal_Int32 _nFeatureId, bool _bEnabled )
+ void NavigationToolBar::enableFeature( sal_Int16 _nFeatureId, bool _bEnabled )
{
DBG_ASSERT( m_pToolbar->GetItemPos( (USHORT)_nFeatureId ) != TOOLBOX_ITEM_NOTFOUND,
"NavigationToolBar::enableFeature: invalid id!" );
@@ -200,7 +233,7 @@ namespace frm
}
//---------------------------------------------------------------------
- void NavigationToolBar::checkFeature( sal_Int32 _nFeatureId, bool _bEnabled )
+ void NavigationToolBar::checkFeature( sal_Int16 _nFeatureId, bool _bEnabled )
{
DBG_ASSERT( m_pToolbar->GetItemPos( (USHORT)_nFeatureId ) != TOOLBOX_ITEM_NOTFOUND,
"NavigationToolBar::checkFeature: invalid id!" );
@@ -209,7 +242,7 @@ namespace frm
}
//---------------------------------------------------------------------
- void NavigationToolBar::setFeatureText( sal_Int32 _nFeatureId, const ::rtl::OUString& _rText )
+ void NavigationToolBar::setFeatureText( sal_Int16 _nFeatureId, const ::rtl::OUString& _rText )
{
DBG_ASSERT( m_pToolbar->GetItemPos( (USHORT)_nFeatureId ) != TOOLBOX_ITEM_NOTFOUND,
"NavigationToolBar::checkFeature: invalid id!" );
@@ -232,71 +265,67 @@ namespace frm
// items. We could duplicate all the information here in our lib
// (such as the item text and the image), but why should we?
- struct SlotDescription
+ struct FeatureDescription
{
USHORT nId;
bool bRepeat;
bool bItemWindow;
- } aSupportedSlots[] =
+ } aSupportedFeatures[] =
{
- { LID_RECORD_LABEL, false, true },
- { SID_FM_RECORD_ABSOLUTE, false, true },
- { LID_RECORD_FILLER, false, true },
- { SID_FM_RECORD_TOTAL, false, true },
-
- { SID_FM_RECORD_FIRST, true, false },
- { SID_FM_RECORD_PREV, true, false },
- { SID_FM_RECORD_NEXT, true, false },
- { SID_FM_RECORD_LAST, true, false },
+ { LID_RECORD_LABEL, false, true },
+ { FormFeature::MoveAbsolute, false, true },
+ { LID_RECORD_FILLER, false, true },
+ { FormFeature::TotalRecords, false, true },
+ { FormFeature::MoveToFirst, true, false },
+ { FormFeature::MoveToPrevious, true, false },
+ { FormFeature::MoveToNext, true, false },
+ { FormFeature::MoveToLast, true, false },
+ { FormFeature::MoveToInsertRow, false, false },
{ 0, false, false },
- { SID_FM_RECORD_SAVE, false, false },
- { SID_FM_RECORD_UNDO, false, false },
- { SID_FM_RECORD_NEW, false, false },
- { SID_FM_RECORD_DELETE, false, false },
- { SID_FM_REFRESH, false, false },
- { SID_FM_REFRESH_FORM_CONTROL, false, false },
+ { FormFeature::SaveRecordChanges, false, false },
+ { FormFeature::UndoRecordChanges, false, false },
+ { FormFeature::DeleteRecord, false, false },
+ { FormFeature::ReloadForm, false, false },
+ { FormFeature::RefreshCurrentControl, false, false },
{ 0, false, false },
- { SID_FM_SORTUP, false, false },
- { SID_FM_SORTDOWN, false, false },
- { SID_FM_ORDERCRIT, false, false },
- { SID_FM_AUTOFILTER, false, false },
- { SID_FM_FILTERCRIT, false, false },
- { SID_FM_FORM_FILTERED, false, false },
- { SID_FM_REMOVE_FILTER_SORT, false, false },
+ { FormFeature::SortAscending, false, false },
+ { FormFeature::SortDescending, false, false },
+ { FormFeature::InteractiveSort, false, false },
+ { FormFeature::AutoFilter, false, false },
+ { FormFeature::InteractiveFilter, false, false },
+ { FormFeature::ToggleApplyFilter, false, false },
+ { FormFeature::RemoveFilterAndSort, false, false },
};
- size_t nSupportedSlots = sizeof( aSupportedSlots ) / sizeof( aSupportedSlots[0] );
- SlotDescription* pSupportedSlots = aSupportedSlots;
- SlotDescription* pSupportedSlotsEnd = aSupportedSlots + nSupportedSlots;
- for ( ; pSupportedSlots < pSupportedSlotsEnd; ++pSupportedSlots )
+ size_t nSupportedFeatures = sizeof( aSupportedFeatures ) / sizeof( aSupportedFeatures[0] );
+ FeatureDescription* pSupportedFeatures = aSupportedFeatures;
+ FeatureDescription* pSupportedFeaturesEnd = aSupportedFeatures + nSupportedFeatures;
+ for ( ; pSupportedFeatures < pSupportedFeaturesEnd; ++pSupportedFeatures )
{
- if ( pSupportedSlots->nId )
+ if ( pSupportedFeatures->nId )
{ // it's _not_ a separator
- // the text(s) of the item
- String sItemText;
- String sItemHelpText;
-
- // TODO/CLEANUP: this code does nothing(!) nowadays
- //SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool( NULL );
- //sItemText = rSlotPool.GetSlotName( pSupportedSlots->nId, &sItemHelpText );
-
// insert the entry
- m_pToolbar->InsertItem( pSupportedSlots->nId, sItemText, pSupportedSlots->bRepeat ? TIB_REPEAT : 0 );
- m_pToolbar->SetQuickHelpText( pSupportedSlots->nId, sItemHelpText );
- if ( isSfxSlot( pSupportedSlots->nId ) )
- m_pToolbar->SetHelpId( pSupportedSlots->nId, pSupportedSlots->nId );
+ m_pToolbar->InsertItem( pSupportedFeatures->nId, String(), pSupportedFeatures->bRepeat ? TIB_REPEAT : 0 );
+ m_pToolbar->SetQuickHelpText( pSupportedFeatures->nId, String() ); // TODO
+ if ( !isArtificialItem( pSupportedFeatures->nId ) )
+ {
+ ::rtl::OUString sCommandURL( lcl_getCommandURL( pSupportedFeatures->nId ) );
+ m_pToolbar->SetItemCommand( pSupportedFeatures->nId, sCommandURL );
+ if ( m_pDescriptionProvider )
+ m_pToolbar->SetQuickHelpText( pSupportedFeatures->nId, m_pDescriptionProvider->getCommandDescription( sCommandURL ) );
+ }
- if ( pSupportedSlots->bItemWindow )
+ if ( pSupportedFeatures->bItemWindow )
{
Window* pItemWindow = NULL;
- if ( SID_FM_RECORD_ABSOLUTE == pSupportedSlots->nId )
+ if ( FormFeature::MoveAbsolute == pSupportedFeatures->nId )
{
pItemWindow = new RecordPositionInput( m_pToolbar );
static_cast< RecordPositionInput* >( pItemWindow )->setDispatcher( m_pDispatcher );
}
- else if ( LID_RECORD_FILLER == pSupportedSlots->nId )
+ else if ( LID_RECORD_FILLER == pSupportedFeatures->nId )
{
pItemWindow = new FixedText( m_pToolbar, WB_CENTER | WB_VCENTER );
pItemWindow->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
@@ -309,7 +338,7 @@ namespace frm
}
m_aChildWins.push_back( pItemWindow );
- switch ( pSupportedSlots->nId )
+ switch ( pSupportedFeatures->nId )
{
case LID_RECORD_LABEL:
pItemWindow->SetText( getLabelString( RID_STR_LABEL_RECORD ) );
@@ -320,7 +349,7 @@ namespace frm
break;
}
- m_pToolbar->SetItemWindow( pSupportedSlots->nId, pItemWindow );
+ m_pToolbar->SetItemWindow( pSupportedFeatures->nId, pItemWindow );
}
}
else
@@ -331,25 +360,66 @@ namespace frm
forEachItemWindow( &NavigationToolBar::adjustItemWindowWidth, NULL );
- // the image of the item
- ::std::auto_ptr< SfxImageManager > pImageManager( new SfxImageManager( NULL ) );
- pImageManager->SetImagesForceSize( *m_pToolbar, FALSE, m_eImageSize == eLarge );
+ implUpdateImages();
+ }
+
+ //---------------------------------------------------------------------
+ void NavigationToolBar::implUpdateImages()
+ {
+ OSL_ENSURE( m_pImageProvider, "NavigationToolBar::implUpdateImages: no image provider => no images!" );
+ if ( !m_pImageProvider )
+ return;
+
+ const bool bIsHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ const USHORT nItemCount = m_pToolbar->GetItemCount();
+
+ // collect the FormFeatures in the toolbar
+ typedef ::std::vector< sal_Int16 > FormFeatures;
+ FormFeatures aFormFeatures;
+ aFormFeatures.reserve( nItemCount );
+
+ for ( USHORT i=0; i<nItemCount; ++i )
+ {
+ USHORT nId = m_pToolbar->GetItemId( i );
+ if ( ( TOOLBOXITEM_BUTTON == m_pToolbar->GetItemType( i ) ) && !isArtificialItem( nId ) )
+ aFormFeatures.push_back( nId );
+ }
+
+ // translate them into command URLs
+ CommandURLs aCommandURLs( aFormFeatures.size() );
+ for ( FormFeatures::const_iterator formFeature = aFormFeatures.begin();
+ formFeature != aFormFeatures.end();
+ ++formFeature
+ )
+ {
+ aCommandURLs[ formFeature - aFormFeatures.begin() ] = lcl_getCommandURL( *formFeature );
+ }
+
+ // retrieve the images for the command URLs
+ CommandImages aCommandImages = m_pImageProvider->getCommandImages( aCommandURLs, m_eImageSize == eLarge, bIsHighContrast );
+
+ // and set them at the toolbar
+ CommandImages::const_iterator commandImage = aCommandImages.begin();
+ for ( FormFeatures::const_iterator formFeature = aFormFeatures.begin();
+ formFeature != aFormFeatures.end();
+ ++formFeature, ++commandImage
+ )
+ {
+ m_pToolbar->SetItemImage( *formFeature, *commandImage );
+ }
// parts of our layout is dependent on the size of our icons
Resize();
}
//---------------------------------------------------------------------
- void NavigationToolBar::implSetImageSize( ImageSize _eSize, bool _bForce )
+ void NavigationToolBar::implSetImageSize( ImageSize _eSize )
{
- if ( ( _eSize != m_eImageSize ) || _bForce )
+ if ( _eSize != m_eImageSize )
{
m_eImageSize = _eSize;
- ::std::auto_ptr< SfxImageManager > pImageManager( new SfxImageManager( NULL ) );
- pImageManager->SetImagesForceSize( *m_pToolbar, lcl_isHighContrast( GetBackground().GetColor() ), m_eImageSize == eLarge );
-
- // parts of our layout is dependent on the size of our icons
- Resize();
+ implUpdateImages();
}
}
@@ -369,7 +439,7 @@ namespace frm
case ePosition:
{
static const USHORT aPositionIds[] = {
- LID_RECORD_LABEL, SID_FM_RECORD_ABSOLUTE, LID_RECORD_FILLER, SID_FM_RECORD_TOTAL, 0
+ LID_RECORD_LABEL, FormFeature::MoveAbsolute, LID_RECORD_FILLER, FormFeature::TotalRecords, 0
};
pGroupIds = aPositionIds;
}
@@ -377,7 +447,7 @@ namespace frm
case eNavigation:
{
static const USHORT aNavigationIds[] = {
- SID_FM_RECORD_FIRST, SID_FM_RECORD_PREV, SID_FM_RECORD_NEXT, SID_FM_RECORD_LAST, 0
+ FormFeature::MoveToFirst, FormFeature::MoveToPrevious, FormFeature::MoveToNext, FormFeature::MoveToLast, FormFeature::MoveToInsertRow, 0
};
pGroupIds = aNavigationIds;
}
@@ -385,7 +455,7 @@ namespace frm
case eRecordActions:
{
static const USHORT aActionIds[] = {
- SID_FM_RECORD_SAVE, SID_FM_RECORD_UNDO, SID_FM_RECORD_NEW, SID_FM_RECORD_DELETE, SID_FM_REFRESH, SID_FM_REFRESH_FORM_CONTROL, 0
+ FormFeature::SaveRecordChanges, FormFeature::UndoRecordChanges, FormFeature::DeleteRecord, FormFeature::ReloadForm, FormFeature::RefreshCurrentControl, 0
};
pGroupIds = aActionIds;
}
@@ -393,7 +463,7 @@ namespace frm
case eFilterSort:
{
static const USHORT aFilterSortIds[] = {
- SID_FM_SORTUP, SID_FM_SORTDOWN, SID_FM_ORDERCRIT, SID_FM_AUTOFILTER, SID_FM_FILTERCRIT, SID_FM_FORM_FILTERED, SID_FM_REMOVE_FILTER_SORT, 0
+ FormFeature::SortAscending, FormFeature::SortDescending, FormFeature::InteractiveSort, FormFeature::AutoFilter, FormFeature::InteractiveFilter, FormFeature::ToggleApplyFilter, FormFeature::RemoveFilterAndSort, 0
};
pGroupIds = aFilterSortIds;
}
@@ -414,9 +484,9 @@ namespace frm
switch ( _eGroup )
{
case ePosition : nIndicatorItem = LID_RECORD_LABEL; break;
- case eNavigation : nIndicatorItem = SID_FM_RECORD_FIRST; break;
- case eRecordActions : nIndicatorItem = SID_FM_RECORD_SAVE; break;
- case eFilterSort : nIndicatorItem = SID_FM_SORTUP; break;
+ case eNavigation : nIndicatorItem = FormFeature::MoveToFirst; break;
+ case eRecordActions : nIndicatorItem = FormFeature::SaveRecordChanges; break;
+ case eFilterSort : nIndicatorItem = FormFeature::SortAscending; break;
default:
OSL_ENSURE( sal_False, "NavigationToolBar::IsFunctionGroupVisible: invalid group id!" );
}
@@ -481,7 +551,7 @@ namespace frm
// the contrast of the background color may have changed, so force
// the images to be rebuild (high contrast requires a possibly different
// image set)
- implSetImageSize( m_eImageSize, true );
+ implUpdateImages();
}
//---------------------------------------------------------------------
@@ -494,7 +564,7 @@ namespace frm
// the contrast of the background color may have changed, so force
// the images to be rebuild (high contrast requires a possibly different
// image set)
- implSetImageSize( m_eImageSize, true );
+ implUpdateImages();
}
//---------------------------------------------------------------------
@@ -583,11 +653,11 @@ namespace frm
sItemText = getLabelString( RID_STR_LABEL_OF );
break;
- case SID_FM_RECORD_ABSOLUTE:
+ case FormFeature::MoveAbsolute:
sItemText = String::CreateFromAscii( "12345678" );
break;
- case SID_FM_RECORD_TOTAL:
+ case FormFeature::TotalRecords:
sItemText = String::CreateFromAscii( "123456" );
break;
}
@@ -642,7 +712,7 @@ namespace frm
return;
if ( m_pDispatcher )
- m_pDispatcher->dispatchWithArgument( SID_FM_RECORD_ABSOLUTE, "Position", ::com::sun::star::uno::makeAny( (sal_Int32)nRecord ) );
+ m_pDispatcher->dispatchWithArgument( FormFeature::MoveAbsolute, "Position", makeAny( (sal_Int32)nRecord ) );
SaveValue();
}
diff --git a/forms/source/solar/inc/navtoolbar.hxx b/forms/source/solar/inc/navtoolbar.hxx
index b19c57431706..eaa3717bc4d2 100644
--- a/forms/source/solar/inc/navtoolbar.hxx
+++ b/forms/source/solar/inc/navtoolbar.hxx
@@ -34,14 +34,19 @@
#include <vcl/toolbox.hxx>
#include <vcl/field.hxx>
+#include <boost/shared_ptr.hpp>
+
//.........................................................................
namespace frm
{
//.........................................................................
class IFeatureDispatcher;
+ class ICommandImageProvider;
+ class ICommandDescriptionProvider;
class ImplNavToolBar;
+
//=====================================================================
//= NavigationToolBar
//=====================================================================
@@ -63,13 +68,22 @@ namespace frm
};
private:
- const IFeatureDispatcher* m_pDispatcher;
- ImageSize m_eImageSize;
- ImplNavToolBar* m_pToolbar;
- ::std::vector< Window* > m_aChildWins;
+ const IFeatureDispatcher* m_pDispatcher;
+ const ::boost::shared_ptr< const ICommandImageProvider >
+ m_pImageProvider;
+ const ::boost::shared_ptr< const ICommandDescriptionProvider >
+ m_pDescriptionProvider;
+ ImageSize m_eImageSize;
+ ImplNavToolBar* m_pToolbar;
+ ::std::vector< Window* > m_aChildWins;
public:
- NavigationToolBar( Window* _pParent, WinBits _nStyle );
+ NavigationToolBar(
+ Window* _pParent,
+ WinBits _nStyle,
+ const ::boost::shared_ptr< const ICommandImageProvider >& _pImageProvider,
+ const ::boost::shared_ptr< const ICommandDescriptionProvider >& _pDescriptionProvider
+ );
~NavigationToolBar( );
/** sets the dispatcher which is to be used for the features
@@ -82,19 +96,16 @@ namespace frm
ensuring the life time of the object does exceed the life time
of the tool bar instance.
*/
- void setDispatcher( const IFeatureDispatcher* _pDispatcher );
+ void setDispatcher( const IFeatureDispatcher* _pDispatcher );
- /** enables or disables a given feature
- */
- void enableFeature( sal_Int32 _nFeatureId, bool _bEnabled );
+ /// enables or disables a given feature
+ void enableFeature( sal_Int16 _nFeatureId, bool _bEnabled );
- /** checks or unchecks a given feature
- */
- void checkFeature( sal_Int32 _nFeatureId, bool _bEnabled );
+ /// checks or unchecks a given feature
+ void checkFeature( sal_Int16 _nFeatureId, bool _bEnabled );
- /** sets the text of a given feature
- */
- void setFeatureText( sal_Int32 _nFeatureId, const ::rtl::OUString& _rText );
+ /// sets the text of a given feature
+ void setFeatureText( sal_Int16 _nFeatureId, const ::rtl::OUString& _rText );
/** retrieves the current image size
*/
@@ -127,7 +138,10 @@ namespace frm
void implInit( );
/// impl version of SetImageSize
- void implSetImageSize( ImageSize _eSize, bool _bForce = false );
+ void implSetImageSize( ImageSize _eSize );
+
+ /// updates the images of our items
+ void implUpdateImages();
/// enables or disables an item, plus possible dependent items
void implEnableItem( USHORT _nItemId, bool _bEnabled );