summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRelease Engineers <releng@openoffice.org>2008-12-01 12:31:27 +0000
committerRelease Engineers <releng@openoffice.org>2008-12-01 12:31:27 +0000
commita6f52ce1a54abd7e8a135eaddf9baea1c5fdad9c (patch)
tree2d0ca2c923577ad07d580a4a6dd042d6c6ea25ca
parenta4ec688d4933aac44011ce7ccb3184b9d9ca6c91 (diff)
CWS-TOOLING: integrate CWS dba31e
2008-11-19 12:36:23 +0100 msc r263980 : i96104 2008-11-19 12:31:19 +0100 msc r263979 : i96104 2008-11-19 12:21:55 +0100 msc r263977 : i96104 2008-11-19 12:18:53 +0100 msc r263976 : i96104 2008-11-18 09:09:45 +0100 oj r263746 : disable color entry when area is set 2008-11-18 08:37:52 +0100 oj r263741 : #remove sub report entry 2008-11-17 11:20:25 +0100 fs r263708 : #i10000# 2008-11-17 11:06:52 +0100 fs r263706 : minimal version now is 3.1 2008-11-12 22:25:59 +0100 fs r263621 : #i96150# 2008-11-12 22:20:02 +0100 fs r263620 : rebased to m34 2008-11-12 21:39:41 +0100 fs r263618 : MANUAL REBASE: rebase CWS dba31d to DEV300_m34 2008-11-12 13:54:58 +0100 fs r263597 : #i96134# MediaDescriptor.URL is to be preferred over MediaDescriptor.FileName. Nonetheless, ensure both are handled 2008-11-12 13:53:40 +0100 fs r263596 : #i96134# re-enabled the code for #i41897#, a better fix is to come 2008-11-12 12:48:21 +0100 fs r263585 : #i96134# disable saving URLs of file-base databases relatively 2008-11-11 16:11:11 +0100 msc r263566 : #i96104# 2008-11-05 09:09:47 +0100 oj r263342 : #i88727# color noe added 2008-11-05 08:41:43 +0100 oj r263341 : #i77916# zoom added 2008-11-04 21:24:15 +0100 fs r263339 : disposing: call disposeAndClear without own mutex locked - some of our listeners insist on locking the SolarMutex, which sometimes led to deadlocks on the complex test cases 2008-11-04 21:23:15 +0100 fs r263338 : remove SolarMutex locking - this happned in CWS dba31c (in the CVS version), which this CWS was created from, but seems to got lost during resync 2008-11-04 20:49:50 +0100 fs r263335 : docu formatting 2008-11-04 20:06:39 +0100 fs r263334 : #i95826# use m_aMutex, not a DocumentGuard (wrongly resolved merge conflicts) 2008-11-04 17:36:29 +0100 fs r263332 : #i92688# properly revoke as XEventListener from m_xActiveController when disposing 2008-11-04 14:49:34 +0100 fs r263324 : #i92322# enable Input Required if EmptyIsNULL does not exist at the control 2008-10-31 11:10:04 +0100 oj r262857 : merge from cvs to svn 2008-10-31 09:46:45 +0100 oj r262853 : merge from cvs to svn 2008-10-31 08:46:37 +0100 oj r262849 : merge from cvs to svn 2008-10-31 08:44:24 +0100 oj r262848 : merge from cvs to svn 2008-10-31 08:43:33 +0100 oj r262847 : merge from cvs to svn 2008-10-31 08:42:28 +0100 oj r262846 : merge from cvs to svn 2008-10-31 08:41:58 +0100 oj r262845 : merge from cvs to svn 2008-10-31 08:41:32 +0100 oj r262844 : merge from cvs to svn 2008-10-28 12:19:50 +0100 oj r262733 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:42 +0100 oj r262732 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:36 +0100 oj r262731 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:31 +0100 oj r262730 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:22 +0100 oj r262729 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:18 +0100 oj r262728 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:10 +0100 oj r262727 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:06 +0100 oj r262726 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:05 +0100 oj r262725 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:01 +0100 oj r262724 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:50 +0100 oj r262723 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:41 +0100 oj r262722 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:40 +0100 oj r262721 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:27 +0100 oj r262720 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:10 +0100 oj r262719 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:01 +0100 oj r262718 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:17:39 +0100 oj r262717 : #iXXXXX#: migrate CWS dba31e to SVN
-rw-r--r--connectivity/com/sun/star/sdbcx/comp/hsqldb/makefile.mk1
-rw-r--r--connectivity/inc/connectivity/dbexception.hxx35
-rw-r--r--connectivity/inc/connectivity/standardsqlstate.hxx76
-rw-r--r--connectivity/qa/connectivity/tools/HsqlDatabase.java46
-rw-r--r--connectivity/qa/connectivity/tools/makefile.mk2
-rw-r--r--connectivity/source/drivers/file/FDatabaseMetaData.cxx2
-rw-r--r--connectivity/source/drivers/file/FPreparedStatement.cxx2
-rw-r--r--connectivity/source/drivers/file/FResultSet.cxx2
-rw-r--r--connectivity/source/drivers/jdbc/PreparedStatement.cxx31
-rw-r--r--connectivity/source/drivers/mozab/MResultSet.cxx2
-rw-r--r--connectivity/source/drivers/odbc/OPreparedStatement.cxx100
-rw-r--r--connectivity/source/drivers/odbc/OResultSet.cxx2
-rw-r--r--connectivity/source/inc/odbc/OBoundParam.hxx29
-rw-r--r--connectivity/source/inc/odbc/OPreparedStatement.hxx2
-rw-r--r--desktop/source/deployment/misc/dp_dependencies.cxx33
-rw-r--r--desktop/test/deployment/dependencies/readme.txt12
-rw-r--r--svx/inc/fmgridif.hxx5
-rw-r--r--svx/inc/svx/fmview.hxx50
-rw-r--r--svx/inc/svx/gridctrl.hxx3
-rw-r--r--svx/source/fmcomp/fmgridcl.cxx157
-rw-r--r--svx/source/fmcomp/fmgridif.cxx50
-rw-r--r--svx/source/fmcomp/gridcell.cxx17
-rw-r--r--svx/source/fmcomp/gridctrl.cxx37
-rw-r--r--svx/source/form/delayedevent.cxx71
-rw-r--r--svx/source/form/fmctrler.cxx645
-rw-r--r--svx/source/form/fmexpl.cxx3
-rw-r--r--svx/source/form/fmmodel.cxx11
-rw-r--r--svx/source/form/fmobj.cxx229
-rw-r--r--svx/source/form/fmpage.cxx121
-rw-r--r--svx/source/form/fmpgeimp.cxx164
-rw-r--r--svx/source/form/fmprop.cxx1
-rw-r--r--svx/source/form/fmshell.cxx95
-rw-r--r--svx/source/form/fmshimp.cxx347
-rw-r--r--svx/source/form/fmtextcontrolshell.cxx95
-rw-r--r--svx/source/form/fmtools.cxx81
-rw-r--r--svx/source/form/fmundo.cxx71
-rw-r--r--svx/source/form/fmview.cxx139
-rw-r--r--svx/source/form/fmvwimp.cxx839
-rw-r--r--svx/source/form/formcontrolfactory.cxx738
-rw-r--r--svx/source/form/makefile.mk6
-rw-r--r--svx/source/form/navigatortree.cxx89
-rw-r--r--svx/source/form/navigatortreemodel.cxx126
-rw-r--r--svx/source/inc/delayedevent.hxx90
-rw-r--r--svx/source/inc/fmcontr.hxx252
-rw-r--r--svx/source/inc/fmctrler.hxx129
-rw-r--r--svx/source/inc/fmexpl.hxx17
-rw-r--r--svx/source/inc/fmobj.hxx50
-rw-r--r--svx/source/inc/fmpgeimp.hxx31
-rw-r--r--svx/source/inc/fmprop.hrc1
-rw-r--r--svx/source/inc/fmshimp.hxx4
-rw-r--r--svx/source/inc/fmtools.hxx5
-rw-r--r--svx/source/inc/fmvwimp.hxx61
-rw-r--r--svx/source/inc/formcontrolfactory.hxx105
-rw-r--r--svx/source/unodraw/unoprov.cxx1
-rw-r--r--svx/source/unodraw/unoshap2.cxx1
-rw-r--r--xmloff/inc/xmloff/ControlBorderHandler.hxx73
-rw-r--r--xmloff/inc/xmloff/controlpropertyhdl.hxx49
-rw-r--r--xmloff/inc/xmloff/xmltoken.hxx4
-rw-r--r--xmloff/source/core/xmltoken.cxx4
-rw-r--r--xmloff/source/draw/sdpropls.cxx12
-rw-r--r--xmloff/source/draw/sdpropls.hxx1
-rw-r--r--xmloff/source/forms/controlpropertyhdl.cxx145
-rw-r--r--xmloff/source/forms/controlpropertymap.cxx6
-rw-r--r--xmloff/source/forms/controlpropertymap.hxx6
-rw-r--r--xmloff/source/forms/elementexport.cxx97
-rw-r--r--xmloff/source/forms/elementimport.cxx15
-rw-r--r--xmloff/source/forms/formattributes.cxx1
-rw-r--r--xmloff/source/forms/formattributes.hxx1
-rw-r--r--xmloff/source/forms/formenums.cxx16
-rw-r--r--xmloff/source/forms/formenums.hxx1
-rw-r--r--xmloff/source/forms/layerexport.cxx10
-rw-r--r--xmloff/source/forms/layerexport.hxx4
-rw-r--r--xmloff/source/forms/layerimport.cxx2
-rw-r--r--xmloff/source/forms/propertyexport.cxx4
-rw-r--r--xmloff/source/forms/propertyimport.hxx19
-rw-r--r--xmloff/source/forms/strings.hxx2
76 files changed, 3080 insertions, 2706 deletions
diff --git a/connectivity/com/sun/star/sdbcx/comp/hsqldb/makefile.mk b/connectivity/com/sun/star/sdbcx/comp/hsqldb/makefile.mk
index b3d55f8e5c..3977a4869e 100644
--- a/connectivity/com/sun/star/sdbcx/comp/hsqldb/makefile.mk
+++ b/connectivity/com/sun/star/sdbcx/comp/hsqldb/makefile.mk
@@ -43,6 +43,7 @@ SECONDARY_PACKAGE = org$/hsqldb$/lib
.IF "$(SYSTEM_HSQLDB)" == "YES"
XCLASSPATH!:=$(XCLASSPATH)$(PATH_SEPERATOR)$(HSQLDB_JAR)
+JARFILES+= $(HSQLDB_JAR)
.ELSE
JARFILES+= hsqldb.jar
.ENDIF
diff --git a/connectivity/inc/connectivity/dbexception.hxx b/connectivity/inc/connectivity/dbexception.hxx
index aba60111cc..ded1030be5 100644
--- a/connectivity/inc/connectivity/dbexception.hxx
+++ b/connectivity/inc/connectivity/dbexception.hxx
@@ -32,6 +32,7 @@
#define _DBHELPER_DBEXCEPTION_HXX_
#include <com/sun/star/sdbc/SQLException.hpp>
+#include "connectivity/standardsqlstate.hxx"
namespace com
{
@@ -56,40 +57,6 @@ namespace dbtools
{
//.........................................................................
-//----------------------------------------------------------------------------------
-/** standard SQLStates to be used with an SQLException
-
- Extend this list whenever you need a new state ...
-
- @see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcodbc_error_codes.asp
-*/
-enum StandardSQLState
-{
- SQL_WRONG_PARAMETER_NUMBER, // 07001
- SQL_INVALID_DESCRIPTOR_INDEX, // 07009
- SQL_UNABLE_TO_CONNECT, // 08001
- SQL_NUMERIC_OUT_OF_RANGE, // 22003
- SQL_INVALID_DATE_TIME, // 22007
- SQL_INVALID_CURSOR_STATE, // 24000
- SQL_TABLE_OR_VIEW_EXISTS, // 42S01
- SQL_TABLE_OR_VIEW_NOT_FOUND, // 42S02
- SQL_INDEX_ESISTS, // 42S11
- SQL_INDEX_NOT_FOUND, // 42S12
- SQL_COLUMN_EXISTS, // 42S21
- SQL_COLUMN_NOT_FOUND, // 42S22
- SQL_GENERAL_ERROR, // HY000
- SQL_INVALID_SQL_DATA_TYPE, // HY004
- SQL_OPERATION_CANCELED, // HY008
- SQL_FUNCTION_SEQUENCE_ERROR, // HY010
- SQL_INVALID_CURSOR_POSITION, // HY109
- SQL_INVALID_BOOKMARK_VALUE, // HY111
- SQL_FEATURE_NOT_IMPLEMENTED, // HYC00
- SQL_FUNCTION_NOT_SUPPORTED, // IM001
- SQL_CONNECTION_DOES_NOT_EXIST, // 08003
-
- SQL_ERROR_UNSPECIFIED = SAL_MAX_ENUM // special value indicating that an SQLState is not to be specified
-};
-
//==============================================================================
//= Special exception if cancel is pressed in DBA UI
//==============================================================================
diff --git a/connectivity/inc/connectivity/standardsqlstate.hxx b/connectivity/inc/connectivity/standardsqlstate.hxx
new file mode 100644
index 0000000000..b9c9d549d0
--- /dev/null
+++ b/connectivity/inc/connectivity/standardsqlstate.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+* 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: standardsqlstate.hxx,v $
+*
+* $Revision: 1.1.2.1 $
+*
+* 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 CONNECTIVITY_STANDARD_SQL_STATE_HXX
+#define CONNECTIVITY_STANDARD_SQL_STATE_HXX
+
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+ //----------------------------------------------------------------------------------
+ /** standard SQLStates to be used with an SQLException
+
+ Extend this list whenever you need a new state ...
+
+ @see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcodbc_error_codes.asp
+ */
+ enum StandardSQLState
+ {
+ SQL_WRONG_PARAMETER_NUMBER, // 07001
+ SQL_INVALID_DESCRIPTOR_INDEX, // 07009
+ SQL_UNABLE_TO_CONNECT, // 08001
+ SQL_NUMERIC_OUT_OF_RANGE, // 22003
+ SQL_INVALID_DATE_TIME, // 22007
+ SQL_INVALID_CURSOR_STATE, // 24000
+ SQL_TABLE_OR_VIEW_EXISTS, // 42S01
+ SQL_TABLE_OR_VIEW_NOT_FOUND, // 42S02
+ SQL_INDEX_ESISTS, // 42S11
+ SQL_INDEX_NOT_FOUND, // 42S12
+ SQL_COLUMN_EXISTS, // 42S21
+ SQL_COLUMN_NOT_FOUND, // 42S22
+ SQL_GENERAL_ERROR, // HY000
+ SQL_INVALID_SQL_DATA_TYPE, // HY004
+ SQL_OPERATION_CANCELED, // HY008
+ SQL_FUNCTION_SEQUENCE_ERROR, // HY010
+ SQL_INVALID_CURSOR_POSITION, // HY109
+ SQL_INVALID_BOOKMARK_VALUE, // HY111
+ SQL_FEATURE_NOT_IMPLEMENTED, // HYC00
+ SQL_FUNCTION_NOT_SUPPORTED, // IM001
+ SQL_CONNECTION_DOES_NOT_EXIST, // 08003
+
+ SQL_ERROR_UNSPECIFIED = SAL_MAX_ENUM // special value indicating that an SQLState is not to be specified
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // CONNECTIVITY_STANDARD_SQL_STATE_HXX
diff --git a/connectivity/qa/connectivity/tools/HsqlDatabase.java b/connectivity/qa/connectivity/tools/HsqlDatabase.java
index 113f3ee479..36e507c0ff 100644
--- a/connectivity/qa/connectivity/tools/HsqlDatabase.java
+++ b/connectivity/qa/connectivity/tools/HsqlDatabase.java
@@ -33,6 +33,7 @@ package connectivity.tools;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
import com.sun.star.container.ElementExistException;
+import com.sun.star.container.XNameAccess;
import com.sun.star.frame.XStorable;
import com.sun.star.frame.XModel;
import com.sun.star.lang.XMultiServiceFactory;
@@ -45,12 +46,15 @@ import com.sun.star.sdbcx.XAppend;
import com.sun.star.sdbcx.XTablesSupplier;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.io.IOException;
+import com.sun.star.sdb.XDocumentDataSource;
import java.io.File;
import com.sun.star.util.CloseVetoException;
+import helper.URLHelper;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
+import java.io.File;
/**
*
@@ -69,29 +73,51 @@ public class HsqlDatabase
// the default connection
XConnection m_connection;
- /** Creates a new instance of HsqlDatabase */
+ // --------------------------------------------------------------------------------------------------------
public HsqlDatabase( XMultiServiceFactory orb ) throws Exception
{
m_orb = orb;
createDBDocument();
}
+ // --------------------------------------------------------------------------------------------------------
+ public HsqlDatabase( XMultiServiceFactory orb, String _existingDocumentURL ) throws Exception
+ {
+ m_orb = orb;
+ createDBDocument( _existingDocumentURL );
+ }
+
+ // --------------------------------------------------------------------------------------------------------
+ private void createDBDocument( String _docURL ) throws Exception
+ {
+ m_databaseDocumentFile = _docURL;
+
+ XNameAccess dbContext = (XNameAccess)UnoRuntime.queryInterface( XNameAccess.class,
+ m_orb.createInstance( "com.sun.star.sdb.DatabaseContext" ) );
+ XDocumentDataSource dataSource = (XDocumentDataSource)UnoRuntime.queryInterface( XDocumentDataSource.class,
+ dbContext.getByName( _docURL ) );
+
+ m_databaseDocument = dataSource.getDatabaseDocument();
+ m_dataSource = new DataSource( m_orb, m_databaseDocument.getDataSource() );
+ }
+
+ /** creates an empty database document in a temporary location
+ */
private void createDBDocument() throws Exception
{
- m_databaseDocumentFile = new String();
- String str = File.createTempFile("testdb",".odb").getCanonicalPath();
- str = str.replaceAll(" ","%20");
- str = "file:///" +str;
- m_databaseDocumentFile = str.replace('\\','/');
+ File documentFile = File.createTempFile("testdb",".odb");
+ documentFile.deleteOnExit();
+ m_databaseDocumentFile = URLHelper.getFileURLFromSystemPath( documentFile );
m_databaseDocument = (XOfficeDatabaseDocument)UnoRuntime.queryInterface(
XOfficeDatabaseDocument.class, m_orb.createInstance( "com.sun.star.sdb.OfficeDatabaseDocument" ) );
m_dataSource = new DataSource( m_orb, m_databaseDocument.getDataSource() );
+
XPropertySet dsProperties = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, m_databaseDocument.getDataSource() );
dsProperties.setPropertyValue("URL", "sdbc:embedded:hsqldb");
XStorable storable = (XStorable)UnoRuntime.queryInterface( XStorable.class, m_databaseDocument );
- storable.storeAsURL(m_databaseDocumentFile,new PropertyValue[]{});
+ storable.storeAsURL( m_databaseDocumentFile, new PropertyValue[]{} );
}
/** returns a connection to the database
@@ -151,8 +177,8 @@ public class HsqlDatabase
m_connection = null;
// close document
- com.sun.star.util.XCloseable closeDoc = (com.sun.star.util.XCloseable)UnoRuntime.queryInterface( XCloseable.class,
- m_databaseDocument );
+ com.sun.star.util.XCloseable closeDoc = (com.sun.star.util.XCloseable)UnoRuntime.queryInterface(
+ com.sun.star.util.XCloseable.class, m_databaseDocument );
if ( closeDoc != null )
{
try
@@ -188,7 +214,7 @@ public class HsqlDatabase
/** returns the underlying database document
*/
- XOfficeDatabaseDocument getDatabaseDocument()
+ public XOfficeDatabaseDocument getDatabaseDocument()
{
return m_databaseDocument;
}
diff --git a/connectivity/qa/connectivity/tools/makefile.mk b/connectivity/qa/connectivity/tools/makefile.mk
index 499db941f8..c85d5ddd54 100644
--- a/connectivity/qa/connectivity/tools/makefile.mk
+++ b/connectivity/qa/connectivity/tools/makefile.mk
@@ -44,7 +44,7 @@ all:
#----- compile .java files -----------------------------------------
-JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar
+JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunnerLight.jar
# Do not use $/ with the $(FIND) command as for W32-4nt this leads to a backslash
# in a posix command. In this special case use / instead of $/
.IF "$(GUI)"=="OS2"
diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx
index d3ce4a66c4..8e23afca81 100644
--- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx
@@ -142,7 +142,7 @@ namespace
if ( bCanAccess )
{
- // here we have two contents which's URLs differ by case only.
+ // here we have two contents whose URLs differ by case only.
// Now let's check if both really refer to the same object ....
Reference< XContent > xContent1 = aContent1.get();
Reference< XContent > xContent2 = aContent2.get();
diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx
index 911ad684c9..f1cf7408fe 100644
--- a/connectivity/source/drivers/file/FPreparedStatement.cxx
+++ b/connectivity/source/drivers/file/FPreparedStatement.cxx
@@ -366,7 +366,7 @@ void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, con
::dbtools::throwFunctionSequenceException(*this);
Sequence<sal_Int8> aSeq;
- x->readSomeBytes(aSeq,length);
+ x->readBytes(aSeq,length);
setParameter(parameterIndex,aSeq);
}
// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx
index aad78bf644..531e02fb1b 100644
--- a/connectivity/source/drivers/file/FResultSet.cxx
+++ b/connectivity/source/drivers/file/FResultSet.cxx
@@ -778,7 +778,7 @@ void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Refer
::dbtools::throwFunctionSequenceException(*this);
Sequence<sal_Int8> aSeq;
- x->readSomeBytes(aSeq,length);
+ x->readBytes(aSeq,length);
updateValue(columnIndex,aSeq);
}
// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/jdbc/PreparedStatement.cxx b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
index 5dfa4c4f6e..d4f6ce4405 100644
--- a/connectivity/source/drivers/jdbc/PreparedStatement.cxx
+++ b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
@@ -650,15 +650,17 @@ void SAL_CALL java_sql_PreparedStatement::setCharacterStream( sal_Int32 paramete
mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID )
{
+ Sequence< sal_Int8 > aSeq;
+ if ( x.is() )
+ x->readBytes( aSeq, length );
+ sal_Int32 actualLength = aSeq.getLength();
+
jvalue args2[3];
- jbyteArray pByteArray = t.pEnv->NewByteArray(length);
- Sequence< sal_Int8> aSeq;
- if(x.is())
- x->readBytes(aSeq,length);
- t.pEnv->SetByteArrayRegion(pByteArray,0,length,(jbyte*)aSeq.getConstArray());
+ jbyteArray pByteArray = t.pEnv->NewByteArray( actualLength );
+ t.pEnv->SetByteArrayRegion(pByteArray,0,actualLength,(jbyte*)aSeq.getConstArray());
args2[0].l = pByteArray;
args2[1].i = 0;
- args2[2].i = (sal_Int32)length;
+ args2[2].i = actualLength;
// temporaere Variable initialisieren
const char * cSignatureStream = "([BII)V";
// Java-Call absetzen
@@ -670,7 +672,7 @@ void SAL_CALL java_sql_PreparedStatement::setCharacterStream( sal_Int32 paramete
if(mID2)
tempObj = t.pEnv->NewObjectA( aClass, mID2, args2 );
- t.pEnv->CallVoidMethod( object, mID, parameterIndex,tempObj,length);
+ t.pEnv->CallVoidMethod( object, mID, parameterIndex,tempObj,actualLength);
// und aufraeumen
t.pEnv->DeleteLocalRef(pByteArray);
t.pEnv->DeleteLocalRef(tempObj);
@@ -698,14 +700,17 @@ void SAL_CALL java_sql_PreparedStatement::setBinaryStream( sal_Int32 parameterIn
mID = t.pEnv->GetMethodID( getMyClass(), cMethodName, cSignature );OSL_ENSURE(mID,"Unknown method id!");
if( mID )
{
+ Sequence< sal_Int8 > aSeq;
+ if ( x.is() )
+ x->readBytes( aSeq, length );
+ sal_Int32 actualLength = aSeq.getLength();
+
jvalue args2[3];
- jbyteArray pByteArray = t.pEnv->NewByteArray(length);
- Sequence< sal_Int8> aSeq;
- x->readBytes(aSeq,length);
- t.pEnv->SetByteArrayRegion(pByteArray,0,length,(jbyte*)aSeq.getConstArray());
+ jbyteArray pByteArray = t.pEnv->NewByteArray(actualLength);
+ t.pEnv->SetByteArrayRegion(pByteArray,0,actualLength,(jbyte*)aSeq.getConstArray());
args2[0].l = pByteArray;
args2[1].i = 0;
- args2[2].i = (sal_Int32)length;
+ args2[2].i = (sal_Int32)actualLength;
// temporaere Variable initialisieren
const char * cSignatureStream = "([BII)V";
@@ -717,7 +722,7 @@ void SAL_CALL java_sql_PreparedStatement::setBinaryStream( sal_Int32 parameterIn
jobject tempObj = NULL;
if(mID2)
tempObj = t.pEnv->NewObjectA( aClass, mID2, args2 );
- t.pEnv->CallVoidMethod( object, mID, parameterIndex,tempObj,(sal_Int32)length);
+ t.pEnv->CallVoidMethod( object, mID, parameterIndex,tempObj,(sal_Int32)actualLength);
// und aufraeumen
t.pEnv->DeleteLocalRef(pByteArray);
t.pEnv->DeleteLocalRef(tempObj);
diff --git a/connectivity/source/drivers/mozab/MResultSet.cxx b/connectivity/source/drivers/mozab/MResultSet.cxx
index f64e143dd7..d2dfb88ba5 100644
--- a/connectivity/source/drivers/mozab/MResultSet.cxx
+++ b/connectivity/source/drivers/mozab/MResultSet.cxx
@@ -1792,7 +1792,7 @@ void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Refer
::dbtools::throwFunctionSequenceException(*this);
Sequence<sal_Int8> aSeq;
- x->readSomeBytes(aSeq,length);
+ x->readBytes(aSeq,length);
updateValue(columnIndex,aSeq);
}
// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/odbc/OPreparedStatement.cxx b/connectivity/source/drivers/odbc/OPreparedStatement.cxx
index 2093e65532..ed6b881212 100644
--- a/connectivity/source/drivers/odbc/OPreparedStatement.cxx
+++ b/connectivity/source/drivers/odbc/OPreparedStatement.cxx
@@ -62,10 +62,6 @@ using namespace com::sun::star::container;
using namespace com::sun::star::io;
using namespace com::sun::star::util;
-int OBoundParam::ASCII = 1;
-int OBoundParam::UNICODE = 2;
-int OBoundParam::BINARY = 3;
-
IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.OPreparedStatement","com.sun.star.sdbc.PreparedStatement");
@@ -201,7 +197,7 @@ sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeExc
// If the parameter index is -1, there is no
// more data required
- if (*paramIndex == -1)
+ if ( !paramIndex || ( *paramIndex == -1 ) )
needData = sal_False;
else
{
@@ -580,13 +576,13 @@ void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequ
void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
{
- setStream (parameterIndex, x, length, DataType::LONGVARCHAR,OBoundParam::ASCII);
+ setStream (parameterIndex, x, length, DataType::LONGVARCHAR);
}
// -------------------------------------------------------------------------
void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
{
- setStream (parameterIndex, x, length, DataType::LONGVARBINARY,OBoundParam::BINARY);
+ setStream (parameterIndex, x, length, DataType::LONGVARBINARY);
}
// -------------------------------------------------------------------------
@@ -759,13 +755,8 @@ void OPreparedStatement::putParamData (sal_Int32 index) throw(SQLException)
return;
}
- // We'll transfer up to maxLen at a time
- sal_Int32 maxLen = MAX_PUT_DATA_LENGTH;
- sal_Int32 bufLen;
- sal_Int32 realLen;
- // sal_Int8* buf = new sal_Int8[maxLen];
- Sequence< sal_Int8 > buf(maxLen);
- sal_Bool endOfStream = sal_False;
+ // We'll transfer up to MAX_PUT_DATA_LENGTH at a time
+ Sequence< sal_Int8 > buf( MAX_PUT_DATA_LENGTH );
// Get the information about the input stream
@@ -776,78 +767,35 @@ void OPreparedStatement::putParamData (sal_Int32 index) throw(SQLException)
const ::rtl::OUString sError( aResources.getResourceString(STR_NO_INPUTSTREAM));
throw SQLException (sError, *this,::rtl::OUString(),0,Any());
}
- sal_Int32 inputStreamLen = boundParams[index - 1].getInputStreamLen ();
- sal_Int32 inputStreamType = boundParams[index - 1].getStreamType ();
+
+ sal_Int32 maxBytesLeft = boundParams[index - 1].getInputStreamLen ();
// Loop while more data from the input stream
+ sal_Int32 haveRead = 0;
try
{
- while (!endOfStream)
+ do
{
+ sal_Int32 toReadThisRound = ::std::min( MAX_PUT_DATA_LENGTH, maxBytesLeft );
// Read some data from the input stream
- bufLen = inputStream->readBytes(buf,maxLen);
+ haveRead = inputStream->readBytes( buf, toReadThisRound );
+ OSL_ENSURE( haveRead == buf.getLength(), "OPreparedStatement::putParamData: inconsistency!" );
- // -1 as the number of bytes read indicates that
- // there is no more data in the input stream
-
- if (bufLen == -1)
- {
-
- // Sanity check to ensure that all the data we said we
- // had was read. If not, raise an exception
-
- if (inputStreamLen != 0)
- {
- ::connectivity::SharedResources aResources;
- const ::rtl::OUString sError( aResources.getResourceString(STR_INPUTSTREAM_WRONG_LEN));
- throw SQLException (sError, *this,::rtl::OUString(),0,Any());
- }
- endOfStream = sal_True;
+ if ( !haveRead )
+ // no more data in the stream - the given stream length was a maximum which could not be
+ // fulfilled by the stream
break;
- }
-
- // If we got more bytes than necessary, truncate
- // the buffer by re-setting the buffer length. Also,
- // indicate that we don't need to read any more.
-
- if (bufLen > inputStreamLen)
- {
- bufLen = inputStreamLen;
- endOfStream = sal_True;
- }
-
- realLen = bufLen;
-
- // For UNICODE streams, strip off the high sal_Int8 and set the
- // number of actual bytes present. It is assumed that
- // there are 2 bytes present for every UNICODE character - if
- // not, then that's not our problem
-
- if (inputStreamType == OBoundParam::UNICODE)
- {
- realLen = bufLen / 2;
-
- for (sal_Int32 ii = 0; ii < realLen; ii++)
- buf[ii] = buf[(ii * 2) + 1];
- }
// Put the data
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
-
- N3SQLPutData (m_aStatementHandle, buf.getArray(), realLen);
-
- // Decrement the number of bytes still needed
+ OSL_ENSURE( m_aStatementHandle, "OPreparedStatement::putParamData: StatementHandle is null!" );
+ N3SQLPutData ( m_aStatementHandle, buf.getArray(), buf.getLength() );
- inputStreamLen -= bufLen;
-
-
- // If there is no more data to be read, exit loop
-
- if (inputStreamLen == 0)
- endOfStream = sal_True;
+ // decrement the number of bytes still needed
+ maxBytesLeft -= haveRead;
}
+ while ( maxBytesLeft > 0 );
}
catch (const IOException& ex)
{
@@ -891,8 +839,7 @@ void OPreparedStatement::setStream (
sal_Int32 ParameterIndex,
const Reference< XInputStream>& x,
sal_Int32 length,
- sal_Int32 SQLtype,
- sal_Int32 streamType)
+ sal_Int32 SQLtype)
throw(SQLException)
{
::osl::MutexGuard aGuard( m_aMutex );
@@ -935,12 +882,7 @@ void OPreparedStatement::setStream (
(SDWORD*)lenBuf);
// Save the input stream
-
boundParams[ParameterIndex - 1].setInputStream (x, length);
-
- // Set the stream type
-
- boundParams[ParameterIndex - 1].setStreamType (streamType);
}
// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/odbc/OResultSet.cxx b/connectivity/source/drivers/odbc/OResultSet.cxx
index eb5ab9f3d7..b5f0e5ace1 100644
--- a/connectivity/source/drivers/odbc/OResultSet.cxx
+++ b/connectivity/source/drivers/odbc/OResultSet.cxx
@@ -1097,7 +1097,7 @@ void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Refer
::dbtools::throwFunctionSequenceException(*this);
Sequence<sal_Int8> aSeq;
- x->readSomeBytes(aSeq,length);
+ x->readBytes(aSeq,length);
updateBytes(columnIndex,aSeq);
}
// -------------------------------------------------------------------------
diff --git a/connectivity/source/inc/odbc/OBoundParam.hxx b/connectivity/source/inc/odbc/OBoundParam.hxx
index a3a81ec29d..7a4a6799fe 100644
--- a/connectivity/source/inc/odbc/OBoundParam.hxx
+++ b/connectivity/source/inc/odbc/OBoundParam.hxx
@@ -157,26 +157,6 @@ namespace connectivity
}
//--------------------------------------------------------------------
- // setStreamType
- // Sets the input stream type used to register an OUT parameter
- //--------------------------------------------------------------------
-
- void setStreamType (sal_Int32 type)
- {
- streamType = type;
- }
-
- //--------------------------------------------------------------------
- // getStreamType
- // Gets the input stream type used to register an OUT parameter
- //--------------------------------------------------------------------
-
- sal_Int32 getStreamType ()
- {
- return streamType;
- }
-
- //--------------------------------------------------------------------
// setOutputParameter
// Sets the flag indicating if this is an OUTPUT parameter
//--------------------------------------------------------------------
@@ -220,10 +200,6 @@ namespace connectivity
sal_Int32 sqlType; // Java SQL type used to
// register an OUT parameter
- sal_Int32 streamType; // Input stream type
- // (ASCII, BINARY, UNICODE)
-
-
sal_Bool outputParameter; // true for OUTPUT parameters
@@ -235,11 +211,6 @@ namespace connectivity
sal_Int32 pC2;
sal_Int32 pS1;
sal_Int32 pS2;// reserved for strings(UTFChars)
-
- public:
- static int ASCII;
- static int UNICODE;
- static int BINARY;
};
}
}
diff --git a/connectivity/source/inc/odbc/OPreparedStatement.hxx b/connectivity/source/inc/odbc/OPreparedStatement.hxx
index 863b07f294..8a5bf3a4b6 100644
--- a/connectivity/source/inc/odbc/OPreparedStatement.hxx
+++ b/connectivity/source/inc/odbc/OPreparedStatement.hxx
@@ -92,7 +92,7 @@ namespace connectivity
void FreeParams();
void putParamData (sal_Int32 index) throw(::com::sun::star::sdbc::SQLException);
void setStream (sal_Int32 ParameterIndex,const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x,
- sal_Int32 length,sal_Int32 SQLtype,sal_Int32 streamType) throw(::com::sun::star::sdbc::SQLException);
+ sal_Int32 length,sal_Int32 SQLtype) throw(::com::sun::star::sdbc::SQLException);
sal_Int32 getParamLength ( sal_Int32 index);
sal_Int8* getLengthBuf (sal_Int32 index);
sal_Int8* getDataBuf (sal_Int32 index);
diff --git a/desktop/source/deployment/misc/dp_dependencies.cxx b/desktop/source/deployment/misc/dp_dependencies.cxx
index 8124960177..2482948028 100644
--- a/desktop/source/deployment/misc/dp_dependencies.cxx
+++ b/desktop/source/deployment/misc/dp_dependencies.cxx
@@ -59,15 +59,18 @@ namespace css = ::com::sun::star;
static char const xmlNamespace[] =
"http://openoffice.org/extensions/description/2006";
-#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
-
-bool satisfiesMinimalVersion( ::rtl::OUString const & version )
-{
- ::rtl::OUString aBaseVersion( UNISTRING( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":Version:OOOPackageVersion}" ) );
- ::rtl::Bootstrap::expandMacros( aBaseVersion );
+::dp_misc::Order compareWithVersion(::rtl::OUString const & version) {
+ ::rtl::OUString v(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version")
+ ":Version:OOOPackageVersion}"));
+ ::rtl::Bootstrap::expandMacros(v);
+ return ::dp_misc::compareVersions(v, version);
+}
- return ::dp_misc::compareVersions(version, aBaseVersion) != ::dp_misc::GREATER;
-};
+bool satisfiesMinimalVersion(::rtl::OUString const & version) {
+ return compareWithVersion(version) != ::dp_misc::LESS;
+}
}
@@ -88,9 +91,6 @@ check(::dp_misc::DescriptionInfoset const & infoset) {
css::uno::Reference< css::xml::dom::XElement > e(
deps->item(i), css::uno::UNO_QUERY_THROW);
bool sat = false;
- // Currently, the only satisfied dependency is OpenOffice.org-minimal-
- // version with a value of the current OOo release or less (the actual
- // version string has to be updated here for every OOo release):
if (e->getNamespaceURI().equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM(xmlNamespace))
&& e->getTagName().equalsAsciiL(
@@ -99,6 +99,17 @@ check(::dp_misc::DescriptionInfoset const & infoset) {
sat = satisfiesMinimalVersion(
e->getAttribute(
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value"))));
+ } else if (e->getNamespaceURI().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(xmlNamespace))
+ && e->getTagName().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(
+ "OpenOffice.org-maximal-version")))
+ {
+ sat =
+ compareWithVersion(
+ e->getAttribute(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value"))))
+ != ::dp_misc::GREATER;
} else if (e->hasAttributeNS(
::rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(xmlNamespace)),
diff --git a/desktop/test/deployment/dependencies/readme.txt b/desktop/test/deployment/dependencies/readme.txt
index e73992e651..751ab31eac 100644
--- a/desktop/test/deployment/dependencies/readme.txt
+++ b/desktop/test/deployment/dependencies/readme.txt
@@ -8,7 +8,7 @@
#
# $RCSfile: readme.txt,v $
#
-# $Revision: 1.7 $
+# $Revision: 1.7.134.1 $
#
# This file is part of OpenOffice.org.
#
@@ -54,6 +54,16 @@ value attribute; neither is allowed by the spec, but the current implementation
treats both as pre OOo 2.1 versions (and the extensions should thus install in
OOo 2.1 or later).
+maxversion30.oxt contains a maximal version dependency on OOo 3.0 (and should
+thus only install in OOo 3.0 or earlier, back to OOo 2.3, thanks to the
+additionally specified OpenOffice.org-minimal-version attribute).
+maxversion10000.oxt contains a maximal version dependency on the hypothetical
+OOo version 10000 (and should thus install in any OOo version 3.1 or later;
+OpenOffice.org-maximal-version was introduced in OOo 3.1, and no OpenOffice.org-
+minimal-version attribute is specified). bad-minmaxversion.oxt contains a
+minimal version dependency on OOo 3.2 and a maximal version dependency on
+OOo 3.1 (and should thus not install in any OOo version).
+
minattr22.oxt contains a (hypothetical, most probably never satisfied)
UNSATISFIED dependency with an OpenOffice.org-minimal-version attribute of
"2.2" (and should thus install in OOo 2.3 or later); minattr23.oxt is similar,
diff --git a/svx/inc/fmgridif.hxx b/svx/inc/fmgridif.hxx
index e2274188c2..d9a7ad66ee 100644
--- a/svx/inc/fmgridif.hxx
+++ b/svx/inc/fmgridif.hxx
@@ -30,6 +30,8 @@
#ifndef _SVX_FMGRIDIF_HXX
#define _SVX_FMGRIDIF_HXX
+#include "svx/svxdllapi.h"
+
#include <com/sun/star/view/XSelectionSupplier.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
@@ -49,11 +51,12 @@
#include <com/sun/star/util/XModeSelector.hpp>
#include <com/sun/star/util/XModifyListener.hpp>
#include <com/sun/star/util/XModifyBroadcaster.hpp>
+
+#include <vcl/wintypes.hxx>
#include <toolkit/controls/unocontrol.hxx>
#include <toolkit/awt/vclxwindow.hxx>
#include <comphelper/uno3.hxx>
#include <cppuhelper/implbase10.hxx>
-#include "svx/svxdllapi.h"
#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_19)
#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_19
diff --git a/svx/inc/svx/fmview.hxx b/svx/inc/svx/fmview.hxx
index cac25a0246..854b68f3b4 100644
--- a/svx/inc/svx/fmview.hxx
+++ b/svx/inc/svx/fmview.hxx
@@ -59,19 +59,10 @@ namespace com { namespace sun { namespace star { namespace form {
class SVX_DLLPUBLIC FmFormView : public E3dView
{
- friend class FmXFormController;
- friend class FmFormShell;
- friend class FmXFormShell;
- friend class FmXFormView;
- friend class FmExplorer;
- friend class FmFormObj;
-
FmXFormView* pImpl;
FmFormShell* pFormShell;
void Init();
- void SetFormShell( FmFormShell* pShell ) { pFormShell = pShell; }
- FmFormShell* GetFormShell() const { return pFormShell; }
public:
TYPEINFO();
@@ -100,18 +91,17 @@ public:
virtual void DeleteWindowFromPaintView(OutputDevice* pOldWin);
static void createControlLabelPair(
- SdrView* _pView,
OutputDevice* _pOutDev,
sal_Int32 _nXOffsetMM,
sal_Int32 _nYOffsetMM,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField,
const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& _rxNumberFormats,
- sal_uInt16 _nObjID,
+ sal_uInt16 _nControlObjectID,
const ::rtl::OUString& _rFieldPostfix,
UINT32 _nInventor,
- UINT16 _nIndent,
+ UINT16 _nLabelObjectID,
SdrPage* _pLabelPage,
- SdrPage* _pPage,
+ SdrPage* _pControlPage,
SdrModel* _pModel,
SdrUnoObj*& _rpLabel,
SdrUnoObj*& _rpControl
@@ -131,11 +121,11 @@ public:
@param _bForceSync
<TRUE/> if the handling should be done synchronously.
*/
- void GrabFirstControlFocus( sal_Bool _bForceSync = sal_False );
+ SVX_DLLPRIVATE void GrabFirstControlFocus( sal_Bool _bForceSync = sal_False );
/** returns the form controller for a given form and a given device
*/
- ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController >
+ SVX_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController >
GetFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm, const OutputDevice& _rDevice ) const;
// SdrView
@@ -144,19 +134,21 @@ public:
/// shortcut to "GetSdrPageView() ? PTR_CAST( FmFormPage, GetSdrPageView() ) : NULL"
FmFormPage* GetCurPage();
-protected:
- void ActivateControls(SdrPageView*);
- void DeactivateControls(SdrPageView*);
-
- // Hinweis an die UI, daß ein Control erzeugt worden ist
- void ObjectCreated(FmFormObj* pObj);
- void ChangeDesignMode(sal_Bool bDesign);
-
-public:
- FmXFormView* GetImpl() const {return pImpl;}
-
- virtual void InsertControlContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& xCC);
- virtual void RemoveControlContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& xCC);
+ SVX_DLLPRIVATE void ActivateControls(SdrPageView*);
+ SVX_DLLPRIVATE void DeactivateControls(SdrPageView*);
+
+ SVX_DLLPRIVATE void ChangeDesignMode(sal_Bool bDesign);
+
+ SVX_DLLPRIVATE FmXFormView* GetImpl() const { return pImpl; }
+ SVX_DLLPRIVATE FmFormShell* GetFormShell() const { return pFormShell; }
+
+ struct FormShellAccess { friend class FmFormShell; private: FormShellAccess() { } };
+ void SetFormShell( FmFormShell* pShell, FormShellAccess ) { pFormShell = pShell; }
+
+ struct ImplAccess { friend class FmXFormView; private: ImplAccess() { } };
+ void SetMoveOutside( bool _bMoveOutside, ImplAccess ) { E3dView::SetMoveOutside( _bMoveOutside ); }
+ virtual void InsertControlContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& xCC);
+ virtual void RemoveControlContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& xCC);
// the following is a hack, only to be used on the 3.0.1 branch, to prevent becoming
// incompatible there
@@ -169,6 +161,8 @@ private:
SVX_DLLPRIVATE void AdjustMarks(const SdrMarkList& rMarkList);
SVX_DLLPRIVATE sal_Bool checkUnMarkAll(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xSource);
SVX_DLLPRIVATE FmFormObj* getMarkedGrid() const;
+ protected:
+ using E3dView::SetMoveOutside;
};
#endif // _FML_FMVIEW_HXX
diff --git a/svx/inc/svx/gridctrl.hxx b/svx/inc/svx/gridctrl.hxx
index b21e09c8c5..d319ff329d 100644
--- a/svx/inc/svx/gridctrl.hxx
+++ b/svx/inc/svx/gridctrl.hxx
@@ -50,9 +50,6 @@
#include <svtools/transfer.hxx>
#include "svx/svxdllapi.h"
-extern XubString INVALIDTEXT;
-extern XubString OBJECTTEXT;
-
class DbGridControl;
class CursorWrapper;
diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx
index 2ae511e520..03a1e4435f 100644
--- a/svx/source/fmcomp/fmgridcl.cxx
+++ b/svx/source/fmcomp/fmgridcl.cxx
@@ -1,13 +1,13 @@
/*************************************************************************
*
* 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: fmgridcl.cxx,v $
- * $Revision: 1.64 $
+ * $Revision: 1.64.94.3 $
*
* This file is part of OpenOffice.org.
*
@@ -30,83 +30,67 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
-#include <svx/fmgridcl.hxx>
-#include "gridcell.hxx"
-#include "fmurl.hxx"
-#include <svtools/fmtfield.hxx>
-#include <math.h>
-#ifndef _SVX_FMPROP_HRC
-#include "fmprop.hrc"
-#endif
-#ifndef _SVX_DBEXCH_HRC
#include "dbexch.hrc"
-#endif
-#include <sfx2/viewfrm.hxx>
-#include <com/sun/star/uno/XNamingService.hpp>
-#include <com/sun/star/sdbcx/XDeleteRows.hpp>
+#include "fmgridif.hxx"
+#include "fmitems.hxx"
+#include "fmprop.hrc"
+#include "fmresids.hrc"
+#include "fmservs.hxx"
+#include "fmurl.hxx"
+#include "formcontrolfactory.hxx"
+#include "gridcell.hxx"
+#include "gridcols.hxx"
+#include "svx/dbaexchange.hxx"
+#include "svx/dialmgr.hxx"
+#include "svx/dialogs.hrc"
+#include "svx/fmgridcl.hxx"
+#include "svx/svxdlg.hxx"
+#include "svx/svxids.hrc"
+#include "trace.hxx"
+
+#include <com/sun/star/form/XConfirmDeleteListener.hpp>
+#include <com/sun/star/form/XFormComponent.hpp>
+#include <com/sun/star/form/XGridColumnFactory.hpp>
+#include <com/sun/star/io/XPersistObject.hpp>
#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdb/RowChangeAction.hpp>
+#include <com/sun/star/sdb/XQueriesSupplier.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/XPreparedStatement.hpp>
-#ifndef _COM_SUN_STAR_SDDB_XCOLUMNSSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
-#endif
-#include <com/sun/star/sdb/XQueriesSupplier.hpp>
-#ifndef _COM_SUN_STAR_SDDB_XTABLESSUPPLIER_HPP_
+#include <com/sun/star/sdbcx/XDeleteRows.hpp>
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
-#endif
-#include <com/sun/star/view/XSelectionSupplier.hpp>
-#include <com/sun/star/sdb/RowChangeAction.hpp>
-#include <com/sun/star/form/XConfirmDeleteListener.hpp>
-#include <com/sun/star/form/XGridColumnFactory.hpp>
-#include <com/sun/star/form/XFormComponent.hpp>
-#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/uno/XNamingService.hpp>
#include <com/sun/star/util/XNumberFormats.hpp>
-#include <com/sun/star/io/XPersistObject.hpp>
-// #100312# ---------------------------
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
-#include <comphelper/processfactory.hxx>
-#include <vcl/help.hxx>
-#include <sfx2/dispatch.hxx>
-#include <svtools/eitem.hxx>
-#include <vcl/menu.hxx>
-#include <vcl/image.hxx>
-#include <vcl/longcurr.hxx>
-#include "fmservs.hxx"
-#include "fmitems.hxx"
-
-#ifndef _SVX_FMRESIDS_HRC
-#include "fmresids.hrc"
-#endif
-
-#ifndef _SVX_SVXIDS_HRC
-#include <svx/svxids.hrc>
-#endif
-#include <tools/shl.hxx>
-#include <svx/dialmgr.hxx>
-#include "gridcols.hxx"
+#include <com/sun/star/view/XSelectionSupplier.hpp>
#ifndef _SVSTDARR_STRINGSDTOR
#define _SVSTDARR_STRINGSDTOR
#define _SVSTDARR_ULONGS
#include <svtools/svstdarr.hxx>
#endif
-#include <svtools/numuno.hxx>
-#include "fmgridif.hxx"
-//CHINA001 #ifndef _SVX_SHOWCOLS_HXX
-//CHINA001 #include "showcols.hxx"
-//CHINA001 #endif
#include <comphelper/extract.hxx>
-#include <connectivity/dbtools.hxx>
-#include <comphelper/property.hxx>
#include <comphelper/numbers.hxx>
-#include "trace.hxx"
-#include <svx/dbaexchange.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/property.hxx>
+#include <connectivity/dbtools.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svtools/eitem.hxx>
+#include <svtools/fmtfield.hxx>
+#include <svtools/numuno.hxx>
#include <tools/multisel.hxx>
+#include <tools/shl.hxx>
+#include <vcl/help.hxx>
+#include <vcl/image.hxx>
+#include <vcl/longcurr.hxx>
+#include <vcl/menu.hxx>
-#include <svx/svxdlg.hxx> //CHINA001
-#include <svx/dialogs.hrc> //CHINA001
+#include <math.h>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::view;
@@ -551,12 +535,8 @@ IMPL_LINK( FmGridHeader, OnAsyncExecuteDrop, void*, /*NOTINTERESTEDIN*/ )
sFieldService = FieldServiceFromId(nPreferedType);
Reference< XPropertySet > xThisRoundCol;
- if (sFieldService.getLength())
- {
+ if ( sFieldService.getLength() )
xThisRoundCol = xFactory->createColumn(sFieldService);
- if (xThisRoundCol.is() && ::comphelper::hasProperty(FM_PROP_STRICTFORMAT, xThisRoundCol))
- xThisRoundCol->setPropertyValue(FM_PROP_STRICTFORMAT, ::cppu::bool2any(sal_False));
- }
if (nColCount)
xSecondCol = xThisRoundCol;
else
@@ -583,37 +563,12 @@ IMPL_LINK( FmGridHeader, OnAsyncExecuteDrop, void*, /*NOTINTERESTEDIN*/ )
else
xCol->setPropertyValue(FM_PROP_LABEL, makeAny(sFieldName));
- if (nPreferedType == SID_FM_NUMERICFIELD)
- {
- // set properties for numeric field
- Reference< XPropertySetInfo > xPSI( xField->getPropertySetInfo() );
- if ( xPSI.is() && xPSI->hasPropertyByName( FM_PROP_FORMATKEY ) )
- {
- sal_Int32 nFormatKey = 0;
- xField->getPropertyValue(FM_PROP_FORMATKEY) >>= nFormatKey;
- Any aScaleVal(::comphelper::getNumberFormatDecimals(xNumberFormats, nFormatKey));
- xCol->setPropertyValue(FM_PROP_DECIMAL_ACCURACY,aScaleVal);
- }
-
- // set the max and min value for this field
- sal_Int32 nMinValue = 0, nMaxValue = 1000000000;
- switch (nDataType)
- {
- case DataType::TINYINT : nMinValue = 0; nMaxValue = 255; break;
- case DataType::SMALLINT : nMinValue = -32768; nMaxValue = 32767; break;
- case DataType::INTEGER : nMinValue = 0x80000000; nMaxValue = 0x7FFFFFFF; break;
- // um die doubles/singles kuemmere ich mich nicht, da es ein wenig sinnlos ist
- // double and singles are ignored
- }
- xCol->setPropertyValue(FM_PROP_VALUEMIN,makeAny((double)nMinValue));
- xCol->setPropertyValue(FM_PROP_VALUEMAX,makeAny((double)nMaxValue));
-
- // format checking for numeric fields is default sal_True
- xCol->setPropertyValue(FM_PROP_STRICTFORMAT, bool2any(sal_True));
- }
+ FormControlFactory aControlFactory( ::comphelper::getProcessServiceFactory() );
+ aControlFactory.initializeControlModel( DocumentClassification::classifyHostDocument( xCols ), xCol );
+ aControlFactory.initializeFieldDependentProperties( xField, xCol, xNumberFormats );
xCol->setPropertyValue(FM_PROP_CONTROLSOURCE, makeAny(sFieldName));
- if (bDateNTimeCol)
+ if ( xSecondCol.is() )
xSecondCol->setPropertyValue(FM_PROP_CONTROLSOURCE, makeAny(sFieldName));
if (bDateNTimeCol)
@@ -996,8 +951,6 @@ void FmGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMe
Reference< ::com::sun::star::beans::XPropertySet > xCol = xFactory->createColumn(aFieldType);
if (xCol.is())
{
- Any aNew;
- aNew <<= xCol;
if (bReplace)
{
// ein paar Properties hinueberretten
@@ -1009,7 +962,7 @@ void FmGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMe
OStaticDataAccessTools().TransferFormComponentProperties(xReplaced, xCol, aAppLocale);
- xCols->replaceByIndex(nPos, aNew);
+ xCols->replaceByIndex( nPos, makeAny( xCol ) );
::comphelper::disposeComponent(xReplaced);
}
else
@@ -1029,7 +982,11 @@ void FmGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMe
// no fallback in case the name is not unique (which is rather improbable) ....
xCol->setPropertyValue(FM_PROP_LABEL, makeAny(sLabel));
xCol->setPropertyValue(FM_PROP_NAME, makeAny(sLabel));
- xCols->insertByIndex(nPos, aNew);
+
+ FormControlFactory determine( ::comphelper::getProcessServiceFactory() );
+ determine.initializeControlModel( DocumentClassification::classifyHostDocument( xCols ), xCol );
+
+ xCols->insertByIndex( nPos, makeAny( xCol ) );
}
}
@@ -2105,9 +2062,9 @@ void FmGridControl::Select()
}
}
// -----------------------------------------------------------------------------
-sal_Int32 FmGridControl::GetSelectedColumn() const
-{
- return m_nCurrentSelectedColumn;
+sal_Int32 FmGridControl::GetSelectedColumn() const
+{
+ return m_nCurrentSelectedColumn;
}
// -----------------------------------------------------------------------------
void FmGridControl::KeyInput( const KeyEvent& rKEvt )
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index 3a55dca728..5df6580eb1 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -30,43 +30,39 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/form/XLoadable.hpp>
-#include <com/sun/star/form/FormComponentType.hpp>
-#include <com/sun/star/form/XFormComponent.hpp>
-#include <com/sun/star/awt/PosSize.hpp>
-#include <com/sun/star/view/XSelectionSupplier.hpp>
-#include <com/sun/star/util/XURLTransformer.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include "fmtools.hxx"
-#ifndef _SVX_FMPROP_HRC
+
+#include "fmgridif.hxx"
#include "fmprop.hrc"
-#endif
#include "fmservs.hxx"
-#include "fmgridif.hxx"
-#include <svx/fmgridcl.hxx>
-#include "gridcell.hxx"
+#include "fmtools.hxx"
#include "fmurl.hxx"
+#include "formcontrolfactory.hxx"
+#include "gridcell.hxx"
+#include "sdbdatacolumn.hxx"
+#include "svx/fmgridcl.hxx"
+#include "svx/svxids.hrc"
-#ifndef _SVX_SVXIDS_HRC
-#include <svx/svxids.hrc>
-#endif
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/form/FormComponentType.hpp>
+#include <com/sun/star/form/XFormComponent.hpp>
+#include <com/sun/star/form/XLoadable.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/sdbc/ResultSetType.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
-#ifndef _TOOLKIT_UNOHLP_HXX
-#include <toolkit/helper/vclunohelper.hxx>
-#endif
#include <comphelper/container.hxx>
#include <comphelper/enumhelper.hxx>
-#include <comphelper/property.hxx>
-#include <comphelper/types.hxx>
+#include <comphelper/extract.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/property.hxx>
#include <comphelper/sequence.hxx>
-#include <comphelper/extract.hxx>
+#include <comphelper/types.hxx>
#include <cppuhelper/typeprovider.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
#include <tools/diagnose_ex.h>
-#include "sdbdatacolumn.hxx"
using namespace ::svxform;
using namespace ::com::sun::star::container;
@@ -1837,7 +1833,7 @@ void FmXGridPeer::elementInserted(const ContainerEvent& evt) throw( RuntimeExcep
if (::comphelper::getBOOL(aHidden))
pGrid->HideColumn(pCol->GetId());
- initializeTextFieldLineEnds( xNewColumn, m_xServiceFactory );
+ FormControlFactory( m_xServiceFactory ).initializeTextFieldLineEnds( xNewColumn );
}
//------------------------------------------------------------------------------
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 74c22e5596..cfbe2458a2 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -94,6 +94,10 @@ using ::com::sun::star::util::XNumberFormatter;
using ::com::sun::star::util::XNumberFormatter;
+String INVALIDTEXT = String::CreateFromAscii("###");
+String OBJECTTEXT = String::CreateFromAscii("<OBJECT>");
+ // TODO: resource
+
//==================================================================
//= helper
//==================================================================
@@ -1596,17 +1600,22 @@ void DbCheckBox::Init( Window& rParent, const Reference< XRowSet >& xCursor )
try
{
- Reference< XPropertySet > xModel( m_rColumn.getModel() );
+ Reference< XPropertySet > xModel( m_rColumn.getModel(), UNO_SET_THROW );
+
sal_Int16 nStyle = awt::VisualEffect::LOOK3D;
- if ( xModel.is() )
- xModel->getPropertyValue( FM_PROP_VISUALEFFECT ) >>= nStyle;
+ OSL_VERIFY( xModel->getPropertyValue( FM_PROP_VISUALEFFECT ) >>= nStyle );
setCheckBoxStyle( m_pWindow, nStyle == awt::VisualEffect::FLAT ? STYLE_CHECKBOX_MONO : STYLE_CHECKBOX_WIN );
setCheckBoxStyle( m_pPainter, nStyle == awt::VisualEffect::FLAT ? STYLE_CHECKBOX_MONO : STYLE_CHECKBOX_WIN );
+
+ sal_Bool bTristate = sal_True;
+ OSL_VERIFY( xModel->getPropertyValue( FM_PROP_TRISTATE ) >>= bTristate );
+ static_cast< CheckBoxControl* >( m_pWindow )->GetBox().EnableTriState( bTristate );
+ static_cast< CheckBoxControl* >( m_pPainter )->GetBox().EnableTriState( bTristate );
}
catch( const Exception& )
{
- OSL_ENSURE( sal_False, "DbCheckBox::Init: caught an exception!" );
+ DBG_UNHANDLED_EXCEPTION();
}
DbCellControl::Init( rParent, xCursor );
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index 5109c03bd5..f275be4973 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -73,12 +73,8 @@
#include "fmservs.hxx"
#include "sdbdatacolumn.hxx"
-#define CURSORPOSITION_UNKNOWN -2
-
#define HANDLE_ID 0
-String INVALIDTEXT = String::CreateFromAscii("###");
-String OBJECTTEXT = String::CreateFromAscii("<OBJECT>");
#include <comphelper/stl_types.hxx>
#include <comphelper/property.hxx>
#include "trace.hxx"
@@ -1522,7 +1518,7 @@ void DbGridControl::setDataSource(const Reference< XRowSet >& _xCursor, sal_uInt
}
catch( const Exception& )
{
- OSL_ENSURE( sal_False, "DbGridControl::setDataSource: caught an exception while checking the privileges!" );
+ DBG_UNHANDLED_EXCEPTION();
}
sal_Bool bPermanentCursor = IsPermanentCursorEnabled();
@@ -2020,12 +2016,22 @@ void DbGridControl::PaintCell(OutputDevice& rDev, const Rectangle& rRect, sal_uI
sal_Bool DbGridControl::CursorMoving(long nNewRow, sal_uInt16 nNewCol)
{
DBG_CHKTHIS( DbGridControl, NULL );
- if (m_pDataCursor &&
- m_nCurrentPos != nNewRow &&
- !SetCurrent(nNewRow))
+
+ DeactivateCell( sal_False );
+
+ if ( m_pDataCursor
+ && ( m_nCurrentPos != nNewRow )
+ && !SetCurrent( nNewRow )
+ )
+ {
+ ActivateCell();
return sal_False;
+ }
- return DbGridControl_Base::CursorMoving(nNewRow, nNewCol);
+ if ( !DbGridControl_Base::CursorMoving( nNewRow, nNewCol ) )
+ return sal_False;
+
+ return sal_True;
}
//------------------------------------------------------------------------------
@@ -2103,15 +2109,9 @@ sal_Bool DbGridControl::SetCurrent(long nNewRow)
return sal_False;
}
}
- catch(com::sun::star::sdbc::SQLException& )
- {
- DBG_ERROR("DbGridControl::SetCurrent : caught an exception !");
- EndCursorAction();
- return sal_False;
- }
- catch (Exception)
+ catch ( const Exception& )
{
- DBG_ERROR("DbGridControl::SetCurrent : caught an exception !");
+ DBG_UNHANDLED_EXCEPTION();
EndCursorAction();
return sal_False;
}
@@ -2544,7 +2544,7 @@ void DbGridControl::MoveToNext()
}
catch(SQLException &)
{
- DBG_ERROR("DbGridControl::MoveToNext: SQLException caught");
+ DBG_UNHANDLED_EXCEPTION();
}
if(!bOk)
@@ -3138,6 +3138,7 @@ void DbGridControl::Undo()
}
catch(Exception&)
{
+ DBG_UNHANDLED_EXCEPTION();
}
EndCursorAction();
diff --git a/svx/source/form/delayedevent.cxx b/svx/source/form/delayedevent.cxx
new file mode 100644
index 0000000000..af986d5c54
--- /dev/null
+++ b/svx/source/form/delayedevent.cxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+* 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: delayedevent.cxx,v $
+*
+* $Revision: 1.1.2.1 $
+*
+* 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.
+************************************************************************/
+
+#include "precompiled_svx.hxx"
+
+#include "delayedevent.hxx"
+
+#include <osl/diagnose.h>
+#include <vcl/svapp.hxx>
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ //====================================================================
+ //= DelayedEvent
+ //====================================================================
+ //--------------------------------------------------------------------
+ void DelayedEvent::Call( void* _pArg )
+ {
+ CancelPendingCall();
+ OSL_POSTCOND( m_nEventId == 0, "DelayedEvent::Call: CancelPendingCall did not work!" );
+
+ m_nEventId = Application::PostUserEvent( LINK( this, DelayedEvent, OnCall ), _pArg );
+ }
+
+ //--------------------------------------------------------------------
+ void DelayedEvent::CancelPendingCall()
+ {
+ if ( m_nEventId )
+ Application::RemoveUserEvent( m_nEventId );
+ m_nEventId = 0;
+ }
+
+ //--------------------------------------------------------------------
+ IMPL_LINK( DelayedEvent, OnCall, void*, _pArg )
+ {
+ m_nEventId = 0;
+ return m_aHandler.Call( _pArg );
+ }
+
+//........................................................................
+} // namespace svxform
+//........................................................................
diff --git a/svx/source/form/fmctrler.cxx b/svx/source/form/fmctrler.cxx
index 136fbac1a4..7f9a6ee7cc 100644
--- a/svx/source/form/fmctrler.cxx
+++ b/svx/source/form/fmctrler.cxx
@@ -119,8 +119,225 @@ using namespace ::connectivity;
using namespace ::svxform;
using namespace ::connectivity::simple;
+//==============================================================================
+// ColumnInfo
+//==============================================================================
+struct ColumnInfo
+{
+ // information about the column itself
+ Reference< XColumn > xColumn;
+ sal_Int32 nNullable;
+ sal_Bool bAutoIncrement;
+ ::rtl::OUString sName;
+
+ // information about the control(s) bound to this column
+
+ /// the first control which is bound to the given column, and which requires input
+ Reference< XControl > xFirstControlWithInputRequired;
+ /** the first grid control which contains a column which is bound to the given database column, and requires
+ input
+ */
+ Reference< XGrid > xFirstGridWithInputRequiredColumn;
+ /** if xFirstControlWithInputRequired is a grid control, then nRequiredGridColumn specifies the position
+ of the grid column which is actually bound
+ */
+ sal_Int32 nRequiredGridColumn;
+
+ ColumnInfo()
+ :xColumn()
+ ,nNullable( ColumnValue::NULLABLE_UNKNOWN )
+ ,bAutoIncrement( sal_False )
+ ,sName()
+ ,xFirstControlWithInputRequired()
+ ,xFirstGridWithInputRequiredColumn()
+ ,nRequiredGridColumn( -1 )
+ {
+ }
+};
+
+//==============================================================================
+//= ColumnInfoCache
+//==============================================================================
+class ColumnInfoCache
+{
+public:
+ ColumnInfoCache( const Reference< XColumnsSupplier >& _rxColSupplier );
+
+ const size_t getColumnCount() const { return m_aColumns.size(); }
+ const ColumnInfo& getColumnInfo( size_t _pos );
+
+ bool controlsInitialized() const { return m_bControlsInitialized; }
+ void initializeControls( const Sequence< Reference< XControl > >& _rControls );
+ void deinitializeControls();
+
+private:
+ typedef ::std::vector< ColumnInfo > ColumnInfos;
+ ColumnInfos m_aColumns;
+ bool m_bControlsInitialized;
+};
+
+//------------------------------------------------------------------------------
+ColumnInfoCache::ColumnInfoCache( const Reference< XColumnsSupplier >& _rxColSupplier )
+ :m_aColumns()
+ ,m_bControlsInitialized( false )
+{
+ try
+ {
+ m_aColumns.clear();
+
+ Reference< XColumnsSupplier > xSupplyCols( _rxColSupplier, UNO_SET_THROW );
+ Reference< XIndexAccess > xColumns( xSupplyCols->getColumns(), UNO_QUERY_THROW );
+ sal_Int32 nColumnCount = xColumns->getCount();
+ m_aColumns.reserve( nColumnCount );
+
+ Reference< XPropertySet > xColumnProps;
+ for ( sal_Int32 i = 0; i < nColumnCount; ++i )
+ {
+ ColumnInfo aColInfo;
+ aColInfo.xColumn.set( xColumns->getByIndex(i), UNO_QUERY_THROW );
+
+ xColumnProps.set( aColInfo.xColumn, UNO_QUERY_THROW );
+ OSL_VERIFY( xColumnProps->getPropertyValue( FM_PROP_ISNULLABLE ) >>= aColInfo.nNullable );
+ OSL_VERIFY( xColumnProps->getPropertyValue( FM_PROP_AUTOINCREMENT ) >>= aColInfo.bAutoIncrement );
+ OSL_VERIFY( xColumnProps->getPropertyValue( FM_PROP_NAME ) >>= aColInfo.sName );
+
+ m_aColumns.push_back( aColInfo );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------------------
+namespace
+{
+ bool lcl_isBoundTo( const Reference< XPropertySet >& _rxControlModel, const Reference< XInterface >& _rxNormDBField )
+ {
+ Reference< XInterface > xNormBoundField( _rxControlModel->getPropertyValue( FM_PROP_BOUNDFIELD ), UNO_QUERY );
+ return ( xNormBoundField.get() == _rxNormDBField.get() );
+ }
+
+ bool lcl_isInputRequired( const Reference< XPropertySet >& _rxControlModel )
+ {
+ sal_Bool bInputRequired = sal_True;
+ OSL_VERIFY( _rxControlModel->getPropertyValue( FM_PROP_INPUT_REQUIRED ) >>= bInputRequired );
+ return ( bInputRequired != sal_False );
+ }
+ void lcl_resetColumnControlInfo( ColumnInfo& _rColInfo )
+ {
+ _rColInfo.xFirstControlWithInputRequired.clear();
+ _rColInfo.xFirstGridWithInputRequiredColumn.clear();
+ _rColInfo.nRequiredGridColumn = -1;
+ }
+}
+
+//------------------------------------------------------------------------------
+void ColumnInfoCache::deinitializeControls()
+{
+ for ( ColumnInfos::iterator col = m_aColumns.begin();
+ col != m_aColumns.end();
+ ++col
+ )
+ {
+ lcl_resetColumnControlInfo( *col );
+ }
+}
+
+//------------------------------------------------------------------------------
+void ColumnInfoCache::initializeControls( const Sequence< Reference< XControl > >& _rControls )
+{
+ try
+ {
+ // for every of our known columns, find the controls which are bound to this column
+ for ( ColumnInfos::iterator col = m_aColumns.begin();
+ col != m_aColumns.end();
+ ++col
+ )
+ {
+ OSL_ENSURE( !col->xFirstControlWithInputRequired.is() && !col->xFirstGridWithInputRequiredColumn.is()
+ && ( col->nRequiredGridColumn == -1 ), "ColumnInfoCache::initializeControls: called me twice?" );
+
+ lcl_resetColumnControlInfo( *col );
+
+ Reference< XInterface > xNormColumn( col->xColumn, UNO_QUERY_THROW );
+
+ const Reference< XControl >* pControl( _rControls.getConstArray() );
+ const Reference< XControl >* pControlEnd( pControl + _rControls.getLength() );
+ for ( ; pControl != pControlEnd; ++pControl )
+ {
+ if ( !pControl->is() )
+ continue;
+
+ Reference< XPropertySet > xModel( (*pControl)->getModel(), UNO_QUERY_THROW );
+ Reference< XPropertySetInfo > xModelPSI( xModel->getPropertySetInfo(), UNO_SET_THROW );
+
+ // special handling for grid controls
+ Reference< XGrid > xGrid( *pControl, UNO_QUERY );
+ if ( xGrid.is() )
+ {
+ Reference< XIndexAccess > xGridColAccess( xModel, UNO_QUERY_THROW );
+ sal_Int32 gridColCount = xGridColAccess->getCount();
+ sal_Int32 gridCol = 0;
+ for ( gridCol = 0; gridCol < gridColCount; ++gridCol )
+ {
+ Reference< XPropertySet > xGridColumnModel( xGridColAccess->getByIndex( gridCol ), UNO_QUERY_THROW );
+
+ if ( !lcl_isBoundTo( xGridColumnModel, xNormColumn )
+ || !lcl_isInputRequired( xGridColumnModel )
+ )
+ continue; // with next grid column
+
+ break;
+ }
+
+ if ( gridCol < gridColCount )
+ {
+ // found a grid column which is bound to the given
+ col->xFirstGridWithInputRequiredColumn = xGrid;
+ col->nRequiredGridColumn = gridCol;
+ break;
+ }
+
+ continue; // with next control
+ }
+
+ if ( !xModelPSI->hasPropertyByName( FM_PROP_BOUNDFIELD )
+ || !lcl_isBoundTo( xModel, xNormColumn )
+ || !lcl_isInputRequired( xModel )
+ )
+ continue; // with next control
+
+ break;
+ }
+
+ if ( pControl == pControlEnd )
+ // did not find a control which is bound to this particular column, and for which the input is required
+ continue; // with next DB column
+
+ col->xFirstControlWithInputRequired = *pControl;
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ m_bControlsInitialized = true;
+}
+
+//------------------------------------------------------------------------------
+const ColumnInfo& ColumnInfoCache::getColumnInfo( size_t _pos )
+{
+ if ( _pos >= m_aColumns.size() )
+ throw IndexOutOfBoundsException();
+
+ return m_aColumns[ _pos ];
+}
+
//==================================================================
-// FmXAutoControl
+// OParameterContinuation
//==================================================================
class OParameterContinuation : public OInteraction< XInteractionSupplyParameters >
{
@@ -258,8 +475,8 @@ DBG_NAME( FmXFormController )
//------------------------------------------------------------------
FmXFormController::FmXFormController(const Reference< XMultiServiceFactory > & _rxORB,
FmFormView* _pView, Window* _pWindow )
- :FmXFormController_BASE1(m_aMutex)
- ,OPropertySetHelper(FmXFormController_BASE1::rBHelper)
+ :FmXFormController_BASE( m_aMutex )
+ ,OPropertySetHelper( FmXFormController_BASE::rBHelper )
,OSQLParserClient(_rxORB)
,m_xORB(_rxORB)
,m_aActivateListeners(m_aMutex)
@@ -273,8 +490,10 @@ FmXFormController::FmXFormController(const Reference< XMultiServiceFactory > & _
,m_pControlBorderManager( new ::svxform::ControlBorderManager )
,m_aControllerFeatures( _rxORB, this )
,m_aMode(getDataModeIdentifier())
- ,m_nLoadEvent( 0 )
- ,m_nToggleEvent(0)
+ ,m_aLoadEvent( LINK( this, FmXFormController, OnLoad ) )
+ ,m_aToggleEvent( LINK( this, FmXFormController, OnToggleAutoFields ) )
+ ,m_aActivationEvent( LINK( this, FmXFormController, OnActivated ) )
+ ,m_aDeactivationEvent( LINK( this, FmXFormController, OnDeactivated ) )
,m_nCurrentFilterPosition(0)
,m_bCurrentRecordModified(sal_False)
,m_bCurrentRecordNew(sal_False)
@@ -321,11 +540,11 @@ FmXFormController::~FmXFormController()
{
{
::osl::MutexGuard aGuard( m_aMutex );
- if( m_nLoadEvent )
- Application::RemoveUserEvent( m_nLoadEvent );
- if ( m_nToggleEvent )
- Application::RemoveUserEvent( m_nToggleEvent );
+ m_aLoadEvent.CancelPendingCall();
+ m_aToggleEvent.CancelPendingCall();
+ m_aActivationEvent.CancelPendingCall();
+ m_aDeactivationEvent.CancelPendingCall();
if ( m_aTabActivationTimer.IsActive() )
m_aTabActivationTimer.Stop();
@@ -349,59 +568,62 @@ FmXFormController::~FmXFormController()
}
// -----------------------------------------------------------------------------
-using namespace ::cppu;
-using namespace ::osl;
-
void SAL_CALL FmXFormController::acquire() throw ()
{
- FmXFormController_BASE1::acquire();
+ FmXFormController_BASE::acquire();
}
+
// -----------------------------------------------------------------------------
void SAL_CALL FmXFormController::release() throw ()
{
- FmXFormController_BASE1::release();
+ FmXFormController_BASE::release();
}
-// -----------------------------------------------------------------------------
-// XUnoTunnel
-Sequence< sal_Int8 > FmXFormController::getUnoTunnelImplementationId()
+
+//------------------------------------------------------------------
+Any SAL_CALL FmXFormController::queryInterface( const Type& _rType ) throw(RuntimeException)
{
- static OImplementationId * pId = 0;
- if (! pId)
+ Any aRet = FmXFormController_BASE::queryInterface( _rType );
+ if ( !aRet.hasValue() )
+ aRet = OPropertySetHelper::queryInterface( _rType );
+ if ( !aRet.hasValue() )
+ aRet = m_xAggregate->queryAggregation( _rType );
+ return aRet;
+}
+
+//------------------------------------------------------------------------------
+Sequence< sal_Int8 > SAL_CALL FmXFormController::getImplementationId() throw( RuntimeException )
+{
+ static ::cppu::OImplementationId* pId = NULL;
+ if ( !pId )
{
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if (! pId)
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if ( !pId )
{
- static OImplementationId aId;
+ static ::cppu::OImplementationId aId;
pId = &aId;
}
}
return pId->getImplementationId();
}
+
//------------------------------------------------------------------------------
-FmXFormController* FmXFormController::getImplementation( const Reference< XInterface >& _rxComponent )
-{
- Reference< XUnoTunnel > xTunnel( _rxComponent, UNO_QUERY );
- if ( xTunnel.is() )
- return reinterpret_cast< FmXFormController* >( xTunnel->getSomething( getUnoTunnelImplementationId() ) );
- return NULL;
-}
-//------------------------------------------------------------------------------
-sal_Int64 SAL_CALL FmXFormController::getSomething(Sequence<sal_Int8> const& rId)throw( RuntimeException )
+Sequence< Type > SAL_CALL FmXFormController::getTypes( ) throw(RuntimeException)
{
- if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
- return reinterpret_cast< sal_Int64 >( this );
-
- return sal_Int64();
+ return comphelper::concatSequences(
+ FmXFormController_BASE::getTypes(),
+ ::cppu::OPropertySetHelper::getTypes()
+ );
}
-//------------------------------------------------------------------------------
-Sequence< sal_Int8 > SAL_CALL FmXFormController::getImplementationId() throw( RuntimeException )
+// -----------------------------------------------------------------------------
+// XUnoTunnel
+Sequence< sal_Int8 > FmXFormController::getUnoTunnelImplementationId()
{
- static ::cppu::OImplementationId* pId = 0;
- if (! pId)
+ static ::cppu::OImplementationId * pId = NULL;
+ if ( !pId )
{
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
+ if ( !pId )
{
static ::cppu::OImplementationId aId;
pId = &aId;
@@ -409,29 +631,21 @@ Sequence< sal_Int8 > SAL_CALL FmXFormController::getImplementationId() throw( Ru
}
return pId->getImplementationId();
}
-
//------------------------------------------------------------------------------
-Sequence< Type > SAL_CALL FmXFormController::getTypes( ) throw(RuntimeException)
+FmXFormController* FmXFormController::getImplementation( const Reference< XInterface >& _rxComponent )
{
- return comphelper::concatSequences(FmXFormController_BASE1::getTypes(),FmXFormController_BASE2::getTypes(),FmXFormController_BASE3::getTypes());
+ Reference< XUnoTunnel > xTunnel( _rxComponent, UNO_QUERY );
+ if ( xTunnel.is() )
+ return reinterpret_cast< FmXFormController* >( xTunnel->getSomething( getUnoTunnelImplementationId() ) );
+ return NULL;
}
-//------------------------------------------------------------------
-Any SAL_CALL FmXFormController::queryAggregation( const Type& _rType ) throw(RuntimeException)
+//------------------------------------------------------------------------------
+sal_Int64 SAL_CALL FmXFormController::getSomething(Sequence<sal_Int8> const& rId)throw( RuntimeException )
{
- Any aRet = FmXFormController_BASE1::queryAggregation(_rType);
- if(!aRet.hasValue())
- {
- aRet = OPropertySetHelper::queryInterface(_rType);
- if(!aRet.hasValue())
- {
- aRet = FmXFormController_BASE2::queryInterface(_rType);
- if(!aRet.hasValue())
- aRet = FmXFormController_BASE3::queryInterface(_rType);
- }
- }
- if(aRet.hasValue())
- return aRet;
- return m_xAggregate->queryAggregation(_rType);
+ if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
+ return reinterpret_cast< sal_Int64 >( this );
+
+ return sal_Int64();
}
// XServiceInfo
@@ -840,7 +1054,7 @@ namespace
//------------------------------------------------------------------------------
void SAL_CALL FmXFormController::propertyChange(const PropertyChangeEvent& evt) throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
if ( evt.PropertyName == FM_PROP_BOUNDFIELD )
{
Reference<XPropertySet> xOldBound;
@@ -881,13 +1095,8 @@ void SAL_CALL FmXFormController::propertyChange(const PropertyChangeEvent& evt)
stopListening();
}
- if (bNewChanged)
- {
- if (m_nToggleEvent)
- Application::RemoveUserEvent( m_nToggleEvent );
- m_nToggleEvent = Application::PostUserEvent( LINK(this, FmXFormController,
- OnToggleAutoFields) );
- }
+ if ( bNewChanged )
+ m_aToggleEvent.Call();
if (!m_bCurrentRecordModified)
m_bModified = sal_False;
@@ -973,7 +1182,7 @@ bool FmXFormController::replaceControl( const Reference< XControl >& _rxExistent
//------------------------------------------------------------------------------
void FmXFormController::toggleAutoFields(sal_Bool bAutoFields)
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
Sequence< Reference< XControl > > aControlsCopy( m_aControls );
@@ -1046,11 +1255,8 @@ void FmXFormController::toggleAutoFields(sal_Bool bAutoFields)
//------------------------------------------------------------------------------
IMPL_LINK(FmXFormController, OnToggleAutoFields, void*, EMPTYARG)
{
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
- m_nToggleEvent = 0;
- }
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
+
toggleAutoFields(m_bCurrentRecordNew);
return 1L;
}
@@ -1059,7 +1265,7 @@ IMPL_LINK(FmXFormController, OnToggleAutoFields, void*, EMPTYARG)
//------------------------------------------------------------------------------
void SAL_CALL FmXFormController::textChanged(const TextEvent& e) throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
if (m_bFiltering)
{
Reference< XTextComponent > xText(e.Source,UNO_QUERY);
@@ -1094,7 +1300,7 @@ void SAL_CALL FmXFormController::textChanged(const TextEvent& e) throw( RuntimeE
//------------------------------------------------------------------------------
void SAL_CALL FmXFormController::itemStateChanged(const ItemEvent& rEvent) throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
if (!m_bModified)
onModify( rEvent.Source );
}
@@ -1103,14 +1309,14 @@ void SAL_CALL FmXFormController::itemStateChanged(const ItemEvent& rEvent) throw
//------------------------------------------------------------------------------
void SAL_CALL FmXFormController::addModifyListener(const Reference< XModifyListener > & l) throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
m_aModifyListeners.addInterface( l );
}
//------------------------------------------------------------------------------
void FmXFormController::removeModifyListener(const Reference< XModifyListener > & l) throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
m_aModifyListeners.removeInterface( l );
}
@@ -1118,7 +1324,7 @@ void FmXFormController::removeModifyListener(const Reference< XModifyListener >
//------------------------------------------------------------------------------
void FmXFormController::modified(const EventObject& rEvent) throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
if (!m_bModified)
onModify( rEvent.Source );
}
@@ -1126,7 +1332,7 @@ void FmXFormController::modified(const EventObject& rEvent) throw( RuntimeExcept
//------------------------------------------------------------------------------
void FmXFormController::onModify( const Reference< XInterface >& _rxControl )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
if (!m_bModified)
{
::osl::MutexGuard aGuard( m_aMutex );
@@ -1152,7 +1358,7 @@ void FmXFormController::onModify( const Reference< XInterface >& _rxControl )
//------------------------------------------------------------------------------
sal_Bool FmXFormController::determineLockState() const
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
// a.) in filter mode we are always locked
// b.) if we have no valid model or our model (a result set) is not alive -> we're locked
// c.) if we are inserting everything is OK and we are not locked
@@ -1171,7 +1377,7 @@ void FmXFormController::focusGained(const FocusEvent& e) throw( RuntimeException
{
TRACE_RANGE( "FmXFormController::focusGained" );
- OSL_ENSURE( !FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController::focusGained: Object already disposed!" );
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
::osl::MutexGuard aGuard( m_aMutex );
Reference< XControl > xControl(e.Source, UNO_QUERY);
@@ -1192,10 +1398,13 @@ void FmXFormController::focusGained(const FocusEvent& e) throw( RuntimeException
// c.) and it must be different from the new focus owning control or
// d.) the focus is moving around (so we have only one control)
- if ((m_bModified || m_bFiltering) &&
- m_xCurrentControl.is() &&
- ((xControl.get() != m_xCurrentControl.get()) ||
- ((e.FocusFlags & FocusChangeReason::AROUND) && (m_bCycle || m_bFiltering)))
+ if ( ( m_bModified || m_bFiltering )
+ && m_xCurrentControl.is()
+ && ( ( xControl.get() != m_xCurrentControl.get() )
+ || ( ( e.FocusFlags & FocusChangeReason::AROUND )
+ && ( m_bCycle || m_bFiltering )
+ )
+ )
)
{
// check the old control if the content is ok
@@ -1259,12 +1468,19 @@ void FmXFormController::focusGained(const FocusEvent& e) throw( RuntimeException
sal_Bool bActivated = !m_xActiveControl.is() && xControl.is();
m_xActiveControl = xControl;
+
implSetCurrentControl( xControl );
+ OSL_POSTCOND( m_xCurrentControl.is(), "implSetCurrentControl did nonsense!" );
- DBG_ASSERT(m_xCurrentControl.is(), "Kein CurrentControl selektiert");
+ if ( bActivated )
+ {
+ // (asynchronously) call activation handlers
+ m_aActivationEvent.Call();
- if (bActivated)
- onActivate();
+ // call modify listeners
+ if ( m_bModified )
+ m_aModifyListeners.notifyEach( &XModifyListener::modified, EventObject( *this ) );
+ }
// invalidate all features which depend on the currently focused control
if ( m_bDBConnection && !m_bFiltering && m_pView )
@@ -1285,23 +1501,29 @@ void FmXFormController::focusGained(const FocusEvent& e) throw( RuntimeException
}
//------------------------------------------------------------------------------
-void FmXFormController::onActivate()
+IMPL_LINK( FmXFormController, OnActivated, void*, /**/ )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
- // benachrichtigen, dass form activiert
- EventObject aEvt;
- aEvt.Source = *this;
- m_aActivateListeners.notifyEach( &XFormControllerListener::formActivated, aEvt );
+ EventObject aEvent;
+ aEvent.Source = *this;
+ m_aActivateListeners.notifyEach( &XFormControllerListener::formActivated, aEvent );
- // verschicken ob modified
- if (m_bModified)
- m_aModifyListeners.notifyEach( &XModifyListener::modified, aEvt );
+ return 0L;
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK( FmXFormController, OnDeactivated, void*, /**/ )
+{
+ EventObject aEvent;
+ aEvent.Source = *this;
+ m_aActivateListeners.notifyEach( &XFormControllerListener::formDeactivated, aEvent );
+
+ return 0L;
}
//------------------------------------------------------------------------------
void FmXFormController::focusLost(const FocusEvent& e) throw( RuntimeException )
{
- OSL_ENSURE( !FmXFormController_BASE1::rBHelper.bDisposed, "FmXFormController::focusLost: Object already disposed!" );
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
m_pControlBorderManager->focusLost( e.Source );
@@ -1311,9 +1533,7 @@ void FmXFormController::focusLost(const FocusEvent& e) throw( RuntimeException )
if (!xNextControl.is())
{
m_xActiveControl = NULL;
- EventObject aEvt;
- aEvt.Source = *this;
- m_aActivateListeners.notifyEach( &XFormControllerListener::formDeactivated, aEvt );
+ m_aDeactivationEvent.Call();
}
}
@@ -1356,7 +1576,7 @@ void SAL_CALL FmXFormController::componentValidityChanged( const EventObject& _r
//--------------------------------------------------------------------
void FmXFormController::setModel(const Reference< XTabControllerModel > & Model) throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
::osl::MutexGuard aGuard( m_aMutex );
DBG_ASSERT(m_xTabController.is(), "FmXFormController::setModel : invalid aggregate !");
@@ -1461,7 +1681,7 @@ void FmXFormController::setModel(const Reference< XTabControllerModel > & Model)
//------------------------------------------------------------------------------
Reference< XTabControllerModel > FmXFormController::getModel() throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
DBG_ASSERT(m_xTabController.is(), "FmXFormController::getModel : invalid aggregate !");
if (!m_xTabController.is())
return Reference< XTabControllerModel > ();
@@ -1471,7 +1691,7 @@ Reference< XTabControllerModel > FmXFormController::getModel() throw( RuntimeEx
//------------------------------------------------------------------------------
void FmXFormController::addToEventAttacher(const Reference< XControl > & xControl)
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
OSL_ENSURE( xControl.is(), "FmXFormController::addToEventAttacher: invalid control - how did you reach this?" );
if ( !xControl.is() )
return; /* throw IllegalArgumentException(); */
@@ -1499,7 +1719,7 @@ void FmXFormController::addToEventAttacher(const Reference< XControl > & xContro
//------------------------------------------------------------------------------
void FmXFormController::removeFromEventAttacher(const Reference< XControl > & xControl)
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
OSL_ENSURE( xControl.is(), "FmXFormController::removeFromEventAttacher: invalid control - how did you reach this?" );
if ( !xControl.is() )
return; /* throw IllegalArgumentException(); */
@@ -1527,7 +1747,7 @@ void FmXFormController::removeFromEventAttacher(const Reference< XControl > & xC
//------------------------------------------------------------------------------
void FmXFormController::setContainer(const Reference< XControlContainer > & xContainer) throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
Reference< XTabControllerModel > xTabModel(getModel());
DBG_ASSERT(xTabModel.is() || !xContainer.is(), "No Model defined");
// if we have a new container we need a model
@@ -1616,7 +1836,7 @@ void FmXFormController::setContainer(const Reference< XControlContainer > & xCon
Reference< XControlContainer > FmXFormController::getContainer() throw( RuntimeException )
{
::osl::MutexGuard aGuard( m_aMutex );
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
DBG_ASSERT(m_xTabController.is(), "FmXFormController::getContainer : invalid aggregate !");
if (!m_xTabController.is())
return Reference< XControlContainer > ();
@@ -1626,7 +1846,7 @@ Reference< XControlContainer > FmXFormController::getContainer() throw( Runtime
//------------------------------------------------------------------------------
Sequence< Reference< XControl > > FmXFormController::getControls(void) throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
::osl::MutexGuard aGuard( m_aMutex );
if (!m_bControlsSorted)
{
@@ -1665,7 +1885,7 @@ Sequence< Reference< XControl > > FmXFormController::getControls(void) throw( Ru
//------------------------------------------------------------------------------
void FmXFormController::autoTabOrder() throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
::osl::MutexGuard aGuard( m_aMutex );
DBG_ASSERT(m_xTabController.is(), "FmXFormController::autoTabOrder : invalid aggregate !");
if (m_xTabController.is())
@@ -1675,7 +1895,7 @@ void FmXFormController::autoTabOrder() throw( RuntimeException )
//------------------------------------------------------------------------------
void FmXFormController::activateTabOrder() throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
::osl::MutexGuard aGuard( m_aMutex );
DBG_ASSERT(m_xTabController.is(), "FmXFormController::activateTabOrder : invalid aggregate !");
if (m_xTabController.is())
@@ -1685,7 +1905,7 @@ void FmXFormController::activateTabOrder() throw( RuntimeException )
//------------------------------------------------------------------------------
void FmXFormController::setControlLock(const Reference< XControl > & xControl)
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
sal_Bool bLocked = isLocked();
// es wird gelockt
@@ -1738,7 +1958,7 @@ void FmXFormController::setControlLock(const Reference< XControl > & xControl)
//------------------------------------------------------------------------------
void FmXFormController::setLocks()
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
// alle Controls, die mit einer Datenquelle verbunden sind locken/unlocken
const Reference< XControl >* pControls = m_aControls.getConstArray();
const Reference< XControl >* pControlsEnd = pControls + m_aControls.getLength();
@@ -1781,7 +2001,7 @@ namespace
//------------------------------------------------------------------------------
void FmXFormController::startControlModifyListening(const Reference< XControl > & xControl)
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController::startControlModifyListening: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
bool bModifyListening = lcl_shouldListenForModifications( xControl, this );
@@ -1830,7 +2050,7 @@ void FmXFormController::startControlModifyListening(const Reference< XControl >
//------------------------------------------------------------------------------
void FmXFormController::stopControlModifyListening(const Reference< XControl > & xControl)
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
bool bModifyListening = lcl_shouldListenForModifications( xControl, NULL );
@@ -1878,7 +2098,7 @@ void FmXFormController::stopControlModifyListening(const Reference< XControl > &
//------------------------------------------------------------------------------
void FmXFormController::startListening()
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
m_bModified = sal_False;
// jetzt anmelden bei gebundenen feldern
@@ -1891,7 +2111,7 @@ void FmXFormController::startListening()
//------------------------------------------------------------------------------
void FmXFormController::stopListening()
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
m_bModified = sal_False;
// jetzt anmelden bei gebundenen feldern
@@ -1905,7 +2125,7 @@ void FmXFormController::stopListening()
//------------------------------------------------------------------------------
Reference< XControl > FmXFormController::findControl(Sequence< Reference< XControl > >& _rControls, const Reference< XControlModel > & xCtrlModel ,sal_Bool _bRemove,sal_Bool _bOverWrite) const
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
DBG_ASSERT( xCtrlModel.is(), "findControl - welches ?!" );
Reference< XControl >* pControls = _rControls.getArray();
@@ -2019,11 +2239,14 @@ void FmXFormController::implSetCurrentControl( const Reference< XControl >& _rxC
//------------------------------------------------------------------------------
void FmXFormController::insertControl(const Reference< XControl > & xControl)
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
m_bControlsSorted = sal_False;
m_aControls.realloc(m_aControls.getLength() + 1);
m_aControls.getArray()[m_aControls.getLength() - 1] = xControl;
+ if ( m_pColumnInfoCache.get() )
+ m_pColumnInfoCache->deinitializeControls();
+
implControlInserted( xControl, m_bAttachEvents );
if (m_bDBConnection && !m_bFiltering)
@@ -2036,7 +2259,7 @@ void FmXFormController::insertControl(const Reference< XControl > & xControl)
//------------------------------------------------------------------------------
void FmXFormController::removeControl(const Reference< XControl > & xControl)
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
const Reference< XControl >* pControls = m_aControls.getConstArray();
const Reference< XControl >* pControlsEnd = pControls + m_aControls.getLength();
while ( pControls != pControlsEnd )
@@ -2068,7 +2291,7 @@ void FmXFormController::loaded(const EventObject& rEvent) throw( RuntimeExceptio
{
OSL_ENSURE( rEvent.Source == m_xModelAsIndex, "FmXFormController::loaded: where did this come from?" );
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
::osl::MutexGuard aGuard( m_aMutex );
Reference< XRowSet > xForm(rEvent.Source, UNO_QUERY);
// do we have a connected data source
@@ -2092,10 +2315,7 @@ void FmXFormController::loaded(const EventObject& rEvent) throw( RuntimeExceptio
// set the locks for the current controls
if (getContainer().is())
{
- if (m_nLoadEvent)
- Application::RemoveUserEvent( m_nLoadEvent );
- m_nLoadEvent = Application::PostUserEvent( LINK(this, FmXFormController,
- OnLoad) );
+ m_aLoadEvent.Call();
}
}
else
@@ -2116,6 +2336,9 @@ void FmXFormController::loaded(const EventObject& rEvent) throw( RuntimeExceptio
m_bLocked = sal_False;
}
+ Reference< XColumnsSupplier > xFormColumns( xForm, UNO_QUERY );
+ m_pColumnInfoCache.reset( xFormColumns.is() ? new ColumnInfoCache( xFormColumns ) : NULL );
+
updateAllDispatchers();
}
@@ -2135,8 +2358,7 @@ void FmXFormController::updateAllDispatchers() const
//------------------------------------------------------------------------------
IMPL_LINK(FmXFormController, OnLoad, void*, EMPTYARG)
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
- m_nLoadEvent = 0;
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
m_bLocked = determineLockState();
setLocks();
@@ -2154,49 +2376,42 @@ IMPL_LINK(FmXFormController, OnLoad, void*, EMPTYARG)
//------------------------------------------------------------------------------
void FmXFormController::unloaded(const EventObject& /*rEvent*/) throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
updateAllDispatchers();
}
//------------------------------------------------------------------------------
void FmXFormController::reloading(const EventObject& /*aEvent*/) throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
::osl::MutexGuard aGuard( m_aMutex );
// do the same like in unloading
// just one exception toggle the auto values
- if (m_nToggleEvent)
- {
- Application::RemoveUserEvent( m_nToggleEvent );
- m_nToggleEvent = 0;
- }
+ m_aToggleEvent.CancelPendingCall();
unload();
}
//------------------------------------------------------------------------------
void FmXFormController::reloaded(const EventObject& aEvent) throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
loaded(aEvent);
}
//------------------------------------------------------------------------------
void FmXFormController::unloading(const EventObject& /*aEvent*/) throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
unload();
}
//------------------------------------------------------------------------------
void FmXFormController::unload() throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
::osl::MutexGuard aGuard( m_aMutex );
- if (m_nLoadEvent)
- {
- Application::RemoveUserEvent( m_nLoadEvent );
- m_nLoadEvent = 0;
- }
+
+ m_aLoadEvent.CancelPendingCall();
// be sure not to have autofields
if (m_bCurrentRecordNew)
@@ -2215,6 +2430,8 @@ void FmXFormController::unload() throw( RuntimeException )
m_bDBConnection = sal_False;
m_bCanInsert = m_bCanUpdate = m_bCycle = sal_False;
m_bCurrentRecordModified = m_bCurrentRecordNew = m_bLocked = sal_False;
+
+ m_pColumnInfoCache.reset( NULL );
}
// -----------------------------------------------------------------------------
@@ -2300,7 +2517,7 @@ void FmXFormController::stopFormListening( const Reference< XPropertySet >& _rxF
//------------------------------------------------------------------------------
void FmXFormController::cursorMoved(const EventObject& /*event*/) throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
// toggle the locking ?
if (m_bLocked != determineLockState())
{
@@ -2333,7 +2550,7 @@ void FmXFormController::rowSetChanged(const EventObject& /*event*/) throw( Runti
//------------------------------------------------------------------------------
void SAL_CALL FmXFormController::elementInserted(const ContainerEvent& evt) throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
Reference< XControl > xControl;
evt.Element >>= xControl;
if (!xControl.is())
@@ -2394,7 +2611,7 @@ void SAL_CALL FmXFormController::elementReplaced(const ContainerEvent& evt) thro
//------------------------------------------------------------------------------
void SAL_CALL FmXFormController::elementRemoved(const ContainerEvent& evt) throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
::osl::MutexGuard aGuard( m_aMutex );
Reference< XControl > xControl;
@@ -2421,7 +2638,7 @@ void SAL_CALL FmXFormController::elementRemoved(const ContainerEvent& evt) throw
//------------------------------------------------------------------------------
Reference< XControl > FmXFormController::isInList(const Reference< XWindowPeer > & xPeer) const
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
const Reference< XControl >* pControls = m_aControls.getConstArray();
sal_uInt32 nCtrls = m_aControls.getLength();
@@ -2440,7 +2657,7 @@ Reference< XControl > FmXFormController::isInList(const Reference< XWindowPeer
//------------------------------------------------------------------------------
void FmXFormController::activateFirst() throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
::osl::MutexGuard aGuard( m_aMutex );
DBG_ASSERT(m_xTabController.is(), "FmXFormController::activateFirst : invalid aggregate !");
if (m_xTabController.is())
@@ -2450,7 +2667,7 @@ void FmXFormController::activateFirst() throw( RuntimeException )
//------------------------------------------------------------------------------
void FmXFormController::activateLast() throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
::osl::MutexGuard aGuard( m_aMutex );
DBG_ASSERT(m_xTabController.is(), "FmXFormController::activateLast : invalid aggregate !");
if (m_xTabController.is())
@@ -2469,21 +2686,21 @@ Reference< XControl> SAL_CALL FmXFormController::getCurrentControl(void) throw(
void SAL_CALL FmXFormController::addActivateListener(const Reference< XFormControllerListener > & l) throw( RuntimeException )
{
::osl::MutexGuard aGuard( m_aMutex );
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
m_aActivateListeners.addInterface(l);
}
//------------------------------------------------------------------------------
void SAL_CALL FmXFormController::removeActivateListener(const Reference< XFormControllerListener > & l) throw( RuntimeException )
{
::osl::MutexGuard aGuard( m_aMutex );
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
m_aActivateListeners.removeInterface(l);
}
//------------------------------------------------------------------------------
void FmXFormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
// create the composer
Reference< XRowSet > xForm(m_xModelAsIndex, UNO_QUERY);
Reference< XConnection > xConnection(OStaticDataAccessTools().getRowSetConnection(xForm));
@@ -2659,7 +2876,7 @@ void FmXFormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
//------------------------------------------------------------------------------
void FmXFormController::startFiltering()
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
OStaticDataAccessTools aStaticTools;
Reference< XConnection > xConnection( aStaticTools.getRowSetConnection( Reference< XRowSet >( m_xModelAsIndex, UNO_QUERY ) ) );
@@ -2818,7 +3035,7 @@ void FmXFormController::startFiltering()
//------------------------------------------------------------------------------
void FmXFormController::stopFiltering()
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
if ( !m_bFiltering ) // #104693# OJ
{ // nothing to do
return;
@@ -2912,7 +3129,7 @@ void FmXFormController::setMode(const ::rtl::OUString& Mode) throw( NoSupportExc
{
::osl::MutexGuard aGuard( m_aMutex );
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
if (!supportsMode(Mode))
throw NoSupportException();
@@ -2939,14 +3156,14 @@ void FmXFormController::setMode(const ::rtl::OUString& Mode) throw( NoSupportExc
::rtl::OUString SAL_CALL FmXFormController::getMode(void) throw( RuntimeException )
{
::osl::MutexGuard aGuard( m_aMutex );
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
return m_aMode;
}
//------------------------------------------------------------------------------
Sequence< ::rtl::OUString > SAL_CALL FmXFormController::getSupportedModes(void) throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
static Sequence< ::rtl::OUString > aModes;
if (!aModes.getLength())
{
@@ -2961,7 +3178,7 @@ Sequence< ::rtl::OUString > SAL_CALL FmXFormController::getSupportedModes(void)
//------------------------------------------------------------------------------
sal_Bool SAL_CALL FmXFormController::supportsMode(const ::rtl::OUString& Mode) throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
Sequence< ::rtl::OUString > aModes(getSupportedModes());
const ::rtl::OUString* pModes = aModes.getConstArray();
for (sal_Int32 i = aModes.getLength(); i > 0; )
@@ -2975,7 +3192,7 @@ sal_Bool SAL_CALL FmXFormController::supportsMode(const ::rtl::OUString& Mode) t
//------------------------------------------------------------------------------
Window* FmXFormController::getDialogParentWindow()
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
Window* pParent = m_pWindow;
if ( !pParent )
{
@@ -3126,8 +3343,9 @@ namespace
//------------------------------------------------------------------------------
sal_Bool SAL_CALL FmXFormController::approveRowChange(const RowChangeEvent& _rEvent) throw( RuntimeException )
{
- ::osl::MutexGuard aGuard( m_aMutex );
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
::cppu::OInterfaceIteratorHelper aIter(m_aRowSetApproveListeners);
sal_Bool bValid = sal_True;
if (aIter.hasMoreElements())
@@ -3150,7 +3368,9 @@ sal_Bool SAL_CALL FmXFormController::approveRowChange(const RowChangeEvent& _rEv
Reference< XControlModel > xInvalidModel;
if ( !checkFormComponentValidity( sInvalidityExplanation, xInvalidModel ) )
{
- displayErrorSetFocus( sInvalidityExplanation, locateControl( xInvalidModel ), getDialogParentWindow() );
+ Reference< XControl > xControl( locateControl( xInvalidModel ) );
+ aGuard.clear();
+ displayErrorSetFocus( sInvalidityExplanation, xControl, getDialogParentWindow() );
return false;
}
@@ -3158,63 +3378,43 @@ sal_Bool SAL_CALL FmXFormController::approveRowChange(const RowChangeEvent& _rEv
if ( !lcl_shouldValidateRequiredFields_nothrow( _rEvent.Source ) )
return sal_True;
+ OSL_ENSURE( m_pColumnInfoCache.get(), "FmXFormController::approveRowChange: no column infos!" );
+ if ( !m_pColumnInfoCache.get() )
+ return sal_True;
+
try
{
- Reference< XColumnsSupplier > xSupplyCols( _rEvent.Source, UNO_QUERY_THROW );
- Reference< XEnumerationAccess > xEnumAccess( xSupplyCols->getColumns(), UNO_QUERY_THROW );
- Reference< XEnumeration > xEnumeration( xEnumAccess->createEnumeration(), UNO_QUERY_THROW );
+ if ( !m_pColumnInfoCache->controlsInitialized() )
+ m_pColumnInfoCache->initializeControls( getControls() );
- Reference< XPropertySet > xFieldSet;
- while ( xEnumeration->hasMoreElements() )
+ size_t colCount = m_pColumnInfoCache->getColumnCount();
+ for ( size_t col = 0; col < colCount; ++col )
{
- xEnumeration->nextElement() >>= xFieldSet;
- Reference< XColumn > xColumn( xFieldSet, UNO_QUERY);
- if ( !xColumn.is() )
- {
- DBG_ERROR( "FmXFormController::approveRowChange: invalid field !" );
+ const ColumnInfo& rColInfo = m_pColumnInfoCache->getColumnInfo( col );
+ if ( rColInfo.nNullable != ColumnValue::NO_NULLS )
continue;
- }
- sal_Bool bRequired = ::comphelper::getINT32( xFieldSet->getPropertyValue( FM_PROP_ISNULLABLE ) ) == ColumnValue::NO_NULLS;
- if ( !bRequired )
+ if ( rColInfo.bAutoIncrement )
continue;
- sal_Bool bAutoIncrement = ::comphelper::getBOOL( xFieldSet->getPropertyValue( FM_PROP_AUTOINCREMENT ) );
- if ( bAutoIncrement )
+ if ( !rColInfo.xFirstControlWithInputRequired.is() && !rColInfo.xFirstGridWithInputRequiredColumn.is() )
continue;
- ::rtl::OUString aFieldName( ::comphelper::getString( xFieldSet->getPropertyValue( FM_PROP_NAME ) ) );
-
// TODO: in case of binary fields, this "getString" below is extremely expensive
- if ( !xColumn->getString().getLength() && xColumn->wasNull() )
- {
- Sequence< Reference< XControl > > aControls( getControls() );
- sal_Int32 nLength = aControls.getLength();
- sal_Int32 i(0);
- const Reference< XControl > * pControls = aControls.getConstArray();
- for (; i < nLength; i++)
- {
- if (pControls[i].is())
- {
- Reference< XPropertySet > xModel(pControls[i]->getModel(), UNO_QUERY);
- if (xModel.is())
- {
- if (::comphelper::hasProperty(FM_PROP_CONTROLSOURCE, xModel))
- {
- ::rtl::OUString aName = ::comphelper::getString(xModel->getPropertyValue(FM_PROP_CONTROLSOURCE));
- if (aName == aFieldName) // Control gefunden
- break;
- }
- }
- }
- }
+ if ( rColInfo.xColumn->getString().getLength() || !rColInfo.xColumn->wasNull() )
+ continue;
- String sMessage( SVX_RES( RID_ERR_FIELDREQUIRED ) );
- sMessage.SearchAndReplace( '#', aFieldName.getStr() );
- displayErrorSetFocus( sMessage, ( i < nLength ) ? pControls[i] : Reference< XControl >(), getDialogParentWindow() );
+ String sMessage( SVX_RES( RID_ERR_FIELDREQUIRED ) );
+ sMessage.SearchAndReplace( '#', rColInfo.sName );
- return sal_False;
- }
+ // the control to focus
+ Reference< XControl > xControl( rColInfo.xFirstControlWithInputRequired );
+ if ( !xControl.is() )
+ xControl.set( rColInfo.xFirstGridWithInputRequiredColumn, UNO_QUERY );
+
+ aGuard.clear();
+ displayErrorSetFocus( sMessage, rColInfo.xFirstControlWithInputRequired, getDialogParentWindow() );
+ return sal_False;
}
}
catch( const Exception& )
@@ -3229,7 +3429,7 @@ sal_Bool SAL_CALL FmXFormController::approveRowChange(const RowChangeEvent& _rEv
sal_Bool SAL_CALL FmXFormController::approveCursorMove(const EventObject& event) throw( RuntimeException )
{
::osl::MutexGuard aGuard( m_aMutex );
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
::cppu::OInterfaceIteratorHelper aIter(m_aRowSetApproveListeners);
if (aIter.hasMoreElements())
{
@@ -3245,7 +3445,7 @@ sal_Bool SAL_CALL FmXFormController::approveCursorMove(const EventObject& event)
sal_Bool SAL_CALL FmXFormController::approveRowSetChange(const EventObject& event) throw( RuntimeException )
{
::osl::MutexGuard aGuard( m_aMutex );
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
::cppu::OInterfaceIteratorHelper aIter(m_aRowSetApproveListeners);
if (aIter.hasMoreElements())
{
@@ -3262,7 +3462,7 @@ sal_Bool SAL_CALL FmXFormController::approveRowSetChange(const EventObject& even
void SAL_CALL FmXFormController::addRowSetApproveListener(const Reference< XRowSetApproveListener > & _rxListener) throw( RuntimeException )
{
::osl::MutexGuard aGuard( m_aMutex );
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
m_aRowSetApproveListeners.addInterface(_rxListener);
}
@@ -3270,7 +3470,7 @@ void SAL_CALL FmXFormController::addRowSetApproveListener(const Reference< XRowS
void SAL_CALL FmXFormController::removeRowSetApproveListener(const Reference< XRowSetApproveListener > & _rxListener) throw( RuntimeException )
{
::osl::MutexGuard aGuard( m_aMutex );
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
m_aRowSetApproveListeners.removeInterface(_rxListener);
}
@@ -3278,8 +3478,8 @@ void SAL_CALL FmXFormController::removeRowSetApproveListener(const Reference< XR
//------------------------------------------------------------------------------
void SAL_CALL FmXFormController::errorOccured(const SQLErrorEvent& aEvent) throw( RuntimeException )
{
- ::osl::MutexGuard aGuard( m_aMutex );
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
::cppu::OInterfaceIteratorHelper aIter(m_aErrorListeners);
if (aIter.hasMoreElements())
@@ -3290,7 +3490,8 @@ void SAL_CALL FmXFormController::errorOccured(const SQLErrorEvent& aEvent) throw
}
else
{
- displayException(aEvent);
+ aGuard.clear();
+ displayException( aEvent );
}
}
@@ -3299,7 +3500,7 @@ void SAL_CALL FmXFormController::errorOccured(const SQLErrorEvent& aEvent) throw
void SAL_CALL FmXFormController::addSQLErrorListener(const Reference< XSQLErrorListener > & aListener) throw( RuntimeException )
{
::osl::MutexGuard aGuard( m_aMutex );
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
m_aErrorListeners.addInterface(aListener);
}
@@ -3307,7 +3508,7 @@ void SAL_CALL FmXFormController::addSQLErrorListener(const Reference< XSQLErrorL
void SAL_CALL FmXFormController::removeSQLErrorListener(const Reference< XSQLErrorListener > & aListener) throw( RuntimeException )
{
::osl::MutexGuard aGuard( m_aMutex );
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
m_aErrorListeners.removeInterface(aListener);
}
@@ -3315,14 +3516,14 @@ void SAL_CALL FmXFormController::removeSQLErrorListener(const Reference< XSQLErr
//------------------------------------------------------------------------------
void SAL_CALL FmXFormController::addDatabaseParameterListener(const Reference< XDatabaseParameterListener > & aListener) throw( RuntimeException )
{
- OSL_ENSURE( !FmXFormController_BASE1::rBHelper.bDisposed, "FmXFormController::addDatabaseParameterListener: Object already disposed!" );
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
m_aParameterListeners.addInterface(aListener);
}
//------------------------------------------------------------------------------
void SAL_CALL FmXFormController::removeDatabaseParameterListener(const Reference< XDatabaseParameterListener > & aListener) throw( RuntimeException )
{
- OSL_ENSURE( !FmXFormController_BASE1::rBHelper.bDisposed, "FmXFormController::removeDatabaseParameterListener: Object already disposed!" );
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
m_aParameterListeners.removeInterface(aListener);
}
@@ -3343,7 +3544,7 @@ void SAL_CALL FmXFormController::removeParameterListener(const Reference< XDatab
//------------------------------------------------------------------------------
sal_Bool SAL_CALL FmXFormController::approveParameter(const DatabaseParameterEvent& aEvent) throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
::cppu::OInterfaceIteratorHelper aIter(m_aParameterListeners);
if (aIter.hasMoreElements())
@@ -3422,14 +3623,14 @@ sal_Bool SAL_CALL FmXFormController::approveParameter(const DatabaseParameterEve
//------------------------------------------------------------------------------
void SAL_CALL FmXFormController::addConfirmDeleteListener(const Reference< XConfirmDeleteListener > & aListener) throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
m_aDeleteListeners.addInterface(aListener);
}
//------------------------------------------------------------------------------
void SAL_CALL FmXFormController::removeConfirmDeleteListener(const Reference< XConfirmDeleteListener > & aListener) throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
m_aDeleteListeners.removeInterface(aListener);
}
@@ -3437,7 +3638,7 @@ void SAL_CALL FmXFormController::removeConfirmDeleteListener(const Reference< XC
//------------------------------------------------------------------------------
sal_Bool SAL_CALL FmXFormController::confirmDelete(const RowChangeEvent& aEvent) throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
::cppu::OInterfaceIteratorHelper aIter(m_aDeleteListeners);
if (aIter.hasMoreElements())
@@ -3484,7 +3685,7 @@ FmXFormController::interceptedQueryDispatch(sal_uInt16 /*_nId*/, const URL& aURL
const ::rtl::OUString& /*aTargetFrameName*/, sal_Int32 /*nSearchFlags*/)
throw( RuntimeException )
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
Reference< XDispatch > xReturn;
// dispatches handled by ourself
if ( ( aURL.Complete == FMURL_CONFIRM_DELETION )
@@ -3576,7 +3777,7 @@ void SAL_CALL FmXFormController::removeStatusListener( const Reference< XStatusL
//------------------------------------------------------------------------------
Reference< XDispatchProviderInterceptor > FmXFormController::createInterceptor(const Reference< XDispatchProviderInterception > & _xInterception)
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
#ifdef DBG_UTIL
// check if we already have a interceptor for the given object
for ( ConstInterceptorsIterator aIter = m_aControlDispatchInterceptors.begin();
@@ -3624,7 +3825,7 @@ void SAL_CALL FmXFormController::handle( const Reference< XInteractionRequest >&
//------------------------------------------------------------------------------
void FmXFormController::deleteInterceptor(const Reference< XDispatchProviderInterception > & _xInterception)
{
- OSL_ENSURE(!FmXFormController_BASE1::rBHelper.bDisposed,"FmXFormController: Object already disposed!");
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FmXFormController: already disposed!" );
// search the interceptor responsible for the given object
InterceptorsIterator aIter;
for ( aIter = m_aControlDispatchInterceptors.begin();
diff --git a/svx/source/form/fmexpl.cxx b/svx/source/form/fmexpl.cxx
index 212569d0a1..89ce08fa51 100644
--- a/svx/source/form/fmexpl.cxx
+++ b/svx/source/form/fmexpl.cxx
@@ -30,9 +30,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
-#ifndef _SVX_FMUNOVW_HXX
-#include "fmvwimp.hxx"
-#endif
#ifndef _SVX_FMRESIDS_HRC
#include "fmresids.hrc"
diff --git a/svx/source/form/fmmodel.cxx b/svx/source/form/fmmodel.cxx
index bb40b9bdca..73a1471b26 100644
--- a/svx/source/form/fmmodel.cxx
+++ b/svx/source/form/fmmodel.cxx
@@ -223,18 +223,21 @@ void FmFormModel::MovePage( USHORT nPgNum, USHORT nNewPos )
\************************************************************************/
SdrPage* FmFormModel::RemovePage(sal_uInt16 nPgNum)
{
- FmFormPage* pPage = (FmFormPage*)SdrModel::RemovePage(nPgNum);
+ FmFormPage* pToBeRemovedPage = dynamic_cast< FmFormPage* >( GetPage( nPgNum ) );
+ OSL_ENSURE( pToBeRemovedPage, "FmFormModel::RemovePage: *which page*?" );
#ifndef SVX_LIGHT
- if (pPage)
+ if ( pToBeRemovedPage )
{
- Reference< XNameContainer > xForms( pPage->GetForms( false ) );
+ Reference< XNameContainer > xForms( pToBeRemovedPage->GetForms( false ) );
if ( xForms.is() )
m_pImpl->pUndoEnv->RemoveForms( xForms );
}
#endif
- return pPage;
+ FmFormPage* pRemovedPage = (FmFormPage*)SdrModel::RemovePage(nPgNum);
+ OSL_ENSURE( pRemovedPage == pToBeRemovedPage, "FmFormModel::RemovePage: inconsistency!" );
+ return pRemovedPage;
}
/*************************************************************************
diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx
index b064daffe3..6861cb0bd8 100644
--- a/svx/source/form/fmobj.cxx
+++ b/svx/source/form/fmobj.cxx
@@ -31,12 +31,12 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
#include <tools/resmgr.hxx>
+#include <tools/diagnose_ex.h>
#include "fmobj.hxx"
-
-#ifndef _SVX_FMPROP_HRC
#include "fmprop.hrc"
-#endif
+#include "fmvwimp.hxx"
#include <svx/editeng.hxx>
+#include <svx/svdovirt.hxx>
/** === begin UNO includes === **/
#include <com/sun/star/awt/XDevice.hpp>
@@ -49,15 +49,11 @@
#include <tools/shl.hxx>
#include <svx/dialmgr.hxx>
-#ifndef _SVX_FMRESIDS_HRC
#include "fmresids.hrc"
-#endif
#include <svx/fmview.hxx>
#include <svx/fmglob.hxx>
-#ifndef _SVX_FMPGEIMP_HXX
#include "fmpgeimp.hxx"
-#endif
#include <svx/fmpage.hxx>
#include <comphelper/property.hxx>
#include <comphelper/processfactory.hxx>
@@ -79,24 +75,20 @@ TYPEINIT1(FmFormObj, SdrUnoObj);
DBG_NAME(FmFormObj);
//------------------------------------------------------------------
FmFormObj::FmFormObj(const ::rtl::OUString& rModelName,sal_Int32 _nType)
- :SdrUnoObj ( rModelName, sal_False )
- ,m_pControlCreationView ( 0 )
- ,m_nControlCreationEvent ( 0 )
- ,m_nPos ( -1 )
- ,m_nType ( _nType )
- ,m_pLastKnownRefDevice ( NULL )
+ :SdrUnoObj ( rModelName )
+ ,m_nPos ( -1 )
+ ,m_nType ( _nType )
+ ,m_pLastKnownRefDevice ( NULL )
{
DBG_CTOR(FmFormObj, NULL);
}
//------------------------------------------------------------------
FmFormObj::FmFormObj( sal_Int32 _nType )
- :SdrUnoObj ( String(), sal_False )
- ,m_pControlCreationView ( 0 )
- ,m_nControlCreationEvent ( 0 )
- ,m_nPos ( -1 )
- ,m_nType ( _nType )
- ,m_pLastKnownRefDevice ( NULL )
+ :SdrUnoObj ( String() )
+ ,m_nPos ( -1 )
+ ,m_nType ( _nType )
+ ,m_pLastKnownRefDevice ( NULL )
{
DBG_CTOR(FmFormObj, NULL);
}
@@ -105,8 +97,6 @@ FmFormObj::FmFormObj( sal_Int32 _nType )
FmFormObj::~FmFormObj()
{
DBG_DTOR(FmFormObj, NULL);
- if (m_nControlCreationEvent)
- Application::RemoveUserEvent(m_nControlCreationEvent);
Reference< XComponent> xHistory(m_xEnvironmentHistory, UNO_QUERY);
if (xHistory.is())
@@ -117,7 +107,7 @@ FmFormObj::~FmFormObj()
}
//------------------------------------------------------------------
-void FmFormObj::SetObjEnv(const Reference< XIndexContainer > & xForm, sal_Int32 nIdx,
+void FmFormObj::SetObjEnv(const Reference< XIndexContainer > & xForm, const sal_Int32 nIdx,
const Sequence< ScriptEventDescriptor >& rEvts)
{
m_xParent = xForm;
@@ -126,71 +116,112 @@ void FmFormObj::SetObjEnv(const Reference< XIndexContainer > & xForm, sal_Int32
}
//------------------------------------------------------------------
+void FmFormObj::ClearObjEnv()
+{
+ m_xParent.clear();
+ aEvts.realloc( 0 );
+ m_nPos = -1;
+}
+
+//------------------------------------------------------------------
+void FmFormObj::impl_isolateControlModel_nothrow()
+{
+ try
+ {
+ Reference< XChild > xControlModel( GetUnoControlModel(), UNO_QUERY );
+ if ( xControlModel.is() )
+ {
+ Reference< XIndexContainer> xParent( xControlModel->getParent(), UNO_QUERY );
+ if ( xParent.is() )
+ {
+ sal_Int32 nPos = getElementPos( xParent.get(), xControlModel );
+ xParent->removeByIndex( nPos );
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------
void FmFormObj::SetPage(SdrPage* _pNewPage)
{
FmFormPage* pNewFormPage = PTR_CAST(FmFormPage, _pNewPage);
- if (!pNewFormPage || (GetPage() == _pNewPage))
+ if ( GetPage() == _pNewPage )
+ {
+ SdrUnoObj::SetPage(_pNewPage);
+ return;
+ }
+
+ if ( !pNewFormPage )
{ // Maybe it makes sense to create an environment history here : if somebody set's our page to NULL, and we have a valid page before,
- // me may want to remember our place within the old page. For this we could create a new m_pEnvironmentHistory to store it.
+ // me may want to remember our place within the old page. For this we could create a new m_xEnvironmentHistory to store it.
// So the next SetPage with a valid new page would restore that environment within the new page.
// But for the original Bug (#57300#) we don't need that, so I omit it here. Maybe this will be implemented later.
+ impl_isolateControlModel_nothrow();
SdrUnoObj::SetPage(_pNewPage);
return;
}
- Reference< XIndexContainer > xNewParent;
+ Reference< XIndexContainer > xNewPageForms( pNewFormPage->GetForms( true ), UNO_QUERY );
+ Reference< XIndexContainer > xNewParent;
Sequence< ScriptEventDescriptor> aNewEvents;
// calc the new parent for my model (within the new page's forms hierarchy)
// do we have a history ? (from :Clone)
- if (m_xEnvironmentHistory.is())
+ if ( m_xEnvironmentHistory.is() )
{
- // the element in *m_pEnvironmentHistory which is equivalent to my new parent (which (perhaps) has to be created within _pNewPage->GetForms)
+ // the element in m_xEnvironmentHistory which is equivalent to my new parent (which (perhaps) has to be created within _pNewPage->GetForms)
// is the right-most element in the tree.
- Reference< XIndexContainer > xLoop = m_xEnvironmentHistory;
- do
+ Reference< XIndexContainer > xRightMostLeaf = m_xEnvironmentHistory;
+ try
{
- if (xLoop->getCount() == 0)
- break;
- Reference< XIndexContainer > xRightMostChild;
- xLoop->getByIndex(xLoop->getCount() - 1) >>= xRightMostChild;
- if (!xRightMostChild.is())
+ while ( xRightMostLeaf->getCount() )
{
- DBG_ERROR("FmFormObj::SetPage : invalid elements in environment history !");
- break;
+ xRightMostLeaf.set(
+ xRightMostLeaf->getByIndex( xRightMostLeaf->getCount() - 1 ),
+ UNO_QUERY_THROW
+ );
}
- xLoop = xRightMostChild;
- }
- while (sal_True);
- xNewParent = Reference< XIndexContainer > (ensureModelEnv(xLoop, Reference< XIndexContainer > (pNewFormPage->GetForms(), ::com::sun::star::uno::UNO_QUERY)), ::com::sun::star::uno::UNO_QUERY);
- if (xNewParent.is())
- // we successfully clone the environment in m_pEnvironmentHistory, so we can use m_aEventsHistory
- // (which describes the events of our model at the moment m_pEnvironmentHistory was created)
+ xNewParent.set( ensureModelEnv( xRightMostLeaf, xNewPageForms ), UNO_QUERY_THROW );
+
+ // we successfully cloned the environment in m_xEnvironmentHistory, so we can use m_aEventsHistory
+ // (which describes the events of our model at the moment m_xEnvironmentHistory was created)
aNewEvents = m_aEventsHistory;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
- if (!xNewParent.is())
+ if ( !xNewParent.is() )
{
// are we a valid part of our current page forms ?
- FmFormPage* pOldFormPage = PTR_CAST(FmFormPage, GetPage());
- Reference< XIndexContainer > xOldForms = pOldFormPage ? Reference< XIndexContainer > (pOldFormPage->GetForms(), ::com::sun::star::uno::UNO_QUERY) : ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > ();
- if (xOldForms.is())
+ Reference< XIndexContainer > xOldForms;
+ FmFormPage* pOldFormPage = dynamic_cast< FmFormPage* >( GetPage() );
+ if ( pOldFormPage )
+ xOldForms.set( pOldFormPage->GetForms(), UNO_QUERY_THROW );
+
+ if ( xOldForms.is() )
{
// search (upward from our model) for xOldForms
- Reference< XChild > xSearch(GetUnoControlModel(), UNO_QUERY);
+ Reference< XChild > xSearch( GetUnoControlModel(), UNO_QUERY );
while (xSearch.is())
{
- if (xSearch == xOldForms)
+ if ( xSearch == xOldForms )
break;
- xSearch = Reference< XChild > (xSearch->getParent(), UNO_QUERY);
+ xSearch = Reference< XChild >( xSearch->getParent(), UNO_QUERY );
}
- if (xSearch.is()) // implies xSearch == xOldForms, which means we're a valid part of our current page forms hierarchy
+ if ( xSearch.is() ) // implies xSearch == xOldForms, which means we're a valid part of our current page forms hierarchy
{
- Reference< XChild > xMeAsChild(GetUnoControlModel(), UNO_QUERY);
- xNewParent = Reference< XIndexContainer > (ensureModelEnv(xMeAsChild->getParent(), Reference< XIndexContainer > (pNewFormPage->GetForms(), ::com::sun::star::uno::UNO_QUERY)), ::com::sun::star::uno::UNO_QUERY);
+ Reference< XChild > xMeAsChild( GetUnoControlModel(), UNO_QUERY );
+ xNewParent.set( ensureModelEnv( xMeAsChild->getParent(), xNewPageForms ), UNO_QUERY );
- if (xNewParent.is())
+ if ( xNewParent.is() )
{
try
{
@@ -206,11 +237,10 @@ void FmFormObj::SetPage(SdrPage* _pNewPage)
else
aNewEvents = aEvts;
}
- catch(...)
+ catch( const Exception& )
{
- DBG_ERROR("FmFormObj::SetPage : could not retrieve script events !");
+ DBG_UNHANDLED_EXCEPTION();
}
-
}
}
}
@@ -250,9 +280,9 @@ void FmFormObj::SetPage(SdrPage* _pNewPage)
xEventManager->registerScriptEvents(nPos, aNewEvents);
}
}
- catch(...)
+ catch( const Exception& )
{
- DBG_ERROR("FmFormObj::SetPage : could not tranfer script events !");
+ DBG_UNHANDLED_EXCEPTION();
}
}
@@ -528,44 +558,81 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface >
}
//------------------------------------------------------------------
-FASTBOOL FmFormObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
+FmFormObj* FmFormObj::GetFormObject( SdrObject* _pSdrObject )
+{
+ FmFormObj* pFormObject = dynamic_cast< FmFormObj* >( _pSdrObject );
+ if ( !pFormObject )
+ {
+ SdrVirtObj* pVirtualObject = dynamic_cast< SdrVirtObj* >( _pSdrObject );
+ if ( pVirtualObject )
+ pFormObject = dynamic_cast< FmFormObj* >( &pVirtualObject->ReferencedObj() );
+ }
+ return pFormObject;
+}
+
+//------------------------------------------------------------------
+const FmFormObj* FmFormObj::GetFormObject( const SdrObject* _pSdrObject )
+{
+ const FmFormObj* pFormObject = dynamic_cast< const FmFormObj* >( _pSdrObject );
+ if ( !pFormObject )
+ {
+ const SdrVirtObj* pVirtualObject = dynamic_cast< const SdrVirtObj* >( _pSdrObject );
+ if ( pVirtualObject )
+ pFormObject = dynamic_cast< const FmFormObj* >( &pVirtualObject->GetReferencedObj() );
+ }
+ return pFormObject;
+}
+
+//------------------------------------------------------------------
+FASTBOOL FmFormObj::EndCreate( SdrDragStat& rStat, SdrCreateCmd eCmd )
{
bool bResult = SdrUnoObj::EndCreate(rStat, eCmd);
- if (bResult && SDRCREATE_FORCEEND == eCmd && rStat.GetView())
+ if ( bResult && SDRCREATE_FORCEEND == eCmd && rStat.GetView() )
{
- // ist das Object teil einer Form?
- Reference< XFormComponent > xContent(xUnoControlModel, UNO_QUERY);
- if (xContent.is() && pPage)
+ if ( pPage )
{
- // Komponente gehoert noch keiner Form an
- if (!xContent->getParent().is())
+ FmFormPage& rPage = dynamic_cast< FmFormPage& >( *pPage );
+
+ try
{
- Reference< XForm > xTemp = ((FmFormPage*)pPage)->GetImpl()->placeInFormComponentHierarchy(xContent);
- Reference< XIndexContainer > xForm(xTemp, UNO_QUERY);
+ Reference< XFormComponent > xContent( xUnoControlModel, UNO_QUERY_THROW );
+ Reference< XForm > xParentForm( xContent->getParent(), UNO_QUERY );
+
+ Reference< XIndexContainer > xFormToInsertInto;
- // Position des Elements
- sal_Int32 nPos = xForm->getCount();
- xForm->insertByIndex(nPos, makeAny(xContent));
+ if ( !xParentForm.is() )
+ { // model is not yet part of a form component hierachy
+ xParentForm.set( rPage.GetImpl()->findPlaceInFormComponentHierarchy( xContent ), UNO_SET_THROW );
+ xFormToInsertInto.set( xParentForm, UNO_QUERY_THROW );
+ }
+
+ rPage.GetImpl()->setUniqueName( xContent, xParentForm );
+
+ if ( xFormToInsertInto.is() )
+ xFormToInsertInto->insertByIndex( xFormToInsertInto->getCount(), makeAny( xContent ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
}
}
- if ( m_nControlCreationEvent )
- Application::RemoveUserEvent( m_nControlCreationEvent );
-
- m_pControlCreationView = static_cast< FmFormView* >( rStat.GetView() );
- m_nControlCreationEvent = Application::PostUserEvent( LINK( this, FmFormObj, OnCreate ) );
+ FmFormView* pView( dynamic_cast< FmFormView* >( rStat.GetView() ) );
+ FmXFormView* pViewImpl = pView ? pView->GetImpl() : NULL;
+ OSL_ENSURE( pViewImpl, "FmFormObj::EndCreate: no view!?" );
+ if ( pViewImpl )
+ pViewImpl->onCreatedFormObject( *this );
}
return bResult;
}
//------------------------------------------------------------------------------
-IMPL_LINK(FmFormObj, OnCreate, void*, /*EMPTYTAG*/)
+void FmFormObj::BrkCreate( SdrDragStat& rStat )
{
- m_nControlCreationEvent = 0;
- if ( m_pControlCreationView )
- m_pControlCreationView->ObjectCreated( this );
- return 0;
+ SdrUnoObj::BrkCreate( rStat );
+ impl_isolateControlModel_nothrow();
}
+
// -----------------------------------------------------------------------------
sal_Int32 FmFormObj::getType() const
{
diff --git a/svx/source/form/fmpage.cxx b/svx/source/form/fmpage.cxx
index bbabd1193a..90edcaef8e 100644
--- a/svx/source/form/fmpage.cxx
+++ b/svx/source/form/fmpage.cxx
@@ -86,6 +86,7 @@ using namespace ::svxform;
using com::sun::star::uno::Reference;
using com::sun::star::uno::UNO_QUERY;
using com::sun::star::container::XChild;
+using com::sun::star::container::XNameContainer;
TYPEINIT1(FmFormPage, SdrPage);
@@ -131,20 +132,19 @@ void FmFormPage::SetModel(SdrModel* pNewModel)
// doesn't, so get the old model to do a check.
SdrModel *pOldModel = GetModel();
-
SdrPage::SetModel( pNewModel );
-
/* #35055# */
if ( ( pOldModel != pNewModel ) && m_pImpl )
{
try
{
- if ( m_pImpl->m_xForms.is() )
+ Reference< XNameContainer > xForms( m_pImpl->getForms( false ) );
+ if ( xForms.is() )
{
// we want to keep the current collection, just reset the model
// with which it's associated.
- Reference< XChild > xAsChild( m_pImpl->m_xForms, UNO_QUERY );
+ Reference< XChild > xAsChild( xForms, UNO_QUERY );
if ( xAsChild.is() )
{
FmFormModel* pDrawModel = (FmFormModel*) GetModel();
@@ -183,7 +183,13 @@ void FmFormPage::InsertObject(SdrObject* pObj, ULONG nPos,
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & FmFormPage::GetForms( bool _bForceCreate ) const
{
#ifndef SVX_LIGHT
- return m_pImpl->getForms( _bForceCreate );
+ const SdrPage& rMasterPage( *this );
+ const FmFormPage* pFormPage = dynamic_cast< const FmFormPage* >( &rMasterPage );
+ OSL_ENSURE( pFormPage, "FmFormPage::GetForms: referenced page is no FmFormPage - is this allowed?!" );
+ if ( !pFormPage )
+ pFormPage = this;
+
+ return pFormPage->m_pImpl->getForms( _bForceCreate );
#else
static ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > aRef;
return aRef;
@@ -195,68 +201,67 @@ sal_Bool FmFormPage::RequestHelp( Window* pWindow, SdrView* pView,
const HelpEvent& rEvt )
{
#ifndef SVX_LIGHT
- if( !pView->IsAction() )
+ if( pView->IsAction() )
+ return sal_False;
+
+ Point aPos = rEvt.GetMousePosPixel();
+ aPos = pWindow->ScreenToOutputPixel( aPos );
+ aPos = pWindow->PixelToLogic( aPos );
+
+ SdrObject* pObj = NULL;
+ SdrPageView* pPV = NULL;
+ if ( !pView->PickObj( aPos, 0, pObj, pPV, SDRSEARCH_DEEP ) )
+ return sal_False;
+
+ FmFormObj* pFormObject = FmFormObj::GetFormObject( pObj );
+ if ( !pFormObject )
+ return sal_False;
+
+ UniString aHelpText;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xSet( pFormObject->GetUnoControlModel(), ::com::sun::star::uno::UNO_QUERY );
+ if (xSet.is())
{
- Point aPos = rEvt.GetMousePosPixel();
- aPos = pWindow->ScreenToOutputPixel( aPos );
- aPos = pWindow->PixelToLogic( aPos );
+ if (::comphelper::hasProperty(FM_PROP_HELPTEXT, xSet))
+ aHelpText = ::comphelper::getString(xSet->getPropertyValue(FM_PROP_HELPTEXT)).getStr();
- SdrObject* pObj = NULL;
- SdrPageView* pPV = NULL;
- if( pView->PickObj( aPos, 0, pObj, pPV, SDRSEARCH_DEEP ) )
+ if (!aHelpText.Len() && ::comphelper::hasProperty(FM_PROP_TARGET_URL, xSet))
{
- // Ein Object getroffen
- if( pObj->ISA(FmFormObj) )
- {
- UniString aHelpText;
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xSet(((FmFormObj*)pObj)->GetUnoControlModel(), ::com::sun::star::uno::UNO_QUERY);
- if (xSet.is())
- {
- if (::comphelper::hasProperty(FM_PROP_HELPTEXT, xSet))
- aHelpText = ::comphelper::getString(xSet->getPropertyValue(FM_PROP_HELPTEXT)).getStr();
+ ::rtl::OUString aText = ::comphelper::getString(xSet->getPropertyValue(FM_PROP_TARGET_URL));
+ INetURLObject aUrl(aText);
- if (!aHelpText.Len() && ::comphelper::hasProperty(FM_PROP_TARGET_URL, xSet))
- {
- ::rtl::OUString aText = ::comphelper::getString(xSet->getPropertyValue(FM_PROP_TARGET_URL));
- INetURLObject aUrl(aText);
-
- // testen, ob es ein Protokoll-Typ ist, den ich anzeigen will
- INetProtocol aProtocol = aUrl.GetProtocol();
- static const INetProtocol s_aQuickHelpSupported[] =
- { INET_PROT_FTP, INET_PROT_HTTP, INET_PROT_FILE, INET_PROT_MAILTO, INET_PROT_NEWS,
- INET_PROT_HTTPS, INET_PROT_JAVASCRIPT, INET_PROT_IMAP, INET_PROT_POP3,
- INET_PROT_VIM, INET_PROT_LDAP
- };
- for (sal_uInt16 i=0; i<sizeof(s_aQuickHelpSupported)/sizeof(s_aQuickHelpSupported[0]); ++i)
- if (s_aQuickHelpSupported[i] == aProtocol)
- {
- aHelpText = INetURLObject::decode(aUrl.GetURLNoPass(), '%', INetURLObject::DECODE_UNAMBIGUOUS);
- break;
- }
- }
- }
- if ( aHelpText.Len() != 0 )
+ // testen, ob es ein Protokoll-Typ ist, den ich anzeigen will
+ INetProtocol aProtocol = aUrl.GetProtocol();
+ static const INetProtocol s_aQuickHelpSupported[] =
+ { INET_PROT_FTP, INET_PROT_HTTP, INET_PROT_FILE, INET_PROT_MAILTO, INET_PROT_NEWS,
+ INET_PROT_HTTPS, INET_PROT_JAVASCRIPT, INET_PROT_IMAP, INET_PROT_POP3,
+ INET_PROT_VIM, INET_PROT_LDAP
+ };
+ for (sal_uInt16 i=0; i<sizeof(s_aQuickHelpSupported)/sizeof(s_aQuickHelpSupported[0]); ++i)
+ if (s_aQuickHelpSupported[i] == aProtocol)
{
- // Hilfe anzeigen
- Rectangle aItemRect = pObj->GetCurrentBoundRect();
- aItemRect = pWindow->LogicToPixel( aItemRect );
- Point aPt = pWindow->OutputToScreenPixel( aItemRect.TopLeft() );
- aItemRect.Left() = aPt.X();
- aItemRect.Top() = aPt.Y();
- aPt = pWindow->OutputToScreenPixel( aItemRect.BottomRight() );
- aItemRect.Right() = aPt.X();
- aItemRect.Bottom() = aPt.Y();
- if( rEvt.GetMode() == HELPMODE_BALLOON )
- Help::ShowBalloon( pWindow, aItemRect.Center(), aItemRect, aHelpText);
- else
- Help::ShowQuickHelp( pWindow, aItemRect, aHelpText );
+ aHelpText = INetURLObject::decode(aUrl.GetURLNoPass(), '%', INetURLObject::DECODE_UNAMBIGUOUS);
+ break;
}
- return sal_True;
- }
}
}
+ if ( aHelpText.Len() != 0 )
+ {
+ // Hilfe anzeigen
+ Rectangle aItemRect = pObj->GetCurrentBoundRect();
+ aItemRect = pWindow->LogicToPixel( aItemRect );
+ Point aPt = pWindow->OutputToScreenPixel( aItemRect.TopLeft() );
+ aItemRect.Left() = aPt.X();
+ aItemRect.Top() = aPt.Y();
+ aPt = pWindow->OutputToScreenPixel( aItemRect.BottomRight() );
+ aItemRect.Right() = aPt.X();
+ aItemRect.Bottom() = aPt.Y();
+ if( rEvt.GetMode() == HELPMODE_BALLOON )
+ Help::ShowBalloon( pWindow, aItemRect.Center(), aItemRect, aHelpText);
+ else
+ Help::ShowQuickHelp( pWindow, aItemRect, aHelpText );
+ }
#endif
- return sal_False;
+ return sal_True;
}
//------------------------------------------------------------------
diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx
index 1350be1135..33abba6842 100644
--- a/svx/source/form/fmpgeimp.cxx
+++ b/svx/source/form/fmpgeimp.cxx
@@ -53,11 +53,10 @@
#include <svx/fmpage.hxx>
#include <svx/fmmodel.hxx>
#include <tools/resid.hxx>
+#include <tools/diagnose_ex.h>
#include "svditer.hxx"
-#ifndef _SVX_FMRESIDS_HRC
#include "fmresids.hrc"
-#endif
#include <tools/shl.hxx>
#include <vcl/stdtext.hxx>
#include <svx/dialmgr.hxx>
@@ -94,6 +93,10 @@ FmFormPageImpl::FmFormPageImpl(FmFormPage* _pPage, const FmFormPageImpl& rImpl)
{
DBG_CTOR(FmFormPageImpl,NULL);
+ OSL_ENSURE( false, "FmFormPageImpl::FmFormPageImpl: I'm pretty sure the below code isn't valid anymore ..." );
+ // streaming of form/controls is not a supported operation anymore, in that it is not guaranteed
+ // that really everything is copied. XCloneable should be used instead.
+
// copy it by streaming
// creating a pipe
Reference< ::com::sun::star::io::XOutputStream > xOutPipe(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.Pipe")), UNO_QUERY);
@@ -183,15 +186,17 @@ FmFormPageImpl::~FmFormPageImpl()
}
//------------------------------------------------------------------------------
-void FmFormPageImpl::validateCurForm()
+bool FmFormPageImpl::validateCurForm()
{
if ( !xCurrentForm.is() )
- return;
+ return false;
Reference< XChild > xAsChild( xCurrentForm, UNO_QUERY );
DBG_ASSERT( xAsChild.is(), "FmFormPageImpl::validateCurForm: a form which is no child??" );
if ( !xAsChild.is() || !xAsChild->getParent().is() )
xCurrentForm.clear();
+
+ return xCurrentForm.is();
}
//------------------------------------------------------------------------------
@@ -201,102 +206,86 @@ void FmFormPageImpl::setCurForm(Reference< ::com::sun::star::form::XForm > xFor
}
//------------------------------------------------------------------------------
-Reference< ::com::sun::star::form::XForm > FmFormPageImpl::getDefaultForm()
+Reference< XForm > FmFormPageImpl::getDefaultForm()
{
- Reference< ::com::sun::star::form::XForm > xForm;
-
- try
- {
- Reference< XNameContainer > xForms( getForms() );
+ Reference< XForm > xForm;
- validateCurForm();
+ Reference< XNameContainer > xForms( getForms() );
- // wenn noch kein TargetForm gefunden, dann aktuelle oder Default
- if (!xCurrentForm.is())
+ // by default, we use our "current form"
+ if ( !validateCurForm() )
+ {
+ // check whether there is a "standard" form
+ if ( xForms->hasElements() )
{
- if (xForms->hasElements())
- {
- // suche die Standardform
- ::rtl::OUString ustrStdFormName = ::rtl::OUString(String(SVX_RES(RID_STR_STDFORMNAME)));
+ // suche die Standardform
+ ::rtl::OUString sStandardFormname = String( SVX_RES( RID_STR_STDFORMNAME ) );
- if (xForms->hasByName(ustrStdFormName))
- {
- try
- {
- xForms->getByName(ustrStdFormName) >>= xForm;
- }
- catch(::com::sun::star::container::NoSuchElementException &)
- {
- DBG_ERROR("NoSuchElementException occured!");
- }
- catch(::com::sun::star::lang::WrappedTargetException &)
- {
- DBG_ERROR("WrappedTargetException occured!");
- }
-
- }
-
- // gibt es denn ueberhaupt eine
- if (!xForm.is())
+ try
+ {
+ if ( xForms->hasByName( sStandardFormname ) )
+ xForm.set( xForms->getByName( sStandardFormname ), UNO_QUERY_THROW );
+ else
{
- Reference< ::com::sun::star::container::XIndexAccess > xGetFirst(xForms, UNO_QUERY);
- DBG_ASSERT(xGetFirst.is(), "FmFormPageImpl::getDefaultForm : no IndexAccess on my form container !");
- // wenn das anspringt, muesste man sich die Namen des NameContainers geben lassen und dann das Objekt fuer den
- // ersten Namen erfragen ... aber normalerweise sollte die FOrms-Sammlung auch einen IndexAccess haben
- xGetFirst->getByIndex(0) >>= xForm;
+ Reference< XIndexAccess > xFormsByIndex( xForms, UNO_QUERY_THROW );
+ xForm.set( xFormsByIndex->getByIndex(0), UNO_QUERY_THROW );
}
}
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
- else
- xForm = xCurrentForm;
+ }
+ else
+ {
+ xForm = xCurrentForm;
+ }
- // keine gefunden dann standard erzeugen
- if (!xForm.is())
- {
+ // did not find an existing suitable form -> create a new one
+ if ( !xForm.is() )
+ {
+ SdrModel* pModel = pPage->GetModel();
+ XubString aStr(SVX_RES(RID_STR_FORM));
+ XubString aUndoStr(SVX_RES(RID_STR_UNDO_CONTAINER_INSERT));
+ aUndoStr.SearchAndReplace('#', aStr);
+ pModel->BegUndo(aUndoStr);
- SdrModel* pModel = pPage->GetModel();
- XubString aStr(SVX_RES(RID_STR_FORM));
- XubString aUndoStr(SVX_RES(RID_STR_UNDO_CONTAINER_INSERT));
- aUndoStr.SearchAndReplace('#', aStr);
- pModel->BegUndo(aUndoStr);
+ try
+ {
+ xForm.set( ::comphelper::getProcessServiceFactory()->createInstance( FM_SUN_COMPONENT_FORM ), UNO_QUERY );
- xForm = Reference< ::com::sun::star::form::XForm >(::comphelper::getProcessServiceFactory()->createInstance(FM_SUN_COMPONENT_FORM), UNO_QUERY);
// a form should always have the command type table as default
- Reference< ::com::sun::star::beans::XPropertySet > xSet(xForm, UNO_QUERY);
- try
- {
- xSet->setPropertyValue(FM_PROP_COMMANDTYPE, makeAny(sal_Int32(CommandType::TABLE)));
- }
- catch(Exception&)
- {
- }
-
- ::rtl::OUString aName = String(SVX_RES(RID_STR_STDFORMNAME));
- xSet->setPropertyValue(FM_PROP_NAME, makeAny(aName));
+ Reference< XPropertySet > xFormProps( xForm, UNO_QUERY_THROW );
+ xFormProps->setPropertyValue( FM_PROP_COMMANDTYPE, makeAny( sal_Int32( CommandType::TABLE ) ) );
+ // and the "Standard" name
+ ::rtl::OUString sName = String( SVX_RES( RID_STR_STDFORMNAME ) );
+ xFormProps->setPropertyValue( FM_PROP_NAME, makeAny( sName ) );
- Reference< ::com::sun::star::container::XIndexContainer > xContainer(xForms, UNO_QUERY);
+ Reference< XIndexContainer > xContainer( xForms, UNO_QUERY );
pModel->AddUndo(new FmUndoContainerAction(*(FmFormModel*)pModel,
FmUndoContainerAction::Inserted,
xContainer,
xForm,
xContainer->getCount()));
- xForms->insertByName(aName, makeAny(xForm));
+ xForms->insertByName( sName, makeAny( xForm ) );
xCurrentForm = xForm;
- pModel->EndUndo();
}
- }
- catch( const Exception& )
- {
- DBG_ERROR( "FmFormPageImpl::getDefaultForm: caught an exception!" );
- xForm.clear();
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ xForm.clear();
+ }
+
+ pModel->EndUndo();
}
return xForm;
}
//------------------------------------------------------------------------------
-Reference< ::com::sun::star::form::XForm > FmFormPageImpl::placeInFormComponentHierarchy(
+Reference< ::com::sun::star::form::XForm > FmFormPageImpl::findPlaceInFormComponentHierarchy(
const Reference< XFormComponent > & rContent, const Reference< XDataSource > & rDatabase,
const ::rtl::OUString& rDBTitle, const ::rtl::OUString& rCursorSource, sal_Int32 nCommandType )
{
@@ -317,7 +306,7 @@ Reference< ::com::sun::star::form::XForm > FmFormPageImpl::placeInFormComponent
xForm = findFormForDataSource( xCurrentForm, rDatabase, rCursorSource, nCommandType );
Reference< ::com::sun::star::container::XIndexAccess > xFormsByIndex( getForms(), UNO_QUERY );
- DBG_ASSERT(xFormsByIndex.is(), "FmFormPageImpl::placeInFormComponentHierarchy : no index access for my forms collection !");
+ DBG_ASSERT(xFormsByIndex.is(), "FmFormPageImpl::findPlaceInFormComponentHierarchy : no index access for my forms collection !");
sal_Int32 nCount = xFormsByIndex->getCount();
for (sal_Int32 i = 0; !xForm.is() && i < nCount; i++)
{
@@ -381,8 +370,6 @@ Reference< ::com::sun::star::form::XForm > FmFormPageImpl::placeInFormComponent
}
xForm = getDefaultForm();
- // eindeutigen Namen fuer die Componente setzen
- setUniqueName(rContent, xForm);
return xForm;
}
@@ -469,7 +456,7 @@ Reference< XForm > FmFormPageImpl::findFormForDataSource(
}
//------------------------------------------------------------------------------
-::rtl::OUString FmFormPageImpl::setUniqueName(const Reference< ::com::sun::star::form::XFormComponent > & xFormComponent, const Reference< ::com::sun::star::form::XForm > & xControls)
+::rtl::OUString FmFormPageImpl::setUniqueName(const Reference< XFormComponent > & xFormComponent, const Reference< XForm > & xControls)
{
::rtl::OUString sName;
Reference< ::com::sun::star::beans::XPropertySet > xSet(xFormComponent, UNO_QUERY);
@@ -492,31 +479,6 @@ Reference< XForm > FmFormPageImpl::findFormForDataSource(
xSet->setPropertyValue(FM_PROP_NAME, makeAny(sDefaultName));
}
- //////////////////////////////////////////////////////////////
- // Labels anpassen
- UniString aLabel = sDefaultName;
- sal_uInt16 nResId = 0;
-
- switch (nClassId)
- {
- case ::com::sun::star::form::FormComponentType::COMMANDBUTTON: nResId = RID_STR_PROPTITLE_PUSHBUTTON; break;
- case ::com::sun::star::form::FormComponentType::RADIOBUTTON: nResId = RID_STR_PROPTITLE_RADIOBUTTON; break;
- case ::com::sun::star::form::FormComponentType::CHECKBOX: nResId = RID_STR_PROPTITLE_CHECKBOX; break;
- case ::com::sun::star::form::FormComponentType::GROUPBOX: nResId = RID_STR_PROPTITLE_GROUPBOX; break;
- case ::com::sun::star::form::FormComponentType::FIXEDTEXT: nResId = RID_STR_PROPTITLE_FIXEDTEXT; break;
- }
-
- if (nResId)
- {
- ::rtl::OUString aText;
- xSet->getPropertyValue( FM_PROP_LABEL ) >>= aText;
- if (!aText.getLength())
- {
- aLabel.SearchAndReplace( getDefaultName( nClassId, xSI ), ::rtl::OUString(String(SVX_RES(nResId)) ));
- xSet->setPropertyValue( FM_PROP_LABEL, makeAny(::rtl::OUString(aLabel)) );
- }
- }
-
sName = sDefaultName;
}
}
diff --git a/svx/source/form/fmprop.cxx b/svx/source/form/fmprop.cxx
index ac79ed0f17..641d7d75ab 100644
--- a/svx/source/form/fmprop.cxx
+++ b/svx/source/form/fmprop.cxx
@@ -186,6 +186,7 @@ namespace svxform
IMPLEMENT_CONSTASCII_USTRING( FM_PROP_BUTTON_TYPE, "ButtonType" );
IMPLEMENT_CONSTASCII_USTRING( FM_PROP_FORM_OPERATIONS, "FormOperations" );
+ IMPLEMENT_CONSTASCII_USTRING( FM_PROP_INPUT_REQUIRED, "InputRequired" );
} // namespace svxform
diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx
index 4a39326f8b..f3eec787b9 100644
--- a/svx/source/form/fmshell.cxx
+++ b/svx/source/form/fmshell.cxx
@@ -187,95 +187,6 @@ using namespace ::com::sun::star::frame;
using namespace ::svxform;
//========================================================================
-//------------------------------------------------------------------------
-sal_Bool IsFormComponent( const SdrObject& rObj )
-{
- //////////////////////////////////////////////////////////////////////
- // Gruppenobjekte rekursiv pruefen
- if( rObj.IsGroupObject() )
- {
- SdrObject* pObj;
- SdrObjListIter aIter( *rObj.GetSubList() );
-
- while( aIter.IsMore() )
- {
- pObj = aIter.Next();
-
- if( !IsFormComponent(*pObj) )
- return sal_False;
- }
- }
-
- //////////////////////////////////////////////////////////////////
- // ...ansonsten Pruefen, ob SdrObj eine FormComponent ist
- else
- {
- if( !rObj.ISA(SdrUnoObj) )
- return sal_False;
-
- Reference< ::com::sun::star::form::XFormComponent > xFormComponent(((SdrUnoObj*)&rObj)->GetUnoControlModel(), UNO_QUERY);
- if (!xFormComponent.is())
- return sal_False;
- }
-
- return sal_True;
-}
-
-//------------------------------------------------------------------------
-sal_Bool IsFormComponentList( const SdrMarkList& rMarkList )
-{
- sal_uInt32 nMarkCount = rMarkList.GetMarkCount();
-
- if( nMarkCount==0 )
- return sal_False;
-
- SdrObject* pObj;
- for( sal_uInt32 i=0; i<nMarkCount; ++i )
- {
- pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
- if( !IsFormComponent(*pObj) )
- return sal_False;
- }
-
- return sal_True;
-}
-
-//------------------------------------------------------------------------
-sal_Bool IsFormComponentList( const SdrObjList& rSdrObjList )
-{
- SdrObject* pSdrObj;
-
-
- SdrObjListIter aIter( rSdrObjList );
- while( aIter.IsMore() )
- {
- pSdrObj = aIter.Next();
-
- //////////////////////////////////////////////////////////////////
- // Gruppenobjekte rekursiv pruefen
- if( pSdrObj->IsGroupObject() )
- {
- if( !IsFormComponentList(*pSdrObj->GetSubList()) )
- return sal_False;
- }
-
- //////////////////////////////////////////////////////////////////
- // ...ansonsten Pruefen, ob SdrObj eine FormComponent ist
- else
- {
- if (!pSdrObj->ISA(SdrUnoObj))
- return sal_False;
-
- Reference< ::com::sun::star::form::XFormComponent > xFormComponent(((SdrUnoObj*)pSdrObj)->GetUnoControlModel(), UNO_QUERY);
- if (!xFormComponent.is())
- return sal_False;
- }
- }
-
- return sal_True;
-}
-
-//========================================================================
// class FmDesignModeChangedHint
//========================================================================
TYPEINIT1( FmDesignModeChangedHint, SfxHint );
@@ -1029,7 +940,7 @@ void FmFormShell::GetState(SfxItemSet &rSet)
sal_Bool bLayerLocked = sal_False;
if (m_pFormView)
{
- // Ist der ::com::sun::star::drawing::Layer gelocked, so m�ssen die Slots disabled werden. #36897
+ // Ist der ::com::sun::star::drawing::Layer gelocked, so m???ssen die Slots disabled werden. #36897
SdrPageView* pPV = m_pFormView->GetSdrPageView();
if (pPV != NULL)
bLayerLocked = pPV->IsLayerLocked(m_pFormView->GetActiveLayer());
@@ -1326,7 +1237,7 @@ void FmFormShell::SetView( FmFormView* _pView )
if ( IsActive() )
GetImpl()->viewDeactivated( *m_pFormView );
- m_pFormView->SetFormShell( NULL );
+ m_pFormView->SetFormShell( NULL, FmFormView::FormShellAccess() );
m_pFormView = NULL;
m_pFormModel = NULL;
}
@@ -1335,7 +1246,7 @@ void FmFormShell::SetView( FmFormView* _pView )
return;
m_pFormView = _pView;
- m_pFormView->SetFormShell( this );
+ m_pFormView->SetFormShell( this, FmFormView::FormShellAccess() );
m_pFormModel = (FmFormModel*)m_pFormView->GetModel();
impl_setDesignMode( m_pFormView->IsDesignMode() );
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index afb4f7e3aa..b9abd0b2db 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -306,7 +306,8 @@ namespace
while ( pCurrent )
{
- FmFormObj* pAsFormObject = PTR_CAST( FmFormObj, pCurrent );
+ FmFormObj* pAsFormObject = FmFormObj::GetFormObject( pCurrent );
+ // note this will de-reference virtual objects, if necessary/possible
if ( pAsFormObject )
{
Reference< XInterface > xControlModel( pAsFormObject->GetUnoControlModel(), UNO_QUERY );
@@ -745,11 +746,9 @@ void SAL_CALL FmXFormShell::formActivated(const EventObject& rEvent) throw( Runt
if ( impl_checkDisposed() )
return;
- Reference< XFormController > xController( rEvent.Source, UNO_QUERY );
- OSL_ENSURE( xController.is(), "FmXFormShell::formActivated: invalid event source!" );
-
- setActiveController( xController );
+ Reference< XFormController > xController( rEvent.Source, UNO_QUERY_THROW );
m_pTextShell->formActivated( xController );
+ setActiveController( xController );
}
//------------------------------------------------------------------------------
@@ -758,9 +757,7 @@ void SAL_CALL FmXFormShell::formDeactivated(const EventObject& rEvent) throw( Ru
if ( impl_checkDisposed() )
return;
- Reference< XFormController > xController( rEvent.Source, UNO_QUERY );
- OSL_ENSURE( xController.is(), "FmXFormShell::formDeactivated: invalid event source!" );
-
+ Reference< XFormController > xController( rEvent.Source, UNO_QUERY_THROW );
m_pTextShell->formDeactivated( xController );
}
@@ -828,12 +825,15 @@ void FmXFormShell::disposing()
DisableNotification();
- // we are disposed from within the destructor of our shell, so now the shell pointer is invalid ....
- m_pShell = NULL;
+ RemoveElement( m_xForms );
+ m_xForms.clear();
+
+ impl_switchActiveControllerListening( false );
m_xActiveController = NULL;
- m_xNavigationController = NULL;
m_xActiveForm = NULL;
- m_xForms = NULL;
+
+ m_pShell = NULL;
+ m_xNavigationController = NULL;
m_xCurrentForm = NULL;
m_xLastGridFound = NULL;
m_xAttachedFrame = NULL;
@@ -1005,6 +1005,12 @@ bool FmXFormShell::executeControlConversionSlot( const Reference< XFormComponent
if ( !_rxObject.is() )
return false;
+ SdrPage* pPage = m_pShell->GetCurPage();
+ FmFormPage* pFormPage = pPage ? dynamic_cast< FmFormPage* >( pPage ) : NULL;
+ OSL_ENSURE( pFormPage, "FmXFormShell::executeControlConversionSlot: no current (form) page!" );
+ if ( !pFormPage )
+ return false;
+
OSL_ENSURE( isSolelySelected( _rxObject ),
"FmXFormShell::executeControlConversionSlot: hmm ... shouldn't this parameter be redundant?" );
@@ -1012,46 +1018,25 @@ bool FmXFormShell::executeControlConversionSlot( const Reference< XFormComponent
{
if (nConvertSlots[lookupSlot] == _nSlotId)
{
- FmFormPage* pCurrentPage = m_pShell->GetCurPage();
+ Reference< XInterface > xNormalizedObject( _rxObject, UNO_QUERY );
- SdrUnoObj* pFound = NULL;
- for (sal_uInt32 obj=0; obj<pCurrentPage->GetObjCount(); ++obj)
+ FmFormObj* pFormObject = NULL;
+ SdrObjListIter aPageIter( *pFormPage );
+ while ( aPageIter.IsMore() )
{
- SdrObject* pCurrent = pCurrentPage->GetObj(obj);
-
- // wenn das Ding eine Gruppierung ist -> durchiterieren
- SdrObjListIter* pGroupIterator = NULL;
- if (pCurrent->IsGroupObject())
- {
- pGroupIterator = new SdrObjListIter(*pCurrent->GetSubList());
- pCurrent = pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL;
- }
-
- Reference< XInterface > xNormalizedObject( _rxObject, UNO_QUERY );
- while (pCurrent)
- {
- if (pCurrent->IsUnoObj())
- {
- Reference< XInterface > xCurrentNormalized( static_cast< SdrUnoObj* >( pCurrent )->GetUnoControlModel(), UNO_QUERY );
- if ( xCurrentNormalized == xNormalizedObject )
- break;
- }
-
- if (pGroupIterator) // ich iteriere gerade durch eine Gruppe von Controls
- pCurrent = pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL;
- else
- pCurrent = NULL;
- }
- delete pGroupIterator;
+ SdrObject* pCurrent = aPageIter.Next();
+ pFormObject = FmFormObj::GetFormObject( pCurrent );
+ if ( !pFormObject )
+ continue;
- if (pCurrent)
- {
- pFound = (SdrUnoObj*)pCurrent;
+ Reference< XInterface > xCurrentNormalized( pFormObject->GetUnoControlModel(), UNO_QUERY );
+ if ( xCurrentNormalized.get() == xNormalizedObject.get() )
break;
- }
+
+ pFormObject = NULL;
}
- if (!pFound)
+ if ( !pFormObject )
return false;
::rtl::OUString sNewName( getServiceNameByControlType( nObjectTypes[ lookupSlot ] ) );
@@ -1059,7 +1044,7 @@ bool FmXFormShell::executeControlConversionSlot( const Reference< XFormComponent
if (!xNewModel.is())
return false;
- Reference< XControlModel> xOldModel(pFound->GetUnoControlModel());
+ Reference< XControlModel> xOldModel( pFormObject->GetUnoControlModel() );
Reference< XServiceInfo> xModelInfo(xOldModel, UNO_QUERY);
// Properties uebertragen
@@ -1135,8 +1120,8 @@ bool FmXFormShell::executeControlConversionSlot( const Reference< XFormComponent
}
// neues Model setzen
- pFound->SetChanged();
- pFound->SetUnoControlModel(xNewModel);
+ pFormObject->SetChanged();
+ pFormObject->SetUnoControlModel(xNewModel);
// transfer script events
// (do this _after_ SetUnoControlModel as we need the new (implicitly created) control)
@@ -1198,7 +1183,7 @@ bool FmXFormShell::executeControlConversionSlot( const Reference< XFormComponent
FmFormModel* pModel = m_pShell->GetFormModel();
DBG_ASSERT(pModel != NULL, "FmXFormShell::executeControlConversionSlot: my shell has no model !");
if (pModel)
- pModel->AddUndo(new FmUndoModelReplaceAction(*pModel, pFound, xOldModel));
+ pModel->AddUndo(new FmUndoModelReplaceAction(*pModel, pFormObject, xOldModel));
return true;
}
@@ -1757,6 +1742,19 @@ void FmXFormShell::ExecuteFormSlot( sal_Int32 _nSlot )
}
//------------------------------------------------------------------------------
+void FmXFormShell::impl_switchActiveControllerListening( const bool _bListen )
+{
+ Reference< XComponent> xComp( m_xActiveController, UNO_QUERY );
+ if ( !xComp.is() )
+ return;
+
+ if ( _bListen )
+ xComp->addEventListener( (XFormControllerListener*)this );
+ else
+ xComp->removeEventListener( (XFormControllerListener*)this );
+}
+
+//------------------------------------------------------------------------------
void FmXFormShell::setActiveController( const Reference< XFormController>& xController, sal_Bool _bNoSaveOldContent )
{
if ( impl_checkDisposed() )
@@ -1811,7 +1809,7 @@ void FmXFormShell::setActiveController( const Reference< XFormController>& xCont
{
m_bSetFocus = sal_True;
if ( m_aActiveControllerFeatures->isModifiedRow() )
- {
+ {
sal_Bool bIsNew = m_aActiveControllerFeatures->isInsertionRow();
sal_Bool bResult = m_aActiveControllerFeatures->commitCurrentRecord();
if ( !bResult && m_bSetFocus )
@@ -1820,7 +1818,7 @@ void FmXFormShell::setActiveController( const Reference< XFormController>& xCont
// current control
Reference< XWindow > xWindow( m_xActiveController->getCurrentControl(), UNO_QUERY );
if ( xWindow.is() )
- xWindow->setFocus();
+ xWindow->setFocus();
m_bInActivate = sal_False;
return;
}
@@ -1838,20 +1836,17 @@ void FmXFormShell::setActiveController( const Reference< XFormController>& xCont
stopListening();
+ impl_switchActiveControllerListening( false );
+
m_aActiveControllerFeatures.dispose();
m_xActiveController = xController;
if ( m_xActiveController.is() )
m_aActiveControllerFeatures.assign( m_xActiveController );
- if ( m_xActiveController.is() )
- {
- // set eventlistener to know when it is disposed
- Reference< ::com::sun::star::lang::XComponent> xComp(m_xActiveController, UNO_QUERY);
- if (xComp.is())
- xComp->addEventListener((XEventListener*)(XPropertyChangeListener*)this);
+ impl_switchActiveControllerListening( true );
- m_xActiveForm = getInternalForm(Reference< XForm>(m_xActiveController->getModel(), UNO_QUERY));
- }
+ if ( m_xActiveController.is() )
+ m_xActiveForm = getInternalForm( Reference< XForm >( m_xActiveController->getModel(), UNO_QUERY ) );
else
m_xActiveForm = NULL;
@@ -2172,9 +2167,9 @@ IMPL_LINK(FmXFormShell, OnFoundData, FmFoundRecordInformation*, pfriWhere)
m_pShell->GetFormView()->UnMarkAll(m_pShell->GetFormView()->GetSdrPageView());
m_pShell->GetFormView()->MarkObj(pObject, m_pShell->GetFormView()->GetSdrPageView());
- DBG_ASSERT(pObject->IsUnoObj(), "FmXFormShell::OnFoundData : ungueltiges Control !");
- Reference< XControlModel> xControlModel( ((SdrUnoObj*)pObject)->GetUnoControlModel());
- DBG_ASSERT(xControlModel.is(), "FmXFormShell::OnFoundData : ungueltiges Control !");
+ FmFormObj* pFormObject = FmFormObj::GetFormObject( pObject );
+ Reference< XControlModel > xControlModel( pFormObject ? pFormObject->GetUnoControlModel() : Reference< XControlModel >() );
+ DBG_ASSERT( xControlModel.is(), "FmXFormShell::OnFoundData: invalid control!" );
// disable the permanent cursor for the last grid we found a record
if (m_xLastGridFound.is() && (m_xLastGridFound != xControlModel))
@@ -2287,157 +2282,131 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest, FmSearchContext*, pfmscContextIn
FmFormPage* pCurrentPage = m_pShell->GetCurPage();
DBG_ASSERT(pCurrentPage!=NULL, "FmXFormShell::OnSearchContextRequest : no page !");
// alle Sdr-Controls dieser Seite durchsuchen ...
- ::rtl::OUString sControlSource, sCompareString,aName;
- for (sal_Int32 i=0; i<(sal_Int32)pCurrentPage->GetObjCount(); ++i)
+ ::rtl::OUString sControlSource, aName;
+
+ SdrObjListIter aPageIter( *pCurrentPage );
+ while ( aPageIter.IsMore() )
{
- SdrObject* pCurrent = pCurrentPage->GetObj(i);
+ SdrObject* pCurrent = aPageIter.Next();
+ FmFormObj* pFormObject = FmFormObj::GetFormObject( pCurrent );
+ // note that in case pCurrent is a virtual object, pFormObject points to the referenced object
- // wenn das Ding eine Gruppierung ist -> durchiterieren
- SdrObjListIter* pGroupIterator = NULL;
- if (pCurrent->IsGroupObject())
- {
- pGroupIterator = new SdrObjListIter(*pCurrent->GetSubList());
- pCurrent = pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL;
- }
+ if ( !pFormObject )
+ continue;
- while (pCurrent)
- {
- if (pCurrent->IsUnoObj())
- {
- // das Model zum aktuellen Object ...
- Reference< XControlModel> xControlModel( ((SdrUnoObj*)pCurrent)->GetUnoControlModel());
- DBG_ASSERT(xControlModel.is(), "FmXFormShell::OnSearchContextRequest : invalid objects !");
- // ... als FormComponent
- Reference< XFormComponent> xCurrentAsFormComponent(xControlModel, UNO_QUERY);
- if (!xCurrentAsFormComponent.is())
- {
- if (pGroupIterator) // ich iteriere gerade durch eine Gruppe von Controls
- pCurrent = pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL;
- else
- pCurrent = NULL;
- continue;
- }
+ // the current object's model, in different tastes
+ Reference< XControlModel> xControlModel( pFormObject->GetUnoControlModel() );
+ Reference< XFormComponent > xCurrentFormComponent( xControlModel, UNO_QUERY );
+ DBG_ASSERT( xCurrentFormComponent.is(), "FmXFormShell::OnSearchContextRequest: invalid objects!" );
+ if ( !xCurrentFormComponent.is() )
+ continue;
- // gehoert diese FormComponent ueberhaupt zu der Form, um die es geht ?
- Reference< XInterface> xParentOfCurrent( xCurrentAsFormComponent->getParent());
- if (xParentOfCurrent != xForm) // vergleich fuehrt zu richtigem Ergebnis, seit TF_ONE
- {
- if (pGroupIterator) // ich iteriere gerade durch eine Gruppe von Controls
- pCurrent = pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL;
- else
- pCurrent = NULL;
- continue;
- }
+ // does the component belong to the form which we're interested in?
+ if ( xCurrentFormComponent->getParent() != xForm )
+ continue;
- // ... nach der ControlSource-Eigenschaft fragen
- SearchableControlIterator iter(xCurrentAsFormComponent);
- Reference< XControl> xControlBehindModel;
- // das Control, das als Model xControlModel hat
- // (das folgende while kann mehrmals durchlaufen werden, ohne dass das Control sich aendert, dann muss
- // ich nicht jedesmal neu suchen)
+ // ... nach der ControlSource-Eigenschaft fragen
+ SearchableControlIterator iter( xCurrentFormComponent );
+ Reference< XControl> xControlBehindModel;
+ // das Control, das als Model xControlModel hat
+ // (das folgende while kann mehrmals durchlaufen werden, ohne dass das Control sich aendert, dann muss
+ // ich nicht jedesmal neu suchen)
- Reference< XInterface> xCurrent( iter.Next());
- while (xCurrent.is())
+ Reference< XInterface > xSearchable( iter.Next() );
+ while ( xSearchable.is() )
+ {
+ sControlSource = iter.getCurrentValue();
+ if ( sControlSource.getLength() == 0 )
+ { // das aktuelle Element hat keine ControlSource, also ist es ein GridControl (das ist das einzige, was
+ // der SearchableControlIterator noch zulaesst)
+ xControlBehindModel = GetControlFromModel(xControlModel);
+ DBG_ASSERT(xControlBehindModel.is(), "FmXFormShell::OnSearchContextRequest : didn't ::std::find a control with requested model !");
+
+ Reference< XGridPeer> xGridPeer(xControlBehindModel->getPeer(), UNO_QUERY);
+ do
{
- sControlSource = iter.getCurrentValue();
- if (sControlSource == sCompareString)
- { // das aktuelle Element hat keine ControlSource, also ist es ein GridControl (das ist das einzige, was
- // der SearchableControlIterator noch zulaesst)
- xControlBehindModel = GetControlFromModel(xControlModel);
- DBG_ASSERT(xControlBehindModel.is(), "FmXFormShell::OnSearchContextRequest : didn't ::std::find a control with requested model !");
+ if (!xGridPeer.is())
+ break;
+
+ Reference< XIndexAccess> xPeerContainer(xGridPeer, UNO_QUERY);
+ if (!xPeerContainer.is())
+ break;
+
+ Reference< XIndexAccess> xModelColumns(xGridPeer->getColumns(), UNO_QUERY);
+ DBG_ASSERT(xModelColumns.is(), "FmXFormShell::OnSearchContextRequest : there is a grid control without columns !");
+ // the case 'no columns' should be indicated with an empty container, I think ...
+ DBG_ASSERT(xModelColumns->getCount() >= xPeerContainer->getCount(), "FmXFormShell::OnSearchContextRequest : impossible : have more view than model columns !");
- Reference< XGridPeer> xGridPeer(xControlBehindModel->getPeer(), UNO_QUERY);
- do
+ Reference< XInterface> xCurrentColumn;
+ for (sal_Int16 nViewPos=0; nViewPos<xPeerContainer->getCount(); ++nViewPos)
+ {
+ xPeerContainer->getByIndex(nViewPos) >>= xCurrentColumn;
+ if (!xCurrentColumn.is())
+ continue;
+
+ // can we use this column control fo searching ?
+ if (!IsSearchableControl(xCurrentColumn))
+ continue;
+
+ sal_Int16 nModelPos = GridView2ModelPos(xModelColumns, nViewPos);
+ Reference< XPropertySet> xCurrentColModel;
+ xModelColumns->getByIndex(nModelPos) >>= xCurrentColModel;
+ aName = ::comphelper::getString(xCurrentColModel->getPropertyValue(FM_PROP_CONTROLSOURCE));
+ // the cursor has a field matching the control source ?
+ if (xValidFormFields->hasByName(aName))
{
- if (!xGridPeer.is())
- break;
+ strFieldList += aName.getStr();
+ strFieldList += ';';
- Reference< XIndexAccess> xPeerContainer(xGridPeer, UNO_QUERY);
- if (!xPeerContainer.is())
- break;
+ sFieldDisplayNames += ::comphelper::getString(xCurrentColModel->getPropertyValue(FM_PROP_LABEL)).getStr();
+ sFieldDisplayNames += ';';
- Reference< XIndexAccess> xModelColumns(xGridPeer->getColumns(), UNO_QUERY);
- DBG_ASSERT(xModelColumns.is(), "FmXFormShell::OnSearchContextRequest : there is a grid control without columns !");
- // the case 'no columns' should be indicated with an empty container, I think ...
- DBG_ASSERT(xModelColumns->getCount() >= xPeerContainer->getCount(), "FmXFormShell::OnSearchContextRequest : impossible : have more view than model columns !");
+ pfmscContextInfo->arrFields.push_back(xCurrentColumn);
- Reference< XInterface> xCurrentColumn;
- for (sal_Int16 nViewPos=0; nViewPos<xPeerContainer->getCount(); ++nViewPos)
- {
- xPeerContainer->getByIndex(nViewPos) >>= xCurrentColumn;
- if (!xCurrentColumn.is())
- continue;
-
- // can we use this column control fo searching ?
- if (!IsSearchableControl(xCurrentColumn))
- continue;
-
- sal_Int16 nModelPos = GridView2ModelPos(xModelColumns, nViewPos);
- Reference< XPropertySet> xCurrentColModel;
- xModelColumns->getByIndex(nModelPos) >>= xCurrentColModel;
- aName = ::comphelper::getString(xCurrentColModel->getPropertyValue(FM_PROP_CONTROLSOURCE));
- // the cursor has a field matching the control source ?
- if (xValidFormFields->hasByName(aName))
- {
- strFieldList += aName.getStr();
- strFieldList += ';';
-
- sFieldDisplayNames += ::comphelper::getString(xCurrentColModel->getPropertyValue(FM_PROP_LABEL)).getStr();
- sFieldDisplayNames += ';';
-
- pfmscContextInfo->arrFields.push_back(xCurrentColumn);
-
- // und das SdrObjekt zum Feld
- m_arrSearchedControls.C40_INSERT(SdrObject, pCurrent, m_arrSearchedControls.Count());
- // die Nummer der Spalte
- m_arrRelativeGridColumn.Insert(nViewPos, m_arrRelativeGridColumn.Count());
- }
- }
- } while (sal_False);
+ // und das SdrObjekt zum Feld
+ m_arrSearchedControls.C40_INSERT(SdrObject, pCurrent, m_arrSearchedControls.Count());
+ // die Nummer der Spalte
+ m_arrRelativeGridColumn.Insert(nViewPos, m_arrRelativeGridColumn.Count());
+ }
}
- else
+ } while (sal_False);
+ }
+ else
+ {
+ if (sControlSource.getLength() && xValidFormFields->hasByName(sControlSource))
+ {
+ // jetzt brauche ich das Control zum SdrObject
+ if (!xControlBehindModel.is())
{
- if (sControlSource.getLength() && xValidFormFields->hasByName(sControlSource))
- {
- // jetzt brauche ich das Control zum SdrObject
- if (!xControlBehindModel.is())
- {
- xControlBehindModel = GetControlFromModel(xControlModel);
- DBG_ASSERT(xControlBehindModel.is(), "FmXFormShell::OnSearchContextRequest : didn't ::std::find a control with requested model !");
- }
+ xControlBehindModel = GetControlFromModel(xControlModel);
+ DBG_ASSERT(xControlBehindModel.is(), "FmXFormShell::OnSearchContextRequest : didn't ::std::find a control with requested model !");
+ }
- if (IsSearchableControl(xControlBehindModel))
- { // alle Tests ueberstanden -> in die Liste mit aufnehmen
- strFieldList += sControlSource.getStr();
- strFieldList += ';';
+ if (IsSearchableControl(xControlBehindModel))
+ { // alle Tests ueberstanden -> in die Liste mit aufnehmen
+ strFieldList += sControlSource.getStr();
+ strFieldList += ';';
- // the label which should appear for the control :
- sFieldDisplayNames += getLabelName(Reference< XPropertySet>(xControlModel, UNO_QUERY)).getStr();
- sFieldDisplayNames += ';';
+ // the label which should appear for the control :
+ sFieldDisplayNames += getLabelName(Reference< XPropertySet>(xControlModel, UNO_QUERY)).getStr();
+ sFieldDisplayNames += ';';
- // das SdrObjekt merken (beschleunigt die Behandlung in OnFoundData)
- m_arrSearchedControls.C40_INSERT(SdrObject, pCurrent, m_arrSearchedControls.Count());
+ // das SdrObjekt merken (beschleunigt die Behandlung in OnFoundData)
+ m_arrSearchedControls.C40_INSERT(SdrObject, pCurrent, m_arrSearchedControls.Count());
- // die Nummer der Spalte (hier ein Dummy, nur fuer GridControls interesant)
- m_arrRelativeGridColumn.Insert(-1, m_arrRelativeGridColumn.Count());
+ // die Nummer der Spalte (hier ein Dummy, nur fuer GridControls interesant)
+ m_arrRelativeGridColumn.Insert(-1, m_arrRelativeGridColumn.Count());
- // und fuer die formatierte Suche ...
- pfmscContextInfo->arrFields.push_back(Reference< XInterface>(xControlBehindModel, UNO_QUERY));
- }
- }
+ // und fuer die formatierte Suche ...
+ pfmscContextInfo->arrFields.push_back(Reference< XInterface>(xControlBehindModel, UNO_QUERY));
}
-
- xCurrent = iter.Next();
}
}
- if (pGroupIterator) // ich iteriere gerade durch eine Gruppe von Controls
- pCurrent = pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL;
- else
- pCurrent = NULL;
+ xSearchable = iter.Next();
}
- delete pGroupIterator;
}
+
strFieldList.EraseTrailingChars(';');
sFieldDisplayNames.EraseTrailingChars(';');
diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx
index 8859141bb2..837ee60102 100644
--- a/svx/source/form/fmtextcontrolshell.cxx
+++ b/svx/source/form/fmtextcontrolshell.cxx
@@ -30,8 +30,20 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
-#include "fmtextcontrolshell.hxx"
+
+#include "fmprop.hrc"
+#include "fmresids.hrc"
+#include "fmtextcontroldialogs.hxx"
#include "fmtextcontrolfeature.hxx"
+#include "fmtextcontrolshell.hxx"
+#include "svx/crsditem.hxx"
+#include "svx/dialmgr.hxx"
+#include "svx/editeng.hxx"
+#include "svx/eeitem.hxx"
+#include "svx/fmglob.hxx"
+#include "svx/scriptspaceitem.hxx"
+#include "svx/svxids.hrc"
+#include "svx/udlnitem.hxx"
/** === begin UNO includes === **/
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -42,48 +54,28 @@
#include <com/sun/star/awt/XFocusListener.hpp>
#include <com/sun/star/awt/XMouseListener.hpp>
/** === end UNO includes === **/
-#include <sfx2/request.hxx>
+
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/processfactory.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <sfx2/app.hxx>
#include <sfx2/bindings.hxx>
-#include <sfx2/msgpool.hxx>
#include <sfx2/dispatch.hxx>
-#include <sfx2/sfxuno.hxx>
-#include <sfx2/viewfrm.hxx>
+#include <sfx2/msgpool.hxx>
#include <sfx2/objsh.hxx>
+#include <sfx2/request.hxx>
#include <sfx2/sfxuno.hxx>
-
-#include <sfx2/app.hxx>
-#include <vcl/outdev.hxx>
-#include <vcl/msgbox.hxx>
-#include <svtools/languageoptions.hxx>
-#include <svtools/intitem.hxx>
-#include <svtools/whiter.hxx>
+#include <sfx2/viewfrm.hxx>
#include <svtools/eitem.hxx>
+#include <svtools/intitem.hxx>
#include <svtools/itempool.hxx>
+#include <svtools/languageoptions.hxx>
#include <svtools/stringtransfer.hxx>
+#include <svtools/whiter.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/diagnose_ex.h>
-#include <comphelper/componentcontext.hxx>
-#include <comphelper/processfactory.hxx>
-#include <cppuhelper/implbase1.hxx>
-
-#ifndef _SVX_SVXIDS_HRC
-#include <svx/svxids.hrc>
-#endif
-#include <svx/fmglob.hxx>
-#include <svx/dialmgr.hxx>
-#ifndef _SVX_FMRESIDS_HRC
-#include "fmresids.hrc"
-#endif
-#include <svx/editeng.hxx>
-#include <svx/eeitem.hxx>
-#ifndef _SVX_FMPROP_HRC
-#include "fmprop.hrc"
-#endif
-#include "fmtextcontroldialogs.hxx"
-#include <svx/scriptspaceitem.hxx>
-
-#include <svx/udlnitem.hxx>
-#include <svx/crsditem.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/outdev.hxx>
#include <vos/mutex.hxx>
#include <memory>
@@ -227,7 +219,7 @@ namespace svx
}
catch( const Exception& )
{
- DBG_ERROR( "FmFocusListenerAdapter::FmFocusListenerAdapter: caught an exception!" );
+ DBG_UNHANDLED_EXCEPTION();
}
}
osl_decrementInterlockedCount( &m_refCount );
@@ -324,7 +316,7 @@ namespace svx
}
catch( const Exception& )
{
- DBG_ERROR( "FmMouseListenerAdapter::FmMouseListenerAdapter: caught an exception!" );
+ DBG_UNHANDLED_EXCEPTION();
}
}
osl_decrementInterlockedCount( &m_refCount );
@@ -517,7 +509,7 @@ namespace svx
}
catch( const Exception& )
{
- OSL_ENSURE( sal_False, "lcl_determineReadOnly: caught an exception!" );
+ DBG_UNHANDLED_EXCEPTION();
}
return bIsReadOnlyModel;
}
@@ -536,7 +528,7 @@ namespace svx
}
catch( const Exception& )
{
- OSL_ENSURE( sal_False, "lcl_getWindow: caught an exception!" );
+ DBG_UNHANDLED_EXCEPTION();
}
return pWindow;
@@ -563,7 +555,7 @@ namespace svx
}
catch( const Exception& )
{
- OSL_ENSURE( sal_False, "lcl_isRichText: caught an exception!" );
+ DBG_UNHANDLED_EXCEPTION();
}
return bIsRichText;
}
@@ -797,7 +789,7 @@ namespace svx
}
catch( const Exception& )
{
- OSL_ENSURE( sal_False, "FmTextControlShell::executeSelectAll: caught an exception!" );
+ DBG_UNHANDLED_EXCEPTION();
}
return false; // not handled
}
@@ -839,7 +831,7 @@ namespace svx
}
catch( const Exception& )
{
- OSL_ENSURE( sal_False, "FmTextControlShell::executeClipboardSlot: caught an exception!" );
+ DBG_UNHANDLED_EXCEPTION();
}
return false; // not handled
}
@@ -1085,18 +1077,18 @@ namespace svx
if ( !_rxController.is() )
return;
+ // sometimes, a form controller notifies activations, even if it's already activated
+ if ( m_xActiveController == _rxController )
+ return;
+
try
{
- if ( m_xActiveController == _rxController )
- // sometimes, a form controller notifies activations, even if it's already activated
- return;
-
startControllerListening( _rxController );
controlActivated( _rxController->getCurrentControl() );
}
catch( const Exception& )
{
- DBG_ERROR( "FmTextControlShell::formActivated: caught an exception!" );
+ DBG_UNHANDLED_EXCEPTION();
}
}
@@ -1119,11 +1111,11 @@ namespace svx
//------------------------------------------------------------------------
void FmTextControlShell::startControllerListening( const Reference< XFormController >& _rxController )
{
- DBG_ASSERT( _rxController.is(), "FmTextControlShell::startControllerListening: invalid controller!" );
+ OSL_PRECOND( _rxController.is(), "FmTextControlShell::startControllerListening: invalid controller!" );
if ( !_rxController.is() )
return;
- DBG_ASSERT( !isControllerListening(), "FmTextControlShell::startControllerListening: already listening!" );
+ OSL_PRECOND( !isControllerListening(), "FmTextControlShell::startControllerListening: already listening!" );
if ( isControllerListening() )
stopControllerListening( );
DBG_ASSERT( !isControllerListening(), "FmTextControlShell::startControllerListening: inconsistence!" );
@@ -1143,7 +1135,7 @@ namespace svx
}
catch( const Exception& )
{
- DBG_ERROR( "FmTextControlShell::startControllerListening: caught an exception!" );
+ DBG_UNHANDLED_EXCEPTION();
}
m_xActiveController = _rxController;
@@ -1152,7 +1144,7 @@ namespace svx
//------------------------------------------------------------------------
void FmTextControlShell::stopControllerListening( )
{
- DBG_ASSERT( isControllerListening(), "FmTextControlShell::stopControllerListening: inconsistence!" );
+ OSL_PRECOND( isControllerListening(), "FmTextControlShell::stopControllerListening: inconsistence!" );
// dispose all listeners associated with the controls of the active controller
for ( FocusListenerAdapters::iterator aLoop = m_aControlObservers.begin();
@@ -1207,7 +1199,6 @@ namespace svx
void FmTextControlShell::controlDeactivated( )
{
DBG_ASSERT( IsActiveControl(), "FmTextControlShell::controlDeactivated: no active control!" );
- OSL_TRACE( "deactivated: %X", m_xActiveControl.get() );
m_bActiveControl = false;
@@ -1217,8 +1208,6 @@ namespace svx
//------------------------------------------------------------------------
void FmTextControlShell::controlActivated( const Reference< XControl >& _rxControl )
{
- OSL_TRACE( "activated : %X", _rxControl.get() );
-
// ensure that all knittings with the previously active control are lost
if ( m_xActiveControl.is() )
implClearActiveControlRef();
diff --git a/svx/source/form/fmtools.cxx b/svx/source/form/fmtools.cxx
index beb3c93e0e..e162ed9609 100644
--- a/svx/source/form/fmtools.cxx
+++ b/svx/source/form/fmtools.cxx
@@ -288,7 +288,7 @@ sal_Bool searchElement(const Reference< ::com::sun::star::container::XIndexAcces
xCont->getByIndex(i) >>= xComp;
if (xComp.is())
{
- if (((XInterface *)xElement.get()) == (XInterface*)xComp.get())
+ if ( xElement == xComp )
return sal_True;
else
{
@@ -1120,82 +1120,3 @@ sal_Bool isRowSetAlive(const Reference< XInterface >& _rxRowSet)
return bIsAlive;
}
-// -----------------------------------------------------------------------------
-namespace
-{
- //....................................................................
- static Sequence< PropertyValue > lcl_getDataSourceIndirectProperties( const Reference< XPropertySet >& _rxControlModel,
- const Reference< XMultiServiceFactory >& _rxORB ) SAL_THROW(())
- {
- OSL_PRECOND( _rxControlModel.is(), "lcl_getDataSourceIndirectProperties: invalid model!" );
-
- Sequence< PropertyValue > aInfo;
- try
- {
- Reference< XChild > xChild( _rxControlModel, UNO_QUERY );
- Reference< XPropertySet > xForm;
- if ( xChild.is() )
- xForm = xForm.query( xChild->getParent() );
-
- if ( Reference< XGridColumnFactory >( xForm, UNO_QUERY ).is() )
- { // hmm. the model is a grid column, in real
- xChild = xChild.query( xForm );
- xForm = xForm.query( xChild->getParent() );
- }
-
- OSL_ENSURE( xForm.is(), "lcl_getDataSourceIndirectProperties: could not determine the form!" );
- if ( !xForm.is() )
- return aInfo;
- ::rtl::OUString sDataSourceName;
- xForm->getPropertyValue( FM_PROP_DATASOURCE ) >>= sDataSourceName;
-
- Reference< XPropertySet > xDsProperties;
- if ( sDataSourceName.getLength() )
- xDsProperties = xDsProperties.query( OStaticDataAccessTools().getDataSource( sDataSourceName, _rxORB ) );
- if ( xDsProperties.is() )
- xDsProperties->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Info" ) ) ) >>= aInfo;
- }
- catch( const Exception& )
- {
- OSL_ENSURE( sal_False, "lcl_getDataSourceIndirectProperties: caught an exception!" );
- }
- return aInfo;
- }
-}
-
-//------------------------------------------------------------------------------
-void initializeTextFieldLineEnds( const Reference< XPropertySet >& _rxModel, const Reference< XMultiServiceFactory >& _rxORB ) SAL_THROW(())
-{
- OSL_PRECOND( _rxModel.is(), "initializeTextFieldLineEnds: invalid model!" );
- if ( !_rxModel.is() )
- return;
-
- try
- {
- Reference< XPropertySetInfo > xInfo = _rxModel->getPropertySetInfo();
- if ( !xInfo.is() || !xInfo->hasPropertyByName( FM_PROP_LINEENDFORMAT ) )
- return;
-
- // let's see if the data source which the form belongs to (if any)
- // has a setting for the preferred line end format
- sal_Bool bDosLineEnds = sal_False;
- Sequence< PropertyValue > aInfo = lcl_getDataSourceIndirectProperties( _rxModel, _rxORB );
- const PropertyValue* pInfo = aInfo.getConstArray();
- const PropertyValue* pInfoEnd = pInfo + aInfo.getLength();
- for ( ; pInfo != pInfoEnd; ++pInfo )
- {
- if ( pInfo->Name.equalsAscii( "PreferDosLikeLineEnds" ) )
- {
- pInfo->Value >>= bDosLineEnds;
- break;
- }
- }
-
- sal_Int16 nLineEndFormat = bDosLineEnds ? LineEndFormat::CARRIAGE_RETURN_LINE_FEED : LineEndFormat::LINE_FEED;
- _rxModel->setPropertyValue( FM_PROP_LINEENDFORMAT, makeAny( nLineEndFormat ) );
- }
- catch( const Exception& )
- {
- OSL_ENSURE( sal_False, "initializeTextFieldLineEnds: caught an exception!" );
- }
-}
diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx
index 7bc281a1a2..88ede3f85e 100644
--- a/svx/source/form/fmundo.cxx
+++ b/svx/source/form/fmundo.cxx
@@ -306,47 +306,59 @@ void FmXUndoEnvironment::Inserted(FmFormObj* pObj)
Reference< XFormComponent > xContent(xModel, UNO_QUERY);
if (xContent.is() && pObj->GetPage())
{
- // Komponente gehoert noch keiner Form an
+ // if the component doesn't belong to a form, yet, find one to insert into
if (!xContent->getParent().is())
{
- // Einfuegen in den Parent falls noetig
- Reference< XIndexContainer > xParent = pObj->GetParent();
- // Suchen des Form in der aktuellen Page
- Reference< XIndexContainer > xForm;
- Reference< XInterface > xIface(xParent, UNO_QUERY);
- Reference< XIndexAccess > xForms(((FmFormPage*)pObj->GetPage())->GetForms(), UNO_QUERY);;
-
- if (searchElement(xForms, xIface))
- xForm = xParent;
- else
+ try
{
- Reference< XForm > xTemp = ((FmFormPage*)pObj->GetPage())->GetImpl()->placeInFormComponentHierarchy(xContent);
- xForm = Reference< XIndexContainer > (xTemp, UNO_QUERY);
- }
+ Reference< XIndexContainer > xObjectParent = pObj->GetOriginalParent();
- // Position des Elements
- sal_Int32 nPos = xForm->getCount();
- if ((XIndexContainer*)xForm.get() == (XIndexContainer*)xParent.get())
- {
- if (nPos > pObj->GetPos())
- nPos = xForm->getCount();
- }
+ FmFormPage& rPage = dynamic_cast< FmFormPage& >( *pObj->GetPage() );
+ Reference< XIndexAccess > xForms( rPage.GetForms(), UNO_QUERY_THROW );
+
+ Reference< XIndexContainer > xNewParent;
+ Reference< XForm > xForm;
+ sal_Int32 nPos = -1;
+ if ( searchElement( xForms, xObjectParent ) )
+ {
+ // the form which was the parent of the object when it was removed is still
+ // part of the form component hierachy of the current page
+ xNewParent = xObjectParent;
+ xForm.set( xNewParent, UNO_QUERY_THROW );
+ nPos = ::std::min( pObj->GetOriginalIndex(), xNewParent->getCount() );
+ }
+ else
+ {
+ xForm.set( rPage.GetImpl()->findPlaceInFormComponentHierarchy( xContent ), UNO_SET_THROW );
+ xNewParent.set( xForm, UNO_QUERY_THROW );
+ nPos = xNewParent->getCount();
+ }
- xForm->insertByIndex(nPos, makeAny(xContent));
+ rPage.GetImpl()->setUniqueName( xContent, xForm );
+ xNewParent->insertByIndex( nPos, makeAny( xContent ) );
- Reference< XEventAttacherManager > xManager(xForm, UNO_QUERY);
- if (xManager.is())
- xManager->registerScriptEvents(nPos, pObj->GetEvents());
+ Reference< XEventAttacherManager > xManager( xNewParent, UNO_QUERY_THROW );
+ xManager->registerScriptEvents( nPos, pObj->GetOriginalEvents() );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
// FormObject zuruecksetzen
- pObj->SetObjEnv(Reference< XIndexContainer > ());
+ pObj->ClearObjEnv();
}
}
//------------------------------------------------------------------
void FmXUndoEnvironment::Removed(SdrObject* pObj)
{
+ if ( pObj->IsVirtualObj() )
+ // for virtual objects, we've already been notified of the removal of the master
+ // object, which is sufficient here
+ return;
+
if (pObj->GetObjInventor() == FmFormInventor)
{
FmFormObj* pFormObj = PTR_CAST(FmFormObj, pObj);
@@ -398,6 +410,7 @@ void FmXUndoEnvironment::Removed(FmFormObj* pObj)
}
catch(Exception&)
{
+ DBG_UNHANDLED_EXCEPTION();
}
}
@@ -492,8 +505,9 @@ void SAL_CALL FmXUndoEnvironment::propertyChange(const PropertyChangeEvent& evt)
Any aCurrentControlSource = xSet->getPropertyValue(FM_PROP_CONTROLSOURCE);
aNewEntry.bHasEmptyControlSource = !aCurrentControlSource.hasValue() || (::comphelper::getString(aCurrentControlSource).getLength() == 0);
}
- catch(Exception&)
+ catch(const Exception&)
{
+ DBG_UNHANDLED_EXCEPTION();
}
}
aSetPos = pCache->insert(PropertySetInfoCache::value_type(xSet,aNewEntry)).first;
@@ -532,8 +546,9 @@ void SAL_CALL FmXUndoEnvironment::propertyChange(const PropertyChangeEvent& evt)
aNewEntry.bIsValueProperty = (sControlSourceProperty.equals(evt.PropertyName));
}
}
- catch(Exception&)
+ catch(const Exception&)
{
+ DBG_UNHANDLED_EXCEPTION();
}
// insert the new entry
diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx
index 0057a7e7f4..25b6739526 100644
--- a/svx/source/form/fmview.cxx
+++ b/svx/source/form/fmview.cxx
@@ -56,25 +56,15 @@
#include "svditer.hxx"
#include <svx/svdpagv.hxx>
#include <svx/svdogrp.hxx>
-#ifndef _FM_FMVIEW_HXX
#include <svx/fmview.hxx>
-#endif
-#ifndef _FM_FMMODEL_HXX
#include <svx/fmmodel.hxx>
-#endif
-#ifndef _FM_FMPAGE_HXX
#include <svx/fmpage.hxx>
-#endif
#include <svx/fmshell.hxx>
-#ifndef _SVX_FMPGEIMP_HXX
#include "fmpgeimp.hxx"
-#endif
#include "fmtools.hxx"
#include "fmshimp.hxx"
#include "fmservs.hxx"
-#ifndef _SVX_FMPROP_HRC
#include "fmprop.hrc"
-#endif
#include "fmundo.hxx"
#include <svx/dataaccessdescriptor.hxx>
#include <comphelper/processfactory.hxx>
@@ -85,6 +75,7 @@
#include <com/sun/star/form/FormComponentType.hpp>
#include <vcl/svapp.hxx>
#include <tools/urlobj.hxx>
+#include <tools/diagnose_ex.h>
#include <vcl/stdtext.hxx>
#include <svx/fmglob.hxx>
#include <svx/sdrpagewindow.hxx>
@@ -95,7 +86,6 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
-using namespace ::com::sun::star::ui::dialogs;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::form;
@@ -445,97 +435,6 @@ void FmFormView::DeactivateControls(SdrPageView* pPageView)
}
//------------------------------------------------------------------------
-void FmFormView::ObjectCreated(FmFormObj* pObj)
-{
- // it is valid that the form shell's forms collection is not initialized, yet
- if ( pFormShell && pFormShell->GetImpl() )
- pFormShell->GetImpl()->UpdateForms( sal_True );
-
- Reference< XPropertySet > xSet( pObj->GetUnoControlModel(), UNO_QUERY );
- if ( !xSet.is() )
- return;
-
- // some initial property defaults
- sal_Int16 nClassId = pImpl->implInitializeNewControlModel( xSet, pObj );
-
- if ( !pFormShell->GetImpl()->GetWizardUsing() )
- return;
-
- // #i31958# don't call wizards in XForms mode
- if ( pFormShell->GetImpl()->isEnhancedForm() )
- return;
-
- // #i46898# no wizards if there is no Base installed - currently, all wizards are
- // database related
- if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) )
- return;
-
- Reference< XChild > xChild(xSet, UNO_QUERY);
- Reference< XRowSet > xForm(xChild->getParent(), UNO_QUERY);
- String sWizardName;
- Any aObj;
-
- switch (nClassId)
- {
- case FormComponentType::GRIDCONTROL:
- sWizardName.AssignAscii("com.sun.star.sdb.GridControlAutoPilot");
- aObj <<= xChild;
- break;
- case FormComponentType::LISTBOX:
- case FormComponentType::COMBOBOX:
- sWizardName.AssignAscii("com.sun.star.sdb.ListComboBoxAutoPilot");
- aObj <<= xChild;
- break;
- case FormComponentType::GROUPBOX:
- sWizardName.AssignAscii("com.sun.star.sdb.GroupBoxAutoPilot");
- aObj <<= xChild;
- break;
- }
-
- if (sWizardName.Len() != 0)
- {
- // build the argument list
- Sequence< Any > aWizardArgs(1);
- // the object affected
- aWizardArgs[0] = makeAny(PropertyValue(
- ::rtl::OUString::createFromAscii("ObjectModel"),
- 0,
- makeAny(xChild),
- PropertyState_DIRECT_VALUE
- ));
-
- // create the wizard object
- Reference< XExecutableDialog > xWizard;
- try
- {
- Reference< XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory();
- xWizard = Reference< XExecutableDialog >(
- ::comphelper::getProcessServiceFactory()->createInstanceWithArguments(sWizardName, aWizardArgs),
- UNO_QUERY);
- }
- catch(Exception&)
- {
- }
- if (!xWizard.is())
- {
- ShowServiceNotAvailableError(NULL, sWizardName, sal_True);
- return;
- }
-
- // execute the wizard
- try
- {
- xWizard->execute();
- }
- catch(Exception&)
- {
- DBG_ERROR("FmFormView::ObjectCreated: could not execute the AutoPilot!");
- // TODO: real error handling
- }
- }
-}
-
-//------------------------------------------------------------------------
SdrObject* FmFormView::CreateFieldControl( const ODataAccessDescriptor& _rColumnDescriptor )
{
return pImpl->implCreateFieldControl( _rColumnDescriptor );
@@ -643,7 +542,7 @@ BOOL FmFormView::KeyInput(const KeyEvent& rKEvt, Window* pWin)
}
}
}
- // Alt-RETURN alone enters shows the properties of the selection
+ // Alt-RETURN alone shows the properties of the selection
if ( pFormShell
&& pFormShell->GetImpl()
&& !rKeyCode.IsShift()
@@ -689,37 +588,39 @@ BOOL FmFormView::MouseButtonDown( const MouseEvent& _rMEvt, Window* _pWin )
// -----------------------------------------------------------------------------
FmFormObj* FmFormView::getMarkedGrid() const
{
- FmFormObj* pObj = NULL;
+ FmFormObj* pFormObject = NULL;
const SdrMarkList& rMarkList = GetMarkedObjectList();
if ( 1 == rMarkList.GetMarkCount() )
{
SdrMark* pMark = rMarkList.GetMark(0);
if ( pMark )
{
- pObj = PTR_CAST(FmFormObj,pMark->GetMarkedSdrObj());
- if ( pObj )
+ pFormObject = FmFormObj::GetFormObject( pMark->GetMarkedSdrObj() );
+ if ( pFormObject )
{
- Reference<XServiceInfo> xServInfo(pObj->GetUnoControlModel(),UNO_QUERY);
- if ( !xServInfo.is() || !xServInfo->supportsService(FM_SUN_COMPONENT_GRIDCONTROL) )
- pObj = NULL;
+ Reference< XServiceInfo > xServInfo( pFormObject->GetUnoControlModel(), UNO_QUERY );
+ if ( !xServInfo.is() || !xServInfo->supportsService( FM_SUN_COMPONENT_GRIDCONTROL ) )
+ pFormObject = NULL;
}
}
}
- return pObj;
+ return pFormObject;
}
// -----------------------------------------------------------------------------
-void FmFormView::createControlLabelPair(SdrView* _pView,OutputDevice* _pOutDev, sal_Int32 _nXOffsetMM, sal_Int32 _nYOffsetMM,
+void FmFormView::createControlLabelPair( OutputDevice* _pOutDev, sal_Int32 _nXOffsetMM, sal_Int32 _nYOffsetMM,
const Reference< XPropertySet >& _rxField, const Reference< XNumberFormats >& _rxNumberFormats,
- sal_uInt16 _nObjID, const ::rtl::OUString& _rFieldPostfix,UINT32 _nInventor,UINT16 _nIndent,
- SdrPage* _pLabelPage,SdrPage* _pPage,SdrModel* _pModel,
- SdrUnoObj*& _rpLabel, SdrUnoObj*& _rpControl)
+ sal_uInt16 _nControlObjectID, const ::rtl::OUString& _rFieldPostfix, UINT32 _nInventor, UINT16 _nLabelObjectID,
+ SdrPage* _pLabelPage, SdrPage* _pControlPage, SdrModel* _pModel, SdrUnoObj*& _rpLabel, SdrUnoObj*& _rpControl )
{
- FmXFormView::createControlLabelPair(_pView,_pOutDev,_nXOffsetMM, _nYOffsetMM,
- _rxField, _rxNumberFormats,
- _nObjID, _rFieldPostfix,_nInventor,_nIndent,
- _pLabelPage,_pPage,_pModel,
- _rpLabel, _rpControl);
+ FmXFormView::createControlLabelPair(
+ ::comphelper::getProcessServiceFactory(),
+ *_pOutDev, _nXOffsetMM, _nYOffsetMM,
+ _rxField, _rxNumberFormats,
+ _nControlObjectID, _rFieldPostfix, _nInventor, _nLabelObjectID,
+ _pLabelPage, _pControlPage, _pModel,
+ _rpLabel, _rpControl
+ );
}
// -----------------------------------------------------------------------------
Reference< XFormController > FmFormView::GetFormController( const Reference< XForm >& _rxForm, const OutputDevice& _rDevice ) const
diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx
index 4ce9d3e682..f09a2c68c1 100644
--- a/svx/source/form/fmvwimp.cxx
+++ b/svx/source/form/fmvwimp.cxx
@@ -30,27 +30,40 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
-#include <fmctrler.hxx>
-#include "fmvwimp.hxx"
-#include <svx/fmglob.hxx>
-#include <svx/dialmgr.hxx>
-#ifndef _SVX_FMRESIDS_HRC
-#include "fmresids.hrc"
-#endif
+
+#include "fmctrler.hxx"
+#include "fmdocumentclassification.hxx"
#include "fmobj.hxx"
-#include <svx/svdogrp.hxx>
-#include "svditer.hxx"
+#include "fmpgeimp.hxx"
+#include "fmprop.hrc"
+#include "fmresids.hrc"
#include "fmservs.hxx"
-#include "fmdocumentclassification.hxx"
-#include "fmcontrollayout.hxx"
+#include "fmshimp.hxx"
+#include "fmtools.hxx"
+#include "fmundo.hxx"
+#include "fmvwimp.hxx"
+#include "formcontrolfactory.hxx"
+#include "sdrpaintwindow.hxx"
+#include "svditer.hxx"
+#include "svx/dataaccessdescriptor.hxx"
+#include "svx/dialmgr.hxx"
+#include "svx/fmglob.hxx"
+#include "svx/fmmodel.hxx"
+#include "svx/fmpage.hxx"
+#include "svx/fmshell.hxx"
+#include "svx/fmview.hxx"
+#include "svx/sdrpagewindow.hxx"
+#include "svx/svdogrp.hxx"
+#include "svx/svdpagv.hxx"
+#include "xmlexchg.hxx"
/** === begin UNO includes === **/
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
#include <com/sun/star/style/VerticalAlignment.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/sdbc/XRowSet.hpp>
#include <com/sun/star/form/XLoadable.hpp>
#include <com/sun/star/awt/VisualEffect.hpp>
-#include <com/sun/star/awt/ScrollBarOrientation.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <com/sun/star/util/XNumberFormats.hpp>
#include <com/sun/star/sdb/CommandType.hpp>
@@ -71,31 +84,16 @@
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#include <com/sun/star/sdbc/XPreparedStatement.hpp>
#include <com/sun/star/sdb/XQueriesSupplier.hpp>
-#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
/** === end UNO includes === **/
-#include <svx/fmmodel.hxx>
-#include "fmundo.hxx"
-#include <svx/fmpage.hxx>
-#include "fmpgeimp.hxx"
-#include <svx/fmview.hxx>
-#include <svx/fmshell.hxx>
-#include "fmshimp.hxx"
-#include "fmtools.hxx"
-#ifndef _SVX_FMPROP_HRC
-#include "fmprop.hrc"
-#endif
-#include <vcl/msgbox.hxx>
-#include <svx/svdpagv.hxx>
-#include "xmlexchg.hxx"
-#include <svx/dataaccessdescriptor.hxx>
-#include <comphelper/extract.hxx>
+
#include <comphelper/enumhelper.hxx>
-#include <comphelper/property.hxx>
+#include <comphelper/extract.hxx>
#include <comphelper/numbers.hxx>
-#include <svtools/syslocale.hxx>
+#include <comphelper/property.hxx>
+#include <svtools/moduleoptions.hxx>
#include <tools/diagnose_ex.h>
-#include <svx/sdrpagewindow.hxx>
-#include "sdrpaintwindow.hxx"
+#include <vcl/msgbox.hxx>
+#include <vcl/stdtext.hxx>
#include <algorithm>
@@ -113,6 +111,7 @@ using namespace ::com::sun::star::util;
using namespace ::com::sun::star::script;
using namespace ::com::sun::star::style;
using namespace ::com::sun::star::task;
+using namespace ::com::sun::star::ui::dialogs;
using namespace ::comphelper;
using namespace ::svxform;
using namespace ::svx;
@@ -159,9 +158,9 @@ public:
//========================================================================
DBG_NAME(FmXPageViewWinRec)
//------------------------------------------------------------------------
-FmXPageViewWinRec::FmXPageViewWinRec(const Reference< XMultiServiceFactory >& _rxORB, const SdrPageWindow& _rWindow, FmXFormView* _pViewImpl )
+FmXPageViewWinRec::FmXPageViewWinRec( const ::comphelper::ComponentContext& _rContext, const SdrPageWindow& _rWindow, FmXFormView* _pViewImpl )
: m_xControlContainer( _rWindow.GetControlContainer() ),
- m_xORB( _rxORB ),
+ m_aContext( _rContext ),
m_pViewImpl( _pViewImpl ),
m_pWindow( dynamic_cast< Window* >( &_rWindow.GetPaintWindow().GetOutputDevice() ) )
{
@@ -215,7 +214,6 @@ void FmXPageViewWinRec::dispose()
xComp->dispose();
}
m_aControllerList.clear(); // this call deletes the formcontrollers
- m_xORB = NULL;
}
@@ -310,7 +308,7 @@ void FmXPageViewWinRec::setController(const Reference< XForm > & xForm, FmXForm
Reference< XTabControllerModel > xTabOrder(xForm, UNO_QUERY);
// create a form controller
- FmXFormController* pController = new FmXFormController( m_xORB,m_pViewImpl->getView(), m_pWindow );
+ FmXFormController* pController = new FmXFormController( m_aContext.getLegacyServiceFactory(), m_pViewImpl->getView(), m_pWindow );
Reference< XFormController > xController( pController );
Reference< XInteractionHandler > xHandler;
@@ -406,14 +404,14 @@ void FmXPageViewWinRec::updateTabOrder( const Reference< XForm >& _rxForm )
}
//------------------------------------------------------------------------
-FmXFormView::FmXFormView(const Reference< XMultiServiceFactory >& _xORB,
- FmFormView* _pView)
- :m_xORB( _xORB )
+FmXFormView::FmXFormView(const ::comphelper::ComponentContext& _rContext, FmFormView* _pView )
+ :m_aContext( _rContext )
,m_pMarkedGrid(NULL)
,m_pView(_pView)
,m_nActivationEvent(0)
,m_nErrorMessageEvent( 0 )
,m_nAutoFocusEvent( 0 )
+ ,m_nControlWizardEvent( 0 )
,m_pWatchStoredList( NULL )
,m_bFirstActivation( true )
,m_isTabOrderUpdateSuspended( false )
@@ -440,6 +438,12 @@ void FmXFormView::cancelEvents()
Application::RemoveUserEvent( m_nAutoFocusEvent );
m_nAutoFocusEvent = 0;
}
+
+ if ( m_nControlWizardEvent )
+ {
+ Application::RemoveUserEvent( m_nControlWizardEvent );
+ m_nControlWizardEvent = 0;
+ }
}
//------------------------------------------------------------------------
@@ -560,7 +564,7 @@ void FmXFormView::addWindow(const SdrPageWindow& rWindow)
Reference< XControlContainer > xCC = rWindow.GetControlContainer();
if ( xCC.is() && findWindow( xCC ) == m_aWinList.end())
{
- FmXPageViewWinRec *pFmRec = new FmXPageViewWinRec(m_xORB, rWindow, this);
+ FmXPageViewWinRec *pFmRec = new FmXPageViewWinRec( m_aContext, rWindow, this );
pFmRec->acquire();
m_aWinList.push_back(pFmRec);
@@ -818,17 +822,17 @@ namespace
SdrObjListIter aSdrObjectLoop( _rPage, IM_DEEPNOGROUPS );
while ( aSdrObjectLoop.IsMore() )
{
- const SdrUnoObj* pUnoObject = dynamic_cast< const SdrUnoObj* >( aSdrObjectLoop.Next() );
- if ( !pUnoObject )
+ FmFormObj* pFormObject = FmFormObj::GetFormObject( aSdrObjectLoop.Next() );
+ if ( !pFormObject )
continue;
- Reference< XChild > xModel( pUnoObject->GetUnoControlModel(), UNO_QUERY_THROW );
+ Reference< XChild > xModel( pFormObject->GetUnoControlModel(), UNO_QUERY_THROW );
Reference< XInterface > xModelParent( xModel->getParent(), UNO_QUERY_THROW );
if ( xNormalizedForm.get() != xModelParent.get() )
continue;
- pUnoObject->GetUnoControl( _rView, _rWindow );
+ pFormObject->GetUnoControl( _rView, _rWindow );
}
}
catch( const Exception& )
@@ -937,324 +941,142 @@ IMPL_LINK(FmXFormView, OnAutoFocus, void*, /*EMPTYTAG*/)
// -----------------------------------------------------------------------------
namespace
{
- /*
- ATTENTION!
- Broken for solaris? It seems that the old used template argument TYPE was already
- defined as a macro ... which expand to ... "TYPE "!?
- All platforms are OK - excepting Solaris. There the line "template< class TYPE >"
- was expanded to "template < class TYPE " where the closing ">" was missing.
- */
- #ifdef MYTYPE
- #error "Who defines the macro MYTYPE, which is used as template argument here?"
- #endif
-
- //....................................................................
- template< class MYTYPE >
- Reference< MYTYPE > getTypedModelNode( const Reference< XInterface >& _rxModelNode )
- {
- Reference< MYTYPE > xTypedNode( _rxModelNode, UNO_QUERY );
- if ( xTypedNode.is() )
- return xTypedNode;
- else
- {
- Reference< XChild > xChild( _rxModelNode, UNO_QUERY );
- if ( xChild.is() )
- return getTypedModelNode< MYTYPE >( xChild->getParent() );
- else
- return NULL;
- }
- }
-
- //....................................................................
- static bool lcl_getDocumentDefaultStyleAndFamily( const Reference< XInterface >& _rxDocument, ::rtl::OUString& _rFamilyName, ::rtl::OUString& _rStyleName ) SAL_THROW(( Exception ))
- {
- bool bSuccess = true;
- Reference< XServiceInfo > xDocumentSI( _rxDocument, UNO_QUERY );
- if ( xDocumentSI.is() )
- {
- if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ) )
- || xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.WebDocument" ) ) )
- )
- {
- _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParagraphStyles" ) );
- _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
- }
- else if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.SpreadsheetDocument" ) ) ) )
- {
- _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CellStyles" ) );
- _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Default" ) );
- }
- else if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) ) )
- || xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) )
- )
- {
- _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "graphics" ) );
- _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "standard" ) );
- }
- else
- bSuccess = false;
- }
- return bSuccess;
- }
-
- static const sal_Char* aCharacterAndParagraphProperties[] =
- {
- "CharFontName",
- "CharFontStyleName",
- "CharFontFamily",
- "CharFontCharSet",
- "CharFontPitch",
- "CharColor",
- "CharEscapement",
- "CharHeight",
- "CharUnderline",
- "CharWeight",
- "CharPosture",
- "CharAutoKerning",
- "CharBackColor",
- "CharBackTransparent",
- "CharCaseMap",
- "CharCrossedOut",
- "CharFlash",
- "CharStrikeout",
- "CharWordMode",
- "CharKerning",
- "CharLocale",
- "CharKeepTogether",
- "CharNoLineBreak",
- "CharShadowed",
- "CharFontType",
- "CharStyleName",
- "CharContoured",
- "CharCombineIsOn",
- "CharCombinePrefix",
- "CharCombineSuffix",
- "CharEmphasize",
- "CharRelief",
- "RubyText",
- "RubyAdjust",
- "RubyCharStyleName",
- "RubyIsAbove",
- "CharRotation",
- "CharRotationIsFitToLine",
- "CharScaleWidth",
- "HyperLinkURL",
- "HyperLinkTarget",
- "HyperLinkName",
- "VisitedCharStyleName",
- "UnvisitedCharStyleName",
- "CharEscapementHeight",
- "CharNoHyphenation",
- "CharUnderlineColor",
- "CharUnderlineHasColor",
- "CharStyleNames",
- "CharHeightAsian",
- "CharWeightAsian",
- "CharFontNameAsian",
- "CharFontStyleNameAsian",
- "CharFontFamilyAsian",
- "CharFontCharSetAsian",
- "CharFontPitchAsian",
- "CharPostureAsian",
- "CharLocaleAsian",
- "ParaIsCharacterDistance",
- "ParaIsForbiddenRules",
- "ParaIsHangingPunctuation",
- "CharHeightComplex",
- "CharWeightComplex",
- "CharFontNameComplex",
- "CharFontStyleNameComplex",
- "CharFontFamilyComplex",
- "CharFontCharSetComplex",
- "CharFontPitchComplex",
- "CharPostureComplex",
- "CharLocaleComplex",
- "ParaAdjust",
- "ParaLineSpacing",
- "ParaBackColor",
- "ParaBackTransparent",
- "ParaBackGraphicURL",
- "ParaBackGraphicFilter",
- "ParaBackGraphicLocation",
- "ParaLastLineAdjust",
- "ParaExpandSingleWord",
- "ParaLeftMargin",
- "ParaRightMargin",
- "ParaTopMargin",
- "ParaBottomMargin",
- "ParaLineNumberCount",
- "ParaLineNumberStartValue",
- "PageDescName",
- "PageNumberOffset",
- "ParaRegisterModeActive",
- "ParaTabStops",
- "ParaStyleName",
- "DropCapFormat",
- "DropCapWholeWord",
- "ParaKeepTogether",
- "Setting",
- "ParaSplit",
- "Setting",
- "NumberingLevel",
- "NumberingRules",
- "NumberingStartValue",
- "ParaIsNumberingRestart",
- "NumberingStyleName",
- "ParaOrphans",
- "ParaWidows",
- "ParaShadowFormat",
- "LeftBorder",
- "RightBorder",
- "TopBorder",
- "BottomBorder",
- "BorderDistance",
- "LeftBorderDistance",
- "RightBorderDistance",
- "TopBorderDistance",
- "BottomBorderDistance",
- "BreakType",
- "DropCapCharStyleName",
- "ParaFirstLineIndent",
- "ParaIsAutoFirstLineIndent",
- "ParaIsHyphenation",
- "ParaHyphenationMaxHyphens",
- "ParaHyphenationMaxLeadingChars",
- "ParaHyphenationMaxTrailingChars",
- "ParaVertAlignment",
- "ParaUserDefinedAttributes",
- "NumberingIsNumber",
- "ParaIsConnectBorder",
- NULL
- };
-
- //....................................................................
- static void lcl_initializeCharacterAttributes( const Reference< XPropertySet >& _rxModel )
- {
- // need to initialize the attributes from the "Default" style of the document we live in
+}
- try
- {
- // the style family collection
- Reference< XStyleFamiliesSupplier > xSuppStyleFamilies = getTypedModelNode< XStyleFamiliesSupplier >( _rxModel.get() );
- Reference< XNameAccess > xStyleFamilies;
- if ( xSuppStyleFamilies.is() )
- xStyleFamilies = xSuppStyleFamilies->getStyleFamilies();
- OSL_ENSURE( xStyleFamilies.is(), "lcl_initializeCharacterAttributes: could not obtain the style families!" );
- if ( !xStyleFamilies.is() )
- return;
+// -----------------------------------------------------------------------------
+void FmXFormView::onCreatedFormObject( FmFormObj& _rFormObject )
+{
+ FmFormShell* pShell = m_pView ? m_pView->GetFormShell() : NULL;
+ FmXFormShell* pShellImpl = pShell ? pShell->GetImpl() : NULL;
+ OSL_ENSURE( pShellImpl, "FmXFormView::onCreatedFormObject: no form shell!" );
+ if ( !pShellImpl )
+ return;
- // the names of the family, and the style - depends on the document type we live in
- ::rtl::OUString sFamilyName, sStyleName;
- bool bKnownDocumentType = lcl_getDocumentDefaultStyleAndFamily( xSuppStyleFamilies.get(), sFamilyName, sStyleName );
- OSL_ENSURE( bKnownDocumentType, "lcl_initializeCharacterAttributes: Huh? What document type is this?" );
- if ( !bKnownDocumentType )
- return;
+ // it is valid that the form shell's forms collection is not initialized, yet
+ pShellImpl->UpdateForms( sal_True );
+
+ m_xLastCreatedControlModel.set( _rFormObject.GetUnoControlModel(), UNO_QUERY );
+ if ( !m_xLastCreatedControlModel.is() )
+ return;
- // the concrete style
- Reference< XNameAccess > xStyleFamily( xStyleFamilies->getByName( sFamilyName ), UNO_QUERY );
- Reference< XPropertySet > xStyle;
- if ( xStyleFamily.is() )
- xStyleFamily->getByName( sStyleName ) >>= xStyle;
- OSL_ENSURE( xStyle.is(), "lcl_initializeCharacterAttributes: could not retrieve the style!" );
- if ( !xStyle.is() )
- return;
+ // some initial property defaults
+ FormControlFactory aControlFactory( m_aContext );
+ aControlFactory.initializeControlModel( pShellImpl->getDocumentType(), _rFormObject );
- // transfer all properties which are described by the com.sun.star.style.
- Reference< XPropertySetInfo > xSourcePropInfo( xStyle->getPropertySetInfo() );
- Reference< XPropertySetInfo > xDestPropInfo( _rxModel->getPropertySetInfo() );
- OSL_ENSURE( xSourcePropInfo.is() && xDestPropInfo.is(), "lcl_initializeCharacterAttributes: no property set info!" );
- if ( !xSourcePropInfo.is() || !xDestPropInfo.is() )
- return;
+ if ( !pShellImpl->GetWizardUsing() )
+ return;
- ::rtl::OUString sPropertyName;
- const sal_Char** pCharacterProperty = aCharacterAndParagraphProperties;
- while ( *pCharacterProperty )
- {
- sPropertyName = ::rtl::OUString::createFromAscii( *pCharacterProperty );
+ // #i31958# don't call wizards in XForms mode
+ if ( pShellImpl->isEnhancedForm() )
+ return;
- if ( xSourcePropInfo->hasPropertyByName( sPropertyName ) && xDestPropInfo->hasPropertyByName( sPropertyName ) )
- _rxModel->setPropertyValue( sPropertyName, xStyle->getPropertyValue( sPropertyName ) );
+ // #i46898# no wizards if there is no Base installed - currently, all wizards are
+ // database related
+ if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) )
+ return;
- ++pCharacterProperty;
- }
- }
- catch( const Exception& )
- {
- OSL_ENSURE( sal_False, "lcl_initializeCharacterAttributes: caught an exception!" );
- }
- }
+ if ( m_nControlWizardEvent )
+ Application::RemoveUserEvent( m_nControlWizardEvent );
+ m_nControlWizardEvent = Application::PostUserEvent( LINK( this, FmXFormView, OnStartControlWizard ) );
}
// -----------------------------------------------------------------------------
-sal_Int16 FmXFormView::implInitializeNewControlModel( const Reference< XPropertySet >& _rxModel, const SdrObject* _pObject ) const
+IMPL_LINK( FmXFormView, OnStartControlWizard, void*, /**/ )
{
- OSL_ENSURE( _rxModel.is() && _pObject, "FmXFormView::implInitializeNewControlModel: invalid model!" );
+ m_nControlWizardEvent = 0;
+ OSL_PRECOND( m_xLastCreatedControlModel.is(), "FmXFormView::OnStartControlWizard: illegal call!" );
+ if ( !m_xLastCreatedControlModel.is() )
+ return 0L;
sal_Int16 nClassId = FormComponentType::CONTROL;
- if ( !_rxModel.is() || !_pObject )
- return nClassId;
-
try
{
- DocumentType eDocumentType = GetFormShell() ? GetFormShell()->GetImpl()->getDocumentType() : eUnknownDocumentType;
- ControlLayouter::initializeControlLayout( _rxModel, eDocumentType );
+ OSL_VERIFY( m_xLastCreatedControlModel->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
- _rxModel->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId;
- Reference< XPropertySetInfo> xPSI(_rxModel->getPropertySetInfo());
- switch ( nClassId )
- {
- case FormComponentType::SCROLLBAR:
- _rxModel->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LiveScroll" ) ), makeAny( (sal_Bool)sal_True ) );
- // NO break!
- case FormComponentType::SPINBUTTON:
- {
- const ::Rectangle& rBoundRect = _pObject->GetCurrentBoundRect();
- sal_Int32 eOrientation = ScrollBarOrientation::HORIZONTAL;
- if ( rBoundRect.GetWidth() < rBoundRect.GetHeight() )
- eOrientation = ScrollBarOrientation::VERTICAL;
- _rxModel->setPropertyValue( FM_PROP_ORIENTATION, makeAny( eOrientation ) );
- }
+ const sal_Char* pWizardAsciiName = NULL;
+ switch ( nClassId )
+ {
+ case FormComponentType::GRIDCONTROL:
+ pWizardAsciiName = "com.sun.star.sdb.GridControlAutoPilot";
break;
-
- case FormComponentType::LISTBOX:
- case FormComponentType::COMBOBOX:
- {
- const ::Rectangle& rBoundRect = _pObject->GetCurrentBoundRect();
- sal_Bool bDropDown = ( rBoundRect.GetWidth() >= 3 * rBoundRect.GetHeight() );
- _rxModel->setPropertyValue( FM_PROP_DROPDOWN, makeAny( (sal_Bool)bDropDown ) );
- }
+ case FormComponentType::LISTBOX:
+ case FormComponentType::COMBOBOX:
+ pWizardAsciiName = "com.sun.star.sdb.ListComboBoxAutoPilot";
break;
+ case FormComponentType::GROUPBOX:
+ pWizardAsciiName = "com.sun.star.sdb.GroupBoxAutoPilot";
+ break;
+ }
- case FormComponentType::TEXTFIELD:
- {
- initializeTextFieldLineEnds( _rxModel, m_xORB );
- lcl_initializeCharacterAttributes( _rxModel );
+ if ( pWizardAsciiName )
+ {
+ // build the argument list
+ Sequence< Any > aWizardArgs(1);
+ // the object affected
+ aWizardArgs[0] = makeAny( PropertyValue(
+ ::rtl::OUString::createFromAscii("ObjectModel"),
+ 0,
+ makeAny( m_xLastCreatedControlModel ),
+ PropertyState_DIRECT_VALUE
+ ) );
+
+ // create the wizard object
+ Reference< XExecutableDialog > xWizard;
+ try
+ {
+ m_aContext.createComponentWithArguments( pWizardAsciiName, aWizardArgs, xWizard );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
- const ::Rectangle& rBoundRect = _pObject->GetCurrentBoundRect();
- if ( !( rBoundRect.GetWidth() > 4 * rBoundRect.GetHeight() ) ) // heuristics
- {
- if ( xPSI.is() && xPSI->hasPropertyByName( FM_PROP_MULTILINE ) )
- _rxModel->setPropertyValue( FM_PROP_MULTILINE, makeAny( (sal_Bool)sal_True ) );
- }
+ if ( !xWizard.is() )
+ {
+ ShowServiceNotAvailableError( NULL, String::CreateFromAscii( pWizardAsciiName ), sal_True );
+ }
+ else
+ {
+ // execute the wizard
+ try
+ {
+ xWizard->execute();
}
- break;
-
- case FormComponentType::RADIOBUTTON:
- case FormComponentType::CHECKBOX:
- case FormComponentType::FIXEDTEXT:
+ catch( const Exception& )
{
- ::rtl::OUString sVertAlignPropertyName( RTL_CONSTASCII_USTRINGPARAM( "VerticalAlign" ) );
- if ( xPSI.is() && xPSI->hasPropertyByName( sVertAlignPropertyName ) )
- _rxModel->setPropertyValue( sVertAlignPropertyName, makeAny( VerticalAlignment_MIDDLE ) );
+ DBG_UNHANDLED_EXCEPTION();
}
- break;
}
}
- catch( const Exception& )
+
+ m_xLastCreatedControlModel.clear();
+ return 1L;
+}
+
+// -----------------------------------------------------------------------------
+namespace
+{
+ void lcl_insertIntoFormComponentHierarchy_throw( const FmFormView& _rView, const SdrUnoObj& _rSdrObj,
+ const Reference< XDataSource >& _rxDataSource = NULL, const ::rtl::OUString& _rDataSourceName = ::rtl::OUString(),
+ const ::rtl::OUString& _rCommand = ::rtl::OUString(), const sal_Int32 _nCommandType = -1 )
{
- OSL_ENSURE( sal_False, "FmXFormView::implInitializeNewControlModel: caught an exception!" );
+ FmFormPage& rPage = static_cast< FmFormPage& >( *_rView.GetSdrPageView()->GetPage() );
+
+ Reference< XFormComponent > xFormComponent( _rSdrObj.GetUnoControlModel(), UNO_QUERY_THROW );
+ Reference< XForm > xTargetForm(
+ rPage.GetImpl()->findPlaceInFormComponentHierarchy( xFormComponent, _rxDataSource, _rDataSourceName, _rCommand, _nCommandType ),
+ UNO_SET_THROW );
+
+ Reference< XIndexContainer > xFormAsContainer( xTargetForm, UNO_QUERY_THROW );
+ xFormAsContainer->insertByIndex( xFormAsContainer->getCount(), makeAny( xFormComponent ) );
+
+ rPage.GetImpl()->setUniqueName( xFormComponent, xTargetForm );
}
- return nClassId;
}
// -----------------------------------------------------------------------------
@@ -1301,7 +1123,7 @@ SdrObject* FmXFormView::implCreateFieldControl( const ::svx::ODataAccessDescript
// obtain the data source
if ( !xDataSource.is() )
- xDataSource = OStaticDataAccessTools().getDataSource(sDataSource, getORB());
+ xDataSource = OStaticDataAccessTools().getDataSource( sDataSource, m_aContext.getLegacyServiceFactory() );
// and the connection, if necessary
if ( !xConnection.is() )
@@ -1309,7 +1131,7 @@ SdrObject* FmXFormView::implCreateFieldControl( const ::svx::ODataAccessDescript
sDataSource,
::rtl::OUString(),
::rtl::OUString(),
- getORB()
+ m_aContext.getLegacyServiceFactory()
) );
}
catch(const SQLContext& e) { aError.Reason <<= e; }
@@ -1334,8 +1156,6 @@ SdrObject* FmXFormView::implCreateFieldControl( const ::svx::ODataAccessDescript
// go
try
{
- FmFormPage& rPage = *static_cast<FmFormPage*>(m_pView->GetSdrPageView()->GetPage());
-
// determine the table/query field which we should create a control for
Reference< XPropertySet > xField;
@@ -1357,13 +1177,13 @@ SdrObject* FmXFormView::implCreateFieldControl( const ::svx::ODataAccessDescript
////////////////////////////////////////////////////////////////
// nur fuer Textgroesse
- OutputDevice* _pOutDev = NULL;
+ OutputDevice* pOutDev = NULL;
if (m_pView->GetActualOutDev() && m_pView->GetActualOutDev()->GetOutDevType() == OUTDEV_WINDOW)
- _pOutDev = const_cast<OutputDevice*>(m_pView->GetActualOutDev());
+ pOutDev = const_cast<OutputDevice*>(m_pView->GetActualOutDev());
else
{// OutDev suchen
SdrPageView* pPageView = m_pView->GetSdrPageView();
- if( pPageView && !_pOutDev )
+ if( pPageView && !pOutDev )
{
// const SdrPageViewWinList& rWinList = pPageView->GetWinList();
// const SdrPageViewWindows& rPageViewWindows = pPageView->GetPageViewWindows();
@@ -1374,14 +1194,14 @@ SdrObject* FmXFormView::implCreateFieldControl( const ::svx::ODataAccessDescript
if( rPageWindow.GetPaintWindow().OutputToWindow())
{
- _pOutDev = &rPageWindow.GetPaintWindow().GetOutputDevice();
+ pOutDev = &rPageWindow.GetPaintWindow().GetOutputDevice();
break;
}
}
}
}
- if (!_pOutDev)
+ if ( !pOutDev )
return NULL;
sal_Int32 nDataType = ::comphelper::getINT32(xField->getPropertyValue(FM_PROP_FIELDTYPE));
@@ -1445,33 +1265,16 @@ SdrObject* FmXFormView::implCreateFieldControl( const ::svx::ODataAccessDescript
if (!nOBJID)
return NULL;
- SdrUnoObj* pLabel;
- SdrUnoObj* pControl;
- createControlLabelPair(m_pView,_pOutDev, 0,0, xField, xNumberFormats, nOBJID, sLabelPostfix, FmFormInventor,OBJ_FM_FIXEDTEXT,NULL,NULL,NULL,pLabel, pControl);
- if (!pLabel || !pControl)
+ SdrUnoObj* pLabel( NULL );
+ SdrUnoObj* pControl( NULL );
+ if ( !createControlLabelPair( *pOutDev, 0, 0, xField, xNumberFormats, nOBJID, sLabelPostfix,
+ pLabel, pControl, xDataSource, sDataSource, sCommand, nCommandType )
+ )
{
- delete pLabel;
- delete pControl;
return NULL;
}
//////////////////////////////////////////////////////////////////////
- // Feststellen ob eine form erzeugt werden muss
- // Dieses erledigt die Page fuer uns bzw. die PageImpl
- Reference< XFormComponent > xContent(pLabel->GetUnoControlModel(), UNO_QUERY);
- Reference< XIndexContainer > xContainer(rPage.GetImpl()->placeInFormComponentHierarchy(xContent, xDataSource, sDataSource, sCommand, nCommandType), UNO_QUERY);
- if (xContainer.is())
- xContainer->insertByIndex(xContainer->getCount(), makeAny(xContent));
- implInitializeNewControlModel( Reference< XPropertySet >( xContent, UNO_QUERY ), pLabel );
-
- xContent = Reference< XFormComponent > (pControl->GetUnoControlModel(), UNO_QUERY);
- xContainer = Reference< XIndexContainer > (rPage.GetImpl()->placeInFormComponentHierarchy(xContent, xDataSource,
- sDataSource, sCommand, nCommandType), UNO_QUERY);
- if (xContainer.is())
- xContainer->insertByIndex(xContainer->getCount(), makeAny(xContent));
- implInitializeNewControlModel( Reference< XPropertySet >( xContent, UNO_QUERY ), pLabel );
-
- //////////////////////////////////////////////////////////////////////
// Objekte gruppieren
SdrObjGroup* pGroup = new SdrObjGroup();
SdrObjList* pObjList = pGroup->GetSubList();
@@ -1479,24 +1282,16 @@ SdrObject* FmXFormView::implCreateFieldControl( const ::svx::ODataAccessDescript
pObjList->InsertObject(pControl);
- if (bDateNTimeField)
- { // wir haben bis jetzt nur ein Datums-Feld eingefuegt, brauchen aber noch ein extra Feld fuer
- // die Zeit-Komponente
+ if ( bDateNTimeField )
+ { // so far we created a date field only, but we also need a time field
pLabel = pControl = NULL;
- createControlLabelPair(m_pView,_pOutDev, 0,1000, xField, xNumberFormats, OBJ_FM_TIMEFIELD,
- String( SVX_RES( RID_STR_POSTFIX_TIME ) ), FmFormInventor,OBJ_FM_FIXEDTEXT,
- NULL,NULL,NULL,
- pLabel, pControl);
-
- if (pLabel && pControl)
- {
- pObjList->InsertObject(pLabel);
- pObjList->InsertObject(pControl);
- }
- else
+ if ( createControlLabelPair( *pOutDev, 0, 1000, xField, xNumberFormats, OBJ_FM_TIMEFIELD,
+ String( SVX_RES( RID_STR_POSTFIX_TIME ) ), pLabel, pControl,
+ xDataSource, sDataSource, sCommand, nCommandType )
+ )
{
- delete pLabel;
- delete pControl;
+ pObjList->InsertObject( pLabel );
+ pObjList->InsertObject( pControl );
}
}
@@ -1523,8 +1318,6 @@ SdrObject* FmXFormView::implCreateXFormsControl( const ::svx::OXFormsDescriptor
// go
try
{
- FmFormPage& rPage = *static_cast<FmFormPage*>(m_pView->GetSdrPageView()->GetPage());
-
// determine the table/query field which we should create a control for
Reference< XPropertySet > xField;
Reference< XNumberFormats > xNumberFormats;
@@ -1532,13 +1325,13 @@ SdrObject* FmXFormView::implCreateXFormsControl( const ::svx::OXFormsDescriptor
////////////////////////////////////////////////////////////////
// nur fuer Textgroesse
- OutputDevice* _pOutDev = NULL;
+ OutputDevice* pOutDev = NULL;
if (m_pView->GetActualOutDev() && m_pView->GetActualOutDev()->GetOutDevType() == OUTDEV_WINDOW)
- _pOutDev = const_cast<OutputDevice*>(m_pView->GetActualOutDev());
+ pOutDev = const_cast<OutputDevice*>(m_pView->GetActualOutDev());
else
{// OutDev suchen
SdrPageView* pPageView = m_pView->GetSdrPageView();
- if( pPageView && !_pOutDev )
+ if( pPageView && !pOutDev )
{
// const SdrPageViewWinList& rWinList = pPageView->GetWinList();
// const SdrPageViewWindows& rPageViewWindows = pPageView->GetPageViewWindows();
@@ -1549,14 +1342,14 @@ SdrObject* FmXFormView::implCreateXFormsControl( const ::svx::OXFormsDescriptor
if( rPageWindow.GetPaintWindow().GetOutputDevice().GetOutDevType() == OUTDEV_WINDOW)
{
- _pOutDev = &rPageWindow.GetPaintWindow().GetOutputDevice();
+ pOutDev = &rPageWindow.GetPaintWindow().GetOutputDevice();
break;
}
}
}
}
- if (!_pOutDev)
+ if ( !pOutDev )
return NULL;
//////////////////////////////////////////////////////////////////////
@@ -1575,13 +1368,12 @@ SdrObject* FmXFormView::implCreateXFormsControl( const ::svx::OXFormsDescriptor
// xform control or submission button?
if ( !xSubmission.is() )
{
-
- SdrUnoObj* pLabel;
- SdrUnoObj* pControl;
- createControlLabelPair(m_pView,_pOutDev, 0,0, xField, xNumberFormats, nOBJID, sLabelPostfix, FmFormInventor,OBJ_FM_FIXEDTEXT,NULL,NULL,NULL,pLabel, pControl);
- if (!pLabel || !pControl) {
- delete pLabel;
- delete pControl;
+ SdrUnoObj* pLabel( NULL );
+ SdrUnoObj* pControl( NULL );
+ if ( !createControlLabelPair( *pOutDev, 0, 0, xField, xNumberFormats, nOBJID, sLabelPostfix,
+ pLabel, pControl )
+ )
+ {
return NULL;
}
@@ -1595,22 +1387,7 @@ SdrObject* FmXFormView::implCreateXFormsControl( const ::svx::OXFormsDescriptor
xBindableValue->setValueBinding(xValueBinding);
//////////////////////////////////////////////////////////////////////
- // Feststellen ob eine ::com::sun::star::form erzeugt werden muss
- // Dieses erledigt die Page fuer uns bzw. die PageImpl
- Reference< XFormComponent > xContent(pLabel->GetUnoControlModel(), UNO_QUERY);
- Reference< XIndexContainer > xContainer(rPage.GetImpl()->placeInFormComponentHierarchy( xContent ), UNO_QUERY);
- if (xContainer.is())
- xContainer->insertByIndex(xContainer->getCount(), makeAny(xContent));
- implInitializeNewControlModel( Reference< XPropertySet >( xContent, UNO_QUERY ), pControl );
-
- xContent = Reference< XFormComponent > (pControl->GetUnoControlModel(), UNO_QUERY);
- xContainer = Reference< XIndexContainer > (rPage.GetImpl()->placeInFormComponentHierarchy( xContent ), UNO_QUERY);
- if (xContainer.is())
- xContainer->insertByIndex(xContainer->getCount(), makeAny(xContent));
- implInitializeNewControlModel( Reference< XPropertySet >( xContent, UNO_QUERY ), pControl );
-
- //////////////////////////////////////////////////////////////////////
- // Objekte gruppieren
+ // group objects
SdrObjGroup* pGroup = new SdrObjGroup();
SdrObjList* pObjList = pGroup->GetSubList();
pObjList->InsertObject(pLabel);
@@ -1621,15 +1398,15 @@ SdrObject* FmXFormView::implCreateXFormsControl( const ::svx::OXFormsDescriptor
else {
// create a button control
- const MapMode eTargetMode(_pOutDev->GetMapMode());
+ const MapMode eTargetMode( pOutDev->GetMapMode() );
const MapMode eSourceMode(MAP_100TH_MM);
const sal_uInt16 nObjID = OBJ_FM_BUTTON;
::Size controlSize(4000, 500);
FmFormObj *pControl = static_cast<FmFormObj*>(SdrObjFactory::MakeNewObject( FmFormInventor, nObjID, NULL, NULL ));
controlSize.Width() = Fraction(controlSize.Width(), 1) * eTargetMode.GetScaleX();
controlSize.Height() = Fraction(controlSize.Height(), 1) * eTargetMode.GetScaleY();
- ::Point controlPos(_pOutDev->LogicToLogic(::Point(controlSize.Width(),0),eSourceMode,eTargetMode));
- ::Rectangle controlRect(controlPos,_pOutDev->LogicToLogic(controlSize, eSourceMode, eTargetMode));
+ ::Point controlPos( pOutDev->LogicToLogic( ::Point( controlSize.Width(), 0 ), eSourceMode, eTargetMode ) );
+ ::Rectangle controlRect( controlPos, pOutDev->LogicToLogic( controlSize, eSourceMode, eTargetMode ) );
pControl->SetLogicRect(controlRect);
// set the button label
@@ -1656,43 +1433,63 @@ SdrObject* FmXFormView::implCreateXFormsControl( const ::svx::OXFormsDescriptor
}
//------------------------------------------------------------------------
-void FmXFormView::createControlLabelPair(SdrView* /*_pView*/,OutputDevice* _pOutDev, sal_Int32 _nXOffsetMM, sal_Int32 _nYOffsetMM,
- const Reference< XPropertySet >& _rxField, const Reference< XNumberFormats >& _rxNumberFormats,
- sal_uInt16 _nObjID, const ::rtl::OUString& _rFieldPostfix,UINT32 _nInventor,UINT16 _nIndent
- ,SdrPage* _pLabelPage,SdrPage* _pPage,SdrModel* _pModel,
- SdrUnoObj*& _rpLabel, SdrUnoObj*& _rpControl)
+bool FmXFormView::createControlLabelPair( OutputDevice& _rOutDev, sal_Int32 _nXOffsetMM, sal_Int32 _nYOffsetMM,
+ const Reference< XPropertySet >& _rxField, const Reference< XNumberFormats >& _rxNumberFormats,
+ sal_uInt16 _nControlObjectID, const ::rtl::OUString& _rFieldPostfix,
+ SdrUnoObj*& _rpLabel, SdrUnoObj*& _rpControl,
+ const Reference< XDataSource >& _rxDataSource, const ::rtl::OUString& _rDataSourceName,
+ const ::rtl::OUString& _rCommand, const sal_Int32 _nCommandType )
+{
+ if ( !createControlLabelPair( m_aContext, _rOutDev, _nXOffsetMM, _nYOffsetMM,
+ _rxField, _rxNumberFormats, _nControlObjectID, _rFieldPostfix, FmFormInventor, OBJ_FM_FIXEDTEXT,
+ NULL, NULL, NULL, _rpLabel, _rpControl )
+ )
+ return false;
+
+ // insert the control model(s) into the form component hierachy
+ lcl_insertIntoFormComponentHierarchy_throw( *m_pView, *_rpLabel, _rxDataSource, _rDataSourceName, _rCommand, _nCommandType );
+ lcl_insertIntoFormComponentHierarchy_throw( *m_pView, *_rpControl, _rxDataSource, _rDataSourceName, _rCommand, _nCommandType );
+
+ // some context-dependent initializations
+ FormControlFactory aControlFactory( m_aContext );
+ aControlFactory.initializeControlModel( impl_getDocumentType(), *_rpLabel );
+ aControlFactory.initializeControlModel( impl_getDocumentType(), *_rpControl );
+
+ return true;
+}
+
+//------------------------------------------------------------------------
+bool FmXFormView::createControlLabelPair( const ::comphelper::ComponentContext& _rContext,
+ OutputDevice& _rOutDev, sal_Int32 _nXOffsetMM, sal_Int32 _nYOffsetMM, const Reference< XPropertySet >& _rxField,
+ const Reference< XNumberFormats >& _rxNumberFormats, sal_uInt16 _nControlObjectID,
+ const ::rtl::OUString& _rFieldPostfix, UINT32 _nInventor, UINT16 _nLabelObjectID,
+ SdrPage* _pLabelPage, SdrPage* _pControlPage, SdrModel* _pModel, SdrUnoObj*& _rpLabel, SdrUnoObj*& _rpControl)
{
sal_Int32 nDataType = 0;
- sal_Int32 nFormatKey = 0;
::rtl::OUString sFieldName;
Any aFieldName;
if ( _rxField.is() )
{
nDataType = ::comphelper::getINT32(_rxField->getPropertyValue(FM_PROP_FIELDTYPE));
- Reference< XPropertySetInfo > xPSI( _rxField->getPropertySetInfo() );
- if ( xPSI.is() && xPSI->hasPropertyByName( FM_PROP_FORMATKEY ) )
- nFormatKey = ::comphelper::getINT32(_rxField->getPropertyValue(FM_PROP_FORMATKEY));
- else
- nFormatKey = OStaticDataAccessTools().getDefaultNumberFormat(
- _rxField,
- Reference< XNumberFormatTypes >( _rxNumberFormats, UNO_QUERY ),
- SvtSysLocale().GetLocaleData().getLocale()
- );
-
aFieldName = Any(_rxField->getPropertyValue(FM_PROP_NAME));
aFieldName >>= sFieldName;
}
- // das Label
- _rpLabel = static_cast<SdrUnoObj*>(SdrObjFactory::MakeNewObject( _nInventor, _nIndent, _pLabelPage,_pModel ));
- Reference< XPropertySet > xLabelSet(_rpLabel->GetUnoControlModel(), UNO_QUERY);
- xLabelSet->setPropertyValue(FM_PROP_LABEL, makeAny(sFieldName + _rFieldPostfix));
+ // the label
+ ::std::auto_ptr< SdrUnoObj > pLabel( dynamic_cast< SdrUnoObj* >(
+ SdrObjFactory::MakeNewObject( _nInventor, _nLabelObjectID, _pLabelPage, _pModel ) ) );
+ OSL_ENSURE( pLabel.get(), "FmXFormView::createControlLabelPair: could not create the label!" );
+ if ( !pLabel.get() )
+ return false;
+
+ Reference< XPropertySet > xLabelSet( pLabel->GetUnoControlModel(), UNO_QUERY );
+ xLabelSet->setPropertyValue( FM_PROP_LABEL, makeAny( sFieldName + _rFieldPostfix ) );
// positionieren unter Beachtung der Einstellungen des Ziel-Output-Devices
- ::Size aTextSize(_pOutDev->GetTextWidth(sFieldName + _rFieldPostfix), _pOutDev->GetTextHeight());
+ ::Size aTextSize( _rOutDev.GetTextWidth(sFieldName + _rFieldPostfix), _rOutDev.GetTextHeight() );
- MapMode eTargetMode(_pOutDev->GetMapMode()),
- eSourceMode(MAP_100TH_MM);
+ MapMode eTargetMode( _rOutDev.GetMapMode() ),
+ eSourceMode( MAP_100TH_MM );
// Textbreite ist mindestens 5cm
// Texthoehe immer halber cm
@@ -1702,27 +1499,34 @@ void FmXFormView::createControlLabelPair(SdrView* /*_pView*/,OutputDevice* _pOut
// Abstand zwischen Text und Control
::Size aDelta(500, 0);
- ::Size aRealSize = _pOutDev->LogicToLogic(aTextSize, eTargetMode, eSourceMode);
+ ::Size aRealSize = _rOutDev.LogicToLogic(aTextSize, eTargetMode, eSourceMode);
aRealSize.Width() = std::max(aRealSize.Width(), aDefTxtSize.Width()) + aDelta.Width();
aRealSize.Height()= aDefSize.Height();
// je nach Skalierung des Zieldevices muss die Groesse noch normiert werden (#53523#)
aRealSize.Width() = long(Fraction(aRealSize.Width(), 1) * eTargetMode.GetScaleX());
aRealSize.Height() = long(Fraction(aRealSize.Height(), 1) * eTargetMode.GetScaleY());
- _rpLabel->SetLogicRect(
- ::Rectangle( _pOutDev->LogicToLogic(::Point(_nXOffsetMM, _nYOffsetMM), eSourceMode, eTargetMode),
- _pOutDev->LogicToLogic(aRealSize, eSourceMode, eTargetMode)
- ));
-
- // jetzt das Control
- _rpControl = static_cast<SdrUnoObj*>(SdrObjFactory::MakeNewObject( _nInventor, _nObjID, _pPage,_pModel ));
- Reference< XPropertySet > xControlSet( _rpControl->GetUnoControlModel(), UNO_QUERY );
-
- // positionieren
+ pLabel->SetLogicRect( ::Rectangle(
+ _rOutDev.LogicToLogic( ::Point( _nXOffsetMM, _nYOffsetMM ), eSourceMode, eTargetMode ),
+ _rOutDev.LogicToLogic( aRealSize, eSourceMode, eTargetMode )
+ ) );
+
+ // the control
+ ::std::auto_ptr< SdrUnoObj > pControl( dynamic_cast< SdrUnoObj* >(
+ SdrObjFactory::MakeNewObject( _nInventor, _nControlObjectID, _pControlPage, _pModel ) ) );
+ OSL_ENSURE( pControl.get(), "FmXFormView::createControlLabelPair: could not create the control!" );
+ if ( !pControl.get() )
+ return false;
+
+ Reference< XPropertySet > xControlSet( pControl->GetUnoControlModel(), UNO_QUERY );
+ if ( !xControlSet.is() )
+ return false;
+
+ // position
::Size szControlSize;
if (DataType::BIT == nDataType || nDataType == DataType::BOOLEAN )
szControlSize = aDefSize;
- else if (OBJ_FM_IMAGECONTROL == _nObjID || DataType::LONGVARCHAR == nDataType || DataType::LONGVARBINARY == nDataType )
+ else if (OBJ_FM_IMAGECONTROL == _nControlObjectID || DataType::LONGVARCHAR == nDataType || DataType::LONGVARBINARY == nDataType )
szControlSize = aDefImageSize;
else
szControlSize = aDefSize;
@@ -1730,101 +1534,46 @@ void FmXFormView::createControlLabelPair(SdrView* /*_pView*/,OutputDevice* _pOut
// normieren wie oben
szControlSize.Width() = long(Fraction(szControlSize.Width(), 1) * eTargetMode.GetScaleX());
szControlSize.Height() = long(Fraction(szControlSize.Height(), 1) * eTargetMode.GetScaleY());
- _rpControl->SetLogicRect(
- ::Rectangle( _pOutDev->LogicToLogic(::Point(aRealSize.Width() + _nXOffsetMM, _nYOffsetMM), eSourceMode, eTargetMode),
- _pOutDev->LogicToLogic(szControlSize, eSourceMode, eTargetMode)
- ));
+ pControl->SetLogicRect( ::Rectangle(
+ _rOutDev.LogicToLogic( ::Point( aRealSize.Width() + _nXOffsetMM, _nYOffsetMM ), eSourceMode, eTargetMode ),
+ _rOutDev.LogicToLogic( szControlSize, eSourceMode, eTargetMode )
+ ) );
- // ein paar initiale Einstellungen am ControlModel
- if (xControlSet.is())
- {
- Reference< XPropertySetInfo > xControlPropInfo = xControlSet->getPropertySetInfo();
- // ein paar numersiche Eigenschaften durchschleifen
- if (xControlPropInfo->hasPropertyByName(FM_PROP_DECIMAL_ACCURACY))
- {
- // Number braucht eine Scale
- Any aScaleVal(::comphelper::getNumberFormatDecimals(_rxNumberFormats, nFormatKey));
- xControlSet->setPropertyValue(FM_PROP_DECIMAL_ACCURACY, aScaleVal);
- }
- if (xControlPropInfo->hasPropertyByName(FM_PROP_VALUEMIN) && xControlPropInfo->hasPropertyByName(FM_PROP_VALUEMAX))
- {
- // die minimale/maximale Zahl in diesem Feld
- sal_Int32 nMinValue = -1000000000, nMaxValue = 1000000000;
- switch (nDataType)
- {
- case DataType::TINYINT : nMinValue = 0; nMaxValue = 255; break;
- case DataType::SMALLINT : nMinValue = -32768; nMaxValue = 32767; break;
- case DataType::INTEGER : nMinValue = 0x80000000; nMaxValue = 0x7FFFFFFF; break;
- // um die doubles/singles kuemmere ich mich nicht, da es ein wenig sinnlos ist
- }
-
- Any aVal;
-
- Property aMinProp = xControlPropInfo->getPropertyByName(FM_PROP_VALUEMIN);
- if (aMinProp.Type.getTypeClass() == TypeClass_DOUBLE)
- aVal <<= (double)nMinValue;
- else if (aMinProp.Type.getTypeClass() == TypeClass_LONG)
- aVal <<= (sal_Int32)nMinValue;
- else
- {
- DBG_ERROR("FmXFormView::createControlLabelPair: unexpected property type (MinValue)!");
- }
- xControlSet->setPropertyValue(FM_PROP_VALUEMIN,aVal);
+ // some initializations
+ Reference< XPropertySetInfo > xControlPropInfo = xControlSet->getPropertySetInfo();
- Property aMaxProp = xControlPropInfo->getPropertyByName(FM_PROP_VALUEMAX);
- if (aMaxProp.Type.getTypeClass() == TypeClass_DOUBLE)
- aVal <<= (double)nMaxValue;
- else if (aMaxProp.Type.getTypeClass() == TypeClass_LONG)
- aVal <<= (sal_Int32)nMaxValue;
- else
- {
- DBG_ERROR("FmXFormView::createControlLabelPair: unexpected property type (MaxValue)!");
- }
- xControlSet->setPropertyValue(FM_PROP_VALUEMAX,aVal);
- }
+ if ( aFieldName.hasValue() )
+ {
+ xControlSet->setPropertyValue(FM_PROP_CONTROLSOURCE, aFieldName);
+ xControlSet->setPropertyValue(FM_PROP_NAME, aFieldName);
+ }
- if (xControlPropInfo->hasPropertyByName(FM_PROP_STRICTFORMAT))
- { // Formatueberpruefung fue numeric fields standardmaessig sal_True
- sal_Bool bB(sal_True);
- Any aVal(&bB,getBooleanCppuType());
- xControlSet->setPropertyValue(FM_PROP_STRICTFORMAT, aVal);
- }
+ if ( nDataType == DataType::LONGVARCHAR && xControlPropInfo->hasPropertyByName( FM_PROP_MULTILINE ) )
+ {
+ xControlSet->setPropertyValue( FM_PROP_MULTILINE, makeAny( sal_Bool( sal_True ) ) );
+ }
- if ( aFieldName.hasValue() )
+ // announce the label to the control
+ if (xControlPropInfo->hasPropertyByName(FM_PROP_CONTROLLABEL))
+ {
+ // (try-catch as the control may refuse a model without the right service name - which we don't know
+ // usually a fixed text we use as label should be accepted, but to be sure ....)
+ try
{
- xControlSet->setPropertyValue(FM_PROP_CONTROLSOURCE, aFieldName);
- xControlSet->setPropertyValue(FM_PROP_NAME, aFieldName);
+ xControlSet->setPropertyValue(FM_PROP_CONTROLLABEL, makeAny(xLabelSet));
}
-
- if (nDataType == DataType::LONGVARCHAR && xControlPropInfo->hasPropertyByName(FM_PROP_MULTILINE) )
+ catch( const Exception& )
{
- sal_Bool bB(sal_True);
- xControlSet->setPropertyValue(FM_PROP_MULTILINE,Any(&bB,getBooleanCppuType()));
+ DBG_UNHANDLED_EXCEPTION();
}
+ }
- if (_nObjID == OBJ_FM_CHECKBOX)
- {
- sal_Int32 nNullable = ColumnValue::NULLABLE_UNKNOWN;
- if( _rxField.is() )
- _rxField->getPropertyValue( FM_PROP_ISNULLABLE ) >>= nNullable;
- xControlSet->setPropertyValue( FM_PROP_TRISTATE, makeAny( sal_Bool( ColumnValue::NULLABLE == nNullable ) ) );
- }
+ FormControlFactory aControlFactory( _rContext );
+ aControlFactory.initializeFieldDependentProperties( _rxField, xControlSet, _rxNumberFormats );
- // announce the label to the control
- if (xControlPropInfo->hasPropertyByName(FM_PROP_CONTROLLABEL))
- {
- // (try-catch as the control may refuse a model without the right service name - which we don't know
- // usually a fixed text we use as label should be accepted, but to be sure ....)
- try
- {
- xControlSet->setPropertyValue(FM_PROP_CONTROLLABEL, makeAny(xLabelSet));
- }
- catch(Exception&)
- {
- DBG_ERROR("FmXFormView::createControlLabelPair : could not marry the control and the label !");
- }
- }
- }
+ _rpLabel = pLabel.release();
+ _rpControl = pControl.release();
+ return true;
}
//------------------------------------------------------------------------------
@@ -2039,8 +1788,7 @@ void SAL_CALL FmXFormView::focusGained( const FocusEvent& /*e*/ ) throw (Runtime
{
if ( m_xWindow.is() && m_pView )
{
- m_pView->SetMoveOutside(TRUE);
- //OLMm_pView->RefreshAllIAOManagers();
+ m_pView->SetMoveOutside( TRUE, FmFormView::ImplAccess() );
}
}
// -----------------------------------------------------------------------------
@@ -2050,8 +1798,7 @@ void SAL_CALL FmXFormView::focusLost( const FocusEvent& /*e*/ ) throw (RuntimeEx
// so we can not remove us as focus listener
if ( m_xWindow.is() && m_pView )
{
- m_pView->SetMoveOutside(FALSE);
- //OLMm_pView->RefreshAllIAOManagers();
+ m_pView->SetMoveOutside( FALSE, FmFormView::ImplAccess() );
}
}
// -----------------------------------------------------------------------------
@@ -2062,12 +1809,16 @@ void FmXFormView::removeGridWindowListening()
m_xWindow->removeFocusListener(this);
if ( m_pView )
{
- m_pView->SetMoveOutside(FALSE);
- //OLMm_pView->RefreshAllIAOManagers();
+ m_pView->SetMoveOutside( FALSE, FmFormView::ImplAccess() );
}
m_xWindow = NULL;
}
}
-// -----------------------------------------------------------------------------
-
+// -----------------------------------------------------------------------------
+DocumentType FmXFormView::impl_getDocumentType() const
+{
+ if ( GetFormShell() && GetFormShell()->GetImpl() )
+ return GetFormShell()->GetImpl()->getDocumentType();
+ return eUnknownDocumentType;
+}
diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx
new file mode 100644
index 0000000000..b440eca39e
--- /dev/null
+++ b/svx/source/form/formcontrolfactory.cxx
@@ -0,0 +1,738 @@
+/*************************************************************************
+* 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: formcontrolfactory.cxx,v $
+*
+* $Revision: 1.1.2.3 $
+*
+* 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_svx.hxx"
+
+#include "dbtoolsclient.hxx"
+#include "formcontrolfactory.hxx"
+#include "fmcontrollayout.hxx"
+#include "fmprop.hrc"
+#include "fmresids.hrc"
+#include "svx/dialmgr.hxx"
+#include "svx/svdouno.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/form/XFormComponent.hpp>
+#include <com/sun/star/form/FormComponentType.hpp>
+#include <com/sun/star/awt/ScrollBarOrientation.hpp>
+#include <com/sun/star/form/XGridColumnFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/awt/LineEndFormat.hpp>
+#include <com/sun/star/awt/ImageScaleMode.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/util/XNumberFormatTypes.hpp>
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/numbers.hxx>
+#include <svtools/syslocale.hxx>
+#include <tools/gen.hxx>
+#include <tools/diagnose_ex.h>
+
+#include <set>
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ /** === 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::beans::XPropertySet;
+ using ::com::sun::star::awt::XControlModel;
+ using ::com::sun::star::form::XFormComponent;
+ using ::com::sun::star::container::XIndexAccess;
+ using ::com::sun::star::beans::XPropertySetInfo;
+ using ::com::sun::star::beans::PropertyValue;
+ using ::com::sun::star::container::XChild;
+ using ::com::sun::star::form::XGridColumnFactory;
+ using ::com::sun::star::lang::XServiceInfo;
+ using ::com::sun::star::style::XStyleFamiliesSupplier;
+ using ::com::sun::star::container::XNameAccess;
+ using ::com::sun::star::style::VerticalAlignment_MIDDLE;
+ using ::com::sun::star::beans::Property;
+ using ::com::sun::star::uno::TypeClass_DOUBLE;
+ using ::com::sun::star::uno::TypeClass_LONG;
+ using ::com::sun::star::util::XNumberFormats;
+ using ::com::sun::star::util::XNumberFormatTypes;
+ /** === end UNO using === **/
+ namespace FormComponentType = ::com::sun::star::form::FormComponentType;
+ namespace ScrollBarOrientation = ::com::sun::star::awt::ScrollBarOrientation;
+ namespace LineEndFormat = ::com::sun::star::awt::LineEndFormat;
+ namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode;
+ namespace DataType = ::com::sun::star::sdbc::DataType;
+ namespace ColumnValue = ::com::sun::star::sdbc::ColumnValue;
+
+ //====================================================================
+ //= FormControlFactory_Data
+ //====================================================================
+ struct FormControlFactory_Data
+ {
+ ::comphelper::ComponentContext m_aContext;
+
+ FormControlFactory_Data( const ::comphelper::ComponentContext& _rContext )
+ :m_aContext( _rContext )
+ {
+ }
+ };
+
+ //====================================================================
+ //= FormControlFactory
+ //====================================================================
+ //--------------------------------------------------------------------
+ FormControlFactory::FormControlFactory( const ::comphelper::ComponentContext& _rContext )
+ :m_pData( new FormControlFactory_Data( _rContext ) )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ FormControlFactory::~FormControlFactory()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int16 FormControlFactory::initializeControlModel( const DocumentType _eDocType, const SdrUnoObj& _rObject )
+ {
+ return initializeControlModel(
+ _eDocType,
+ Reference< XPropertySet >( _rObject.GetUnoControlModel(), UNO_QUERY ),
+ _rObject.GetCurrentBoundRect()
+ );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int16 FormControlFactory::initializeControlModel( const DocumentType _eDocType, const Reference< XPropertySet >& _rxControlModel )
+ {
+ return initializeControlModel(
+ _eDocType, _rxControlModel, Rectangle()
+ );
+ }
+
+ // -----------------------------------------------------------------------------
+ namespace
+ {
+ //....................................................................
+ static ::rtl::OUString lcl_getUniqueLabel_nothrow( const Reference< XPropertySet >& _rxControlModel, const ::rtl::OUString& _rBaseLabel )
+ {
+ ::rtl::OUString sLabel( _rBaseLabel );
+ try
+ {
+ typedef ::std::set< ::rtl::OUString > StringBag;
+ StringBag aUsedLabels;
+
+ Reference< XFormComponent > xFormComponent( _rxControlModel, UNO_QUERY_THROW );
+ Reference< XIndexAccess > xContainer( xFormComponent->getParent(), UNO_QUERY_THROW );
+ // loop through all siblings of the control model, and collect their labels
+ for ( sal_Int32 index=xContainer->getCount(); index>0; )
+ {
+ Reference< XPropertySet > xElement( xContainer->getByIndex( --index ), UNO_QUERY_THROW );
+ if ( xElement == _rxControlModel )
+ continue;
+
+ Reference< XPropertySetInfo > xPSI( xElement->getPropertySetInfo(), UNO_SET_THROW );
+ if ( !xPSI->hasPropertyByName( FM_PROP_LABEL ) )
+ continue;
+
+ ::rtl::OUString sElementLabel;
+ OSL_VERIFY( xElement->getPropertyValue( FM_PROP_LABEL ) >>= sElementLabel );
+ aUsedLabels.insert( sElementLabel );
+ }
+
+ // now find a free label
+ sal_Int32 i=2;
+ while ( aUsedLabels.find( sLabel ) != aUsedLabels.end() )
+ {
+ ::rtl::OUStringBuffer aBuffer( _rBaseLabel );
+ aBuffer.appendAscii( " " );
+ aBuffer.append( (sal_Int32)i++ );
+ sLabel = aBuffer.makeStringAndClear();
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return sLabel;
+ }
+
+ //....................................................................
+ static Sequence< PropertyValue > lcl_getDataSourceIndirectProperties( const Reference< XPropertySet >& _rxControlModel,
+ const ::comphelper::ComponentContext& _rContext )
+ {
+ OSL_PRECOND( _rxControlModel.is(), "lcl_getDataSourceIndirectProperties: invalid model!" );
+
+ Sequence< PropertyValue > aInfo;
+ try
+ {
+ Reference< XChild > xChild( _rxControlModel, UNO_QUERY );
+ Reference< XPropertySet > xForm;
+ if ( xChild.is() )
+ xForm = xForm.query( xChild->getParent() );
+
+ if ( Reference< XGridColumnFactory >( xForm, UNO_QUERY ).is() )
+ { // hmm. the model is a grid column, in real
+ xChild = xChild.query( xForm );
+ xForm = xForm.query( xChild->getParent() );
+ }
+
+ OSL_ENSURE( xForm.is(), "lcl_getDataSourceIndirectProperties: could not determine the form!" );
+ if ( !xForm.is() )
+ return aInfo;
+ ::rtl::OUString sDataSourceName;
+ xForm->getPropertyValue( FM_PROP_DATASOURCE ) >>= sDataSourceName;
+
+ Reference< XPropertySet > xDsProperties;
+ if ( sDataSourceName.getLength() )
+ xDsProperties = xDsProperties.query( OStaticDataAccessTools().getDataSource( sDataSourceName, _rContext.getLegacyServiceFactory() ) );
+ if ( xDsProperties.is() )
+ xDsProperties->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Info" ) ) ) >>= aInfo;
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "lcl_getDataSourceIndirectProperties: caught an exception!" );
+ }
+ return aInfo;
+ }
+ /*
+ ATTENTION!
+ Broken for solaris? It seems that the old used template argument TYPE was already
+ defined as a macro ... which expand to ... "TYPE "!?
+ All platforms are OK - excepting Solaris. There the line "template< class TYPE >"
+ was expanded to "template < class TYPE " where the closing ">" was missing.
+ */
+ #ifdef MYTYPE
+ #error "Who defines the macro MYTYPE, which is used as template argument here?"
+ #endif
+
+ //....................................................................
+ template< class MYTYPE >
+ Reference< MYTYPE > getTypedModelNode( const Reference< XInterface >& _rxModelNode )
+ {
+ Reference< MYTYPE > xTypedNode( _rxModelNode, UNO_QUERY );
+ if ( xTypedNode.is() )
+ return xTypedNode;
+ else
+ {
+ Reference< XChild > xChild( _rxModelNode, UNO_QUERY );
+ if ( xChild.is() )
+ return getTypedModelNode< MYTYPE >( xChild->getParent() );
+ else
+ return NULL;
+ }
+ }
+
+ //....................................................................
+ static bool lcl_getDocumentDefaultStyleAndFamily( const Reference< XInterface >& _rxDocument, ::rtl::OUString& _rFamilyName, ::rtl::OUString& _rStyleName ) SAL_THROW(( Exception ))
+ {
+ bool bSuccess = true;
+ Reference< XServiceInfo > xDocumentSI( _rxDocument, UNO_QUERY );
+ if ( xDocumentSI.is() )
+ {
+ if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ) )
+ || xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.WebDocument" ) ) )
+ )
+ {
+ _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParagraphStyles" ) );
+ _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
+ }
+ else if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.SpreadsheetDocument" ) ) ) )
+ {
+ _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CellStyles" ) );
+ _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Default" ) );
+ }
+ else if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) ) )
+ || xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) )
+ )
+ {
+ _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "graphics" ) );
+ _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "standard" ) );
+ }
+ else
+ bSuccess = false;
+ }
+ return bSuccess;
+ }
+
+ //....................................................................
+ static const sal_Char* aCharacterAndParagraphProperties[] =
+ {
+ "CharFontName",
+ "CharFontStyleName",
+ "CharFontFamily",
+ "CharFontCharSet",
+ "CharFontPitch",
+ "CharColor",
+ "CharEscapement",
+ "CharHeight",
+ "CharUnderline",
+ "CharWeight",
+ "CharPosture",
+ "CharAutoKerning",
+ "CharBackColor",
+ "CharBackTransparent",
+ "CharCaseMap",
+ "CharCrossedOut",
+ "CharFlash",
+ "CharStrikeout",
+ "CharWordMode",
+ "CharKerning",
+ "CharLocale",
+ "CharKeepTogether",
+ "CharNoLineBreak",
+ "CharShadowed",
+ "CharFontType",
+ "CharStyleName",
+ "CharContoured",
+ "CharCombineIsOn",
+ "CharCombinePrefix",
+ "CharCombineSuffix",
+ "CharEmphasize",
+ "CharRelief",
+ "RubyText",
+ "RubyAdjust",
+ "RubyCharStyleName",
+ "RubyIsAbove",
+ "CharRotation",
+ "CharRotationIsFitToLine",
+ "CharScaleWidth",
+ "HyperLinkURL",
+ "HyperLinkTarget",
+ "HyperLinkName",
+ "VisitedCharStyleName",
+ "UnvisitedCharStyleName",
+ "CharEscapementHeight",
+ "CharNoHyphenation",
+ "CharUnderlineColor",
+ "CharUnderlineHasColor",
+ "CharStyleNames",
+ "CharHeightAsian",
+ "CharWeightAsian",
+ "CharFontNameAsian",
+ "CharFontStyleNameAsian",
+ "CharFontFamilyAsian",
+ "CharFontCharSetAsian",
+ "CharFontPitchAsian",
+ "CharPostureAsian",
+ "CharLocaleAsian",
+ "ParaIsCharacterDistance",
+ "ParaIsForbiddenRules",
+ "ParaIsHangingPunctuation",
+ "CharHeightComplex",
+ "CharWeightComplex",
+ "CharFontNameComplex",
+ "CharFontStyleNameComplex",
+ "CharFontFamilyComplex",
+ "CharFontCharSetComplex",
+ "CharFontPitchComplex",
+ "CharPostureComplex",
+ "CharLocaleComplex",
+ "ParaAdjust",
+ "ParaLineSpacing",
+ "ParaBackColor",
+ "ParaBackTransparent",
+ "ParaBackGraphicURL",
+ "ParaBackGraphicFilter",
+ "ParaBackGraphicLocation",
+ "ParaLastLineAdjust",
+ "ParaExpandSingleWord",
+ "ParaLeftMargin",
+ "ParaRightMargin",
+ "ParaTopMargin",
+ "ParaBottomMargin",
+ "ParaLineNumberCount",
+ "ParaLineNumberStartValue",
+ "PageDescName",
+ "PageNumberOffset",
+ "ParaRegisterModeActive",
+ "ParaTabStops",
+ "ParaStyleName",
+ "DropCapFormat",
+ "DropCapWholeWord",
+ "ParaKeepTogether",
+ "Setting",
+ "ParaSplit",
+ "Setting",
+ "NumberingLevel",
+ "NumberingRules",
+ "NumberingStartValue",
+ "ParaIsNumberingRestart",
+ "NumberingStyleName",
+ "ParaOrphans",
+ "ParaWidows",
+ "ParaShadowFormat",
+ "LeftBorder",
+ "RightBorder",
+ "TopBorder",
+ "BottomBorder",
+ "BorderDistance",
+ "LeftBorderDistance",
+ "RightBorderDistance",
+ "TopBorderDistance",
+ "BottomBorderDistance",
+ "BreakType",
+ "DropCapCharStyleName",
+ "ParaFirstLineIndent",
+ "ParaIsAutoFirstLineIndent",
+ "ParaIsHyphenation",
+ "ParaHyphenationMaxHyphens",
+ "ParaHyphenationMaxLeadingChars",
+ "ParaHyphenationMaxTrailingChars",
+ "ParaVertAlignment",
+ "ParaUserDefinedAttributes",
+ "NumberingIsNumber",
+ "ParaIsConnectBorder",
+ NULL
+ };
+
+ //....................................................................
+ static void lcl_initializeCharacterAttributes( const Reference< XPropertySet >& _rxModel )
+ {
+ // need to initialize the attributes from the "Default" style of the document we live in
+
+ try
+ {
+ // the style family collection
+ Reference< XStyleFamiliesSupplier > xSuppStyleFamilies = getTypedModelNode< XStyleFamiliesSupplier >( _rxModel.get() );
+ Reference< XNameAccess > xStyleFamilies;
+ if ( xSuppStyleFamilies.is() )
+ xStyleFamilies = xSuppStyleFamilies->getStyleFamilies();
+ OSL_ENSURE( xStyleFamilies.is(), "lcl_initializeCharacterAttributes: could not obtain the style families!" );
+ if ( !xStyleFamilies.is() )
+ return;
+
+ // the names of the family, and the style - depends on the document type we live in
+ ::rtl::OUString sFamilyName, sStyleName;
+ bool bKnownDocumentType = lcl_getDocumentDefaultStyleAndFamily( xSuppStyleFamilies.get(), sFamilyName, sStyleName );
+ OSL_ENSURE( bKnownDocumentType, "lcl_initializeCharacterAttributes: Huh? What document type is this?" );
+ if ( !bKnownDocumentType )
+ return;
+
+ // the concrete style
+ Reference< XNameAccess > xStyleFamily( xStyleFamilies->getByName( sFamilyName ), UNO_QUERY );
+ Reference< XPropertySet > xStyle;
+ if ( xStyleFamily.is() )
+ xStyleFamily->getByName( sStyleName ) >>= xStyle;
+ OSL_ENSURE( xStyle.is(), "lcl_initializeCharacterAttributes: could not retrieve the style!" );
+ if ( !xStyle.is() )
+ return;
+
+ // transfer all properties which are described by the com.sun.star.style.
+ Reference< XPropertySetInfo > xSourcePropInfo( xStyle->getPropertySetInfo() );
+ Reference< XPropertySetInfo > xDestPropInfo( _rxModel->getPropertySetInfo() );
+ OSL_ENSURE( xSourcePropInfo.is() && xDestPropInfo.is(), "lcl_initializeCharacterAttributes: no property set info!" );
+ if ( !xSourcePropInfo.is() || !xDestPropInfo.is() )
+ return;
+
+ ::rtl::OUString sPropertyName;
+ const sal_Char** pCharacterProperty = aCharacterAndParagraphProperties;
+ while ( *pCharacterProperty )
+ {
+ sPropertyName = ::rtl::OUString::createFromAscii( *pCharacterProperty );
+
+ if ( xSourcePropInfo->hasPropertyByName( sPropertyName ) && xDestPropInfo->hasPropertyByName( sPropertyName ) )
+ _rxModel->setPropertyValue( sPropertyName, xStyle->getPropertyValue( sPropertyName ) );
+
+ ++pCharacterProperty;
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int16 FormControlFactory::initializeControlModel( const DocumentType _eDocType, const Reference< XPropertySet >& _rxControlModel,
+ const Rectangle& _rControlBoundRect )
+ {
+ sal_Int16 nClassId = FormComponentType::CONTROL;
+
+ OSL_ENSURE( _rxControlModel.is(), "FormControlFactory::initializeControlModel: invalid model!" );
+ if ( !_rxControlModel.is() )
+ return nClassId;
+
+ try
+ {
+ ControlLayouter::initializeControlLayout( _rxControlModel, _eDocType );
+
+ _rxControlModel->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId;
+ Reference< XPropertySetInfo > xPSI( _rxControlModel->getPropertySetInfo(), UNO_SET_THROW );
+ switch ( nClassId )
+ {
+ case FormComponentType::SCROLLBAR:
+ _rxControlModel->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LiveScroll" ) ), makeAny( (sal_Bool)sal_True ) );
+ // NO break!
+ case FormComponentType::SPINBUTTON:
+ {
+ sal_Int32 eOrientation = ScrollBarOrientation::HORIZONTAL;
+ if ( !_rControlBoundRect.IsEmpty() && ( _rControlBoundRect.GetWidth() < _rControlBoundRect.GetHeight() ) )
+ eOrientation = ScrollBarOrientation::VERTICAL;
+ _rxControlModel->setPropertyValue( FM_PROP_ORIENTATION, makeAny( eOrientation ) );
+ }
+ break;
+
+ case FormComponentType::LISTBOX:
+ case FormComponentType::COMBOBOX:
+ {
+ sal_Bool bDropDown = !_rControlBoundRect.IsEmpty() && ( _rControlBoundRect.GetWidth() >= 3 * _rControlBoundRect.GetHeight() );
+ _rxControlModel->setPropertyValue( FM_PROP_DROPDOWN, makeAny( (sal_Bool)bDropDown ) );
+ }
+ break;
+
+ case FormComponentType::TEXTFIELD:
+ {
+ initializeTextFieldLineEnds( _rxControlModel );
+ lcl_initializeCharacterAttributes( _rxControlModel );
+
+ if ( !_rControlBoundRect.IsEmpty()
+ && !( _rControlBoundRect.GetWidth() > 4 * _rControlBoundRect.GetHeight() )
+ )
+ {
+ if ( xPSI->hasPropertyByName( FM_PROP_MULTILINE ) )
+ _rxControlModel->setPropertyValue( FM_PROP_MULTILINE, makeAny( (sal_Bool)sal_True ) );
+ }
+ }
+ break;
+
+ case FormComponentType::RADIOBUTTON:
+ case FormComponentType::CHECKBOX:
+ case FormComponentType::FIXEDTEXT:
+ {
+ ::rtl::OUString sVertAlignPropertyName( RTL_CONSTASCII_USTRINGPARAM( "VerticalAlign" ) );
+ if ( xPSI->hasPropertyByName( sVertAlignPropertyName ) )
+ _rxControlModel->setPropertyValue( sVertAlignPropertyName, makeAny( VerticalAlignment_MIDDLE ) );
+ }
+ break;
+
+ case FormComponentType::IMAGEBUTTON:
+ case FormComponentType::IMAGECONTROL:
+ {
+ const ::rtl::OUString sScaleModeProperty( RTL_CONSTASCII_USTRINGPARAM( "ScaleMode" ) );
+ if ( xPSI->hasPropertyByName( sScaleModeProperty ) )
+ _rxControlModel->setPropertyValue( sScaleModeProperty, makeAny( ImageScaleMode::Isotropic ) );
+ }
+ break;
+ }
+
+ // initial default label for the control
+ if ( xPSI->hasPropertyByName( FM_PROP_LABEL ) )
+ {
+ ::rtl::OUString sExistingLabel;
+ OSL_VERIFY( _rxControlModel->getPropertyValue( FM_PROP_LABEL ) >>= sExistingLabel );
+ if ( !sExistingLabel.getLength() )
+ {
+ ::rtl::OUString sInitialLabel;
+ OSL_VERIFY( _rxControlModel->getPropertyValue( FM_PROP_NAME ) >>= sInitialLabel );
+
+ sal_uInt16 nTitleResId = 0;
+ switch ( nClassId )
+ {
+ case FormComponentType::COMMANDBUTTON: nTitleResId = RID_STR_PROPTITLE_PUSHBUTTON; break;
+ case FormComponentType::RADIOBUTTON: nTitleResId = RID_STR_PROPTITLE_RADIOBUTTON; break;
+ case FormComponentType::CHECKBOX: nTitleResId = RID_STR_PROPTITLE_CHECKBOX; break;
+ case FormComponentType::GROUPBOX: nTitleResId = RID_STR_PROPTITLE_GROUPBOX; break;
+ case FormComponentType::FIXEDTEXT: nTitleResId = RID_STR_PROPTITLE_FIXEDTEXT; break;
+ }
+
+ if ( nTitleResId )
+ sInitialLabel = String( SVX_RES( nTitleResId ) );
+
+ _rxControlModel->setPropertyValue(
+ FM_PROP_LABEL,
+ makeAny( lcl_getUniqueLabel_nothrow( _rxControlModel, sInitialLabel ) )
+ );
+ }
+ }
+
+ // strict format = yes is the default (i93467)
+ if ( xPSI->hasPropertyByName( FM_PROP_STRICTFORMAT ) )
+ {
+ _rxControlModel->setPropertyValue( FM_PROP_STRICTFORMAT, makeAny( sal_Bool( sal_True ) ) );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return nClassId;
+ }
+
+ //------------------------------------------------------------------------------
+ void FormControlFactory::initializeTextFieldLineEnds( const Reference< XPropertySet >& _rxModel )
+ {
+ OSL_PRECOND( _rxModel.is(), "initializeTextFieldLineEnds: invalid model!" );
+ if ( !_rxModel.is() )
+ return;
+
+ try
+ {
+ Reference< XPropertySetInfo > xInfo = _rxModel->getPropertySetInfo();
+ if ( !xInfo.is() || !xInfo->hasPropertyByName( FM_PROP_LINEENDFORMAT ) )
+ return;
+
+ // let's see if the data source which the form belongs to (if any)
+ // has a setting for the preferred line end format
+ sal_Bool bDosLineEnds = sal_False;
+ Sequence< PropertyValue > aInfo = lcl_getDataSourceIndirectProperties( _rxModel, m_pData->m_aContext );
+ const PropertyValue* pInfo = aInfo.getConstArray();
+ const PropertyValue* pInfoEnd = pInfo + aInfo.getLength();
+ for ( ; pInfo != pInfoEnd; ++pInfo )
+ {
+ if ( pInfo->Name.equalsAscii( "PreferDosLikeLineEnds" ) )
+ {
+ pInfo->Value >>= bDosLineEnds;
+ break;
+ }
+ }
+
+ sal_Int16 nLineEndFormat = bDosLineEnds ? LineEndFormat::CARRIAGE_RETURN_LINE_FEED : LineEndFormat::LINE_FEED;
+ _rxModel->setPropertyValue( FM_PROP_LINEENDFORMAT, makeAny( nLineEndFormat ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------------
+ void FormControlFactory::initializeFieldDependentProperties( const Reference< XPropertySet >& _rxDatabaseField,
+ const Reference< XPropertySet >& _rxControlModel, const Reference< XNumberFormats >& _rxNumberFormats )
+ {
+ OSL_PRECOND( _rxDatabaseField.is() && _rxControlModel.is(),
+ "FormControlFactory::initializeFieldDependentProperties: illegal params!" );
+ if ( !_rxDatabaseField.is() || !_rxControlModel.is() )
+ return;
+
+ try
+ {
+ ////////////////////////////////////////////////////////////////////////
+ // if the field has a numeric format, and the model has a "Scale" property, sync it
+ Reference< XPropertySetInfo > xFieldPSI( _rxDatabaseField->getPropertySetInfo(), UNO_SET_THROW );
+ Reference< XPropertySetInfo > xModelPSI( _rxControlModel->getPropertySetInfo(), UNO_SET_THROW );
+
+ if ( xModelPSI->hasPropertyByName( FM_PROP_DECIMAL_ACCURACY ) )
+ {
+ sal_Int32 nFormatKey = 0;
+ if ( xFieldPSI->hasPropertyByName( FM_PROP_FORMATKEY ) )
+ {
+ _rxDatabaseField->getPropertyValue( FM_PROP_FORMATKEY ) >>= nFormatKey;
+ }
+ else
+ {
+ nFormatKey = OStaticDataAccessTools().getDefaultNumberFormat(
+ _rxDatabaseField,
+ Reference< XNumberFormatTypes >( _rxNumberFormats, UNO_QUERY ),
+ SvtSysLocale().GetLocaleData().getLocale()
+ );
+ }
+
+ Any aScaleVal( ::comphelper::getNumberFormatDecimals( _rxNumberFormats, nFormatKey ) );
+ _rxControlModel->setPropertyValue( FM_PROP_DECIMAL_ACCURACY, aScaleVal );
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // minimum and maximum of the control according to the type of the database field
+ sal_Int32 nDataType = DataType::OTHER;
+ OSL_VERIFY( _rxDatabaseField->getPropertyValue( FM_PROP_FIELDTYPE ) >>= nDataType );
+
+ if ( xModelPSI->hasPropertyByName( FM_PROP_VALUEMIN )
+ && xModelPSI->hasPropertyByName( FM_PROP_VALUEMAX )
+ )
+ {
+ sal_Int32 nMinValue = -1000000000, nMaxValue = 1000000000;
+ switch ( nDataType )
+ {
+ case DataType::TINYINT : nMinValue = 0; nMaxValue = 255; break;
+ case DataType::SMALLINT : nMinValue = -32768; nMaxValue = 32767; break;
+ case DataType::INTEGER : nMinValue = 0x80000000; nMaxValue = 0x7FFFFFFF; break;
+ // double and singles are ignored
+ }
+
+ Any aValue;
+
+ // both the minimum and the maximum value properties can be either Long or Double
+ Property aProperty = xModelPSI->getPropertyByName( FM_PROP_VALUEMIN );
+ if ( aProperty.Type.getTypeClass() == TypeClass_DOUBLE )
+ aValue <<= (double)nMinValue;
+ else if ( aProperty.Type.getTypeClass() == TypeClass_LONG )
+ aValue <<= (sal_Int32)nMinValue;
+ else
+ {
+ DBG_ERROR( "FormControlFactory::initializeFieldDependentProperties: unexpected property type (MinValue)!" );
+ }
+ _rxControlModel->setPropertyValue( FM_PROP_VALUEMIN, aValue );
+
+ // both the minimum and the maximum value properties can be either Long or Double
+ aProperty = xModelPSI->getPropertyByName( FM_PROP_VALUEMAX );
+ if ( aProperty.Type.getTypeClass() == TypeClass_DOUBLE )
+ aValue <<= (double)nMaxValue;
+ else if ( aProperty.Type.getTypeClass() == TypeClass_LONG )
+ aValue <<= (sal_Int32)nMaxValue;
+ else
+ {
+ DBG_ERROR( "FormControlFactory::initializeFieldDependentProperties: unexpected property type (MaxValue)!" );
+ }
+ _rxControlModel->setPropertyValue( FM_PROP_VALUEMAX, aValue );
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // a check box can be tristate if and only if the column it is bound to is nullable
+ sal_Int16 nClassId = FormComponentType::CONTROL;
+ OSL_VERIFY( _rxControlModel->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId );
+ if ( nClassId == FormComponentType::CHECKBOX )
+ {
+ sal_Int32 nNullable = ColumnValue::NULLABLE_UNKNOWN;
+ OSL_VERIFY( _rxDatabaseField->getPropertyValue( FM_PROP_ISNULLABLE ) >>= nNullable );
+ _rxControlModel->setPropertyValue( FM_PROP_TRISTATE, makeAny( sal_Bool( ColumnValue::NO_NULLS != nNullable ) ) );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+//........................................................................
+} // namespace svxform
+//........................................................................
diff --git a/svx/source/form/makefile.mk b/svx/source/form/makefile.mk
index 238faf5e34..3d405edc00 100644
--- a/svx/source/form/makefile.mk
+++ b/svx/source/form/makefile.mk
@@ -8,7 +8,7 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.35 $
+# $Revision: 1.35.2.2 $
#
# This file is part of OpenOffice.org.
#
@@ -105,7 +105,9 @@ SLOFILES = \
$(SLO)$/datalistener.obj \
$(SLO)$/fmscriptingenv.obj \
$(SLO)$/stringlistresource.obj \
- $(SLO)$/databaselocationinput.obj
+ $(SLO)$/databaselocationinput.obj \
+ $(SLO)$/delayedevent.obj \
+ $(SLO)$/formcontrolfactory.obj
.IF "$(OS)$(CPU)"=="SOLARISI"
NOOPTFILES=$(SLO)$/fmprop.obj
diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx
index a146052ecd..936adb60c9 100644
--- a/svx/source/form/navigatortree.cxx
+++ b/svx/source/form/navigatortree.cxx
@@ -37,21 +37,16 @@
#include <svx/svdpagv.hxx>
#include "svditer.hxx"
-#ifndef _SVX_FMHELP_HRC
#include "fmhelp.hrc"
-#endif
-#ifndef _SVX_FMEXPL_HRC
#include "fmexpl.hrc"
-#endif
#include "fmexpl.hxx"
-#ifndef _SVX_FMRESIDS_HRC
#include "fmresids.hrc"
-#endif
#include "fmshimp.hxx"
#include "fmservs.hxx"
#include "fmundo.hxx"
#include "fmpgeimp.hxx"
#include "fmitems.hxx"
+#include "fmobj.hxx"
#include <vcl/wrkwin.hxx>
#include <sfx2/viewsh.hxx>
#include <sfx2/dispatch.hxx>
@@ -112,23 +107,20 @@ namespace svxform
SdrObjListIter aIter( *_pPage );
while ( aIter.IsMore() )
{
- // get the shape
- SdrObject* pShape = aIter.Next();
+ SdrObject* pSdrObject = aIter.Next();
+ FmFormObj* pFormObject = FmFormObj::GetFormObject( pSdrObject );
+ if ( !pFormObject )
+ continue;
- // is it a UNO control shape?
- if ( pShape->IsUnoObj() )
- {
- Reference< XInterface > xNormalizedModel;
- xNormalizedModel = xNormalizedModel.query( ( static_cast< SdrUnoObj* >( pShape )->GetUnoControlModel() ) );
- // note that this is normalized (i.e. queried for XInterface explicitly)
+ Reference< XInterface > xNormalizedModel( pFormObject->GetUnoControlModel(), UNO_QUERY );
+ // note that this is normalized (i.e. queried for XInterface explicitly)
#ifdef DBG_UTIL
- ::std::pair< MapModelToShape::iterator, bool > aPos =
+ ::std::pair< MapModelToShape::iterator, bool > aPos =
#endif
- _rMapping.insert( ModelShapePair( xNormalizedModel, pShape ) );
- DBG_ASSERT( aPos.second, "collectShapeModelMapping: model was already existent!" );
- // if this asserts, this would mean we have 2 shapes pointing to the same model
- }
+ _rMapping.insert( ModelShapePair( xNormalizedModel, pSdrObject ) );
+ DBG_ASSERT( aPos.second, "collectShapeModelMapping: model was already existent!" );
+ // if this asserts, this would mean we have 2 shapes pointing to the same model
}
}
@@ -2183,46 +2175,35 @@ namespace svxform
SdrPageView* pPageView = pFormView->GetSdrPageView();
SdrPage* pPage = pPageView->GetPage();
- SdrObjListIter aIter( *pPage );
- while( aIter.IsMore() )
+ SdrObjListIter aIter( *pPage );
+ while ( aIter.IsMore() )
{
- SdrObject* pObj = aIter.Next();
-
- //////////////////////////////////////////////////////////////////////
- // Es interessieren nur Uno-Objekte
- if( pObj->IsUnoObj() )
- {
- Reference< XInterface > xControlModel(((SdrUnoObj*)pObj)->GetUnoControlModel());
-
- //////////////////////////////////////////////////////////////////////
- // Ist dieses Objekt ein XFormComponent?
- Reference< XFormComponent > xFormViewControl(xControlModel, UNO_QUERY);
- if( !xFormViewControl.is() )
- return;
+ SdrObject* pSdrObject = aIter.Next();
+ FmFormObj* pFormObject = FmFormObj::GetFormObject( pSdrObject );
+ if ( !pFormObject )
+ continue;
- if (xFormViewControl == xFormComponent )
- {
- // Objekt markieren
- if (bMark != pFormView->IsObjMarked(pObj))
- // der Writer mag das leider nicht, wenn schon markierte Objekte noch mal markiert werden ...
- pFormView->MarkObj( pObj, pPageView, !bMark, sal_False );
+ Reference< XInterface > xControlModel( pFormObject->GetUnoControlModel() );
+ if ( xControlModel != xFormComponent )
+ continue;
- // Markierung in allen Fenstern in den sichtbaren Bereich verschieben
- if( bMarkHandles && bMark)
- {
- ::Rectangle aMarkRect( pFormView->GetAllMarkedRect());
+ // mark the object
+ if ( bMark != pFormView->IsObjMarked( pSdrObject ) )
+ // unfortunately, the writer doesn't like marking an already-marked object, again, so reset the mark first
+ pFormView->MarkObj( pSdrObject, pPageView, !bMark, sal_False );
- for(sal_uInt32 a(0L); a < pFormView->PaintWindowCount(); a++)
- {
- SdrPaintWindow* pPaintWindow = pFormView->GetPaintWindow(a);
- OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
+ if ( !bMarkHandles || !bMark )
+ continue;
- if(OUTDEV_WINDOW == rOutDev.GetOutDevType())
- {
- pFormView->MakeVisible(aMarkRect, (Window&)rOutDev);
- }
- }
- }
+ // make the mark visible
+ ::Rectangle aMarkRect( pFormView->GetAllMarkedRect());
+ for ( sal_uInt32 i = 0; i < pFormView->PaintWindowCount(); ++i )
+ {
+ SdrPaintWindow* pPaintWindow = pFormView->GetPaintWindow( i );
+ OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
+ if ( OUTDEV_WINDOW == rOutDev.GetOutDevType() )
+ {
+ pFormView->MakeVisible( aMarkRect, (Window&)rOutDev );
}
}
}
diff --git a/svx/source/form/navigatortreemodel.cxx b/svx/source/form/navigatortreemodel.cxx
index 3a76983db3..00241c588e 100644
--- a/svx/source/form/navigatortreemodel.cxx
+++ b/svx/source/form/navigatortreemodel.cxx
@@ -41,18 +41,14 @@
#include "fmundo.hxx"
-#ifndef _SVX_FMHELP_HRC
#include "fmhelp.hrc"
-#endif
-#ifndef _SVX_FMEXPL_HRC
#include "fmexpl.hrc"
-#endif
#include "fmexpl.hxx"
-#ifndef _SVX_FMRESIDS_HRC
#include "fmresids.hrc"
-#endif
#include "fmshimp.hxx"
+#include "fmobj.hxx"
#include <sfx2/objsh.hxx>
+#include <tools/diagnose_ex.h>
#include <com/sun/star/container/XContainer.hpp>
//............................................................................
@@ -731,49 +727,55 @@ namespace svxform
}
//------------------------------------------------------------------------
- void NavigatorTreeModel::InsertSdrObj(const SdrObject* pObj)
+ void NavigatorTreeModel::InsertSdrObj( const SdrObject* pObj )
{
- if (pObj->GetObjInventor() == FmFormInventor)
- { //////////////////////////////////////////////////////////////////////
- // Ist dieses Objekt ein XFormComponent?
- Reference< XFormComponent > xFormComponent(((SdrUnoObj*)pObj)->GetUnoControlModel(), UNO_QUERY);
- if (xFormComponent.is())
+ const FmFormObj* pFormObject = FmFormObj::GetFormObject( pObj );
+ if ( pFormObject )
+ {
+ try
{
- Reference< XIndexContainer > xContainer(xFormComponent->getParent(), UNO_QUERY);
- if (xContainer.is())
- {
- sal_Int32 nPos = getElementPos(Reference< XIndexAccess > (xContainer, UNO_QUERY), xFormComponent);
- InsertFormComponent(xFormComponent, nPos);
- }
+ Reference< XFormComponent > xFormComponent( pFormObject->GetUnoControlModel(), UNO_QUERY_THROW );
+ Reference< XIndexAccess > xContainer( xFormComponent->getParent(), UNO_QUERY_THROW );
+
+ sal_Int32 nPos = getElementPos( xContainer, xFormComponent );
+ InsertFormComponent( xFormComponent, nPos );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
}
}
- else if (pObj->IsGroupObject())
+ else if ( pObj->IsGroupObject() )
{
- SdrObjListIter aIter(*pObj->GetSubList());
- while (aIter.IsMore())
- InsertSdrObj(aIter.Next());
+ SdrObjListIter aIter( *pObj->GetSubList() );
+ while ( aIter.IsMore() )
+ InsertSdrObj( aIter.Next() );
}
}
//------------------------------------------------------------------------
- void NavigatorTreeModel::RemoveSdrObj(const SdrObject* pObj)
+ void NavigatorTreeModel::RemoveSdrObj( const SdrObject* pObj )
{
- if (pObj->GetObjInventor() == FmFormInventor)
- { //////////////////////////////////////////////////////////////////////
- // Ist dieses Objekt ein XFormComponent?
- Reference< XFormComponent > xFormComponent(((SdrUnoObj*)pObj)->GetUnoControlModel(), UNO_QUERY);
- if (xFormComponent.is())
+ const FmFormObj* pFormObject = FmFormObj::GetFormObject( pObj );
+ if ( pFormObject )
+ {
+ try
{
- FmEntryData* pEntryData = FindData(xFormComponent, GetRootList(), sal_True);
- if (pEntryData)
- Remove(pEntryData);
+ Reference< XFormComponent > xFormComponent( pFormObject->GetUnoControlModel(), UNO_QUERY_THROW );
+ FmEntryData* pEntryData = FindData( xFormComponent, GetRootList(), sal_True );
+ if ( pEntryData )
+ Remove( pEntryData );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
}
}
- else if (pObj->IsGroupObject())
+ else if ( pObj->IsGroupObject() )
{
- SdrObjListIter aIter(*pObj->GetSubList());
- while (aIter.IsMore())
- RemoveSdrObj(aIter.Next());
+ SdrObjListIter aIter( *pObj->GetSubList() );
+ while ( aIter.IsMore() )
+ RemoveSdrObj( aIter.Next() );
}
}
@@ -788,23 +790,29 @@ namespace svxform
if (!InsertFormComponent(rHint, pCurrent))
return sal_False;
}
- } else
- if (pObject->IsUnoObj())
+ }
+ else
+ {
+ FmFormObj* pFormObject = FmFormObj::GetFormObject( pObject );
+ if ( !pFormObject )
+ return sal_False;
+
+ try
{
- Reference< XInterface > xControlModel( ((SdrUnoObj*)pObject)->GetUnoControlModel());
- // Ist dieses Objekt ein XFormComponent?
- Reference< XFormComponent > xFormViewControl(xControlModel, UNO_QUERY);
- if (xFormViewControl.is())
- { // es ist ein Form-Control -> selektieren lassen
- FmEntryData* pControlData = FindData( xFormViewControl, GetRootList() );
- if (pControlData)
- rHint.AddItem( pControlData );
- } else
- { // es ist kein Form-Control -> im Baum ueberhaupt nix selektieren lassen
+ Reference< XFormComponent > xFormViewControl( pFormObject->GetUnoControlModel(), UNO_QUERY_THROW );
+ FmEntryData* pControlData = FindData( xFormViewControl, GetRootList() );
+ if ( !pControlData )
return sal_False;
- }
- } else
+
+ rHint.AddItem( pControlData );
+ return sal_True;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
return sal_False;
+ }
+ }
return sal_True;
}
@@ -1036,20 +1044,18 @@ namespace svxform
while (rIter.IsMore())
{
SdrObject* pObj = rIter.Next();
- //////////////////////////////////////////////////////////////////////
- // Es interessieren nur Uno-Objekte
- if (pObj->GetObjInventor() == FmFormInventor)
- { //////////////////////////////////////////////////////////////////////
- // Ist dieses Objekt ein XFormComponent?
- Reference< XFormComponent > xFormViewControl(((SdrUnoObj*)pObj)->GetUnoControlModel(), UNO_QUERY);
- if (xFormViewControl == xComp)
+ FmFormObj* pFormObject = FmFormObj::GetFormObject( pObj );
+ if ( pFormObject )
+ {
+ Reference< XFormComponent > xFormViewControl( pFormObject->GetUnoControlModel(), UNO_QUERY );
+ if ( xFormViewControl == xComp )
return pObj;
}
- else if (pObj->IsGroupObject())
+ else if ( pObj->IsGroupObject() )
{
- SdrObjListIter aIter(*pObj->GetSubList());
- pObj = Search(aIter, xComp);
- if (pObj)
+ SdrObjListIter aIter( *pObj->GetSubList() );
+ pObj = Search( aIter, xComp );
+ if ( pObj )
return pObj;
}
}
diff --git a/svx/source/inc/delayedevent.hxx b/svx/source/inc/delayedevent.hxx
new file mode 100644
index 0000000000..be0e5ad4b0
--- /dev/null
+++ b/svx/source/inc/delayedevent.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+* 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: delayedevent.hxx,v $
+*
+* $Revision: 1.1.2.1 $
+*
+* 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 SVX_DELAYEDLINK_HXX
+#define SVX_DELAYEDLINK_HXX
+
+#include <tools/link.hxx>
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ //====================================================================
+ //= DelayedEvent
+ //====================================================================
+ /** small class which encapsulates posting a Link instance as ApplicationUserEvent
+
+ No thread safety at all here, just a little saving of code to type multiple times
+ */
+ class DelayedEvent
+ {
+ public:
+ DelayedEvent( const Link& _rHandler )
+ :m_aHandler( _rHandler )
+ ,m_nEventId( 0 )
+ {
+ }
+
+ ~DelayedEvent()
+ {
+ CancelPendingCall();
+ }
+
+ /** calls the handler asynchronously
+
+ If there's already a call pending, this previous call is cancelled.
+ */
+ void Call( void* _pArg = NULL );
+
+ /** cancels a call which is currently pending
+
+ If no call is currently pending, then this is ignored.
+ */
+ void CancelPendingCall();
+
+ private:
+ Link m_aHandler;
+ ULONG m_nEventId;
+
+ private:
+ DECL_LINK( OnCall, void* );
+
+ private:
+ DelayedEvent(); // never implemented
+ DelayedEvent( const DelayedEvent& ); // never implemented
+ DelayedEvent& operator=( const DelayedEvent& ); // never implemented
+ };
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+#endif // SVX_DELAYEDLINK_HXX
diff --git a/svx/source/inc/fmcontr.hxx b/svx/source/inc/fmcontr.hxx
deleted file mode 100644
index 584e26b5ed..0000000000
--- a/svx/source/inc/fmcontr.hxx
+++ /dev/null
@@ -1,252 +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: fmcontr.hxx,v $
- * $Revision: 1.4 $
- *
- * 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 _SVX_FMCONTR_HXX
-#define _SVX_FMCONTR_HXX
-
-#include <comphelper/stl_types.hxx>
-#include <com/sun/star/form/XFormComponent.hpp>
-#include <com/sun/star/beans/XPropertyChangeListener.hpp>
-#include <com/sun/star/beans/PropertyChangeEvent.hpp>
-#include <com/sun/star/script/XEventAttacherManager.hpp>
-#include <com/sun/star/script/ScriptEvent.hpp>
-#include <com/sun/star/script/ScriptEventDescriptor.hpp>
-#include <com/sun/star/container/XContainer.hpp>
-#include <com/sun/star/container/XIndexContainer.hpp>
-#include <com/sun/star/container/XNameReplace.hpp>
-#include <com/sun/star/container/XIndexReplace.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/lang/XEventListener.hpp>
-#include <com/sun/star/lang/EventObject.hpp>
-
-typedef ::std::hash_multimap< ::rtl::OUString, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > , ::comphelper::UStringHash, ::comphelper::UStringEqual> OInterfaceMap;
-
-DECLARE_STL_VECTOR(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > ,InterfaceArray);
-
-class ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream > ;
-class ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream > ;
-
-//==================================================================
-// FmForms
-// Implementiert den UNO-::com::sun::star::sdbcx::Container fuer Formulare
-// enthaelt alle zugeordneten ::com::sun::star::form::Forms
-// dieses ::com::sun::star::sdbcx::Container kann selbst den Context fuer Formulare darstellen
-// oder außen einen Context uebergeben bekommen
-//==================================================================
-class FmXInterfaceContainer : public ::com::sun::star::container::XNameContainer,
- public ::com::sun::star::container::XIndexContainer,
- public ::com::sun::star::container::XContainer,
- public ::com::sun::star::container::XEnumerationAccess,
- public ::com::sun::star::script::XEventAttacherManager,
- public ::com::sun::star::beans::XPropertyChangeListener
-{
-protected:
- OInterfaceMap m_aMap;
- OInterfaceArray m_aItems;
- ::usr::OInterfaceContainerHelper
- m_aContainerListeners;
-
- InterfaceReflection* m_pElementReflection;
- ::VOS::IMutex& m_rMutex;
- ::com::sun::star::uno::Uik m_aElementUik;
-
-
- // EventManager
- ::com::sun::star::uno::Reference< ::com::sun::star::script::XEventAttacherManager > m_xEventAttacher;
-
-public:
- FmXInterfaceContainer(::VOS::IMutex& _rMutex, InterfaceReflection* pElementReflection, const ::com::sun::star::uno::Uik& rUik );
-
-public:
-// automatisch auskommentiert - [getIdlClass or queryInterface] - Bitte XTypeProvider benutzen!
-// virtual sal_Bool queryInterface( ::com::sun::star::uno::Uik aUik, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rOut );
-
-
-// ::com::sun::star::io::XPersistObject
- void write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream > & OutStream);
- void read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream > & InStream);
-
-// ::com::sun::star::lang::XEventListener
- virtual void disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
-
-// ::com::sun::star::beans::XPropertyChangeListener
- virtual void propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt);
-
-// ::com::sun::star::container::XElementAccess
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass > getElementType(void) const throw( ::com::sun::star::uno::RuntimeException );
- virtual sal_Bool hasElements(void) const throw( ::com::sun::star::uno::RuntimeException );
-
-// ::com::sun::star::container::XEnumerationAccess
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException );
-
-// ::com::sun::star::container::XNameAccess
- virtual ::com::sun::star::uno::Any getByName(const ::rtl::OUString& Name) const throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > getElementNames(void) const throw( ::com::sun::star::uno::RuntimeException );
- virtual sal_Bool hasByName(const ::rtl::OUString& Name) const throw( ::com::sun::star::uno::RuntimeException );
-
-// ::com::sun::star::container::XNameReplace
- virtual void replaceByName(const ::rtl::OUString& Name, const ::com::sun::star::uno::Any& Element) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
-
-// ::com::sun::star::container::XNameContainer
- virtual void insertByName(const ::rtl::OUString& Name, const ::com::sun::star::uno::Any& Element) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
- virtual void removeByName(const ::rtl::OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
-
-// ::com::sun::star::container::XIndexAccess
- virtual sal_Int32 getCount(void) const throw( ::com::sun::star::uno::RuntimeException );
- virtual ::com::sun::star::uno::Any getByIndex(sal_Int32 ::com::sun::star::sdbcx::Index) const throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
-
-// ::com::sun::star::container::XIndexReplace
- virtual void replaceByIndex(sal_Int32 ::com::sun::star::sdbcx::Index, const ::com::sun::star::uno::Any& Element) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
-
-// ::com::sun::star::container::XIndexContainer
- virtual void insertByIndex(sal_Int32 ::com::sun::star::sdbcx::Index, const ::com::sun::star::uno::Any& Element) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
- virtual void removeByIndex(sal_Int32 ::com::sun::star::sdbcx::Index) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
-
-// ::com::sun::star::container::XContainer
- virtual void addContainerListener(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > & l) throw( ::com::sun::star::uno::RuntimeException );
- virtual void removeContainerListener(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > & l) throw( ::com::sun::star::uno::RuntimeException );
-
-// ::com::sun::star::script::XEventAttacherManager
- virtual void registerScriptEvent(sal_Int32 nIndex, const ::com::sun::star::script::ScriptEventDescriptor& ::com::sun::star::script::ScriptEvent);
- virtual void registerScriptEvents(sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& ScriptEvents);
- virtual void revokeScriptEvent(sal_Int32 nIndex, const ::rtl::OUString& ListenerType, const ::rtl::OUString& EventMethod, const ::rtl::OUString& rRemoveListenerParam);
- virtual void revokeScriptEvents(sal_Int32 nIndex);
- virtual void insertEntry(sal_Int32 nIndex);
- virtual void removeEntry(sal_Int32 nIndex);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor > getScriptEvents(sal_Int32 nIndex);
- virtual void attach(sal_Int32 nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & Object, const ::com::sun::star::uno::Any& Helper);
- virtual void detach(sal_Int32 nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & xObject);
- virtual void addScriptListener(const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener > & aListener);
- virtual void removeScriptListener(const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener > & aListener);
-
- static ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass > getStaticIdlClass();
-
-protected:
- // helper
- virtual void disposing();
- virtual void insert(sal_Int32 ::com::sun::star::sdbcx::Index, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & _Object, sal_Bool bEvents = sal_True)
- throw( ::com::sun::star::lang::IllegalArgumentException );
- virtual void removeElementsNoEvents(sal_Int32 nIndex);
-
- // called after the object is inserted, but before the "real listeners" are notified
- virtual void implInserted(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & _rxObject) { }
- // called after the object is removed, but before the "real listeners" are notified
- virtual void implRemoved(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & _rxObject) { }
-
- void writeEvents(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream > & OutStream);
- void readEvents(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream > & InStream, sal_Int32 nCount);
-};
-
-//==================================================================
-// FmForms
-// Implementiert den UNO-::com::sun::star::sdbcx::Container fuer Formulare
-// enthaelt alle zugeordneten ::com::sun::star::form::Forms
-// dieses ::com::sun::star::sdbcx::Container kann selbst den Context fuer Formulare darstellen
-// oder außen einen Context uebergeben bekommen
-//==================================================================
-class FmXForms : public ::usr::OComponentHelper,
- public FmXInterfaceContainer,
- public ::com::sun::star::container::XChild
-
-{
- friend Reflection* ::getCppuType((const FmXForms*)0);
- ::osl::Mutex m_aMutex;
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent; // Parent
-
-public:
- FmXForms();
- virtual ~FmXForms();
-
-public:
-// automatisch auskommentiert - [getIdlClass or queryInterface] - Bitte XTypeProvider benutzen!
-// virtual sal_Bool queryInterface( ::com::sun::star::uno::Uik aUik, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rOut )
-
-// automatisch auskommentiert - [getIdlClass or queryInterface] - Bitte XTypeProvider benutzen!
-// { return OComponentHelper::queryInterface( aUik, rOut ); }
-
- virtual sal_Bool queryAggregation(::com::sun::star::uno::Uik aUik, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rOut);
-// automatisch auskommentiert - [getIdlClass or queryInterface] - Bitte XTypeProvider benutzen!
-// virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass > > getIdlClasses(void);
-
-// automatisch auskommentiert - [getImplementation] - Wird von OWeakObject nicht weiter unterstützt!
-// virtual void* getImplementation(Reflection * pRef);
-
- virtual void acquire() { OComponentHelper::acquire(); }
- virtual void release() { OComponentHelper::release(); }
-
-// OComponentHelper
- virtual void disposing();
-
-// ::com::sun::star::container::XChild
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getParent(void) const throw( ::com::sun::star::uno::RuntimeException );
- virtual void setParent(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & Parent) throw( ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException );
-};
-
-//==================================================================
-// FmForm
-// Implementiert den UNO-::com::sun::star::sdbcx::Container fuer FormularControls
-//==================================================================
-class FmXFormComponents : public ::usr::OComponentHelper,
- public FmXInterfaceContainer,
- public ::com::sun::star::form::XFormComponent
-{
-protected:
- ::osl::Mutex m_aMutex;
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent; // Parent
-
-public:
- FmXFormComponents();
- virtual ~FmXFormComponents();
-
- SMART_UNO_DECLARATION(FmXFormComponents, OComponentHelper);
-
-// automatisch auskommentiert - [getIdlClass or queryInterface] - Bitte XTypeProvider benutzen!
-// virtual sal_Bool queryInterface( ::com::sun::star::uno::Uik aUik, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rOut )
-
-// automatisch auskommentiert - [getIdlClass or queryInterface] - Bitte XTypeProvider benutzen!
-// { return OComponentHelper::queryInterface( aUik, rOut ); }
-
- virtual sal_Bool queryAggregation(::com::sun::star::uno::Uik aUik, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rOut);
-// automatisch auskommentiert - [getIdlClass or queryInterface] - Bitte XTypeProvider benutzen!
-// virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass > > getIdlClasses(void);
-
-
-// OComponentHelper
- virtual void disposing();
-
-// ::com::sun::star::form::XFormComponent
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getParent(void) const throw( ::com::sun::star::uno::RuntimeException );
- virtual void setParent(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & Parent) throw( ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException );
-
- static ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass > getStaticIdlClass();
-};
-
-
-#endif // _SVX_FMCONTR_HXX
-
diff --git a/svx/source/inc/fmctrler.hxx b/svx/source/inc/fmctrler.hxx
index 44f89f4f65..0e86b17d39 100644
--- a/svx/source/inc/fmctrler.hxx
+++ b/svx/source/inc/fmctrler.hxx
@@ -33,6 +33,7 @@
#include "fmtools.hxx"
#include "formcontrolling.hxx"
#include "sqlparserclient.hxx"
+#include "delayedevent.hxx"
/** === begin UNO includes === **/
#include <com/sun/star/awt/XControl.hpp>
@@ -96,13 +97,16 @@
#include <comphelper/proparrhlp.hxx>
#include <comphelper/stl_types.hxx>
#include <connectivity/sqlparse.hxx>
-#include <cppuhelper/compbase12.hxx>
-#include <cppuhelper/implbase12.hxx>
-#include <cppuhelper/implbase7.hxx>
#include <cppuhelper/propshlp.hxx>
#include <tools/debug.hxx>
#include <vcl/timer.hxx>
+#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_31)
+#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_31
+#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 31
+#include <comphelper/implbase_var.hxx>
+#endif
+
struct FmXTextComponentLess : public ::std::binary_function< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent> , sal_Bool>
{
sal_Bool operator() (const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >& x, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >& y) const
@@ -125,50 +129,45 @@ namespace svxform
class ControlBorderManager;
}
-typedef ::cppu::WeakAggComponentImplHelper12< ::com::sun::star::form::XFormController
- , ::com::sun::star::container::XChild
- , ::com::sun::star::container::XIndexAccess
- , ::com::sun::star::container::XEnumerationAccess
- , ::com::sun::star::awt::XFocusListener
- , ::com::sun::star::form::XLoadListener
- , ::com::sun::star::beans::XPropertyChangeListener
- , ::com::sun::star::awt::XTextListener
- , ::com::sun::star::awt::XItemListener
- , ::com::sun::star::container::XContainerListener
- , ::com::sun::star::util::XModifyListener
- , ::com::sun::star::util::XModifyBroadcaster
- > FmXFormController_BASE1;
-
-typedef ::cppu::ImplHelper12< ::com::sun::star::util::XModeSelector
- , ::com::sun::star::form::XConfirmDeleteListener
- , ::com::sun::star::form::XConfirmDeleteBroadcaster
- , ::com::sun::star::sdb::XSQLErrorListener
- , ::com::sun::star::sdb::XSQLErrorBroadcaster
- , ::com::sun::star::sdbc::XRowSetListener
- , ::com::sun::star::sdb::XRowSetApproveListener
- , ::com::sun::star::sdb::XRowSetApproveBroadcaster
- , ::com::sun::star::form::XDatabaseParameterListener
- , ::com::sun::star::form::XDatabaseParameterBroadcaster
- , ::com::sun::star::lang::XServiceInfo
- , ::com::sun::star::form::XResetListener
- > FmXFormController_BASE2;
-
-typedef ::cppu::ImplHelper7< ::com::sun::star::lang::XUnoTunnel
- , ::com::sun::star::frame::XDispatch
- , ::com::sun::star::awt::XMouseListener
- , ::com::sun::star::form::validation::XFormComponentValidityListener
- , ::com::sun::star::task::XInteractionHandler
- , ::com::sun::star::lang::XInitialization
- , ::com::sun::star::form::XGridControlListener
- > FmXFormController_BASE3;
+typedef ::comphelper::WeakComponentImplHelper31 < ::com::sun::star::form::XFormController
+ , ::com::sun::star::container::XChild
+ , ::com::sun::star::container::XIndexAccess
+ , ::com::sun::star::container::XEnumerationAccess
+ , ::com::sun::star::awt::XFocusListener
+ , ::com::sun::star::form::XLoadListener
+ , ::com::sun::star::beans::XPropertyChangeListener
+ , ::com::sun::star::awt::XTextListener
+ , ::com::sun::star::awt::XItemListener
+ , ::com::sun::star::container::XContainerListener
+ , ::com::sun::star::util::XModifyListener
+ , ::com::sun::star::util::XModifyBroadcaster
+ , ::com::sun::star::util::XModeSelector
+ , ::com::sun::star::form::XConfirmDeleteListener
+ , ::com::sun::star::form::XConfirmDeleteBroadcaster
+ , ::com::sun::star::sdb::XSQLErrorListener
+ , ::com::sun::star::sdb::XSQLErrorBroadcaster
+ , ::com::sun::star::sdbc::XRowSetListener
+ , ::com::sun::star::sdb::XRowSetApproveListener
+ , ::com::sun::star::sdb::XRowSetApproveBroadcaster
+ , ::com::sun::star::form::XDatabaseParameterListener
+ , ::com::sun::star::form::XDatabaseParameterBroadcaster
+ , ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::form::XResetListener
+ , ::com::sun::star::lang::XUnoTunnel
+ , ::com::sun::star::frame::XDispatch
+ , ::com::sun::star::awt::XMouseListener
+ , ::com::sun::star::form::validation::XFormComponentValidityListener
+ , ::com::sun::star::task::XInteractionHandler
+ , ::com::sun::star::lang::XInitialization
+ , ::com::sun::star::form::XGridControlListener
+ > FmXFormController_BASE;
//==================================================================
// FmXFormController
//==================================================================
+class ColumnInfoCache;
class SAL_DLLPRIVATE FmXFormController :public ::comphelper::OBaseMutex
- ,public FmXFormController_BASE1
- ,public FmXFormController_BASE2
- ,public FmXFormController_BASE3
+ ,public FmXFormController_BASE
,public ::cppu::OPropertySetHelper
,public FmDispatchInterceptor
,public ::comphelper::OAggregationArrayUsageHelper< FmXFormController >
@@ -219,24 +218,29 @@ class SAL_DLLPRIVATE FmXFormController :public ::comphelper::OBaseMutex
::rtl::OUString m_aMode;
- ULONG m_nLoadEvent;
- ULONG m_nToggleEvent;
+ ::svxform::DelayedEvent m_aLoadEvent;
+ ::svxform::DelayedEvent m_aToggleEvent;
+ ::svxform::DelayedEvent m_aActivationEvent;
+ ::svxform::DelayedEvent m_aDeactivationEvent;
+
+ ::std::auto_ptr< ColumnInfoCache >
+ m_pColumnInfoCache;
sal_Int32 m_nCurrentFilterPosition; // current level for filtering (or-criteria)
- sal_Bool m_bCurrentRecordModified : 1;
- sal_Bool m_bCurrentRecordNew : 1;
- sal_Bool m_bLocked : 1;
- sal_Bool m_bDBConnection : 1; // Focuslistener nur fuer Datenbankformulare
- sal_Bool m_bCycle : 1;
- sal_Bool m_bCanInsert : 1;
- sal_Bool m_bCanUpdate : 1;
- sal_Bool m_bCommitLock : 1; // lock the committing of controls see focusGained
- sal_Bool m_bModified : 1; // ist der Inhalt eines Controls modifiziert ?
- sal_Bool m_bControlsSorted : 1;
- sal_Bool m_bFiltering : 1;
- sal_Bool m_bAttachEvents : 1;
- sal_Bool m_bDetachEvents : 1;
+ sal_Bool m_bCurrentRecordModified : 1;
+ sal_Bool m_bCurrentRecordNew : 1;
+ sal_Bool m_bLocked : 1;
+ sal_Bool m_bDBConnection : 1; // Focuslistener nur fuer Datenbankformulare
+ sal_Bool m_bCycle : 1;
+ sal_Bool m_bCanInsert : 1;
+ sal_Bool m_bCanUpdate : 1;
+ sal_Bool m_bCommitLock : 1; // lock the committing of controls see focusGained
+ sal_Bool m_bModified : 1; // ist der Inhalt eines Controls modifiziert ?
+ sal_Bool m_bControlsSorted : 1;
+ sal_Bool m_bFiltering : 1;
+ sal_Bool m_bAttachEvents : 1;
+ sal_Bool m_bDetachEvents : 1;
sal_Bool m_bAttemptedHandlerCreation : 1;
// as we want to intercept dispatches of _all_ controls we're responsible for, and an object implementing
@@ -257,10 +261,8 @@ public:
FmFormView* _pView = NULL, Window* _pWindow = NULL );
~FmXFormController();
- // UNO Anbindung
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& type) throw ( ::com::sun::star::uno::RuntimeException )
- { return FmXFormController_BASE1::queryInterface( type ); }
- virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
+// XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& type) throw ( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL acquire() throw ();
virtual void SAL_CALL release() throw ();
@@ -551,8 +553,9 @@ protected:
*/
void implInvalidateCurrentControlDependentFeatures();
+ bool impl_isDisposed_nofail() const { return FmXFormController_BASE::rBHelper.bDisposed; }
+
void onModify( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxControl );
- void onActivate();
sal_Bool isLocked() const {return m_bLocked;}
sal_Bool determineLockState() const;
@@ -602,6 +605,8 @@ protected:
DECL_LINK( OnInvalidateFeatures, void* );
DECL_LINK( OnLoad, void* );
DECL_LINK( OnToggleAutoFields, void* );
+ DECL_LINK( OnActivated, void* );
+ DECL_LINK( OnDeactivated, void* );
};
diff --git a/svx/source/inc/fmexpl.hxx b/svx/source/inc/fmexpl.hxx
index 3f697df220..a4599f1a6f 100644
--- a/svx/source/inc/fmexpl.hxx
+++ b/svx/source/inc/fmexpl.hxx
@@ -46,28 +46,13 @@
#include <com/sun/star/container/XContainerListener.hpp>
#include <com/sun/star/container/XContainer.hpp>
-
#include <svtools/svtreebx.hxx>
-#ifndef _DIALOG_HXX //autogen
#include <vcl/dialog.hxx>
-#endif
-
-#ifndef _GROUP_HXX //autogen
#include <vcl/group.hxx>
-#endif
-
-#ifndef _BUTTON_HXX //autogen
#include <vcl/button.hxx>
-#endif
-
-#ifndef _FIXED_HXX //autogen
#include <vcl/fixed.hxx>
-#endif
-
-#ifndef _EDIT_HXX //autogen
#include <vcl/edit.hxx>
-#endif
#include <vcl/dockwin.hxx>
#include <svx/fmview.hxx>
@@ -78,6 +63,8 @@ class SdrObjListIter;
class FmFormShell;
class SdrObject;
class FmFormModel;
+class FmFormView;
+class SdrMarkList;
//========================================================================
class FmEntryData;
diff --git a/svx/source/inc/fmobj.hxx b/svx/source/inc/fmobj.hxx
index 9b430ef0e0..9c40e87c08 100644
--- a/svx/source/inc/fmobj.hxx
+++ b/svx/source/inc/fmobj.hxx
@@ -42,14 +42,6 @@ class FmFormView;
class FmXForms;
class FmFormObj: public SdrUnoObj
{
- friend class FmForm;
- friend class FmFormPage;
- friend class FmFormPageImpl;
- friend class FmFormObjFactory;
- friend class FmXUndoEnvironment;
- friend class SvxFmDrawPage;
- friend class SvxFmMSFactory;
-
::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor > aEvts; // events des Objects
::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor> m_aEventsHistory;
// valid if and only if m_pEnvironmentHistory != NULL, this are the events which we're set when
@@ -70,17 +62,23 @@ class FmFormObj: public SdrUnoObj
// only to be used for comparison with the current ref device!
public:
- TYPEINFO();
-
-protected:
FmFormObj(const ::rtl::OUString& rModelName,sal_Int32 _nType);
FmFormObj(sal_Int32 _nType);
- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>& GetParent() const {return m_xParent;}
- void SetObjEnv(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>& xForm, sal_Int32 nIdx = -1,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& rEvts= ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >());
- const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& GetEvents() const {return aEvts;}
- sal_Int32 GetPos() const { return m_nPos; }
+ TYPEINFO();
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>&
+ GetOriginalParent() const { return m_xParent; }
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >&
+ GetOriginalEvents() const { return aEvts; }
+ sal_Int32
+ GetOriginalIndex() const { return m_nPos; }
+
+ void SetObjEnv(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>& xForm,
+ const sal_Int32 nIdx,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& rEvts );
+ void ClearObjEnv();
public:
virtual ~FmFormObj();
@@ -98,18 +96,32 @@ public:
static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> ensureModelEnv(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rSourceContainer, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer> _rTopLevelDestContainer);
+ /** returns the FmFormObj behind the given SdrObject
+
+ In case the SdrObject *is* an FmFormObject, this is a simple cast. In case the SdrObject
+ is a virtual object whose referenced object is an FmFormObj, then this referenced
+ object is returned. In all other cases, NULL is returned.
+ */
+ static FmFormObj* GetFormObject( SdrObject* _pSdrObject );
+ static const FmFormObj* GetFormObject( const SdrObject* _pSdrObject );
+
/** returns the type of this form object. See fmglob.hxx
*/
sal_Int32 getType() const;
protected:
- virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
-
- DECL_LINK(OnCreate, void* );
+ virtual FASTBOOL EndCreate( SdrDragStat& rStat, SdrCreateCmd eCmd );
+ virtual void BrkCreate( SdrDragStat& rStat );
// #i70852# overload Layer interface to force to FormColtrol layer
virtual SdrLayerID GetLayer() const;
virtual void NbcSetLayer(SdrLayerID nLayer);
+
+private:
+ /** isolates the control model from its form component hierarchy, i.e. removes it from
+ its parent.
+ */
+ void impl_isolateControlModel_nothrow();
};
diff --git a/svx/source/inc/fmpgeimp.hxx b/svx/source/inc/fmpgeimp.hxx
index 6ca1418ca3..e2669c4531 100644
--- a/svx/source/inc/fmpgeimp.hxx
+++ b/svx/source/inc/fmpgeimp.hxx
@@ -66,10 +66,6 @@ DECLARE_LIST(FmObjectList, FmFormObj*)
class SVX_DLLPRIVATE FmFormPageImpl
{
- friend class FmFormPage;
- friend class FmFormObj;
- friend class FmXFormShell;
-
::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> xCurrentForm;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer> m_xForms;
FmFormPage* pPage;
@@ -79,26 +75,24 @@ class SVX_DLLPRIVATE FmFormPageImpl
bool m_bAttemptedFormCreation;
protected:
+ void Init();
+
+public:
FmFormPageImpl(FmFormPage* _pPage);
FmFormPageImpl(FmFormPage* _pPage, const FmFormPageImpl& rImpl);
~FmFormPageImpl();
- void Init();
-
-public:
// nur wichtig fuer den DesignMode
void setCurForm(::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> xForm);
::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> getDefaultForm();
- /** inserts a form component into the form component hierarchy
+ /** finds a place in the form component hierarchy where to insert the given component
- If the given component does not yet belong into the form hierarchy, a suitable place for
- it is found, using <member>findFormForDataSource</member>, if possible.
-
- If no sutiable form is found, a new one is created, and also inserted into the
- hierarchy.
+ Note that no actual insertion happens, this is the responsibility of the caller (as
+ the caller might decide on a suitable place where in the returned container the insertion
+ should happen).
*/
- ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> placeInFormComponentHierarchy(
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> findPlaceInFormComponentHierarchy(
const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent>& rContent,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>& rDatabase = ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>(),
const ::rtl::OUString& rDBTitle = ::rtl::OUString(),
@@ -110,6 +104,8 @@ public:
inline sal_Bool hasEverBeenActivated( ) const { return !m_bFirstActivation; }
inline void setHasBeenActivated( ) { m_bFirstActivation = sal_False; }
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& getForms( bool _bForceCreate = true );
+
void SetFormsCreationHdl( const Link& _rFormsCreationHdl ) { m_aFormsCreationHdl = _rFormsCreationHdl; }
const Link& GetFormsCreationHdl() const { return m_aFormsCreationHdl; }
@@ -118,8 +114,6 @@ protected:
void write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& OutStream) const;
void read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& InStream);
- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& getForms( bool _bForceCreate = true );
-
void fillList(FmObjectList& rList, const SdrObjList& rObjList, sal_Bool bConnected) const;
/** finds a form with a given data source signature
@@ -155,9 +149,12 @@ private:
If <member>xCurrentForm</member> is not valid anymore, it is reset to <NULL/>.
+ @return
+ <TRUE/> if and only if xCurrentForm is valid.
+
@since #i40086#
*/
- void validateCurForm();
+ bool validateCurForm();
public:
diff --git a/svx/source/inc/fmprop.hrc b/svx/source/inc/fmprop.hrc
index 2bba14d39c..14475b5909 100644
--- a/svx/source/inc/fmprop.hrc
+++ b/svx/source/inc/fmprop.hrc
@@ -180,6 +180,7 @@ namespace svxform
DECLARE_CONSTASCII_USTRING( FM_PROP_CONTROL_BORDER_COLOR_INVALID );
DECLARE_CONSTASCII_USTRING( FM_PROP_BUTTON_TYPE );
DECLARE_CONSTASCII_USTRING( FM_PROP_FORM_OPERATIONS );
+ DECLARE_CONSTASCII_USTRING( FM_PROP_INPUT_REQUIRED );
} // namespace svxform
diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx
index 7da13b751d..33f8685b29 100644
--- a/svx/source/inc/fmshimp.hxx
+++ b/svx/source/inc/fmshimp.hxx
@@ -547,6 +547,10 @@ private:
*/
void impl_updateCurrentForm( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxNewCurForm );
+ /** adds or removes ourself as XEventListener at m_xActiveController
+ */
+ void impl_switchActiveControllerListening( const bool _bListen );
+
// ---------------------------------------------------
// asyncronous cursor actions/navigation slot handling
diff --git a/svx/source/inc/fmtools.hxx b/svx/source/inc/fmtools.hxx
index c358e3f087..a45b85c5d0 100644
--- a/svx/source/inc/fmtools.hxx
+++ b/svx/source/inc/fmtools.hxx
@@ -384,11 +384,6 @@ sal_Bool isLoadable(const ::com::sun::star::uno::Reference< ::com::sun::star::un
sal_Bool isRowSetAlive(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rxRowSet);
// checks if the ::com::sun::star::sdbcx::XColumnsSupplier provided by _rxRowSet supllies any columns
-void initializeTextFieldLineEnds(
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
- ) SAL_THROW(());
-
//==================================================================
typedef ::std::set < ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
, ::comphelper::OInterfaceCompare< ::com::sun::star::uno::XInterface >
diff --git a/svx/source/inc/fmvwimp.hxx b/svx/source/inc/fmvwimp.hxx
index 9e807eb805..64a8ef4849 100644
--- a/svx/source/inc/fmvwimp.hxx
+++ b/svx/source/inc/fmvwimp.hxx
@@ -30,9 +30,10 @@
#ifndef _SVX_FMVWIMP_HXX
#define _SVX_FMVWIMP_HXX
-#include <comphelper/stl_types.hxx>
-
+#include "svx/svdmark.hxx"
+#include "fmdocumentclassification.hxx"
+/** === begin UNO includes === **/
#include <com/sun/star/form/XForm.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/container/XEnumeration.hpp>
@@ -42,12 +43,16 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/awt/XFocusListener.hpp>
#include <com/sun/star/sdb/SQLErrorEvent.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/stl_types.hxx>
#include <tools/link.hxx>
#include <tools/string.hxx>
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase3.hxx>
#include <comphelper/uno3.hxx>
-#include <svx/svdmark.hxx>
+#include <comphelper/componentcontext.hxx>
//class SdrPageViewWinRec;
class SdrPageWindow;
@@ -85,12 +90,12 @@ class FmXPageViewWinRec : public ::cppu::WeakImplHelper1< ::com::sun::star::cont
::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > > m_aControllerList;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > m_xControlContainer;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB;
+ ::comphelper::ComponentContext m_aContext;
FmXFormView* m_pViewImpl;
Window* m_pWindow;
public:
- FmXPageViewWinRec( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB,
+ FmXPageViewWinRec( const ::comphelper::ComponentContext& _rContext,
const SdrPageWindow&, FmXFormView* pView);
//const SdrPageViewWinRec*, FmXFormView* pView);
~FmXPageViewWinRec();
@@ -144,14 +149,16 @@ class FmXFormView : public ::cppu::WeakImplHelper3<
class ObjectRemoveListener;
friend class ObjectRemoveListener;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB;
+ ::comphelper::ComponentContext m_aContext;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> m_xWindow;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xLastCreatedControlModel;
FmFormObj* m_pMarkedGrid;
FmFormView* m_pView;
sal_uIntPtr m_nActivationEvent;
sal_uIntPtr m_nErrorMessageEvent; // event for an asynchronous error message. See also m_aAsyncError
sal_uIntPtr m_nAutoFocusEvent; // event for asynchronously setting the focus to a control
+ sal_uIntPtr m_nControlWizardEvent; // event for asynchronously setting the focus to a control
::com::sun::star::sdb::SQLErrorEvent
m_aAsyncError; // error event which is to be displayed asyn. See m_nErrorMessageEvent.
@@ -172,8 +179,7 @@ class FmXFormView : public ::cppu::WeakImplHelper3<
void removeGridWindowListening();
protected:
- FmXFormView(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB,
- FmFormView* _pView);
+ FmXFormView( const ::comphelper::ComponentContext& _rContext, FmFormView* _pView );
~FmXFormView();
void saveMarkList( sal_Bool _bSmartUnmark = sal_True );
@@ -210,8 +216,6 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController >
getFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm, const OutputDevice& _rDevice ) const;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() { return m_xORB; }
-
// activation handling
inline bool hasEverBeenActivated( ) const { return !m_bFirstActivation; }
inline void setHasBeenActivated( ) { m_bFirstActivation = false; }
@@ -229,6 +233,8 @@ public:
*/
void resumeTabOrderUpdate();
+ void onCreatedFormObject( FmFormObj& _rFormObject );
+
private:
FmWinRecList::iterator findWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& _rxCC );
//void addWindow(const SdrPageViewWinRec*);
@@ -240,27 +246,40 @@ private:
SdrObject* implCreateFieldControl( const ::svx::ODataAccessDescriptor& _rColumnDescriptor );
SdrObject* implCreateXFormsControl( const ::svx::OXFormsDescriptor &_rDesc );
- /// does some initializations to the newly created control model, returns the ClassId
- sal_Int16 implInitializeNewControlModel( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel, const SdrObject* _pObject ) const;
-
- static void createControlLabelPair(
- SdrView* _pView,
- OutputDevice* _pOutDev,
+ static bool createControlLabelPair(
+ const ::comphelper::ComponentContext& _rContext,
+ OutputDevice& _rOutDev,
sal_Int32 _nXOffsetMM,
sal_Int32 _nYOffsetMM,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField,
const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& _rxNumberFormats,
- sal_uInt16 _nObjID,
+ sal_uInt16 _nControlObjectID,
const ::rtl::OUString& _rFieldPostfix,
UINT32 _nInventor,
- UINT16 _nIndent,
+ UINT16 _nLabelObjectID,
SdrPage* _pLabelPage,
- SdrPage* _pPage,
+ SdrPage* _pControlPage,
SdrModel* _pModel,
SdrUnoObj*& _rpLabel,
SdrUnoObj*& _rpControl
);
+ bool createControlLabelPair(
+ OutputDevice& _rOutDev,
+ sal_Int32 _nXOffsetMM,
+ sal_Int32 _nYOffsetMM,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& _rxNumberFormats,
+ sal_uInt16 _nControlObjectID,
+ const ::rtl::OUString& _rFieldPostfix,
+ SdrUnoObj*& _rpLabel,
+ SdrUnoObj*& _rpControl,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource >& _rxDataSource = NULL,
+ const ::rtl::OUString& _rDataSourceName = ::rtl::OUString(),
+ const ::rtl::OUString& _rCommand= ::rtl::OUString(),
+ const sal_Int32 _nCommandType = -1
+ );
+
void ObjectRemovedInAliveMode(const SdrObject* pObject);
// asynchronously displays an error message. See also OnDelayedErrorMessage.
@@ -274,6 +293,10 @@ private:
DECL_LINK( OnActivate, void* );
DECL_LINK( OnAutoFocus, void* );
DECL_LINK( OnDelayedErrorMessage, void* );
+ DECL_LINK( OnStartControlWizard, void* );
+
+private:
+ ::svxform::DocumentType impl_getDocumentType() const;
};
diff --git a/svx/source/inc/formcontrolfactory.hxx b/svx/source/inc/formcontrolfactory.hxx
new file mode 100644
index 0000000000..c405727e39
--- /dev/null
+++ b/svx/source/inc/formcontrolfactory.hxx
@@ -0,0 +1,105 @@
+
+/*************************************************************************
+* 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: formcontrolfactory.hxx,v $
+*
+* $Revision: 1.1.2.1 $
+*
+* 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 SVX_FORMCONTROLMANAGER_HXX
+#define SVX_FORMCONTROLMANAGER_HXX
+
+#include "fmdocumentclassification.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/util/XNumberFormats.hpp>
+/** === end UNO includes === **/
+
+#include <memory>
+
+class SdrUnoObj;
+class Rectangle;
+
+namespace comphelper {
+ class ComponentContext;
+}
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ //====================================================================
+ //= FormControlFactory
+ //====================================================================
+ struct FormControlFactory_Data;
+
+ class FormControlFactory
+ {
+ public:
+ FormControlFactory( const ::comphelper::ComponentContext& _rContext );
+ ~FormControlFactory();
+
+ /** initializes the given control model which is to be newly inserted into a document
+
+ @param _eDocType
+ the type of the document which the control is to be inserted into
+ @param _rxControlModel
+ the control model to be inserted
+ @param _rControlBoundRect
+ the bound rect of the control, if applicable
+ @return
+ the class ID of the control
+ */
+ sal_Int16 initializeControlModel(
+ const DocumentType _eDocType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
+ const Rectangle& _rControlBoundRect
+ );
+
+ sal_Int16 initializeControlModel( const DocumentType _eDocType, const SdrUnoObj& _rObject );
+ sal_Int16 initializeControlModel( const DocumentType _eDocType, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel );
+
+ void initializeTextFieldLineEnds(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel
+ );
+
+ void initializeFieldDependentProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDatabaseField,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& _rxNumberFormats
+ );
+
+ private:
+ ::std::auto_ptr< FormControlFactory_Data > m_pData;
+ };
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+#endif // SVX_FORMCONTROLMANAGER_HXX
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index c07f7ae35b..b83671e61e 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -630,6 +630,7 @@ SfxItemPropertyMap* ImplGetSvxControlShapePropertyMap()
{ MAP_CHAR_LEN("ControlBorder"), 0, &::getCppuType((const sal_Int16*)0), 0, 0 },
{ MAP_CHAR_LEN("ControlBorderColor"), 0, &::getCppuType((const sal_Int32*)0), 0, 0 },
{ MAP_CHAR_LEN("ControlSymbolColor"), 0, &::getCppuType((const sal_Int16*)0), 0, 0 },
+ { MAP_CHAR_LEN("ImageScaleMode"), 0, &::getCppuType((const sal_Int16*)0), 0, 0 },
{ MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_MOVEPROTECT), SDRATTR_OBJMOVEPROTECT, &::getBooleanCppuType(),0, 0},
{ MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_SIZEPROTECT), SDRATTR_OBJSIZEPROTECT, &::getBooleanCppuType(),0, 0},
{ MAP_CHAR_LEN("ControlTextEmphasis"), 0, &::getCppuType((const sal_Int16*)0), 0, 0 },
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index 903e94c9fe..069aa4577a 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -714,6 +714,7 @@ SvxShapeControlPropertyMapping[] =
{ MAP_CHAR_LEN("ControlBorder"), MAP_CHAR_LEN("Border") },
{ MAP_CHAR_LEN("ControlBorderColor"), MAP_CHAR_LEN("BorderColor") },
{ MAP_CHAR_LEN("ControlTextEmphasis"), MAP_CHAR_LEN("FontEmphasisMark") },
+ { MAP_CHAR_LEN("ImageScaleMode"), MAP_CHAR_LEN("ScaleMode") },
{ NULL,0, NULL, 0 }
};
diff --git a/xmloff/inc/xmloff/ControlBorderHandler.hxx b/xmloff/inc/xmloff/ControlBorderHandler.hxx
deleted file mode 100644
index f29d14f0a4..0000000000
--- a/xmloff/inc/xmloff/ControlBorderHandler.hxx
+++ /dev/null
@@ -1,73 +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: ControlBorderHandler.hxx,v $
- * $Revision: 1.3 $
- *
- * 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 _XMLOFF_CONTROLBORDERHDL_HXX_
-#define _XMLOFF_CONTROLBORDERHDL_HXX_
-
-#include <xmloff/prhdlfac.hxx>
-#include <vos/ref.hxx>
-#include <rtl/ustring.hxx>
-#include <xmloff/xmlexppr.hxx>
-
-//.........................................................................
-namespace xmloff
-{
-//.........................................................................
-
- //=====================================================================
- //= OControlBorderHandlerFactory
- //=====================================================================
- class OControlBorderHandlerFactory
- {
- private:
- OControlBorderHandlerFactory(); // never implemented
-
- public:
- static const XMLPropertyHandler* createBorderHandler();
- static const XMLPropertyHandler* createBorderColorHandler();
- };
-
- //=====================================================================
- //= OControlTextEmphasisHandler
- //=====================================================================
- class OControlTextEmphasisHandler : public XMLPropertyHandler
- {
- public:
- OControlTextEmphasisHandler();
-
- virtual sal_Bool importXML( const ::rtl::OUString& _rStrImpValue, ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const;
- virtual sal_Bool exportXML( ::rtl::OUString& _rStrExpValue, const ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const;
- };
-
-//.........................................................................
-} // namespace xmloff
-//.........................................................................
-
-#endif // _XMLOFF_CONTROLBORDERHDL_HXX_
diff --git a/xmloff/inc/xmloff/controlpropertyhdl.hxx b/xmloff/inc/xmloff/controlpropertyhdl.hxx
index 54477da4d4..6c85ea32f6 100644
--- a/xmloff/inc/xmloff/controlpropertyhdl.hxx
+++ b/xmloff/inc/xmloff/controlpropertyhdl.hxx
@@ -37,10 +37,9 @@
#include <vos/ref.hxx>
#include <rtl/ustring.hxx>
#include <xmloff/xmlexppr.hxx>
-#include <xmloff/ControlBorderHandler.hxx>
+#include <xmloff/XMLConstantsPropertyHandler.hxx>
struct SvXMLEnumMapEntry;
-class XMLConstantsPropertyHandler;
class Color;
//.........................................................................
namespace xmloff
@@ -77,58 +76,54 @@ namespace xmloff
//=====================================================================
//= OControlBorderHandlerBase
//=====================================================================
- class OControlBorderHandlerBase : public XMLPropertyHandler
+ class OControlBorderHandler : public XMLPropertyHandler
{
public:
- OControlBorderHandlerBase();
+ enum BorderFacet
+ {
+ STYLE,
+ COLOR
+ };
+
+ OControlBorderHandler( const BorderFacet _eFacet );
virtual sal_Bool importXML( const ::rtl::OUString& _rStrImpValue, ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const;
- virtual sal_Bool exportXML( ::rtl::OUString& _rStrExpValue, const ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const = 0;
+ virtual sal_Bool exportXML( ::rtl::OUString& _rStrExpValue, const ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const;
- protected:
- /** called during importXML, after the string value has been split
- */
- virtual void pickOne( const Color& _rColor, sal_Int16 _nStyle, ::com::sun::star::uno::Any& _rValue ) const = 0;
+ private:
+ BorderFacet m_eFacet;
};
//=====================================================================
- //= OControlBorderStyleHandler
+ //= OControlTextEmphasisHandler
//=====================================================================
- class OControlBorderStyleHandler : public OControlBorderHandlerBase
+ class OControlTextEmphasisHandler : public XMLPropertyHandler
{
public:
- OControlBorderStyleHandler();
+ OControlTextEmphasisHandler();
+ virtual sal_Bool importXML( const ::rtl::OUString& _rStrImpValue, ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const;
virtual sal_Bool exportXML( ::rtl::OUString& _rStrExpValue, const ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const;
-
- protected:
- virtual void pickOne( const Color& _rColor, sal_Int16 _nStyle, ::com::sun::star::uno::Any& _rValue ) const;
};
//=====================================================================
- //= OControlBorderStyleHandler
+ //= ImageScaleModeHandler
//=====================================================================
- class OControlBorderColorHandler : public OControlBorderHandlerBase
+ class ImageScaleModeHandler : public XMLConstantsPropertyHandler
{
public:
- OControlBorderColorHandler();
-
- virtual sal_Bool exportXML( ::rtl::OUString& _rStrExpValue, const ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const;
-
- protected:
- virtual void pickOne( const Color& _rColor, sal_Int16 _nStyle, ::com::sun::star::uno::Any& _rValue ) const;
+ ImageScaleModeHandler();
};
//=====================================================================
//= OControlPropertyHandlerFactory
//=====================================================================
- class XMLOFF_DLLPUBLIC OControlPropertyHandlerFactory:
- public XMLPropertyHandlerFactory
+ class XMLOFF_DLLPUBLIC OControlPropertyHandlerFactory : public XMLPropertyHandlerFactory
{
protected:
mutable XMLConstantsPropertyHandler* m_pTextAlignHandler;
- mutable OControlBorderStyleHandler* m_pControlBorderStyleHandler;
- mutable OControlBorderColorHandler* m_pControlBorderColorHandler;
+ mutable OControlBorderHandler* m_pControlBorderStyleHandler;
+ mutable OControlBorderHandler* m_pControlBorderColorHandler;
mutable ORotationAngleHandler* m_pRotationAngleHandler;
mutable OFontWidthHandler* m_pFontWidthHandler;
mutable XMLConstantsPropertyHandler* m_pFontEmphasisHandler;
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index b0e8040faa..22edccad35 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -3050,6 +3050,10 @@ namespace xmloff { namespace token {
XML_N_FIELD,
XML_NP_FIELD,
+ XML_IMAGE_SCALE,
+ XML_ISOTROPIC,
+ XML_ANISOTROPIC,
+
XML_TOKEN_END
};
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 2a619976d5..fe683fc1fc 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3052,6 +3052,10 @@ namespace xmloff { namespace token {
TOKEN( "urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0", XML_N_FIELD ),
TOKEN( "field", XML_NP_FIELD ),
+ TOKEN( "image-scale", XML_IMAGE_SCALE ),
+ TOKEN( "isotropic", XML_ISOTROPIC ),
+ TOKEN( "anisotropic", XML_ANISOTROPIC ),
+
#if OSL_DEBUG_LEVEL > 0
{ 0, NULL, NULL, XML_TOKEN_END }
#else
diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx
index 0aa525be8a..20f0473c73 100644
--- a/xmloff/source/draw/sdpropls.cxx
+++ b/xmloff/source/draw/sdpropls.cxx
@@ -59,7 +59,7 @@
#include <com/sun/star/drawing/TextFitToSizeType.hpp>
#include <com/sun/star/drawing/MeasureTextHorzPos.hpp>
#include <com/sun/star/drawing/MeasureTextVertPos.hpp>
-#include <xmloff/ControlBorderHandler.hxx>
+#include <xmloff/controlpropertyhdl.hxx>
#include <xmloff/xmltoken.hxx>
#include "sdpropls.hxx"
#include "propimp0.hxx"
@@ -134,7 +134,7 @@ const XMLPropertyMapEntry aXMLSDProperties[] =
GMAP( "FillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SD_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
GMAP( "FillBitmapSizeY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SD_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
GMAP( "FillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SD_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0 ),
- GMAP( "FillBitmapMode", XML_NAMESPACE_STYLE,XML_REPEAT, XML_SD_TYPE_BITMAP_MODE, 0 ),
+ GMAP( "FillBitmapMode", XML_NAMESPACE_STYLE,XML_REPEAT, XML_SD_TYPE_BITMAP_MODE|MID_FLAG_MULTI_PROPERTY, 0 ),
GMAP( "FillBitmapPositionOffsetX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_X, XML_TYPE_PERCENT, 0 ),
GMAP( "FillBitmapPositionOffsetY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_Y, XML_TYPE_PERCENT, 0 ),
GMAP( "FillBitmapRectanglePoint", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT, XML_SD_TYPE_BITMAP_REFPOINT, 0 ),
@@ -266,6 +266,7 @@ const XMLPropertyMapEntry aXMLSDProperties[] =
GMAP( "ControlBorderColor", XML_NAMESPACE_FO, XML_BORDER, XML_SD_TYPE_CONTROL_BORDER_COLOR|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
GMAP( "ControlDataStyle", XML_NAMESPACE_STYLE,XML_DATA_STYLE_NAME, XML_TYPE_STRING|MID_FLAG_NO_PROPERTY_EXPORT|MID_FLAG_SPECIAL_ITEM, CTF_SD_CONTROL_SHAPE_DATA_STYLE ),
GMAP( "ControlTextEmphasis", XML_NAMESPACE_STYLE,XML_TEXT_EMPHASIZE, XML_TYPE_CONTROL_TEXT_EMPHASIZE, 0 ),
+ GMAP( "ImageScaleMode", XML_NAMESPACE_STYLE,XML_REPEAT, XML_SD_TYPE_IMAGE_SCALE_MODE|MID_FLAG_MULTI_PROPERTY, 0 ),
// special entries for floating frames
GMAP( "FrameIsAutoScroll", XML_NAMESPACE_DRAW, XML_FRAME_DISPLAY_SCROLLBAR, XML_TYPE_BOOL|MID_FLAG_MULTI_PROPERTY, CTF_FRAME_DISPLAY_SCROLLBAR ),
@@ -1086,10 +1087,13 @@ const XMLPropertyHandler* XMLSdPropHdlFactory::GetPropertyHandler( sal_Int32 nTy
break;
case XML_SD_TYPE_CONTROL_BORDER:
- pHdl = xmloff::OControlBorderHandlerFactory::createBorderHandler();
+ pHdl = new ::xmloff::OControlBorderHandler( ::xmloff::OControlBorderHandler::STYLE );
break;
case XML_SD_TYPE_CONTROL_BORDER_COLOR:
- pHdl = xmloff::OControlBorderHandlerFactory::createBorderColorHandler();
+ pHdl = new ::xmloff::OControlBorderHandler( ::xmloff::OControlBorderHandler::COLOR );
+ break;
+ case XML_SD_TYPE_IMAGE_SCALE_MODE:
+ pHdl = new ::xmloff::ImageScaleModeHandler;
break;
case XML_TYPE_CONTROL_TEXT_EMPHASIZE:
pHdl = new ::xmloff::OControlTextEmphasisHandler;
diff --git a/xmloff/source/draw/sdpropls.hxx b/xmloff/source/draw/sdpropls.hxx
index 6918601a5c..9664f4b6a6 100644
--- a/xmloff/source/draw/sdpropls.hxx
+++ b/xmloff/source/draw/sdpropls.hxx
@@ -89,6 +89,7 @@ extern const XMLPropertyMapEntry aXMLSDPresPageProps_onlyHeadersFooter[];
#define XML_SD_TYPE_MEASURE_PLACING (XML_SD_TYPES_START + 31 )
#define XML_SD_TYPE_CONTROL_BORDER (XML_SD_TYPES_START + 32 )
#define XML_SD_TYPE_CONTROL_BORDER_COLOR (XML_SD_TYPES_START + 33 )
+#define XML_SD_TYPE_IMAGE_SCALE_MODE (XML_SD_TYPES_START + 34 )
// 3D property types
#define XML_SD_TYPE_BACKFACE_CULLING (XML_SD_TYPES_START + 40 )
diff --git a/xmloff/source/forms/controlpropertyhdl.cxx b/xmloff/source/forms/controlpropertyhdl.cxx
index 0f21663455..390e50a105 100644
--- a/xmloff/source/forms/controlpropertyhdl.cxx
+++ b/xmloff/source/forms/controlpropertyhdl.cxx
@@ -96,13 +96,13 @@ namespace xmloff
case XML_TYPE_CONTROL_BORDER:
if (!m_pControlBorderStyleHandler)
- m_pControlBorderStyleHandler = new OControlBorderStyleHandler;
+ m_pControlBorderStyleHandler = new OControlBorderHandler( OControlBorderHandler::STYLE );
pHandler = m_pControlBorderStyleHandler;
break;
case XML_TYPE_CONTROL_BORDER_COLOR:
if ( !m_pControlBorderColorHandler )
- m_pControlBorderColorHandler = new OControlBorderColorHandler;
+ m_pControlBorderColorHandler = new OControlBorderHandler( OControlBorderHandler::COLOR );
pHandler = m_pControlBorderColorHandler;
break;
@@ -225,30 +225,16 @@ namespace xmloff
}
//=====================================================================
- //= OControlBorderHandlerFactory
- //=====================================================================
- //---------------------------------------------------------------------
- const XMLPropertyHandler* OControlBorderHandlerFactory::createBorderHandler()
- {
- return new OControlBorderStyleHandler;
- }
-
- //---------------------------------------------------------------------
- const XMLPropertyHandler* OControlBorderHandlerFactory::createBorderColorHandler()
- {
- return new OControlBorderColorHandler;
- }
-
- //=====================================================================
//= OControlBorderHandlerBase
//=====================================================================
//---------------------------------------------------------------------
- OControlBorderHandlerBase::OControlBorderHandlerBase()
+ OControlBorderHandler::OControlBorderHandler( const OControlBorderHandler::BorderFacet _eFacet )
+ :m_eFacet( _eFacet )
{
}
//---------------------------------------------------------------------
- sal_Bool OControlBorderHandlerBase::importXML( const ::rtl::OUString& _rStrImpValue, Any& _rValue, const SvXMLUnitConverter& ) const
+ sal_Bool OControlBorderHandler::importXML( const ::rtl::OUString& _rStrImpValue, Any& _rValue, const SvXMLUnitConverter& ) const
{
::rtl::OUString sToken;
SvXMLTokenEnumerator aTokens(_rStrImpValue);
@@ -256,92 +242,70 @@ namespace xmloff
sal_uInt16 nStyle = 1;
Color aColor;
- sal_Bool bFoundStyle = sal_False;
- sal_Bool bFoundColor = sal_False;
-
- while ( !( bFoundStyle && bFoundColor ) // did not yet find both aspects
- && aTokens.getNextToken(sToken) // have a new token
+ while ( aTokens.getNextToken(sToken) // have a new token
&& (0 != sToken.getLength()) // really have a new token
)
{
- // is it a valid enum value?
- if ( !bFoundStyle )
- bFoundStyle = SvXMLUnitConverter::convertEnum(nStyle, sToken, OEnumMapper::getEnumMap(OEnumMapper::epBorderWidth));
- // is it a color value?
- if ( !bFoundColor )
- bFoundColor = SvXMLUnitConverter::convertColor( aColor, sToken );
- }
-
- if ( !bFoundStyle && !bFoundColor )
- return sal_False;
-
- // if we're here, the string could have had more or less than the requested 3 tokens, but we ignore this.
- // At least we have a valid style or a valid, which is everything we're interested in.
- pickOne( aColor, (sal_Int16)nStyle, _rValue );
- return sal_True;
- }
-
- //=====================================================================
- //= OControlBorderStyleHandler
- //=====================================================================
- //---------------------------------------------------------------------
- OControlBorderStyleHandler::OControlBorderStyleHandler()
- {
- }
-
- //---------------------------------------------------------------------
- sal_Bool OControlBorderStyleHandler::exportXML( ::rtl::OUString& _rStrExpValue, const Any& _rValue, const SvXMLUnitConverter& ) const
- {
- sal_Bool bSuccess = sal_False;
- sal_Int16 nBorder = 0;
-
- ::rtl::OUStringBuffer aOut;
- bSuccess = (_rValue >>= nBorder)
- && SvXMLUnitConverter::convertEnum(aOut, nBorder, OEnumMapper::getEnumMap(OEnumMapper::epBorderWidth));
-
- if ( _rStrExpValue.getLength() )
- _rStrExpValue += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ) );
- _rStrExpValue += aOut.makeStringAndClear();
- return bSuccess;
- }
+ // try interpreting the token as border style
+ if ( m_eFacet == STYLE )
+ {
+ // is it a valid enum value?
+ if ( SvXMLUnitConverter::convertEnum( nStyle, sToken, OEnumMapper::getEnumMap( OEnumMapper::epBorderWidth ) ) )
+ {
+ _rValue <<= nStyle;
+ return sal_True;
+ }
+ }
- //---------------------------------------------------------------------
- void OControlBorderStyleHandler::pickOne( const Color&, sal_Int16 _nStyle, Any& _rValue ) const
- {
- _rValue <<= _nStyle;
- }
+ // try interpreting it as color value
+ if ( m_eFacet == COLOR )
+ {
+ if ( SvXMLUnitConverter::convertColor( aColor, sToken ) )
+ {
+ _rValue <<= (sal_Int32)aColor.GetColor();
+ return sal_True;
+ }
+ }
+ }
- //=====================================================================
- //= OControlBorderColorHandler
- //=====================================================================
- //---------------------------------------------------------------------
- OControlBorderColorHandler::OControlBorderColorHandler()
- {
+ return sal_False;
}
//---------------------------------------------------------------------
- sal_Bool OControlBorderColorHandler::exportXML( ::rtl::OUString& _rStrExpValue, const Any& _rValue, const SvXMLUnitConverter& ) const
+ sal_Bool OControlBorderHandler::exportXML( ::rtl::OUString& _rStrExpValue, const Any& _rValue, const SvXMLUnitConverter& ) const
{
sal_Bool bSuccess = sal_False;
- sal_Int32 nBorderColor = 0;
::rtl::OUStringBuffer aOut;
- if ( _rValue >>= nBorderColor )
+ switch ( m_eFacet )
+ {
+ case STYLE:
{
- SvXMLUnitConverter::convertColor( aOut, Color( nBorderColor ) );
- bSuccess = sal_True;
+ sal_Int16 nBorder = 0;
+ bSuccess = (_rValue >>= nBorder)
+ && SvXMLUnitConverter::convertEnum( aOut, nBorder, OEnumMapper::getEnumMap( OEnumMapper::epBorderWidth ) );
}
+ break;
+ case COLOR:
+ {
+ sal_Int32 nBorderColor = 0;
+ if ( _rValue >>= nBorderColor )
+ {
+ SvXMLUnitConverter::convertColor( aOut, Color( nBorderColor ) );
+ bSuccess = sal_True;
+ }
+ }
+ break;
+ } // switch ( m_eFacet )
+
+ if ( !bSuccess )
+ return sal_False;
if ( _rStrExpValue.getLength() )
_rStrExpValue += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ) );
_rStrExpValue += aOut.makeStringAndClear();
- return bSuccess;
- }
- //---------------------------------------------------------------------
- void OControlBorderColorHandler::pickOne( const Color& _rColor, sal_Int16 /*_nStyle*/, Any& _rValue ) const
- {
- _rValue <<= (sal_Int32)_rColor.GetColor();
+ return sal_True;
}
//=====================================================================
@@ -414,6 +378,15 @@ namespace xmloff
return bSuccess;
}
+ //=====================================================================
+ //= ImageScaleModeHandler
+ //=====================================================================
+ //---------------------------------------------------------------------
+ ImageScaleModeHandler::ImageScaleModeHandler()
+ :XMLConstantsPropertyHandler( OEnumMapper::getEnumMap( OEnumMapper::epImageScaleMode ), XML_STRETCH )
+ {
+ }
+
//.........................................................................
} // namespace xmloff
//.........................................................................
diff --git a/xmloff/source/forms/controlpropertymap.cxx b/xmloff/source/forms/controlpropertymap.cxx
index 9046a6a55c..a40421864c 100644
--- a/xmloff/source/forms/controlpropertymap.cxx
+++ b/xmloff/source/forms/controlpropertymap.cxx
@@ -134,16 +134,16 @@ namespace xmloff
}
//=====================================================================
- //= OFormExportPropertyMapper
+ //= OFormComponentStyleExportMapper
//=====================================================================
//---------------------------------------------------------------------
- OFormExportPropertyMapper::OFormExportPropertyMapper( const UniReference< XMLPropertySetMapper >& _rMapper )
+ OFormComponentStyleExportMapper::OFormComponentStyleExportMapper( const UniReference< XMLPropertySetMapper >& _rMapper )
:SvXMLExportPropertyMapper( _rMapper )
{
}
//---------------------------------------------------------------------
- void OFormExportPropertyMapper::handleSpecialItem( SvXMLAttributeList& _rAttrList, const XMLPropertyState& _rProperty, const SvXMLUnitConverter& _rUnitConverter,
+ void OFormComponentStyleExportMapper::handleSpecialItem( SvXMLAttributeList& _rAttrList, const XMLPropertyState& _rProperty, const SvXMLUnitConverter& _rUnitConverter,
const SvXMLNamespaceMap& _rNamespaceMap, const ::std::vector< XMLPropertyState >* _pProperties,
sal_uInt32 _nIdx ) const
{
diff --git a/xmloff/source/forms/controlpropertymap.hxx b/xmloff/source/forms/controlpropertymap.hxx
index 0f2502e492..d6302c74f5 100644
--- a/xmloff/source/forms/controlpropertymap.hxx
+++ b/xmloff/source/forms/controlpropertymap.hxx
@@ -45,12 +45,12 @@ namespace xmloff
void initializePropertyMaps();
//=====================================================================
- //= OFormExportPropertyMapper
+ //= OFormComponentStyleExportMapper
//=====================================================================
- class OFormExportPropertyMapper : public SvXMLExportPropertyMapper
+ class OFormComponentStyleExportMapper : public SvXMLExportPropertyMapper
{
public:
- OFormExportPropertyMapper( const UniReference< XMLPropertySetMapper >& _rMapper );
+ OFormComponentStyleExportMapper( const UniReference< XMLPropertySetMapper >& _rMapper );
void handleSpecialItem(
SvXMLAttributeList& _rAttrList,
diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx
index a8c8ac922f..546bd6802a 100644
--- a/xmloff/source/forms/elementexport.cxx
+++ b/xmloff/source/forms/elementexport.cxx
@@ -31,24 +31,14 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"
-#include <stdio.h>
#include "elementexport.hxx"
#include "strings.hxx"
-#include <xmloff/xmlexp.hxx>
-#include <xmloff/nmspmap.hxx>
#include "xmlnmspe.hxx"
-#include <xmloff/xmluconv.hxx>
-#include <xmloff/xmltoken.hxx>
-#include <tools/time.hxx>
-#include <tools/diagnose_ex.h>
-#include <comphelper/extract.hxx>
#include "eventexport.hxx"
#include "formenums.hxx"
-#include <vcl/wintypes.hxx> // for check states
-#include <xmloff/XMLEventExport.hxx>
#include "formcellbinding.hxx"
-
-#include <algorithm>
+#include "formcellbinding.hxx"
+#include "xformsexport.hxx"
/** === begin UNO includes === **/
#include <com/sun/star/text/XText.hpp>
@@ -67,21 +57,37 @@
#include <com/sun/star/form/ListSourceType.hpp>
#include <com/sun/star/awt/ImagePosition.hpp>
/** === end UNO includes === **/
+
#include <vcl/wintypes.hxx> // for check states
#include <xmloff/txtprmap.hxx>
-#include "formcellbinding.hxx"
-#include "xformsexport.hxx"
#include <com/sun/star/form/binding/XBindableValue.hpp>
#include <com/sun/star/form/binding/XListEntrySink.hpp>
#include <tools/urlobj.hxx>
-#include <algorithm>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <vcl/wintypes.hxx> // for check states
+#include <xmloff/XMLEventExport.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <tools/time.hxx>
+#include <tools/diagnose_ex.h>
+#include <comphelper/extract.hxx>
+#include <stdio.h>
+#include <algorithm>
//.........................................................................
namespace xmloff
{
//.........................................................................
+ #if OSL_DEBUG_LEVEL > 0
+ #define RESET_BIT( bitfield, bit ) \
+ bitfield = bitfield & ~bit
+ #else
+ #define RESET_BIT( bitfield, bit )
+ #endif
+
using namespace ::xmloff::token;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdb;
@@ -310,7 +316,7 @@ namespace xmloff
// the control id
if (CCA_CONTROL_ID & m_nIncludeCommon)
{
- OSL_ENSURE(m_sControlId.getLength(), "OControlExport::exportOuterAttributes: have no control id for the control!");
+ OSL_ENSURE(m_sControlId.getLength(), "OControlExport::exportInnerAttributes: have no control id for the control!");
AddAttribute(
OAttributeMetaData::getCommonControlAttributeNamespace(CCA_CONTROL_ID),
OAttributeMetaData::getCommonControlAttributeName(CCA_CONTROL_ID),
@@ -789,10 +795,19 @@ namespace xmloff
OAttributeMetaData::getDatabaseAttributeNamespace(DA_DATA_FIELD),
OAttributeMetaData::getDatabaseAttributeName(DA_DATA_FIELD),
PROPERTY_DATAFIELD);
- #if OSL_DEBUG_LEVEL > 0
- // reset the bit for later checking
- nIncludeDatabase = nIncludeDatabase & ~DA_DATA_FIELD;
- #endif
+ RESET_BIT( nIncludeDatabase, DA_DATA_FIELD );
+ }
+
+ // InputRequired
+ if ( DA_INPUT_REQUIRED & m_nIncludeDatabase )
+ {
+ exportBooleanPropertyAttribute(
+ OAttributeMetaData::getDatabaseAttributeNamespace( DA_INPUT_REQUIRED ),
+ OAttributeMetaData::getDatabaseAttributeName( DA_INPUT_REQUIRED ),
+ PROPERTY_INPUT_REQUIRED,
+ BOOLATTR_DEFAULT_TRUE
+ );
+ RESET_BIT( nIncludeDatabase, DA_INPUT_REQUIRED );
}
// the only int16 property: BoundColumn
@@ -803,13 +818,10 @@ namespace xmloff
OAttributeMetaData::getDatabaseAttributeName(DA_BOUND_COLUMN),
PROPERTY_BOUNDCOLUMN,
0);
- #if OSL_DEBUG_LEVEL > 0
- // reset the bit for later checking
- nIncludeDatabase = nIncludeDatabase & ~DA_BOUND_COLUMN;
- #endif
+ RESET_BIT( nIncludeDatabase, DA_BOUND_COLUMN );
}
- // the only boolean property: ConvertEmptyToNull
+ // ConvertEmptyToNull
if (DA_CONVERT_EMPTY & m_nIncludeDatabase)
{
exportBooleanPropertyAttribute(
@@ -818,10 +830,7 @@ namespace xmloff
PROPERTY_EMPTY_IS_NULL,
BOOLATTR_DEFAULT_FALSE
);
- #if OSL_DEBUG_LEVEL > 0
- // reset the bit for later checking
- nIncludeDatabase = nIncludeDatabase & ~DA_CONVERT_EMPTY;
- #endif
+ RESET_BIT( nIncludeDatabase, DA_CONVERT_EMPTY );
}
// the only enum property: ListSourceType
@@ -834,19 +843,13 @@ namespace xmloff
OEnumMapper::getEnumMap(OEnumMapper::epListSourceType),
ListSourceType_VALUELIST
);
- #if OSL_DEBUG_LEVEL > 0
- // reset the bit for later checking
- nIncludeDatabase = nIncludeDatabase & ~DA_LIST_SOURCE_TYPE;
- #endif
+ RESET_BIT( nIncludeDatabase, DA_LIST_SOURCE_TYPE );
}
if (m_nIncludeDatabase & DA_LIST_SOURCE)
{
exportListSourceAsAttribute();
- #if OSL_DEBUG_LEVEL > 0
- // reset the bit for later checking
- nIncludeDatabase = nIncludeDatabase & ~DA_LIST_SOURCE;
- #endif
+ RESET_BIT( nIncludeDatabase, DA_LIST_SOURCE );
}
#if OSL_DEBUG_LEVEL > 0
@@ -1151,11 +1154,7 @@ namespace xmloff
if ( SCA_IMAGE_POSITION & m_nIncludeSpecial )
{
exportImagePositionAttributes();
-
- #if OSL_DEBUG_LEVEL > 0
- // reset the bit for later checking
- m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_IMAGE_POSITION;
- #endif
+ RESET_BIT( m_nIncludeSpecial, SCA_IMAGE_POSITION );
}
OSL_ENSURE(0 == m_nIncludeSpecial,
@@ -1446,7 +1445,7 @@ namespace xmloff
CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE;
// database attributes
- m_nIncludeDatabase = DA_DATA_FIELD;
+ m_nIncludeDatabase = DA_DATA_FIELD | DA_INPUT_REQUIRED;
// event attributes
m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE | EA_ON_SELECT;
@@ -1508,7 +1507,7 @@ namespace xmloff
CCA_DISABLED | CCA_DROPDOWN | CCA_MAX_LENGTH | CCA_PRINTABLE | CCA_READONLY | CCA_SIZE |
CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE | CCA_VALUE;
m_nIncludeSpecial = SCA_AUTOMATIC_COMPLETION;
- m_nIncludeDatabase = DA_CONVERT_EMPTY | DA_DATA_FIELD | DA_LIST_SOURCE | DA_LIST_SOURCE_TYPE;
+ m_nIncludeDatabase = DA_CONVERT_EMPTY | DA_DATA_FIELD | DA_INPUT_REQUIRED | DA_LIST_SOURCE | DA_LIST_SOURCE_TYPE;
m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE | EA_ON_SELECT;
break;
@@ -1518,7 +1517,7 @@ namespace xmloff
CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_DROPDOWN |
CCA_PRINTABLE | CCA_SIZE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE;
m_nIncludeSpecial = SCA_MULTIPLE;
- m_nIncludeDatabase = DA_BOUND_COLUMN | DA_DATA_FIELD | DA_LIST_SOURCE_TYPE;
+ m_nIncludeDatabase = DA_BOUND_COLUMN | DA_DATA_FIELD | DA_INPUT_REQUIRED | DA_LIST_SOURCE_TYPE;
m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE | EA_ON_CLICK | EA_ON_DBLCLICK;
// check if we need to export the ListSource as attribute
{
@@ -1545,8 +1544,10 @@ namespace xmloff
// NO BREAK !
case FormComponentType::IMAGEBUTTON:
if (BUTTON != m_eType)
+ {
// not coming from the previous case
m_eType = IMAGE;
+ }
m_nIncludeCommon |=
CCA_NAME | CCA_SERVICE_NAME | CCA_BUTTON_TYPE | CCA_DISABLED |
CCA_IMAGE_DATA | CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TARGET_FRAME |
@@ -1569,7 +1570,7 @@ namespace xmloff
}
if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_IMAGE_POSITION ) )
m_nIncludeSpecial |= SCA_IMAGE_POSITION;
- m_nIncludeDatabase = DA_DATA_FIELD;
+ m_nIncludeDatabase = DA_DATA_FIELD | DA_INPUT_REQUIRED;
m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE;
break;
@@ -1586,7 +1587,7 @@ namespace xmloff
m_nIncludeCommon =
CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_IMAGE_DATA |
CCA_PRINTABLE | CCA_READONLY | CCA_TITLE;
- m_nIncludeDatabase = DA_DATA_FIELD;
+ m_nIncludeDatabase = DA_DATA_FIELD | DA_INPUT_REQUIRED;
m_nIncludeEvents = EA_CONTROL_EVENTS;
break;
@@ -1955,7 +1956,7 @@ namespace xmloff
// grid columns miss some properties of the controls they're representing
m_nIncludeCommon &= ~(CCA_FOR | CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_LABEL);
- m_nIncludeSpecial &= ~(SCA_ECHO_CHAR | SCA_AUTOMATIC_COMPLETION | SCA_MULTIPLE | SCA_MULTI_LINE | SCA_IS_TRISTATE);
+ m_nIncludeSpecial &= ~(SCA_ECHO_CHAR | SCA_AUTOMATIC_COMPLETION | SCA_MULTIPLE | SCA_MULTI_LINE);
if (FormComponentType::DATEFIELD != m_nClassId)
// except date fields, no column has the DropDown property
diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx
index 3726a92966..d41435168f 100644
--- a/xmloff/source/forms/elementimport.cxx
+++ b/xmloff/source/forms/elementimport.cxx
@@ -331,7 +331,12 @@ namespace xmloff
{
if ( !xDynamicProperties.is() )
{
- OSL_ENSURE( false, "OElementImport::implImportGenericProperties: encountered an unknown property, but component is no PropertyBag!" );
+ #if OSL_DEBUG_LEVEL > 0
+ ::rtl::OString aMessage( "OElementImport::implImportGenericProperties: encountered an unknown property (" );
+ aMessage += ::rtl::OUStringToOString( aPropValues->Name, RTL_TEXTENCODING_ASCII_US );
+ aMessage += "), but component is no PropertyBag!";
+ OSL_ENSURE( false, aMessage.getStr() );
+ #endif
continue;
}
@@ -1133,10 +1138,10 @@ namespace xmloff
)
);
- if ( bMakeAbsolute )
+ if ( bMakeAbsolute && ( _rValue.getLength() > 0 ) )
{
// make a global URL out of the local one
- ::rtl::OUString sAdjustedValue = m_rContext.getGlobalContext().GetAbsoluteReference( _rValue );
+ ::rtl::OUString sAdjustedValue = m_rContext.getGlobalContext().ResolveGraphicObjectURL( _rValue, FALSE );
OImagePositionImport::handleAttribute( _nNamespaceKey, _rLocalName, sAdjustedValue );
}
else
@@ -1989,10 +1994,8 @@ namespace xmloff
case OControlElement::BUTTON:
case OControlElement::IMAGE:
- return new OButtonImport(m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType);
-
case OControlElement::IMAGE_FRAME:
- return new OURLReferenceImport( m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType );
+ return new OButtonImport( m_rFormImport, *this, _nPrefix, _rLocalName, m_xMeAsContainer, _eType );
case OControlElement::COMBOBOX:
case OControlElement::LISTBOX:
diff --git a/xmloff/source/forms/formattributes.cxx b/xmloff/source/forms/formattributes.cxx
index 015eda3edb..9cb70d95dd 100644
--- a/xmloff/source/forms/formattributes.cxx
+++ b/xmloff/source/forms/formattributes.cxx
@@ -150,6 +150,7 @@ namespace xmloff
case DA_DATA_FIELD: return "data-field";
case DA_LIST_SOURCE: return "list-source";
case DA_LIST_SOURCE_TYPE: return "list-source-type";
+ case DA_INPUT_REQUIRED: return "input-required";
default:
OSL_ENSURE(sal_False, "OAttributeMetaData::getDatabaseAttributeName: invalid id (maybe you or-ed two flags?)!");
}
diff --git a/xmloff/source/forms/formattributes.hxx b/xmloff/source/forms/formattributes.hxx
index 478f1d7342..69eff4c95e 100644
--- a/xmloff/source/forms/formattributes.hxx
+++ b/xmloff/source/forms/formattributes.hxx
@@ -76,6 +76,7 @@ namespace xmloff
#define DA_DATA_FIELD 0x00000004
#define DA_LIST_SOURCE 0x00000008
#define DA_LIST_SOURCE_TYPE 0x00000010
+ #define DA_INPUT_REQUIRED 0x00000020
// flags for binding related control attributes
#define BA_LINKED_CELL 0x00000001
diff --git a/xmloff/source/forms/formenums.cxx b/xmloff/source/forms/formenums.cxx
index 427483b552..90efb4b39c 100644
--- a/xmloff/source/forms/formenums.cxx
+++ b/xmloff/source/forms/formenums.cxx
@@ -45,6 +45,7 @@
#include <com/sun/star/awt/FontRelief.hpp>
#include <com/sun/star/awt/ScrollBarOrientation.hpp>
#include <com/sun/star/awt/VisualEffect.hpp>
+#include <com/sun/star/awt/ImageScaleMode.hpp>
#include <vcl/wintypes.hxx> // for check states
#include <xmloff/xmltoken.hxx>
@@ -321,6 +322,21 @@ namespace xmloff
rReturn = aImageAlignMap;
}
break;
+
+ case epImageScaleMode:
+ {
+ static const SvXMLEnumMapEntry aScaleModeMap[] =
+ {
+ { XML_BACKGROUND_NO_REPEAT, ImageScaleMode::None },
+ { XML_REPEAT, ImageScaleMode::None }, // repeating the image is not supported
+ { XML_STRETCH, ImageScaleMode::Anisotropic },
+ { XML_SCALE, ImageScaleMode::Isotropic },
+ { XML_TOKEN_INVALID, ImageScaleMode::None }
+ };
+ rReturn = aScaleModeMap;
+ }
+ break;
+
case KNOWN_ENUM_PROPERTIES:
break;
}
diff --git a/xmloff/source/forms/formenums.hxx b/xmloff/source/forms/formenums.hxx
index 3fe4e5bc2b..2d798bcf6e 100644
--- a/xmloff/source/forms/formenums.hxx
+++ b/xmloff/source/forms/formenums.hxx
@@ -63,6 +63,7 @@ namespace xmloff
epVisualEffect,
epImagePosition,
epImageAlign,
+ epImageScaleMode,
KNOWN_ENUM_PROPERTIES
};
diff --git a/xmloff/source/forms/layerexport.cxx b/xmloff/source/forms/layerexport.cxx
index 309d177319..29641727f5 100644
--- a/xmloff/source/forms/layerexport.cxx
+++ b/xmloff/source/forms/layerexport.cxx
@@ -103,12 +103,12 @@ namespace xmloff
// add our style family to the export context's style pool
m_xPropertyHandlerFactory = new OControlPropertyHandlerFactory();
::vos::ORef< XMLPropertySetMapper > xStylePropertiesMapper = new XMLPropertySetMapper( getControlStylePropertyMap(), m_xPropertyHandlerFactory.getBodyPtr() );
- m_xExportMapper = new OFormExportPropertyMapper( xStylePropertiesMapper.getBodyPtr() );
+ m_xStyleExportMapper = new OFormComponentStyleExportMapper( xStylePropertiesMapper.getBodyPtr() );
// our style family
m_rContext.GetAutoStylePool()->AddFamily(
XML_STYLE_FAMILY_CONTROL_ID, token::GetXMLToken(token::XML_PARAGRAPH),
- m_xExportMapper.getBodyPtr(),
+ m_xStyleExportMapper.getBodyPtr(),
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( XML_STYLE_FAMILY_CONTROL_PREFIX) )
);
@@ -188,7 +188,7 @@ namespace xmloff
//---------------------------------------------------------------------
::vos::ORef< SvXMLExportPropertyMapper > OFormLayerXMLExport_Impl::getStylePropertyMapper()
{
- return m_xExportMapper;
+ return m_xStyleExportMapper;
}
//---------------------------------------------------------------------
@@ -641,7 +641,7 @@ namespace xmloff
// determine a number style, if needed
xColumnPropertiesMeta = xColumnProperties->getPropertySetInfo();
// get the styles of the column
- ::std::vector< XMLPropertyState > aPropertyStates = m_xExportMapper->Filter( xColumnProperties );
+ ::std::vector< XMLPropertyState > aPropertyStates = m_xStyleExportMapper->Filter( xColumnProperties );
// care for the number format, additionally
::rtl::OUString sColumnNumberStyle;
@@ -650,7 +650,7 @@ namespace xmloff
if ( sColumnNumberStyle.getLength() )
{ // the column indeed has a formatting
- sal_Int32 nStyleMapIndex = m_xExportMapper->getPropertySetMapper()->FindEntryIndex( CTF_FORMS_DATA_STYLE );
+ sal_Int32 nStyleMapIndex = m_xStyleExportMapper->getPropertySetMapper()->FindEntryIndex( CTF_FORMS_DATA_STYLE );
// TODO: move this to the ctor
OSL_ENSURE ( -1 != nStyleMapIndex, "XMLShapeExport::collectShapeAutoStyles: could not obtain the index for our context id!");
diff --git a/xmloff/source/forms/layerexport.hxx b/xmloff/source/forms/layerexport.hxx
index 00b8deb26b..6d3a318bfd 100644
--- a/xmloff/source/forms/layerexport.hxx
+++ b/xmloff/source/forms/layerexport.hxx
@@ -84,7 +84,7 @@ namespace xmloff
// style handling
::vos::ORef< XMLPropertyHandlerFactory > m_xPropertyHandlerFactory;
- ::vos::ORef< SvXMLExportPropertyMapper > m_xExportMapper;
+ ::vos::ORef< SvXMLExportPropertyMapper > m_xStyleExportMapper;
// we need our own number formats supplier:
// Controls which have a number formats do not work with the formats supplier of the document they reside
@@ -100,7 +100,7 @@ namespace xmloff
// add this format to the global (document) formats supplier.
// In case of an export we could do some cleanup afterwards, but in case of an import, there is no such
// chance, as (if other user-defined formats exist in the document as well) we can't distinguish
- // between user-defined formats really beeded for the doc (i.e. in a calc cell) and formats only added
+ // between user-defined formats really needed for the doc (i.e. in a calc cell) and formats only added
// to the supplier because the controls needed it.
::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >
m_xControlNumberFormats;
diff --git a/xmloff/source/forms/layerimport.cxx b/xmloff/source/forms/layerimport.cxx
index eb0a47a14b..bb152eb8ad 100644
--- a/xmloff/source/forms/layerimport.cxx
+++ b/xmloff/source/forms/layerimport.cxx
@@ -177,6 +177,8 @@ namespace xmloff
OAttributeMetaData::getSpecialAttributeName( SCA_TOGGLE ), PROPERTY_TOGGLE, sal_False );
m_aAttributeMetaData.addBooleanProperty(
OAttributeMetaData::getSpecialAttributeName( SCA_FOCUS_ON_CLICK ), PROPERTY_FOCUS_ON_CLICK, sal_True );
+ m_aAttributeMetaData.addBooleanProperty(
+ OAttributeMetaData::getDatabaseAttributeName( DA_INPUT_REQUIRED ), PROPERTY_INPUT_REQUIRED, sal_False );
// the int16 attributes
m_aAttributeMetaData.addInt16Property(
diff --git a/xmloff/source/forms/propertyexport.cxx b/xmloff/source/forms/propertyexport.cxx
index f9971f11b1..4cbb5f939c 100644
--- a/xmloff/source/forms/propertyexport.cxx
+++ b/xmloff/source/forms/propertyexport.cxx
@@ -429,7 +429,9 @@ namespace xmloff
::rtl::OUString sTargetLocation = comphelper::getString(m_xProps->getPropertyValue(_sPropertyName));
if ( sTargetLocation.getLength() )
- sTargetLocation = m_rContext.getGlobalContext().GetRelativeReference(sTargetLocation);
+ // If this isn't a GraphicObject then GetRelativeReference
+ // will be called anyway ( in AddEmbeddedGraphic )
+ sTargetLocation = m_rContext.getGlobalContext().AddEmbeddedGraphicObject(sTargetLocation);
AddAttribute(OAttributeMetaData::getCommonControlAttributeNamespace(_nProperty)
,OAttributeMetaData::getCommonControlAttributeName(_nProperty)
, sTargetLocation);
diff --git a/xmloff/source/forms/propertyimport.hxx b/xmloff/source/forms/propertyimport.hxx
index 32d75392a5..01741dfdfa 100644
--- a/xmloff/source/forms/propertyimport.hxx
+++ b/xmloff/source/forms/propertyimport.hxx
@@ -143,10 +143,21 @@ namespace xmloff
*/
void enableTrackAttributes() { m_bTrackAttributes = sal_True; }
- void implPushBackPropertyValue(const ::com::sun::star::beans::PropertyValue& _rProp)
- { m_aValues.push_back(_rProp); }
- void implPushBackGenericPropertyValue(const ::com::sun::star::beans::PropertyValue& _rProp)
- { m_aGenericValues.push_back(_rProp); }
+ inline void implPushBackPropertyValue(const ::com::sun::star::beans::PropertyValue& _rProp)
+ {
+ m_aValues.push_back(_rProp);
+ }
+
+ inline void implPushBackPropertyValue( const ::rtl::OUString& _rName, const ::com::sun::star::uno::Any& _rValue )
+ {
+ m_aValues.push_back( ::com::sun::star::beans::PropertyValue(
+ _rName, -1, _rValue, ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) );
+ }
+
+ inline void implPushBackGenericPropertyValue(const ::com::sun::star::beans::PropertyValue& _rProp)
+ {
+ m_aGenericValues.push_back(_rProp);
+ }
};
SV_DECL_IMPL_REF( OPropertyImport )
diff --git a/xmloff/source/forms/strings.hxx b/xmloff/source/forms/strings.hxx
index cd20bc720e..870f2285e5 100644
--- a/xmloff/source/forms/strings.hxx
+++ b/xmloff/source/forms/strings.hxx
@@ -136,6 +136,7 @@ namespace xmloff
XMLFORM_CONSTASCII_STRING( PROPERTY_DATAFIELD, "DataField" );
XMLFORM_CONSTASCII_STRING( PROPERTY_BOUNDCOLUMN, "BoundColumn");
XMLFORM_CONSTASCII_STRING( PROPERTY_EMPTY_IS_NULL, "ConvertEmptyToNull");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_INPUT_REQUIRED, "InputRequired");
XMLFORM_CONSTASCII_STRING( PROPERTY_LISTSOURCE, "ListSource");
XMLFORM_CONSTASCII_STRING( PROPERTY_LISTSOURCETYPE, "ListSourceType");
XMLFORM_CONSTASCII_STRING( PROPERTY_ECHO_CHAR, "EchoChar");
@@ -204,6 +205,7 @@ namespace xmloff
XMLFORM_CONSTASCII_STRING( PROPERTY_VISUAL_EFFECT, "VisualEffect");
XMLFORM_CONSTASCII_STRING( PROPERTY_IMAGE_POSITION, "ImagePosition");
XMLFORM_CONSTASCII_STRING( PROPERTY_IMAGE_ALIGN, "ImageAlign");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_SCALE_IMAGE, "ScaleImage");
XMLFORM_CONSTASCII_STRING( PROPERTY_BOUND_CELL, "BoundCell");
XMLFORM_CONSTASCII_STRING( PROPERTY_LIST_CELL_RANGE, "CellRange");