2000-10-26 13:46:14 +00:00
/*************************************************************************
*
2008-04-10 13:04:15 +00:00
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER .
2000-10-26 13:46:14 +00:00
*
2008-04-10 13:04:15 +00:00
* Copyright 2008 by Sun Microsystems , Inc .
2000-10-26 13:46:14 +00:00
*
2008-04-10 13:04:15 +00:00
* OpenOffice . org - a multi - platform office productivity suite
2000-10-26 13:46:14 +00:00
*
2008-04-10 13:04:15 +00:00
* $ RCSfile : brwctrlr . cxx , v $
2008-10-16 06:57:26 +00:00
* $ Revision : 1.105 .6 .3 $
2000-10-26 13:46:14 +00:00
*
2008-04-10 13:04:15 +00:00
* This file is part of OpenOffice . org .
2000-10-26 13:46:14 +00:00
*
2008-04-10 13:04:15 +00:00
* 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 .
2000-10-26 13:46:14 +00:00
*
2008-04-10 13:04:15 +00:00
* 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 ) .
2000-10-26 13:46:14 +00:00
*
2008-04-10 13:04:15 +00:00
* 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 .
2000-10-26 13:46:14 +00:00
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2006-09-17 05:56:13 +00:00
// MARKER(update_precomp.py): autogen include statement, do not remove
# include "precompiled_dbaccess.hxx"
2000-10-26 13:46:14 +00:00
# ifndef _SBA_BWRCTRLR_HXX
# include "brwctrlr.hxx"
# endif
# ifndef _SBX_BRWVIEW_HXX
# include "brwview.hxx"
# endif
# ifndef _OSL_MUTEX_HXX_ //autogen wg. MutexGuard
# include <osl/mutex.hxx>
# endif
# ifndef _SFXAPP_HXX //autogen wg. SFX_APP
# include <sfx2/app.hxx>
# endif
# ifndef _COM_SUN_STAR_UNO_TYPECLASS_HPP_
# include <com/sun/star/uno/TypeClass.hpp>
# endif
2000-11-09 06:33:33 +00:00
# ifndef _DBAUI_SQLMESSAGE_HXX_
# include "sqlmessage.hxx"
2000-10-26 13:46:14 +00:00
# endif
2001-05-16 13:27:19 +00:00
# ifndef _COM_SUN_STAR_FORM_XFORMCONTROLLER_HPP_
# include <com/sun/star/form/XFormController.hpp>
# endif
2000-10-26 13:46:14 +00:00
# ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_
# include <com/sun/star/sdb/CommandType.hpp>
# endif
# ifndef _COM_SUN_STAR_SDBC_XROWSETLISTENER_HPP_
# include <com/sun/star/sdbc/XRowSetListener.hpp>
# endif
# ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
# include <com/sun/star/sdbc/XConnection.hpp>
# endif
# ifndef _COM_SUN_STAR_SDBCX_XROWLOCATE_HPP_
# include <com/sun/star/sdbcx/XRowLocate.hpp>
# endif
# ifndef _COM_SUN_STAR_SDBC_XRESULTSETUPDATE_HPP_
# include <com/sun/star/sdbc/XResultSetUpdate.hpp>
# endif
# ifndef _COM_SUN_STAR_SDB_XSQLERRORBROADCASTER_HPP_
# include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp>
# endif
2005-01-05 11:33:18 +00:00
# ifndef _COM_SUN_STAR_SDB_XSINGLESELECTQUERYCOMPOSER_HPP_
# include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
2004-10-22 08:04:30 +00:00
# endif
2000-10-26 13:46:14 +00:00
# ifndef _COM_SUN_STAR_FORM_XLOADABLE_HPP_
# include <com/sun/star/form/XLoadable.hpp>
# endif
# ifndef _COM_SUN_STAR_SDB_SQLCONTEXT_HPP_
# include <com/sun/star/sdb/SQLContext.hpp>
# endif
# ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
# include <com/sun/star/beans/PropertyAttribute.hpp>
# endif
# ifndef _COM_SUN_STAR_FORM_FORMBUTTONTYPE_HPP_
# include <com/sun/star/form/FormButtonType.hpp>
# endif
# ifndef _COM_SUN_STAR_FORM_XCHANGELISTENER_HPP_
# include <com/sun/star/form/XChangeListener.hpp>
# endif
# ifndef _COM_SUN_STAR_FORM_FORMSUBMITENCODING_HPP_
# include <com/sun/star/form/FormSubmitEncoding.hpp>
# endif
# ifndef _COM_SUN_STAR_FORM_FORMSUBMITMETHOD_HPP_
# include <com/sun/star/form/FormSubmitMethod.hpp>
# endif
# ifndef _COM_SUN_STAR_FORM_XSUBMITLISTENER_HPP_
# include <com/sun/star/form/XSubmitListener.hpp>
# endif
# ifndef _COM_SUN_STAR_FORM_XRESET_HPP_
# include <com/sun/star/form/XReset.hpp>
# endif
# ifndef _COM_SUN_STAR_FORM_XSUBMIT_HPP_
# include <com/sun/star/form/XSubmit.hpp>
# endif
# ifndef _COM_SUN_STAR_FORM_XAPPROVEACTIONBROADCASTER_HPP_
# include <com/sun/star/form/XApproveActionBroadcaster.hpp>
# endif
# ifndef _COM_SUN_STAR_FORM_XCHANGEBROADCASTER_HPP_
# include <com/sun/star/form/XChangeBroadcaster.hpp>
# endif
# ifndef _COM_SUN_STAR_FORM_XRESETLISTENER_HPP_
# include <com/sun/star/form/XResetListener.hpp>
# endif
# ifndef _COM_SUN_STAR_UTIL_XCANCELLABLE_HPP_
# include <com/sun/star/util/XCancellable.hpp>
# endif
# ifndef _COM_SUN_STAR_FORM_XDATABASEPARAMETERBROADCASTER_HPP_
# include <com/sun/star/form/XDatabaseParameterBroadcaster.hpp>
# endif
# ifndef _COM_SUN_STAR_FORM_XBOUNDCONTROL_HPP_
# include <com/sun/star/form/XBoundControl.hpp>
# endif
# ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
# include <com/sun/star/container/XNameContainer.hpp>
# endif
2000-11-14 13:22:04 +00:00
# ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_
# include <com/sun/star/container/XNamed.hpp>
# endif
2001-08-16 09:39:55 +00:00
# ifndef _COM_SUN_STAR_SDBCX_PRIVILEGE_HPP_
# include <com/sun/star/sdbcx/Privilege.hpp>
# endif
2001-06-21 16:52:32 +00:00
# ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
# include <cppuhelper/typeprovider.hxx>
# endif
CWS-TOOLING: integrate CWS evoab2def
2009-05-28 16:00:19 +0200 fs r272412 : don't use createFalse - Evo 2.22 simply hangs when ask for all contacts without a first name. Instead, in the WHERE 0=1 case, simply create an empty result set
2009-05-22 14:25:51 +0200 fs r272193 : #i10000#
2009-05-22 14:25:37 +0200 fs r272192 : oops, ENABLE_EVOAB2 for some platforms only, not generically
2009-05-22 14:19:00 +0200 fs r272191 : #i10000#
2009-05-22 12:42:38 +0200 fs r272183 : when sorting, properly use a syslocale collator, instead of comparing the numerical values of the string's UTF-16 code points
2009-05-20 15:09:00 +0200 fs r272131 : clear/getWarnings: also allowed without cache
2009-05-20 14:11:19 +0200 fs r272128 : removed debug traces
2009-05-20 14:03:31 +0200 fs r272126 : #i55701# +STR_SORT_BY_COL_ONLY
2009-05-20 14:02:29 +0200 fs r272125 : implement sorting
2009-05-20 10:10:19 +0200 fs r272107 : #i10000#
2009-05-19 16:02:17 +0200 fs r272089 : #i10000#
2009-05-19 16:02:02 +0200 fs r272088 : #i55701# strings for new error condition DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 16:01:31 +0200 fs r272087 : #i55701# use DATA_CANNOT_SELECT_UNFILTERED as standardized error code
2009-05-19 15:59:59 +0200 fs r272086 : #i55701# +DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 15:46:12 +0200 fs r272084 : #i55701# recognize the DATA_CANNOT_SELECT_UNFILTERED error condition, and allow filtering in this case, even when the result set is empty
2009-05-19 09:06:50 +0200 fs r272059 : merging changes from CWS dba32b, to prevent future conflicts with upcoming local changes
2009-05-18 21:48:58 +0200 fs r272054 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:48:42 +0200 fs r272053 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:47:41 +0200 fs r272052 : +setExternalWarnings
2009-05-18 21:47:12 +0200 fs r272051 : #i55701# when re/loading the form, display any possible warnings
2009-05-18 21:43:26 +0200 fs r272050 : #i55701# implement XWarningsSupplier, exposing the warnings of our result set
2009-05-18 21:42:51 +0200 fs r272049 : #i55701# implement XWarningsSupplier, exposing the warnings of our aggregate RowSet
2009-05-18 17:53:59 +0200 fs r272041 : #i55701# moved the (I)WarningsContainer from dbaccess to connectivity, to be able to use it in the latter module, too
2009-05-18 17:24:10 +0200 fs r272040 : #i55701# properly enable the various Evolution types
2009-05-18 14:52:19 +0200 fs r272024 : #i55701# properly enable the Evolution types
2009-05-18 13:57:10 +0200 fs r272018 : fixed/extended whereAnalysis (column searching still not enabled, as neither LIKE nor = seem to work with my (somewhat older) Evolution version)
2009-05-18 13:56:08 +0200 fs r272017 : extended showParseTree
2009-05-18 13:55:25 +0200 fs r272016 : extended showParseTree
2009-05-18 11:40:16 +0200 fs r272008 : #i55701#
2009-05-18 11:39:02 +0200 fs r272006 : let the PreparedStatement return proper meta data, too
2009-05-18 10:05:37 +0200 fs r271999 : moved the XStatement interface to from OCommonStatement to OStatement - the former class is also the base for other classes which should not have this interface
2009-05-15 21:53:22 +0200 fs r271973 : collectColumnInformation: report invalid meta data as assertion
2009-05-15 21:51:40 +0200 fs r271972 : showParseTree should be const
2009-05-15 21:51:26 +0200 fs r271971 : showParseTree should be const
2009-05-15 21:51:03 +0200 fs r271970 : properly recognize the 'WHERE 0 = 1' clause, this way having proper statement meta data, this way saving much much calls from the DBA framework
2009-05-15 20:29:03 +0200 fs r271969 : cleaned up the mess with the statement classes
2009-05-15 15:51:11 +0200 fs r271944 : let the result set properly init its meta data
2009-05-15 15:29:54 +0200 fs r271939 : proper property implementations for the resultset class
2009-05-15 15:01:31 +0200 fs r271936 : proper property implementations for the statement class
2009-05-08 14:46:33 +0200 fs r271717 : component_foo must be PUBLIC
2009-05-06 09:20:05 +0200 fs r271565 : #i10000# (warnings on unxlngi6)
2009-05-06 09:01:30 +0200 fs r271564 : #i101493#
2009-05-05 23:08:12 +0200 fs r271560 : #i55701# merging the changes from the ancient (CVS-based) CWS evoab2default into this CWS here
2009-06-05 12:31:05 +00:00
# ifndef _CPPUHELPER_EXC_HLP_HXX_
# include <cppuhelper/exc_hlp.hxx>
# endif
2000-10-26 13:46:14 +00:00
# ifndef _SV_MSGBOX_HXX //autogen
# include <vcl/msgbox.hxx>
# endif
# ifndef _FMSEARCH_HXX
# include <svx/fmsearch.hxx>
# endif
# ifndef _SV_WAITOBJ_HXX
# include <vcl/waitobj.hxx>
# endif
# ifndef _TOOLS_COLOR_HXX
# include <tools/color.hxx>
# endif
2005-12-21 12:36:29 +00:00
# ifndef TOOLS_DIAGNOSE_EX_H
# include <tools/diagnose_ex.h>
# endif
2001-06-21 16:52:32 +00:00
# ifndef _COMPHELPER_SEQUENCE_HXX_
# include <comphelper/sequence.hxx>
2000-10-26 13:46:14 +00:00
# endif
# ifndef _CONNECTIVITY_DBTOOLS_HXX_
# include <connectivity/dbtools.hxx>
# endif
CWS-TOOLING: integrate CWS evoab2def
2009-05-28 16:00:19 +0200 fs r272412 : don't use createFalse - Evo 2.22 simply hangs when ask for all contacts without a first name. Instead, in the WHERE 0=1 case, simply create an empty result set
2009-05-22 14:25:51 +0200 fs r272193 : #i10000#
2009-05-22 14:25:37 +0200 fs r272192 : oops, ENABLE_EVOAB2 for some platforms only, not generically
2009-05-22 14:19:00 +0200 fs r272191 : #i10000#
2009-05-22 12:42:38 +0200 fs r272183 : when sorting, properly use a syslocale collator, instead of comparing the numerical values of the string's UTF-16 code points
2009-05-20 15:09:00 +0200 fs r272131 : clear/getWarnings: also allowed without cache
2009-05-20 14:11:19 +0200 fs r272128 : removed debug traces
2009-05-20 14:03:31 +0200 fs r272126 : #i55701# +STR_SORT_BY_COL_ONLY
2009-05-20 14:02:29 +0200 fs r272125 : implement sorting
2009-05-20 10:10:19 +0200 fs r272107 : #i10000#
2009-05-19 16:02:17 +0200 fs r272089 : #i10000#
2009-05-19 16:02:02 +0200 fs r272088 : #i55701# strings for new error condition DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 16:01:31 +0200 fs r272087 : #i55701# use DATA_CANNOT_SELECT_UNFILTERED as standardized error code
2009-05-19 15:59:59 +0200 fs r272086 : #i55701# +DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 15:46:12 +0200 fs r272084 : #i55701# recognize the DATA_CANNOT_SELECT_UNFILTERED error condition, and allow filtering in this case, even when the result set is empty
2009-05-19 09:06:50 +0200 fs r272059 : merging changes from CWS dba32b, to prevent future conflicts with upcoming local changes
2009-05-18 21:48:58 +0200 fs r272054 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:48:42 +0200 fs r272053 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:47:41 +0200 fs r272052 : +setExternalWarnings
2009-05-18 21:47:12 +0200 fs r272051 : #i55701# when re/loading the form, display any possible warnings
2009-05-18 21:43:26 +0200 fs r272050 : #i55701# implement XWarningsSupplier, exposing the warnings of our result set
2009-05-18 21:42:51 +0200 fs r272049 : #i55701# implement XWarningsSupplier, exposing the warnings of our aggregate RowSet
2009-05-18 17:53:59 +0200 fs r272041 : #i55701# moved the (I)WarningsContainer from dbaccess to connectivity, to be able to use it in the latter module, too
2009-05-18 17:24:10 +0200 fs r272040 : #i55701# properly enable the various Evolution types
2009-05-18 14:52:19 +0200 fs r272024 : #i55701# properly enable the Evolution types
2009-05-18 13:57:10 +0200 fs r272018 : fixed/extended whereAnalysis (column searching still not enabled, as neither LIKE nor = seem to work with my (somewhat older) Evolution version)
2009-05-18 13:56:08 +0200 fs r272017 : extended showParseTree
2009-05-18 13:55:25 +0200 fs r272016 : extended showParseTree
2009-05-18 11:40:16 +0200 fs r272008 : #i55701#
2009-05-18 11:39:02 +0200 fs r272006 : let the PreparedStatement return proper meta data, too
2009-05-18 10:05:37 +0200 fs r271999 : moved the XStatement interface to from OCommonStatement to OStatement - the former class is also the base for other classes which should not have this interface
2009-05-15 21:53:22 +0200 fs r271973 : collectColumnInformation: report invalid meta data as assertion
2009-05-15 21:51:40 +0200 fs r271972 : showParseTree should be const
2009-05-15 21:51:26 +0200 fs r271971 : showParseTree should be const
2009-05-15 21:51:03 +0200 fs r271970 : properly recognize the 'WHERE 0 = 1' clause, this way having proper statement meta data, this way saving much much calls from the DBA framework
2009-05-15 20:29:03 +0200 fs r271969 : cleaned up the mess with the statement classes
2009-05-15 15:51:11 +0200 fs r271944 : let the result set properly init its meta data
2009-05-15 15:29:54 +0200 fs r271939 : proper property implementations for the resultset class
2009-05-15 15:01:31 +0200 fs r271936 : proper property implementations for the statement class
2009-05-08 14:46:33 +0200 fs r271717 : component_foo must be PUBLIC
2009-05-06 09:20:05 +0200 fs r271565 : #i10000# (warnings on unxlngi6)
2009-05-06 09:01:30 +0200 fs r271564 : #i101493#
2009-05-05 23:08:12 +0200 fs r271560 : #i55701# merging the changes from the ancient (CVS-based) CWS evoab2default into this CWS here
2009-06-05 12:31:05 +00:00
# ifndef _DBHELPER_DBEXCEPTION_HXX_
# include <connectivity/dbexception.hxx>
# endif
2000-10-26 13:46:14 +00:00
# ifndef _CPPUHELPER_IMPLBASE2_HXX_
# include <cppuhelper/implbase2.hxx>
# endif
2002-08-19 06:32:53 +00:00
# ifndef _DBU_BRW_HRC_
# include "dbu_brw.hrc"
2000-10-26 13:46:14 +00:00
# endif
# ifndef _SFX_HRC
# include <sfx2/sfx.hrc>
# endif
# ifndef DBACCESS_UI_BROWSER_ID_HXX
# include "browserids.hxx"
# endif
# ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
# include "dbustrings.hrc"
# endif
2000-10-31 09:00:53 +00:00
# ifndef _COMPHELPER_INTERACTION_HXX_
# include <comphelper/interaction.hxx>
# endif
2000-11-09 06:33:33 +00:00
# ifndef _DBHELPER_DBEXCEPTION_HXX_
# include <connectivity/dbexception.hxx>
# endif
CWS-TOOLING: integrate CWS evoab2def
2009-05-28 16:00:19 +0200 fs r272412 : don't use createFalse - Evo 2.22 simply hangs when ask for all contacts without a first name. Instead, in the WHERE 0=1 case, simply create an empty result set
2009-05-22 14:25:51 +0200 fs r272193 : #i10000#
2009-05-22 14:25:37 +0200 fs r272192 : oops, ENABLE_EVOAB2 for some platforms only, not generically
2009-05-22 14:19:00 +0200 fs r272191 : #i10000#
2009-05-22 12:42:38 +0200 fs r272183 : when sorting, properly use a syslocale collator, instead of comparing the numerical values of the string's UTF-16 code points
2009-05-20 15:09:00 +0200 fs r272131 : clear/getWarnings: also allowed without cache
2009-05-20 14:11:19 +0200 fs r272128 : removed debug traces
2009-05-20 14:03:31 +0200 fs r272126 : #i55701# +STR_SORT_BY_COL_ONLY
2009-05-20 14:02:29 +0200 fs r272125 : implement sorting
2009-05-20 10:10:19 +0200 fs r272107 : #i10000#
2009-05-19 16:02:17 +0200 fs r272089 : #i10000#
2009-05-19 16:02:02 +0200 fs r272088 : #i55701# strings for new error condition DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 16:01:31 +0200 fs r272087 : #i55701# use DATA_CANNOT_SELECT_UNFILTERED as standardized error code
2009-05-19 15:59:59 +0200 fs r272086 : #i55701# +DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 15:46:12 +0200 fs r272084 : #i55701# recognize the DATA_CANNOT_SELECT_UNFILTERED error condition, and allow filtering in this case, even when the result set is empty
2009-05-19 09:06:50 +0200 fs r272059 : merging changes from CWS dba32b, to prevent future conflicts with upcoming local changes
2009-05-18 21:48:58 +0200 fs r272054 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:48:42 +0200 fs r272053 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:47:41 +0200 fs r272052 : +setExternalWarnings
2009-05-18 21:47:12 +0200 fs r272051 : #i55701# when re/loading the form, display any possible warnings
2009-05-18 21:43:26 +0200 fs r272050 : #i55701# implement XWarningsSupplier, exposing the warnings of our result set
2009-05-18 21:42:51 +0200 fs r272049 : #i55701# implement XWarningsSupplier, exposing the warnings of our aggregate RowSet
2009-05-18 17:53:59 +0200 fs r272041 : #i55701# moved the (I)WarningsContainer from dbaccess to connectivity, to be able to use it in the latter module, too
2009-05-18 17:24:10 +0200 fs r272040 : #i55701# properly enable the various Evolution types
2009-05-18 14:52:19 +0200 fs r272024 : #i55701# properly enable the Evolution types
2009-05-18 13:57:10 +0200 fs r272018 : fixed/extended whereAnalysis (column searching still not enabled, as neither LIKE nor = seem to work with my (somewhat older) Evolution version)
2009-05-18 13:56:08 +0200 fs r272017 : extended showParseTree
2009-05-18 13:55:25 +0200 fs r272016 : extended showParseTree
2009-05-18 11:40:16 +0200 fs r272008 : #i55701#
2009-05-18 11:39:02 +0200 fs r272006 : let the PreparedStatement return proper meta data, too
2009-05-18 10:05:37 +0200 fs r271999 : moved the XStatement interface to from OCommonStatement to OStatement - the former class is also the base for other classes which should not have this interface
2009-05-15 21:53:22 +0200 fs r271973 : collectColumnInformation: report invalid meta data as assertion
2009-05-15 21:51:40 +0200 fs r271972 : showParseTree should be const
2009-05-15 21:51:26 +0200 fs r271971 : showParseTree should be const
2009-05-15 21:51:03 +0200 fs r271970 : properly recognize the 'WHERE 0 = 1' clause, this way having proper statement meta data, this way saving much much calls from the DBA framework
2009-05-15 20:29:03 +0200 fs r271969 : cleaned up the mess with the statement classes
2009-05-15 15:51:11 +0200 fs r271944 : let the result set properly init its meta data
2009-05-15 15:29:54 +0200 fs r271939 : proper property implementations for the resultset class
2009-05-15 15:01:31 +0200 fs r271936 : proper property implementations for the statement class
2009-05-08 14:46:33 +0200 fs r271717 : component_foo must be PUBLIC
2009-05-06 09:20:05 +0200 fs r271565 : #i10000# (warnings on unxlngi6)
2009-05-06 09:01:30 +0200 fs r271564 : #i101493#
2009-05-05 23:08:12 +0200 fs r271560 : #i55701# merging the changes from the ancient (CVS-based) CWS evoab2default into this CWS here
2009-06-05 12:31:05 +00:00
# ifndef CONNECTIVITY_SQLERROR_HXX
# include <connectivity/sqlerror.hxx>
# endif
2001-03-15 07:29:16 +00:00
# ifndef _COMPHELPER_EXTRACT_HXX_
# include <comphelper/extract.hxx>
2000-10-31 09:00:53 +00:00
# endif
# ifndef _COM_SUN_STAR_SDB_XINTERACTIONSUPPLYPARAMETERS_HPP_
# include <com/sun/star/sdb/XInteractionSupplyParameters.hpp>
# endif
# ifndef _COM_SUN_STAR_SDB_PARAMETERSREQUEST_HPP_
# include <com/sun/star/sdb/ParametersRequest.hpp>
# endif
# ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_
# include <com/sun/star/task/XInteractionHandler.hpp>
# endif
CWS-TOOLING: integrate CWS evoab2def
2009-05-28 16:00:19 +0200 fs r272412 : don't use createFalse - Evo 2.22 simply hangs when ask for all contacts without a first name. Instead, in the WHERE 0=1 case, simply create an empty result set
2009-05-22 14:25:51 +0200 fs r272193 : #i10000#
2009-05-22 14:25:37 +0200 fs r272192 : oops, ENABLE_EVOAB2 for some platforms only, not generically
2009-05-22 14:19:00 +0200 fs r272191 : #i10000#
2009-05-22 12:42:38 +0200 fs r272183 : when sorting, properly use a syslocale collator, instead of comparing the numerical values of the string's UTF-16 code points
2009-05-20 15:09:00 +0200 fs r272131 : clear/getWarnings: also allowed without cache
2009-05-20 14:11:19 +0200 fs r272128 : removed debug traces
2009-05-20 14:03:31 +0200 fs r272126 : #i55701# +STR_SORT_BY_COL_ONLY
2009-05-20 14:02:29 +0200 fs r272125 : implement sorting
2009-05-20 10:10:19 +0200 fs r272107 : #i10000#
2009-05-19 16:02:17 +0200 fs r272089 : #i10000#
2009-05-19 16:02:02 +0200 fs r272088 : #i55701# strings for new error condition DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 16:01:31 +0200 fs r272087 : #i55701# use DATA_CANNOT_SELECT_UNFILTERED as standardized error code
2009-05-19 15:59:59 +0200 fs r272086 : #i55701# +DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 15:46:12 +0200 fs r272084 : #i55701# recognize the DATA_CANNOT_SELECT_UNFILTERED error condition, and allow filtering in this case, even when the result set is empty
2009-05-19 09:06:50 +0200 fs r272059 : merging changes from CWS dba32b, to prevent future conflicts with upcoming local changes
2009-05-18 21:48:58 +0200 fs r272054 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:48:42 +0200 fs r272053 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:47:41 +0200 fs r272052 : +setExternalWarnings
2009-05-18 21:47:12 +0200 fs r272051 : #i55701# when re/loading the form, display any possible warnings
2009-05-18 21:43:26 +0200 fs r272050 : #i55701# implement XWarningsSupplier, exposing the warnings of our result set
2009-05-18 21:42:51 +0200 fs r272049 : #i55701# implement XWarningsSupplier, exposing the warnings of our aggregate RowSet
2009-05-18 17:53:59 +0200 fs r272041 : #i55701# moved the (I)WarningsContainer from dbaccess to connectivity, to be able to use it in the latter module, too
2009-05-18 17:24:10 +0200 fs r272040 : #i55701# properly enable the various Evolution types
2009-05-18 14:52:19 +0200 fs r272024 : #i55701# properly enable the Evolution types
2009-05-18 13:57:10 +0200 fs r272018 : fixed/extended whereAnalysis (column searching still not enabled, as neither LIKE nor = seem to work with my (somewhat older) Evolution version)
2009-05-18 13:56:08 +0200 fs r272017 : extended showParseTree
2009-05-18 13:55:25 +0200 fs r272016 : extended showParseTree
2009-05-18 11:40:16 +0200 fs r272008 : #i55701#
2009-05-18 11:39:02 +0200 fs r272006 : let the PreparedStatement return proper meta data, too
2009-05-18 10:05:37 +0200 fs r271999 : moved the XStatement interface to from OCommonStatement to OStatement - the former class is also the base for other classes which should not have this interface
2009-05-15 21:53:22 +0200 fs r271973 : collectColumnInformation: report invalid meta data as assertion
2009-05-15 21:51:40 +0200 fs r271972 : showParseTree should be const
2009-05-15 21:51:26 +0200 fs r271971 : showParseTree should be const
2009-05-15 21:51:03 +0200 fs r271970 : properly recognize the 'WHERE 0 = 1' clause, this way having proper statement meta data, this way saving much much calls from the DBA framework
2009-05-15 20:29:03 +0200 fs r271969 : cleaned up the mess with the statement classes
2009-05-15 15:51:11 +0200 fs r271944 : let the result set properly init its meta data
2009-05-15 15:29:54 +0200 fs r271939 : proper property implementations for the resultset class
2009-05-15 15:01:31 +0200 fs r271936 : proper property implementations for the statement class
2009-05-08 14:46:33 +0200 fs r271717 : component_foo must be PUBLIC
2009-05-06 09:20:05 +0200 fs r271565 : #i10000# (warnings on unxlngi6)
2009-05-06 09:01:30 +0200 fs r271564 : #i101493#
2009-05-05 23:08:12 +0200 fs r271560 : #i55701# merging the changes from the ancient (CVS-based) CWS evoab2default into this CWS here
2009-06-05 12:31:05 +00:00
# ifndef INCLUDED_COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP
# include <com/sun/star/sdbc/XWarningsSupplier.hpp>
# endif
# ifndef INCLUDED_COM_SUN_STAR_SDB_ERRORCONDITION_HPP
# include <com/sun/star/sdb/ErrorCondition.hpp>
# endif
2000-11-10 15:14:45 +00:00
# ifndef DBAUI_QUERYFILTER_HXX
# include "queryfilter.hxx"
# endif
# ifndef DBAUI_QUERYORDER_HXX
# include "queryorder.hxx"
# endif
2009-04-23 10:42:05 +00:00
# include <rtl/logfile.hxx>
2001-05-16 13:27:19 +00:00
2004-02-03 19:41:49 +00:00
# include <svx/svxdlg.hxx> //CHINA001
2004-11-16 13:30:31 +00:00
//#include <svx/fmresids.hrc> //CHINA001
2004-02-03 19:41:49 +00:00
2000-10-26 13:46:14 +00:00
using namespace : : com : : sun : : star : : uno ;
2001-05-16 13:27:19 +00:00
using namespace : : com : : sun : : star : : awt ;
2000-10-26 13:46:14 +00:00
using namespace : : com : : sun : : star : : sdb ;
using namespace : : com : : sun : : star : : sdbc ;
2001-08-27 05:57:24 +00:00
using namespace : : com : : sun : : star : : sdbcx ;
2000-10-31 09:00:53 +00:00
using namespace : : com : : sun : : star : : task ;
2000-10-26 13:46:14 +00:00
using namespace : : com : : sun : : star : : beans ;
2000-11-07 17:34:39 +00:00
using namespace : : com : : sun : : star : : frame ;
2001-05-16 13:27:19 +00:00
using namespace : : com : : sun : : star : : form ;
2000-11-07 17:34:39 +00:00
using namespace : : com : : sun : : star : : util ;
2001-01-09 14:52:33 +00:00
using namespace : : com : : sun : : star : : lang ;
2000-10-26 13:46:14 +00:00
using namespace : : com : : sun : : star : : container ;
2000-10-31 09:00:53 +00:00
using namespace : : dbtools ;
using namespace : : comphelper ;
2001-06-29 07:45:10 +00:00
using namespace : : svt ;
2000-10-26 13:46:14 +00:00
# define HANDLE_SQL_ERRORS( action, successflag, context, message ) \
try \
{ \
2006-07-10 14:23:44 +00:00
successflag = sal_False ; \
2000-10-26 13:46:14 +00:00
action ; \
2006-07-10 14:23:44 +00:00
successflag = sal_True ; \
2000-10-26 13:46:14 +00:00
} \
2006-07-10 14:23:44 +00:00
catch ( SQLException & e ) \
2000-10-26 13:46:14 +00:00
{ \
2006-07-10 14:23:44 +00:00
SQLException aError = : : dbtools : : prependErrorInfo ( e , * this , context ) ; \
2000-10-26 13:46:14 +00:00
: : com : : sun : : star : : sdb : : SQLErrorEvent aEvent ; \
2006-07-10 14:23:44 +00:00
aEvent . Reason < < = aError ; \
2000-10-26 13:46:14 +00:00
errorOccured ( aEvent ) ; \
} \
2006-07-10 14:23:44 +00:00
catch ( Exception & ) \
2000-10-26 13:46:14 +00:00
{ \
2006-07-10 14:23:44 +00:00
DBG_UNHANDLED_EXCEPTION ( ) ; \
2000-10-26 13:46:14 +00:00
} \
2001-01-09 14:52:33 +00:00
# define DO_SAFE( action, message ) try { action; } catch(Exception&) { DBG_ERROR(message); } ;
2000-10-26 13:46:14 +00:00
2000-10-31 09:00:53 +00:00
//..................................................................
namespace dbaui
{
//..................................................................
//==================================================================
// OParameterContinuation
//==================================================================
class OParameterContinuation : public OInteraction < XInteractionSupplyParameters >
{
Sequence < PropertyValue > m_aValues ;
public :
OParameterContinuation ( ) { }
Sequence < PropertyValue > getValues ( ) const { return m_aValues ; }
// XInteractionSupplyParameters
virtual void SAL_CALL setParameters ( const Sequence < PropertyValue > & _rValues ) throw ( RuntimeException ) ;
} ;
//------------------------------------------------------------------
void SAL_CALL OParameterContinuation : : setParameters ( const Sequence < PropertyValue > & _rValues ) throw ( RuntimeException )
{
m_aValues = _rValues ;
}
2000-10-26 13:46:14 +00:00
2001-05-16 13:27:19 +00:00
//==============================================================================
// a helper class implementing a ::com::sun::star::form::XFormController, will be aggregated by SbaXDataBrowserController
// (we can't derive from ::com::sun::star::form::XFormController as it's base class is ::com::sun::star::awt::XTabController and the ::com::sun::star::awt::XTabController::getModel collides
// with the ::com::sun::star::frame::XController::getModel implemented in our base class SbaXDataBrowserController)
class SbaXDataBrowserController : : FormControllerImpl
: public : : cppu : : WeakAggImplHelper2 < : : com : : sun : : star : : form : : XFormController ,
: : com : : sun : : star : : frame : : XFrameActionListener >
{
friend class SbaXDataBrowserController ;
: : cppu : : OInterfaceContainerHelper m_aActivateListeners ;
SbaXDataBrowserController * m_pOwner ;
public :
FormControllerImpl ( SbaXDataBrowserController * pOwner ) ;
// ::com::sun::star::form::XFormController
virtual : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : awt : : XControl > SAL_CALL getCurrentControl ( void ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
virtual void SAL_CALL addActivateListener ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : form : : XFormControllerListener > & l ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
virtual void SAL_CALL removeActivateListener ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : form : : XFormControllerListener > & l ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
// ::com::sun::star::awt::XTabController
virtual void SAL_CALL setModel ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : awt : : XTabControllerModel > & Model ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
virtual : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : awt : : XTabControllerModel > SAL_CALL getModel ( void ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
virtual void SAL_CALL setContainer ( const : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : awt : : XControlContainer > & _Container ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
virtual : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : awt : : XControlContainer > SAL_CALL getContainer ( void ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
virtual : : com : : sun : : star : : uno : : Sequence < : : com : : sun : : star : : uno : : Reference < : : com : : sun : : star : : awt : : XControl > > SAL_CALL getControls ( void ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
virtual void SAL_CALL autoTabOrder ( void ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
virtual void SAL_CALL activateTabOrder ( void ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
virtual void SAL_CALL activateFirst ( void ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
virtual void SAL_CALL activateLast ( void ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
// ::com::sun::star::frame::XFrameActionListener
virtual void SAL_CALL frameAction ( const : : com : : sun : : star : : frame : : FrameActionEvent & aEvent ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
// ::com::sun::star::lang::XEventListener
virtual void SAL_CALL disposing ( const : : com : : sun : : star : : lang : : EventObject & Source ) throw ( : : com : : sun : : star : : uno : : RuntimeException ) ;
protected :
~ FormControllerImpl ( ) ;
} ;
2005-09-23 11:19:18 +00:00
DBG_NAME ( FormControllerImpl )
2001-05-16 13:27:19 +00:00
//------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
SbaXDataBrowserController : : FormControllerImpl : : FormControllerImpl ( SbaXDataBrowserController * _pOwner )
: m_aActivateListeners ( _pOwner - > getMutex ( ) )
, m_pOwner ( _pOwner )
2001-05-16 13:27:19 +00:00
{
2005-09-23 11:19:18 +00:00
DBG_CTOR ( FormControllerImpl , NULL ) ;
2001-05-16 13:27:19 +00:00
OSL_ENSURE ( m_pOwner , " SbaXDataBrowserController::FormControllerImpl::FormControllerImpl : invalid Owner ! " ) ;
}
//------------------------------------------------------------------
SbaXDataBrowserController : : FormControllerImpl : : ~ FormControllerImpl ( )
{
2005-09-23 11:19:18 +00:00
DBG_DTOR ( FormControllerImpl , NULL ) ;
2001-05-16 13:27:19 +00:00
}
//------------------------------------------------------------------
Reference < : : com : : sun : : star : : awt : : XControl > SbaXDataBrowserController : : FormControllerImpl : : getCurrentControl ( void ) throw ( RuntimeException )
{
return m_pOwner - > getBrowserView ( ) ? m_pOwner - > getBrowserView ( ) - > getGridControl ( ) : Reference < : : com : : sun : : star : : awt : : XControl > ( ) ;
}
//------------------------------------------------------------------
void SAL_CALL SbaXDataBrowserController : : FormControllerImpl : : addActivateListener ( const Reference < : : com : : sun : : star : : form : : XFormControllerListener > & l ) throw ( RuntimeException )
{
m_aActivateListeners . addInterface ( l ) ;
}
//------------------------------------------------------------------
void SAL_CALL SbaXDataBrowserController : : FormControllerImpl : : removeActivateListener ( const Reference < : : com : : sun : : star : : form : : XFormControllerListener > & l ) throw ( RuntimeException )
{
m_aActivateListeners . removeInterface ( l ) ;
}
//------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SAL_CALL SbaXDataBrowserController : : FormControllerImpl : : setModel ( const Reference < : : com : : sun : : star : : awt : : XTabControllerModel > & /*Model*/ ) throw ( RuntimeException )
2001-05-16 13:27:19 +00:00
{
OSL_ENSURE ( sal_False , " SbaXDataBrowserController::FormControllerImpl::setModel : invalid call, can't change my model ! " ) ;
}
//------------------------------------------------------------------
Reference < : : com : : sun : : star : : awt : : XTabControllerModel > SAL_CALL SbaXDataBrowserController : : FormControllerImpl : : getModel ( void ) throw ( RuntimeException )
{
return Reference < XTabControllerModel > ( m_pOwner - > getRowSet ( ) , UNO_QUERY ) ;
}
//------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SAL_CALL SbaXDataBrowserController : : FormControllerImpl : : setContainer ( const Reference < : : com : : sun : : star : : awt : : XControlContainer > & /*_Container*/ ) throw ( RuntimeException )
2001-05-16 13:27:19 +00:00
{
OSL_ENSURE ( sal_False , " SbaXDataBrowserController::FormControllerImpl::setContainer : invalid call, can't change my container ! " ) ;
}
//------------------------------------------------------------------
Reference < : : com : : sun : : star : : awt : : XControlContainer > SAL_CALL SbaXDataBrowserController : : FormControllerImpl : : getContainer ( void ) throw ( RuntimeException )
{
if ( m_pOwner - > getBrowserView ( ) )
return m_pOwner - > getBrowserView ( ) - > getContainer ( ) ;
return Reference < : : com : : sun : : star : : awt : : XControlContainer > ( ) ;
}
//------------------------------------------------------------------
Sequence < Reference < : : com : : sun : : star : : awt : : XControl > > SAL_CALL SbaXDataBrowserController : : FormControllerImpl : : getControls ( void ) throw ( RuntimeException )
{
if ( m_pOwner - > getBrowserView ( ) )
{
Reference < : : com : : sun : : star : : awt : : XControl > xGrid = m_pOwner - > getBrowserView ( ) - > getGridControl ( ) ;
return Sequence < Reference < : : com : : sun : : star : : awt : : XControl > > ( & xGrid , 1 ) ;
}
return Sequence < Reference < : : com : : sun : : star : : awt : : XControl > > ( ) ;
}
//------------------------------------------------------------------
void SAL_CALL SbaXDataBrowserController : : FormControllerImpl : : autoTabOrder ( void ) throw ( RuntimeException )
{
OSL_ENSURE ( sal_False , " SbaXDataBrowserController::FormControllerImpl::autoTabOrder : nothing to do (always have only one control) ! " ) ;
}
//------------------------------------------------------------------
void SAL_CALL SbaXDataBrowserController : : FormControllerImpl : : activateTabOrder ( void ) throw ( RuntimeException )
{
OSL_ENSURE ( sal_False , " SbaXDataBrowserController::FormControllerImpl::activateTabOrder : nothing to do (always have only one control) ! " ) ;
}
//------------------------------------------------------------------
void SAL_CALL SbaXDataBrowserController : : FormControllerImpl : : activateFirst ( void ) throw ( RuntimeException )
{
if ( m_pOwner - > getBrowserView ( ) )
m_pOwner - > getBrowserView ( ) - > getVclControl ( ) - > ActivateCell ( ) ;
}
//------------------------------------------------------------------
void SAL_CALL SbaXDataBrowserController : : FormControllerImpl : : activateLast ( void ) throw ( RuntimeException )
{
if ( m_pOwner - > getBrowserView ( ) )
m_pOwner - > getBrowserView ( ) - > getVclControl ( ) - > ActivateCell ( ) ;
}
//------------------------------------------------------------------
2008-03-06 17:13:16 +00:00
void SAL_CALL SbaXDataBrowserController : : FormControllerImpl : : frameAction ( const : : com : : sun : : star : : frame : : FrameActionEvent & /*aEvent*/ ) throw ( RuntimeException )
2001-05-16 13:27:19 +00:00
{
}
//------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SAL_CALL SbaXDataBrowserController : : FormControllerImpl : : disposing ( const : : com : : sun : : star : : lang : : EventObject & /*Source*/ ) throw ( RuntimeException )
2001-05-16 13:27:19 +00:00
{
// nothing to do
// we don't add ourself as listener to any broadcasters, so we are not resposible for removing us
}
2000-10-26 13:46:14 +00:00
//==================================================================
//= SbaXDataBrowserController
//==================================================================
2001-06-21 16:52:32 +00:00
//------------------------------------------------------------------
Sequence < Type > SAL_CALL SbaXDataBrowserController : : getTypes ( ) throw ( RuntimeException )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::getTypes " ) ;
2001-06-21 16:52:32 +00:00
return : : comphelper : : concatSequences (
2008-03-06 17:13:16 +00:00
SbaXDataBrowserController_Base : : getTypes ( ) ,
2001-06-21 16:52:32 +00:00
m_pFormControllerImpl - > getTypes ( )
) ;
}
//------------------------------------------------------------------
Sequence < sal_Int8 > SAL_CALL SbaXDataBrowserController : : getImplementationId ( ) throw ( RuntimeException )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::getImplementationId " ) ;
2001-08-27 05:57:24 +00:00
static : : cppu : : OImplementationId * pId = 0 ;
if ( ! pId )
{
: : osl : : MutexGuard aGuard ( : : osl : : Mutex : : getGlobalMutex ( ) ) ;
if ( ! pId )
{
static : : cppu : : OImplementationId aId ;
pId = & aId ;
}
}
return pId - > getImplementationId ( ) ;
2001-06-21 16:52:32 +00:00
}
//------------------------------------------------------------------
2000-10-26 13:46:14 +00:00
Any SAL_CALL SbaXDataBrowserController : : queryInterface ( const Type & _rType ) throw ( RuntimeException )
{
2009-04-23 10:42:05 +00:00
//RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::queryInterface" );
2001-05-16 13:27:19 +00:00
// check for our additional interfaces
2008-03-06 17:13:16 +00:00
Any aRet = SbaXDataBrowserController_Base : : queryInterface ( _rType ) ;
2001-05-16 13:27:19 +00:00
// check for the base controllers interfaces
if ( ! aRet . hasValue ( ) )
2001-08-24 05:40:35 +00:00
{
// check for our aggregate (implementing the XFormController)
if ( ! aRet . hasValue ( ) )
{
aRet = m_xFormControllerImpl - > queryAggregation ( _rType ) ;
}
}
2001-05-16 13:27:19 +00:00
// no more to offer
return aRet ;
2000-10-26 13:46:14 +00:00
}
2005-09-23 11:19:18 +00:00
DBG_NAME ( SbaXDataBrowserController )
2000-10-26 13:46:14 +00:00
//------------------------------------------------------------------------------
SbaXDataBrowserController : : SbaXDataBrowserController ( const Reference < : : com : : sun : : star : : lang : : XMultiServiceFactory > & _rM )
2008-03-06 17:13:16 +00:00
: SbaXDataBrowserController_Base ( _rM )
2006-08-25 08:18:44 +00:00
, m_pClipbordNotifier ( NULL )
2006-06-20 01:55:50 +00:00
, m_aAsyncGetCellFocus ( LINK ( this , SbaXDataBrowserController , OnAsyncGetCellFocus ) )
, m_sStateSaveRecord ( ModuleRes ( RID_STR_SAVE_CURRENT_RECORD ) )
, m_sStateUndoRecord ( ModuleRes ( RID_STR_UNDO_MODIFY_RECORD ) )
2008-03-05 15:52:29 +00:00
, m_sModuleIdentifier ( : : rtl : : OUString ( RTL_CONSTASCII_USTRINGPARAM ( " com.sun.star.sdb.DataSourceBrowser " ) ) )
2000-10-26 13:46:14 +00:00
, m_pLoadThread ( NULL )
2006-06-20 01:55:50 +00:00
, m_pFormControllerImpl ( NULL )
2000-10-26 13:46:14 +00:00
, m_nPendingLoadFinished ( 0 )
, m_nFormActionNestingLevel ( 0 )
2006-06-20 01:55:50 +00:00
, m_bLoadCanceled ( sal_False )
, m_bClosingKillOpen ( sal_False )
2002-01-29 11:23:58 +00:00
, m_bErrorOccured ( sal_False )
CWS-TOOLING: integrate CWS evoab2def
2009-05-28 16:00:19 +0200 fs r272412 : don't use createFalse - Evo 2.22 simply hangs when ask for all contacts without a first name. Instead, in the WHERE 0=1 case, simply create an empty result set
2009-05-22 14:25:51 +0200 fs r272193 : #i10000#
2009-05-22 14:25:37 +0200 fs r272192 : oops, ENABLE_EVOAB2 for some platforms only, not generically
2009-05-22 14:19:00 +0200 fs r272191 : #i10000#
2009-05-22 12:42:38 +0200 fs r272183 : when sorting, properly use a syslocale collator, instead of comparing the numerical values of the string's UTF-16 code points
2009-05-20 15:09:00 +0200 fs r272131 : clear/getWarnings: also allowed without cache
2009-05-20 14:11:19 +0200 fs r272128 : removed debug traces
2009-05-20 14:03:31 +0200 fs r272126 : #i55701# +STR_SORT_BY_COL_ONLY
2009-05-20 14:02:29 +0200 fs r272125 : implement sorting
2009-05-20 10:10:19 +0200 fs r272107 : #i10000#
2009-05-19 16:02:17 +0200 fs r272089 : #i10000#
2009-05-19 16:02:02 +0200 fs r272088 : #i55701# strings for new error condition DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 16:01:31 +0200 fs r272087 : #i55701# use DATA_CANNOT_SELECT_UNFILTERED as standardized error code
2009-05-19 15:59:59 +0200 fs r272086 : #i55701# +DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 15:46:12 +0200 fs r272084 : #i55701# recognize the DATA_CANNOT_SELECT_UNFILTERED error condition, and allow filtering in this case, even when the result set is empty
2009-05-19 09:06:50 +0200 fs r272059 : merging changes from CWS dba32b, to prevent future conflicts with upcoming local changes
2009-05-18 21:48:58 +0200 fs r272054 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:48:42 +0200 fs r272053 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:47:41 +0200 fs r272052 : +setExternalWarnings
2009-05-18 21:47:12 +0200 fs r272051 : #i55701# when re/loading the form, display any possible warnings
2009-05-18 21:43:26 +0200 fs r272050 : #i55701# implement XWarningsSupplier, exposing the warnings of our result set
2009-05-18 21:42:51 +0200 fs r272049 : #i55701# implement XWarningsSupplier, exposing the warnings of our aggregate RowSet
2009-05-18 17:53:59 +0200 fs r272041 : #i55701# moved the (I)WarningsContainer from dbaccess to connectivity, to be able to use it in the latter module, too
2009-05-18 17:24:10 +0200 fs r272040 : #i55701# properly enable the various Evolution types
2009-05-18 14:52:19 +0200 fs r272024 : #i55701# properly enable the Evolution types
2009-05-18 13:57:10 +0200 fs r272018 : fixed/extended whereAnalysis (column searching still not enabled, as neither LIKE nor = seem to work with my (somewhat older) Evolution version)
2009-05-18 13:56:08 +0200 fs r272017 : extended showParseTree
2009-05-18 13:55:25 +0200 fs r272016 : extended showParseTree
2009-05-18 11:40:16 +0200 fs r272008 : #i55701#
2009-05-18 11:39:02 +0200 fs r272006 : let the PreparedStatement return proper meta data, too
2009-05-18 10:05:37 +0200 fs r271999 : moved the XStatement interface to from OCommonStatement to OStatement - the former class is also the base for other classes which should not have this interface
2009-05-15 21:53:22 +0200 fs r271973 : collectColumnInformation: report invalid meta data as assertion
2009-05-15 21:51:40 +0200 fs r271972 : showParseTree should be const
2009-05-15 21:51:26 +0200 fs r271971 : showParseTree should be const
2009-05-15 21:51:03 +0200 fs r271970 : properly recognize the 'WHERE 0 = 1' clause, this way having proper statement meta data, this way saving much much calls from the DBA framework
2009-05-15 20:29:03 +0200 fs r271969 : cleaned up the mess with the statement classes
2009-05-15 15:51:11 +0200 fs r271944 : let the result set properly init its meta data
2009-05-15 15:29:54 +0200 fs r271939 : proper property implementations for the resultset class
2009-05-15 15:01:31 +0200 fs r271936 : proper property implementations for the statement class
2009-05-08 14:46:33 +0200 fs r271717 : component_foo must be PUBLIC
2009-05-06 09:20:05 +0200 fs r271565 : #i10000# (warnings on unxlngi6)
2009-05-06 09:01:30 +0200 fs r271564 : #i101493#
2009-05-05 23:08:12 +0200 fs r271560 : #i55701# merging the changes from the ancient (CVS-based) CWS evoab2default into this CWS here
2009-06-05 12:31:05 +00:00
, m_bCannotSelectUnfiltered ( true )
2000-10-26 13:46:14 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::SbaXDataBrowserController " ) ;
2005-09-23 11:19:18 +00:00
DBG_CTOR ( SbaXDataBrowserController , NULL ) ;
2001-05-16 13:27:19 +00:00
// create the form controller aggregate
: : comphelper : : increment ( m_refCount ) ;
{
m_pFormControllerImpl = new FormControllerImpl ( this ) ;
m_xFormControllerImpl = m_pFormControllerImpl ;
m_xFormControllerImpl - > setDelegator ( * this ) ;
}
: : comphelper : : decrement ( m_refCount ) ;
2006-08-15 09:49:12 +00:00
m_aInvalidateClipboard . SetTimeoutHdl ( LINK ( this , SbaXDataBrowserController , OnInvalidateClipboard ) ) ;
m_aInvalidateClipboard . SetTimeout ( 300 ) ;
2000-10-26 13:46:14 +00:00
}
//------------------------------------------------------------------------------
SbaXDataBrowserController : : ~ SbaXDataBrowserController ( )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::~SbaXDataBrowserController " ) ;
2004-08-02 14:31:55 +00:00
// deleteView();
2001-05-16 13:27:19 +00:00
// release the aggregated form controller
if ( m_xFormControllerImpl . is ( ) )
{
Reference < XInterface > xEmpty ;
m_xFormControllerImpl - > setDelegator ( xEmpty ) ;
}
2005-09-23 11:19:18 +00:00
DBG_DTOR ( SbaXDataBrowserController , NULL ) ;
2001-05-16 13:27:19 +00:00
}
2008-03-06 17:13:16 +00:00
2001-05-16 13:27:19 +00:00
// -----------------------------------------------------------------------
2008-03-06 17:13:16 +00:00
void SbaXDataBrowserController : : startFrameListening ( const Reference < XFrame > & _rxFrame )
2001-05-16 13:27:19 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::startFrameListening " ) ;
2008-03-06 17:13:16 +00:00
SbaXDataBrowserController_Base : : startFrameListening ( _rxFrame ) ;
2001-05-16 13:27:19 +00:00
2008-03-06 17:13:16 +00:00
Reference < XFrameActionListener > xAggListener ;
if ( m_xFormControllerImpl . is ( ) )
m_xFormControllerImpl - > queryAggregation ( XFrameActionListener : : static_type ( ) ) > > = xAggListener ;
2001-05-16 13:27:19 +00:00
2008-03-06 17:13:16 +00:00
if ( _rxFrame . is ( ) & & xAggListener . is ( ) )
_rxFrame - > addFrameActionListener ( xAggListener ) ;
}
2001-05-16 13:27:19 +00:00
2008-03-06 17:13:16 +00:00
// -----------------------------------------------------------------------
void SbaXDataBrowserController : : stopFrameListening ( const Reference < XFrame > & _rxFrame )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::stopFrameListening " ) ;
2008-03-06 17:13:16 +00:00
SbaXDataBrowserController_Base : : stopFrameListening ( _rxFrame ) ;
Reference < XFrameActionListener > xAggListener ;
if ( m_xFormControllerImpl . is ( ) )
m_xFormControllerImpl - > queryAggregation ( XFrameActionListener : : static_type ( ) ) > > = xAggListener ;
if ( _rxFrame . is ( ) & & xAggListener . is ( ) )
_rxFrame - > removeFrameActionListener ( xAggListener ) ;
2000-10-26 13:46:14 +00:00
}
2001-05-16 13:27:19 +00:00
2001-07-17 12:07:48 +00:00
// -----------------------------------------------------------------------------
CWS-TOOLING: integrate CWS evoab2def
2009-05-28 16:00:19 +0200 fs r272412 : don't use createFalse - Evo 2.22 simply hangs when ask for all contacts without a first name. Instead, in the WHERE 0=1 case, simply create an empty result set
2009-05-22 14:25:51 +0200 fs r272193 : #i10000#
2009-05-22 14:25:37 +0200 fs r272192 : oops, ENABLE_EVOAB2 for some platforms only, not generically
2009-05-22 14:19:00 +0200 fs r272191 : #i10000#
2009-05-22 12:42:38 +0200 fs r272183 : when sorting, properly use a syslocale collator, instead of comparing the numerical values of the string's UTF-16 code points
2009-05-20 15:09:00 +0200 fs r272131 : clear/getWarnings: also allowed without cache
2009-05-20 14:11:19 +0200 fs r272128 : removed debug traces
2009-05-20 14:03:31 +0200 fs r272126 : #i55701# +STR_SORT_BY_COL_ONLY
2009-05-20 14:02:29 +0200 fs r272125 : implement sorting
2009-05-20 10:10:19 +0200 fs r272107 : #i10000#
2009-05-19 16:02:17 +0200 fs r272089 : #i10000#
2009-05-19 16:02:02 +0200 fs r272088 : #i55701# strings for new error condition DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 16:01:31 +0200 fs r272087 : #i55701# use DATA_CANNOT_SELECT_UNFILTERED as standardized error code
2009-05-19 15:59:59 +0200 fs r272086 : #i55701# +DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 15:46:12 +0200 fs r272084 : #i55701# recognize the DATA_CANNOT_SELECT_UNFILTERED error condition, and allow filtering in this case, even when the result set is empty
2009-05-19 09:06:50 +0200 fs r272059 : merging changes from CWS dba32b, to prevent future conflicts with upcoming local changes
2009-05-18 21:48:58 +0200 fs r272054 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:48:42 +0200 fs r272053 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:47:41 +0200 fs r272052 : +setExternalWarnings
2009-05-18 21:47:12 +0200 fs r272051 : #i55701# when re/loading the form, display any possible warnings
2009-05-18 21:43:26 +0200 fs r272050 : #i55701# implement XWarningsSupplier, exposing the warnings of our result set
2009-05-18 21:42:51 +0200 fs r272049 : #i55701# implement XWarningsSupplier, exposing the warnings of our aggregate RowSet
2009-05-18 17:53:59 +0200 fs r272041 : #i55701# moved the (I)WarningsContainer from dbaccess to connectivity, to be able to use it in the latter module, too
2009-05-18 17:24:10 +0200 fs r272040 : #i55701# properly enable the various Evolution types
2009-05-18 14:52:19 +0200 fs r272024 : #i55701# properly enable the Evolution types
2009-05-18 13:57:10 +0200 fs r272018 : fixed/extended whereAnalysis (column searching still not enabled, as neither LIKE nor = seem to work with my (somewhat older) Evolution version)
2009-05-18 13:56:08 +0200 fs r272017 : extended showParseTree
2009-05-18 13:55:25 +0200 fs r272016 : extended showParseTree
2009-05-18 11:40:16 +0200 fs r272008 : #i55701#
2009-05-18 11:39:02 +0200 fs r272006 : let the PreparedStatement return proper meta data, too
2009-05-18 10:05:37 +0200 fs r271999 : moved the XStatement interface to from OCommonStatement to OStatement - the former class is also the base for other classes which should not have this interface
2009-05-15 21:53:22 +0200 fs r271973 : collectColumnInformation: report invalid meta data as assertion
2009-05-15 21:51:40 +0200 fs r271972 : showParseTree should be const
2009-05-15 21:51:26 +0200 fs r271971 : showParseTree should be const
2009-05-15 21:51:03 +0200 fs r271970 : properly recognize the 'WHERE 0 = 1' clause, this way having proper statement meta data, this way saving much much calls from the DBA framework
2009-05-15 20:29:03 +0200 fs r271969 : cleaned up the mess with the statement classes
2009-05-15 15:51:11 +0200 fs r271944 : let the result set properly init its meta data
2009-05-15 15:29:54 +0200 fs r271939 : proper property implementations for the resultset class
2009-05-15 15:01:31 +0200 fs r271936 : proper property implementations for the statement class
2009-05-08 14:46:33 +0200 fs r271717 : component_foo must be PUBLIC
2009-05-06 09:20:05 +0200 fs r271565 : #i10000# (warnings on unxlngi6)
2009-05-06 09:01:30 +0200 fs r271564 : #i101493#
2009-05-05 23:08:12 +0200 fs r271560 : #i55701# merging the changes from the ancient (CVS-based) CWS evoab2default into this CWS here
2009-06-05 12:31:05 +00:00
void SbaXDataBrowserController : : onStartLoading ( const Reference < XLoadable > & _rxLoadable )
{
m_bLoadCanceled = sal_False ;
m_bCannotSelectUnfiltered = false ;
Reference < XWarningsSupplier > xWarnings ( _rxLoadable , UNO_QUERY ) ;
if ( xWarnings . is ( ) )
xWarnings - > clearWarnings ( ) ;
}
// -----------------------------------------------------------------------------
void SbaXDataBrowserController : : impl_checkForCannotSelectUnfiltered ( const SQLExceptionInfo & _rError )
{
: : connectivity : : SQLError aError ( getORB ( ) ) ;
: : connectivity : : ErrorCode nErrorCode ( aError . getErrorCode ( ErrorCondition : : DATA_CANNOT_SELECT_UNFILTERED ) ) ;
if ( ( ( const SQLException * ) _rError ) - > ErrorCode = = nErrorCode )
{
m_bCannotSelectUnfiltered = true ;
InvalidateFeature ( ID_BROWSER_FILTERCRIT ) ;
}
}
// -----------------------------------------------------------------------------
sal_Bool SbaXDataBrowserController : : reloadForm ( const Reference < XLoadable > & _rxLoadable )
2001-07-17 12:07:48 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::reloadForm " ) ;
2001-07-17 12:07:48 +00:00
WaitObject aWO ( getBrowserView ( ) ) ;
CWS-TOOLING: integrate CWS evoab2def
2009-05-28 16:00:19 +0200 fs r272412 : don't use createFalse - Evo 2.22 simply hangs when ask for all contacts without a first name. Instead, in the WHERE 0=1 case, simply create an empty result set
2009-05-22 14:25:51 +0200 fs r272193 : #i10000#
2009-05-22 14:25:37 +0200 fs r272192 : oops, ENABLE_EVOAB2 for some platforms only, not generically
2009-05-22 14:19:00 +0200 fs r272191 : #i10000#
2009-05-22 12:42:38 +0200 fs r272183 : when sorting, properly use a syslocale collator, instead of comparing the numerical values of the string's UTF-16 code points
2009-05-20 15:09:00 +0200 fs r272131 : clear/getWarnings: also allowed without cache
2009-05-20 14:11:19 +0200 fs r272128 : removed debug traces
2009-05-20 14:03:31 +0200 fs r272126 : #i55701# +STR_SORT_BY_COL_ONLY
2009-05-20 14:02:29 +0200 fs r272125 : implement sorting
2009-05-20 10:10:19 +0200 fs r272107 : #i10000#
2009-05-19 16:02:17 +0200 fs r272089 : #i10000#
2009-05-19 16:02:02 +0200 fs r272088 : #i55701# strings for new error condition DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 16:01:31 +0200 fs r272087 : #i55701# use DATA_CANNOT_SELECT_UNFILTERED as standardized error code
2009-05-19 15:59:59 +0200 fs r272086 : #i55701# +DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 15:46:12 +0200 fs r272084 : #i55701# recognize the DATA_CANNOT_SELECT_UNFILTERED error condition, and allow filtering in this case, even when the result set is empty
2009-05-19 09:06:50 +0200 fs r272059 : merging changes from CWS dba32b, to prevent future conflicts with upcoming local changes
2009-05-18 21:48:58 +0200 fs r272054 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:48:42 +0200 fs r272053 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:47:41 +0200 fs r272052 : +setExternalWarnings
2009-05-18 21:47:12 +0200 fs r272051 : #i55701# when re/loading the form, display any possible warnings
2009-05-18 21:43:26 +0200 fs r272050 : #i55701# implement XWarningsSupplier, exposing the warnings of our result set
2009-05-18 21:42:51 +0200 fs r272049 : #i55701# implement XWarningsSupplier, exposing the warnings of our aggregate RowSet
2009-05-18 17:53:59 +0200 fs r272041 : #i55701# moved the (I)WarningsContainer from dbaccess to connectivity, to be able to use it in the latter module, too
2009-05-18 17:24:10 +0200 fs r272040 : #i55701# properly enable the various Evolution types
2009-05-18 14:52:19 +0200 fs r272024 : #i55701# properly enable the Evolution types
2009-05-18 13:57:10 +0200 fs r272018 : fixed/extended whereAnalysis (column searching still not enabled, as neither LIKE nor = seem to work with my (somewhat older) Evolution version)
2009-05-18 13:56:08 +0200 fs r272017 : extended showParseTree
2009-05-18 13:55:25 +0200 fs r272016 : extended showParseTree
2009-05-18 11:40:16 +0200 fs r272008 : #i55701#
2009-05-18 11:39:02 +0200 fs r272006 : let the PreparedStatement return proper meta data, too
2009-05-18 10:05:37 +0200 fs r271999 : moved the XStatement interface to from OCommonStatement to OStatement - the former class is also the base for other classes which should not have this interface
2009-05-15 21:53:22 +0200 fs r271973 : collectColumnInformation: report invalid meta data as assertion
2009-05-15 21:51:40 +0200 fs r271972 : showParseTree should be const
2009-05-15 21:51:26 +0200 fs r271971 : showParseTree should be const
2009-05-15 21:51:03 +0200 fs r271970 : properly recognize the 'WHERE 0 = 1' clause, this way having proper statement meta data, this way saving much much calls from the DBA framework
2009-05-15 20:29:03 +0200 fs r271969 : cleaned up the mess with the statement classes
2009-05-15 15:51:11 +0200 fs r271944 : let the result set properly init its meta data
2009-05-15 15:29:54 +0200 fs r271939 : proper property implementations for the resultset class
2009-05-15 15:01:31 +0200 fs r271936 : proper property implementations for the statement class
2009-05-08 14:46:33 +0200 fs r271717 : component_foo must be PUBLIC
2009-05-06 09:20:05 +0200 fs r271565 : #i10000# (warnings on unxlngi6)
2009-05-06 09:01:30 +0200 fs r271564 : #i101493#
2009-05-05 23:08:12 +0200 fs r271560 : #i55701# merging the changes from the ancient (CVS-based) CWS evoab2default into this CWS here
2009-06-05 12:31:05 +00:00
onStartLoading ( _rxLoadable ) ;
2001-07-17 12:07:48 +00:00
FormErrorHelper aReportError ( this ) ;
if ( _rxLoadable - > isLoaded ( ) )
_rxLoadable - > reload ( ) ;
else
_rxLoadable - > load ( ) ;
CWS-TOOLING: integrate CWS evoab2def
2009-05-28 16:00:19 +0200 fs r272412 : don't use createFalse - Evo 2.22 simply hangs when ask for all contacts without a first name. Instead, in the WHERE 0=1 case, simply create an empty result set
2009-05-22 14:25:51 +0200 fs r272193 : #i10000#
2009-05-22 14:25:37 +0200 fs r272192 : oops, ENABLE_EVOAB2 for some platforms only, not generically
2009-05-22 14:19:00 +0200 fs r272191 : #i10000#
2009-05-22 12:42:38 +0200 fs r272183 : when sorting, properly use a syslocale collator, instead of comparing the numerical values of the string's UTF-16 code points
2009-05-20 15:09:00 +0200 fs r272131 : clear/getWarnings: also allowed without cache
2009-05-20 14:11:19 +0200 fs r272128 : removed debug traces
2009-05-20 14:03:31 +0200 fs r272126 : #i55701# +STR_SORT_BY_COL_ONLY
2009-05-20 14:02:29 +0200 fs r272125 : implement sorting
2009-05-20 10:10:19 +0200 fs r272107 : #i10000#
2009-05-19 16:02:17 +0200 fs r272089 : #i10000#
2009-05-19 16:02:02 +0200 fs r272088 : #i55701# strings for new error condition DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 16:01:31 +0200 fs r272087 : #i55701# use DATA_CANNOT_SELECT_UNFILTERED as standardized error code
2009-05-19 15:59:59 +0200 fs r272086 : #i55701# +DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 15:46:12 +0200 fs r272084 : #i55701# recognize the DATA_CANNOT_SELECT_UNFILTERED error condition, and allow filtering in this case, even when the result set is empty
2009-05-19 09:06:50 +0200 fs r272059 : merging changes from CWS dba32b, to prevent future conflicts with upcoming local changes
2009-05-18 21:48:58 +0200 fs r272054 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:48:42 +0200 fs r272053 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:47:41 +0200 fs r272052 : +setExternalWarnings
2009-05-18 21:47:12 +0200 fs r272051 : #i55701# when re/loading the form, display any possible warnings
2009-05-18 21:43:26 +0200 fs r272050 : #i55701# implement XWarningsSupplier, exposing the warnings of our result set
2009-05-18 21:42:51 +0200 fs r272049 : #i55701# implement XWarningsSupplier, exposing the warnings of our aggregate RowSet
2009-05-18 17:53:59 +0200 fs r272041 : #i55701# moved the (I)WarningsContainer from dbaccess to connectivity, to be able to use it in the latter module, too
2009-05-18 17:24:10 +0200 fs r272040 : #i55701# properly enable the various Evolution types
2009-05-18 14:52:19 +0200 fs r272024 : #i55701# properly enable the Evolution types
2009-05-18 13:57:10 +0200 fs r272018 : fixed/extended whereAnalysis (column searching still not enabled, as neither LIKE nor = seem to work with my (somewhat older) Evolution version)
2009-05-18 13:56:08 +0200 fs r272017 : extended showParseTree
2009-05-18 13:55:25 +0200 fs r272016 : extended showParseTree
2009-05-18 11:40:16 +0200 fs r272008 : #i55701#
2009-05-18 11:39:02 +0200 fs r272006 : let the PreparedStatement return proper meta data, too
2009-05-18 10:05:37 +0200 fs r271999 : moved the XStatement interface to from OCommonStatement to OStatement - the former class is also the base for other classes which should not have this interface
2009-05-15 21:53:22 +0200 fs r271973 : collectColumnInformation: report invalid meta data as assertion
2009-05-15 21:51:40 +0200 fs r271972 : showParseTree should be const
2009-05-15 21:51:26 +0200 fs r271971 : showParseTree should be const
2009-05-15 21:51:03 +0200 fs r271970 : properly recognize the 'WHERE 0 = 1' clause, this way having proper statement meta data, this way saving much much calls from the DBA framework
2009-05-15 20:29:03 +0200 fs r271969 : cleaned up the mess with the statement classes
2009-05-15 15:51:11 +0200 fs r271944 : let the result set properly init its meta data
2009-05-15 15:29:54 +0200 fs r271939 : proper property implementations for the resultset class
2009-05-15 15:01:31 +0200 fs r271936 : proper property implementations for the statement class
2009-05-08 14:46:33 +0200 fs r271717 : component_foo must be PUBLIC
2009-05-06 09:20:05 +0200 fs r271565 : #i10000# (warnings on unxlngi6)
2009-05-06 09:01:30 +0200 fs r271564 : #i101493#
2009-05-05 23:08:12 +0200 fs r271560 : #i55701# merging the changes from the ancient (CVS-based) CWS evoab2default into this CWS here
2009-06-05 12:31:05 +00:00
Reference < XWarningsSupplier > xWarnings ( _rxLoadable , UNO_QUERY ) ;
if ( xWarnings . is ( ) )
{
SQLExceptionInfo aInfo ( xWarnings - > getWarnings ( ) ) ;
if ( aInfo . isValid ( ) )
{
showError ( aInfo ) ;
impl_checkForCannotSelectUnfiltered ( aInfo ) ;
}
}
2001-07-17 12:07:48 +00:00
return _rxLoadable - > isLoaded ( ) & & ! errorOccured ( ) ;
}
2000-11-03 13:46:21 +00:00
// -----------------------------------------------------------------------------
void SbaXDataBrowserController : : initFormatter ( )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::initFormatter " ) ;
2000-11-03 13:46:21 +00:00
// ---------------------------------------------------------------
// create a formatter working with the connections format supplier
2007-07-06 07:02:38 +00:00
Reference < : : com : : sun : : star : : util : : XNumberFormatsSupplier > xSupplier ( : : dbtools : : getNumberFormats ( : : dbtools : : getConnection ( m_xRowSet ) , sal_True , getORB ( ) ) ) ;
2000-10-26 13:46:14 +00:00
2000-11-03 13:46:21 +00:00
if ( xSupplier . is ( ) )
{
// create a new formatter
m_xFormatter = Reference < : : com : : sun : : star : : util : : XNumberFormatter > (
2007-07-06 07:02:38 +00:00
getORB ( ) - > createInstance ( : : rtl : : OUString : : createFromAscii ( " com.sun.star.util.NumberFormatter " ) ) , UNO_QUERY ) ;
2000-11-03 13:46:21 +00:00
if ( m_xFormatter . is ( ) )
m_xFormatter - > attachNumberFormatsSupplier ( xSupplier ) ;
}
else // clear the formatter
m_xFormatter = NULL ;
}
2001-01-09 14:52:33 +00:00
// -----------------------------------------------------------------------------
2004-11-16 13:30:31 +00:00
void SbaXDataBrowserController : : describeSupportedFeatures ( )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::describeSupportedFeatures " ) ;
2008-03-06 17:13:16 +00:00
SbaXDataBrowserController_Base : : describeSupportedFeatures ( ) ;
2004-11-16 13:30:31 +00:00
implDescribeSupportedFeature ( " .uno:FormSlots/undoRecord " , ID_BROWSER_UNDORECORD , CommandGroup : : CONTROLS ) ;
implDescribeSupportedFeature ( " .uno:FormController/undoRecord " , ID_BROWSER_UNDORECORD , CommandGroup : : CONTROLS ) ;
implDescribeSupportedFeature ( " .uno:RecUndo " , ID_BROWSER_UNDORECORD , CommandGroup : : CONTROLS ) ;
implDescribeSupportedFeature ( " .uno:FormSlots/saveRecord " , ID_BROWSER_SAVERECORD , CommandGroup : : CONTROLS ) ;
implDescribeSupportedFeature ( " .uno:FormController/saveRecord " , ID_BROWSER_SAVERECORD , CommandGroup : : CONTROLS ) ;
implDescribeSupportedFeature ( " .uno:RecSave " , ID_BROWSER_SAVERECORD , CommandGroup : : CONTROLS ) ;
2008-01-30 07:42:45 +00:00
implDescribeSupportedFeature ( " .uno:Save " , ID_BROWSER_SAVERECORD , CommandGroup : : DOCUMENT ) ;
2004-11-16 13:30:31 +00:00
implDescribeSupportedFeature ( " .uno:RecSearch " , SID_FM_SEARCH , CommandGroup : : CONTROLS ) ;
implDescribeSupportedFeature ( " .uno:AutoFilter " , SID_FM_AUTOFILTER , CommandGroup : : CONTROLS ) ;
implDescribeSupportedFeature ( " .uno:Refresh " , SID_FM_REFRESH , CommandGroup : : CONTROLS ) ;
implDescribeSupportedFeature ( " .uno:OrderCrit " , SID_FM_ORDERCRIT , CommandGroup : : CONTROLS ) ;
implDescribeSupportedFeature ( " .uno:RemoveFilterSort " , SID_FM_REMOVE_FILTER_SORT , CommandGroup : : CONTROLS ) ;
implDescribeSupportedFeature ( " .uno:FormFiltered " , SID_FM_FORM_FILTERED , CommandGroup : : CONTROLS ) ;
implDescribeSupportedFeature ( " .uno:FilterCrit " , SID_FM_FILTERCRIT , CommandGroup : : CONTROLS ) ;
implDescribeSupportedFeature ( " .uno:Sortup " , ID_BROWSER_SORTUP , CommandGroup : : CONTROLS ) ;
implDescribeSupportedFeature ( " .uno:SortDown " , ID_BROWSER_SORTDOWN , CommandGroup : : CONTROLS ) ;
2008-03-06 17:13:16 +00:00
implDescribeSupportedFeature ( " .uno:FormSlots/deleteRecord " , SID_FM_DELETEROWS , CommandGroup : : EDIT ) ;
implDescribeSupportedFeature ( " .uno:FormSlots/insertRecord " , ID_BROWSER_INSERT_ROW , CommandGroup : : INSERT ) ;
2001-01-09 14:52:33 +00:00
}
2000-10-26 13:46:14 +00:00
//------------------------------------------------------------------------------
sal_Bool SbaXDataBrowserController : : Construct ( Window * pParent )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::Construct " ) ;
2000-10-26 13:46:14 +00:00
// ---------------------------------------------
// create/initialize the form and the grid model
m_xRowSet = CreateForm ( ) ;
if ( ! m_xRowSet . is ( ) )
return sal_False ;
2004-08-02 14:31:55 +00:00
m_xColumnsSupplier . set ( m_xRowSet , UNO_QUERY ) ;
m_xLoadable . set ( m_xRowSet , UNO_QUERY ) ;
2001-08-27 05:57:24 +00:00
2000-10-26 13:46:14 +00:00
if ( ! InitializeForm ( m_xRowSet ) )
return sal_False ;
m_xGridModel = CreateGridModel ( ) ;
if ( ! m_xGridModel . is ( ) )
return sal_False ;
2000-11-03 13:46:21 +00:00
// set the formatter if available
initFormatter ( ) ;
2000-10-26 13:46:14 +00:00
// ---------------------------------------------------------------
// we want to have a grid with a "flat" border
Reference < XPropertySet > xGridSet ( m_xGridModel , UNO_QUERY ) ;
2004-08-02 14:31:55 +00:00
if ( xGridSet . is ( ) )
2000-10-26 13:46:14 +00:00
xGridSet - > setPropertyValue ( PROPERTY_BORDER , makeAny ( ( sal_Int16 ) 2 ) ) ;
// ----------
// marry them
Reference < : : com : : sun : : star : : container : : XNameContainer > xNameCont ( m_xRowSet , UNO_QUERY ) ;
2002-04-23 06:23:16 +00:00
{
String sText ( ModuleRes ( STR_DATASOURCE_GRIDCONTROL_NAME ) ) ;
xNameCont - > insertByName ( : : rtl : : OUString ( sText ) , makeAny ( m_xGridModel ) ) ;
}
2000-10-26 13:46:14 +00:00
// ---------------
// create the view
2008-06-25 11:39:41 +00:00
m_pView = new UnoDataBrowserView ( pParent , * this , getORB ( ) ) ;
2001-01-09 14:52:33 +00:00
if ( ! getBrowserView ( ) )
2000-10-26 13:46:14 +00:00
return sal_False ;
// late construction
sal_Bool bSuccess = sal_False ;
try
{
2001-01-09 14:52:33 +00:00
getBrowserView ( ) - > Construct ( getControlModel ( ) ) ;
2000-10-26 13:46:14 +00:00
bSuccess = sal_True ;
}
catch ( SQLException & )
{
}
2001-01-09 14:52:33 +00:00
catch ( Exception & )
2000-10-26 13:46:14 +00:00
{
DBG_ERROR ( " SbaXDataBrowserController::Construct : the construction of UnoDataBrowserView failed ! " ) ;
}
if ( ! bSuccess )
{
2004-08-02 14:31:55 +00:00
// deleteView();
2000-10-26 13:46:14 +00:00
return sal_False ;
}
2002-05-23 11:25:52 +00:00
// now that we have a view we can create the clipboard listener
m_aSystemClipboard = TransferableDataHelper : : CreateFromSystemClipboard ( getView ( ) ) ;
m_aSystemClipboard . StartClipboardListening ( ) ;
m_pClipbordNotifier = new TransferableClipboardListener ( LINK ( this , SbaXDataBrowserController , OnClipboardChanged ) ) ;
m_pClipbordNotifier - > acquire ( ) ;
m_pClipbordNotifier - > AddRemoveListener ( getView ( ) , sal_True ) ;
2001-01-09 14:52:33 +00:00
// this call create the toolbox
2008-03-06 17:13:16 +00:00
SbaXDataBrowserController_Base : : Construct ( pParent ) ;
2000-10-26 13:46:14 +00:00
2001-01-09 14:52:33 +00:00
getBrowserView ( ) - > Show ( ) ;
2000-10-26 13:46:14 +00:00
// set the callbacks for the grid control
2001-01-09 14:52:33 +00:00
SbaGridControl * pVclGrid = getBrowserView ( ) - > getVclControl ( ) ;
2000-10-26 13:46:14 +00:00
DBG_ASSERT ( pVclGrid , " SbaXDataBrowserController::Construct : have no VCL control ! " ) ;
pVclGrid - > SetMasterListener ( this ) ;
// --------------------------
// add listeners ...
// ... to the form model
Reference < XPropertySet > xFormSet ( getRowSet ( ) , UNO_QUERY ) ;
if ( xFormSet . is ( ) )
{
2001-06-21 16:52:32 +00:00
xFormSet - > addPropertyChangeListener ( PROPERTY_ISNEW , static_cast < XPropertyChangeListener * > ( this ) ) ;
xFormSet - > addPropertyChangeListener ( PROPERTY_ISMODIFIED , static_cast < XPropertyChangeListener * > ( this ) ) ;
xFormSet - > addPropertyChangeListener ( PROPERTY_ROWCOUNT , static_cast < XPropertyChangeListener * > ( this ) ) ;
xFormSet - > addPropertyChangeListener ( PROPERTY_ACTIVECOMMAND , static_cast < XPropertyChangeListener * > ( this ) ) ;
xFormSet - > addPropertyChangeListener ( PROPERTY_ORDER , static_cast < XPropertyChangeListener * > ( this ) ) ;
xFormSet - > addPropertyChangeListener ( PROPERTY_FILTER , static_cast < XPropertyChangeListener * > ( this ) ) ;
2004-10-22 08:04:30 +00:00
xFormSet - > addPropertyChangeListener ( PROPERTY_HAVING_CLAUSE , static_cast < XPropertyChangeListener * > ( this ) ) ;
2001-06-21 16:52:32 +00:00
xFormSet - > addPropertyChangeListener ( PROPERTY_APPLYFILTER , static_cast < XPropertyChangeListener * > ( this ) ) ;
2000-10-26 13:46:14 +00:00
}
Reference < : : com : : sun : : star : : sdb : : XSQLErrorBroadcaster > xFormError ( getRowSet ( ) , UNO_QUERY ) ;
if ( xFormError . is ( ) )
xFormError - > addSQLErrorListener ( ( : : com : : sun : : star : : sdb : : XSQLErrorListener * ) this ) ;
2001-08-27 05:57:24 +00:00
if ( m_xLoadable . is ( ) )
m_xLoadable - > addLoadListener ( this ) ;
2000-10-26 13:46:14 +00:00
Reference < : : com : : sun : : star : : form : : XDatabaseParameterBroadcaster > xFormParameter ( getRowSet ( ) , UNO_QUERY ) ;
if ( xFormParameter . is ( ) )
xFormParameter - > addParameterListener ( ( : : com : : sun : : star : : form : : XDatabaseParameterListener * ) this ) ;
addModelListeners ( getControlModel ( ) ) ;
2001-01-09 14:52:33 +00:00
addControlListeners ( getBrowserView ( ) - > getGridControl ( ) ) ;
2000-10-26 13:46:14 +00:00
// -------------
// load the form
return LoadForm ( ) ;
}
//------------------------------------------------------------------------------
sal_Bool SbaXDataBrowserController : : LoadForm ( )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::LoadForm " ) ;
2001-08-27 05:57:24 +00:00
reloadForm ( m_xLoadable ) ;
2000-10-26 13:46:14 +00:00
return sal_True ;
}
//------------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SbaXDataBrowserController : : AddColumnListener ( const Reference < XPropertySet > & /*xCol*/ )
2000-10-26 13:46:14 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::AddColumnListener " ) ;
2000-10-26 13:46:14 +00:00
// we're not interested in any column properties ...
}
//------------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SbaXDataBrowserController : : RemoveColumnListener ( const Reference < XPropertySet > & /*xCol*/ )
2000-10-26 13:46:14 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::RemoveColumnListener " ) ;
2000-10-26 13:46:14 +00:00
}
//------------------------------------------------------------------------------
Reference < XRowSet > SbaXDataBrowserController : : CreateForm ( )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::CreateForm " ) ;
2007-07-06 07:02:38 +00:00
return Reference < XRowSet > ( getORB ( ) - > createInstance ( : : rtl : : OUString : : createFromAscii ( " com.sun.star.form.component.Form " ) ) , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
}
//------------------------------------------------------------------------------
Reference < : : com : : sun : : star : : form : : XFormComponent > SbaXDataBrowserController : : CreateGridModel ( )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::CreateGridModel " ) ;
2007-07-06 07:02:38 +00:00
return Reference < : : com : : sun : : star : : form : : XFormComponent > ( getORB ( ) - > createInstance ( : : rtl : : OUString : : createFromAscii ( " com.sun.star.form.component.GridControl " ) ) , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
}
// -------------------------------------------------------------------------
void SbaXDataBrowserController : : addModelListeners ( const Reference < : : com : : sun : : star : : awt : : XControlModel > & _xGridControlModel )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::addModelListeners " ) ;
2000-10-26 13:46:14 +00:00
// ... all the grid columns
2005-09-23 11:19:18 +00:00
addColumnListeners ( _xGridControlModel ) ;
2000-10-26 13:46:14 +00:00
// (we are interested in all columns the grid has (and only in these) so we have to listen to the container, too)
Reference < : : com : : sun : : star : : container : : XContainer > xColContainer ( _xGridControlModel , UNO_QUERY ) ;
if ( xColContainer . is ( ) )
xColContainer - > addContainerListener ( ( : : com : : sun : : star : : container : : XContainerListener * ) this ) ;
Reference < : : com : : sun : : star : : form : : XReset > xReset ( _xGridControlModel , UNO_QUERY ) ;
if ( xReset . is ( ) )
xReset - > addResetListener ( ( : : com : : sun : : star : : form : : XResetListener * ) this ) ;
}
// -------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SbaXDataBrowserController : : removeModelListeners ( const Reference < XControlModel > & _xGridControlModel )
2000-10-26 13:46:14 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::removeModelListeners " ) ;
2000-10-26 13:46:14 +00:00
// every single column model
2006-06-20 01:55:50 +00:00
Reference < XIndexContainer > xColumns ( _xGridControlModel , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
if ( xColumns . is ( ) )
{
2004-08-02 14:31:55 +00:00
sal_Int32 nCount = xColumns - > getCount ( ) ;
for ( sal_uInt16 i = 0 ; i < nCount ; + + i )
2000-10-26 13:46:14 +00:00
{
2004-08-02 14:31:55 +00:00
Reference < XPropertySet > xCol ( xColumns - > getByIndex ( i ) , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
RemoveColumnListener ( xCol ) ;
}
}
2006-06-20 01:55:50 +00:00
Reference < XContainer > xColContainer ( _xGridControlModel , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
if ( xColContainer . is ( ) )
2006-06-20 01:55:50 +00:00
xColContainer - > removeContainerListener ( this ) ;
2000-10-26 13:46:14 +00:00
2006-06-20 01:55:50 +00:00
Reference < XReset > xReset ( _xGridControlModel , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
if ( xReset . is ( ) )
2006-06-20 01:55:50 +00:00
xReset - > removeResetListener ( this ) ;
2000-10-26 13:46:14 +00:00
}
// -------------------------------------------------------------------------
void SbaXDataBrowserController : : addControlListeners ( const Reference < : : com : : sun : : star : : awt : : XControl > & _xGridControl )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::addControlListeners " ) ;
2000-10-26 13:46:14 +00:00
// to ge the 'modified' for the current cell
2001-05-16 13:27:19 +00:00
Reference < XModifyBroadcaster > xBroadcaster ( getBrowserView ( ) - > getGridControl ( ) , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
if ( xBroadcaster . is ( ) )
2001-06-21 16:52:32 +00:00
xBroadcaster - > addModifyListener ( static_cast < XModifyListener * > ( this ) ) ;
2000-10-26 13:46:14 +00:00
// introduce ourself as dispatch provider for the grid
2001-05-16 13:27:19 +00:00
Reference < XDispatchProviderInterception > xInterception ( getBrowserView ( ) - > getGridControl ( ) , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
if ( xInterception . is ( ) )
2001-06-21 16:52:32 +00:00
xInterception - > registerDispatchProviderInterceptor ( static_cast < XDispatchProviderInterceptor * > ( this ) ) ;
2001-05-16 13:27:19 +00:00
// add as focus listener to the control (needed for the form controller functionality)
Reference < XWindow > xWindow ( _xGridControl , UNO_QUERY ) ;
if ( xWindow . is ( ) )
xWindow - > addFocusListener ( this ) ;
2000-10-26 13:46:14 +00:00
}
// -------------------------------------------------------------------------
void SbaXDataBrowserController : : removeControlListeners ( const Reference < : : com : : sun : : star : : awt : : XControl > & _xGridControl )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::removeControlListeners " ) ;
2001-05-16 13:27:19 +00:00
Reference < XModifyBroadcaster > xBroadcaster ( _xGridControl , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
if ( xBroadcaster . is ( ) )
2001-06-21 16:52:32 +00:00
xBroadcaster - > removeModifyListener ( static_cast < XModifyListener * > ( this ) ) ;
2000-10-26 13:46:14 +00:00
2001-05-16 13:27:19 +00:00
Reference < XDispatchProviderInterception > xInterception ( _xGridControl , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
if ( xInterception . is ( ) )
2001-06-21 16:52:32 +00:00
xInterception - > releaseDispatchProviderInterceptor ( static_cast < XDispatchProviderInterceptor * > ( this ) ) ;
2001-05-16 13:27:19 +00:00
Reference < XWindow > xWindow ( _xGridControl , UNO_QUERY ) ;
if ( xWindow . is ( ) )
xWindow - > removeFocusListener ( this ) ;
}
//------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SAL_CALL SbaXDataBrowserController : : focusGained ( const FocusEvent & /*e*/ ) throw ( RuntimeException )
2001-05-16 13:27:19 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::focusGained " ) ;
2001-05-16 13:27:19 +00:00
// notify our activate listeners (registered on the form controller aggregate)
EventObject aEvt ( * this ) ;
: : cppu : : OInterfaceIteratorHelper aIter ( m_pFormControllerImpl - > m_aActivateListeners ) ;
while ( aIter . hasMoreElements ( ) )
2001-06-21 16:52:32 +00:00
static_cast < XFormControllerListener * > ( aIter . next ( ) ) - > formActivated ( aEvt ) ;
2001-05-16 13:27:19 +00:00
}
//------------------------------------------------------------------
void SAL_CALL SbaXDataBrowserController : : focusLost ( const FocusEvent & e ) throw ( RuntimeException )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::focusLost " ) ;
2001-05-16 13:27:19 +00:00
// some general checks
if ( ! getBrowserView ( ) | | ! getBrowserView ( ) - > getGridControl ( ) . is ( ) )
return ;
Reference < XVclWindowPeer > xMyGridPeer ( getBrowserView ( ) - > getGridControl ( ) - > getPeer ( ) , UNO_QUERY ) ;
if ( ! xMyGridPeer . is ( ) )
return ;
Reference < XWindowPeer > xNextControlPeer ( e . NextFocus , UNO_QUERY ) ;
if ( ! xNextControlPeer . is ( ) )
return ;
// don't do a notification if it remains in the family (i.e. a child of the grid control gets the focus)
if ( xMyGridPeer - > isChild ( xNextControlPeer ) )
return ;
if ( xMyGridPeer = = xNextControlPeer )
return ;
// notify the listeners that the "form" we represent has been deactivated
EventObject aEvt ( * this ) ;
: : cppu : : OInterfaceIteratorHelper aIter ( m_pFormControllerImpl - > m_aActivateListeners ) ;
while ( aIter . hasMoreElements ( ) )
2001-06-21 16:52:32 +00:00
static_cast < XFormControllerListener * > ( aIter . next ( ) ) - > formDeactivated ( aEvt ) ;
2001-05-16 13:27:19 +00:00
// commit the changes of the grid control (as we're deactivated)
Reference < XBoundComponent > xCommitable ( getBrowserView ( ) - > getGridControl ( ) , UNO_QUERY ) ;
if ( xCommitable . is ( ) )
xCommitable - > commit ( ) ;
else
OSL_ENSURE ( sal_False , " SbaXDataBrowserController::focusLost : why is my control not commitable ? " ) ;
2000-10-26 13:46:14 +00:00
}
// -------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SbaXDataBrowserController : : disposingGridControl ( const : : com : : sun : : star : : lang : : EventObject & /*Source*/ )
2000-10-26 13:46:14 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::disposingGridControl " ) ;
2001-01-09 14:52:33 +00:00
removeControlListeners ( getBrowserView ( ) - > getGridControl ( ) ) ;
2000-10-26 13:46:14 +00:00
}
// -------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SbaXDataBrowserController : : disposingGridModel ( const : : com : : sun : : star : : lang : : EventObject & /*Source*/ )
2000-10-26 13:46:14 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::disposingGridModel " ) ;
2000-10-26 13:46:14 +00:00
removeModelListeners ( getControlModel ( ) ) ;
}
// -------------------------------------------------------------------------
void SbaXDataBrowserController : : disposingFormModel ( const : : com : : sun : : star : : lang : : EventObject & Source )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::disposingFormModel " ) ;
2000-10-26 13:46:14 +00:00
Reference < XPropertySet > xSourceSet ( Source . Source , UNO_QUERY ) ;
if ( xSourceSet . is ( ) )
{
2001-06-21 16:52:32 +00:00
xSourceSet - > removePropertyChangeListener ( PROPERTY_ISNEW , static_cast < XPropertyChangeListener * > ( this ) ) ;
xSourceSet - > removePropertyChangeListener ( PROPERTY_ISMODIFIED , static_cast < XPropertyChangeListener * > ( this ) ) ;
xSourceSet - > removePropertyChangeListener ( PROPERTY_ROWCOUNT , static_cast < XPropertyChangeListener * > ( this ) ) ;
xSourceSet - > removePropertyChangeListener ( PROPERTY_ACTIVECOMMAND , static_cast < XPropertyChangeListener * > ( this ) ) ;
xSourceSet - > removePropertyChangeListener ( PROPERTY_ORDER , static_cast < XPropertyChangeListener * > ( this ) ) ;
xSourceSet - > removePropertyChangeListener ( PROPERTY_FILTER , static_cast < XPropertyChangeListener * > ( this ) ) ;
2004-10-22 08:04:30 +00:00
xSourceSet - > removePropertyChangeListener ( PROPERTY_HAVING_CLAUSE , static_cast < XPropertyChangeListener * > ( this ) ) ;
2001-06-21 16:52:32 +00:00
xSourceSet - > removePropertyChangeListener ( PROPERTY_APPLYFILTER , static_cast < XPropertyChangeListener * > ( this ) ) ;
2000-10-26 13:46:14 +00:00
}
Reference < : : com : : sun : : star : : sdb : : XSQLErrorBroadcaster > xFormError ( Source . Source , UNO_QUERY ) ;
if ( xFormError . is ( ) )
xFormError - > removeSQLErrorListener ( ( : : com : : sun : : star : : sdb : : XSQLErrorListener * ) this ) ;
2001-08-27 05:57:24 +00:00
if ( m_xLoadable . is ( ) )
m_xLoadable - > removeLoadListener ( this ) ;
2000-10-26 13:46:14 +00:00
Reference < : : com : : sun : : star : : form : : XDatabaseParameterBroadcaster > xFormParameter ( Source . Source , UNO_QUERY ) ;
if ( xFormParameter . is ( ) )
xFormParameter - > removeParameterListener ( ( : : com : : sun : : star : : form : : XDatabaseParameterListener * ) this ) ;
}
// -------------------------------------------------------------------------
void SbaXDataBrowserController : : disposingColumnModel ( const : : com : : sun : : star : : lang : : EventObject & Source )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::disposingColumnModel " ) ;
2000-10-26 13:46:14 +00:00
RemoveColumnListener ( Reference < XPropertySet > ( Source . Source , UNO_QUERY ) ) ;
}
// -------------------------------------------------------------------------
2001-05-16 13:27:19 +00:00
void SbaXDataBrowserController : : disposing ( const EventObject & Source ) throw ( RuntimeException )
2000-10-26 13:46:14 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::disposing " ) ;
2001-05-16 13:27:19 +00:00
// if it's a component other than our aggregate, forward it to the aggregate
2008-03-06 17:13:16 +00:00
if ( m_xFormControllerImpl ! = Source . Source )
2001-05-16 13:27:19 +00:00
{
2008-03-06 17:13:16 +00:00
Reference < XEventListener > xAggListener ;
m_xFormControllerImpl - > queryAggregation ( : : getCppuType ( & xAggListener ) ) > > = xAggListener ;
if ( xAggListener . is ( ) )
xAggListener - > disposing ( Source ) ;
2001-05-16 13:27:19 +00:00
}
2000-10-26 13:46:14 +00:00
// is it the grid control ?
2001-01-09 14:52:33 +00:00
if ( getBrowserView ( ) )
2000-10-26 13:46:14 +00:00
{
Reference < : : com : : sun : : star : : awt : : XControl > xSourceControl ( Source . Source , UNO_QUERY ) ;
2001-01-09 14:52:33 +00:00
if ( xSourceControl = = getBrowserView ( ) - > getGridControl ( ) )
2000-10-26 13:46:14 +00:00
disposingGridControl ( Source ) ;
}
// it's model (the container of the columns) ?
if ( getControlModel ( ) = = Source . Source )
disposingGridModel ( Source ) ;
// the form's model ?
if ( ( getRowSet ( ) = = Source . Source ) )
disposingFormModel ( Source ) ;
// from a single column model ?
Reference < XPropertySet > xSourceSet ( Source . Source , UNO_QUERY ) ;
if ( xSourceSet . is ( ) )
{
Reference < XPropertySetInfo > xInfo = xSourceSet - > getPropertySetInfo ( ) ;
// we assume that columns have a Width property and all other sets we are listening to don't have
if ( xInfo - > hasPropertyByName ( PROPERTY_WIDTH ) )
disposingColumnModel ( Source ) ;
}
2008-03-06 17:13:16 +00:00
SbaXDataBrowserController_Base : : OGenericUnoController : : disposing ( Source ) ;
2000-10-26 13:46:14 +00:00
}
2008-03-05 15:52:29 +00:00
// -----------------------------------------------------------------------
void SAL_CALL SbaXDataBrowserController : : setIdentifier ( const : : rtl : : OUString & _Identifier ) throw ( RuntimeException )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::setIdentifier " ) ;
2008-12-01 12:31:27 +00:00
: : osl : : MutexGuard aGuard ( getMutex ( ) ) ;
2008-03-05 15:52:29 +00:00
m_sModuleIdentifier = _Identifier ;
}
// -----------------------------------------------------------------------
: : rtl : : OUString SAL_CALL SbaXDataBrowserController : : getIdentifier ( ) throw ( RuntimeException )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::getIdentifier " ) ;
2008-12-01 12:31:27 +00:00
: : osl : : MutexGuard aGuard ( getMutex ( ) ) ;
2008-03-05 15:52:29 +00:00
return m_sModuleIdentifier ;
}
2000-10-26 13:46:14 +00:00
// -----------------------------------------------------------------------
2001-06-22 09:24:09 +00:00
void SbaXDataBrowserController : : propertyChange ( const PropertyChangeEvent & evt ) throw ( RuntimeException )
2000-10-26 13:46:14 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::propertyChange " ) ;
2000-10-26 13:46:14 +00:00
Reference < XPropertySet > xSource ( evt . Source , UNO_QUERY ) ;
if ( ! xSource . is ( ) )
return ;
: : vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
// the IsModified changed to sal_False ?
if ( ( evt . PropertyName . equals ( PROPERTY_ISMODIFIED ) )
& & ( : : comphelper : : getBOOL ( evt . NewValue ) = = sal_False )
)
{ // -> the current field isn't modified anymore, too
2001-10-29 14:14:28 +00:00
setCurrentModified ( sal_False ) ;
2000-10-26 13:46:14 +00:00
}
// switching to a new record ?
if ( ( evt . PropertyName . equals ( PROPERTY_ISNEW ) )
& & ( : : comphelper : : getBOOL ( evt . NewValue ) = = sal_True )
)
{
if ( : : comphelper : : getINT32 ( xSource - > getPropertyValue ( PROPERTY_ROWCOUNT ) ) = = 0 )
// if we're switching to a new record and didn't have any records before we need to invalidate
// all slots (as the cursor was invalid before the mode change and so the slots were disabled)
InvalidateAll ( ) ;
}
2009-04-23 10:42:05 +00:00
2000-10-26 13:46:14 +00:00
// the filter or the sort criterias have changed ? -> update our parser
2009-04-23 10:42:05 +00:00
if ( evt . PropertyName . equals ( PROPERTY_ACTIVECOMMAND ) )
2000-10-26 13:46:14 +00:00
{
2009-04-23 10:42:05 +00:00
initializeParser ( ) ;
if ( m_xParser . is ( ) )
2005-01-05 11:33:18 +00:00
DO_SAFE ( m_xParser - > setElementaryQuery ( : : comphelper : : getString ( evt . NewValue ) ) , " SbaXDataBrowserController::propertyChange : could not forward the new query to my parser ! " ) ;
2009-04-23 10:42:05 +00:00
}
else if ( evt . PropertyName . equals ( PROPERTY_FILTER ) )
{
initializeParser ( ) ;
if ( m_xParser . is ( ) & & m_xParser - > getFilter ( ) ! = : : comphelper : : getString ( evt . NewValue ) )
2000-10-26 13:46:14 +00:00
{
2009-04-23 10:42:05 +00:00
DO_SAFE ( m_xParser - > setFilter ( : : comphelper : : getString ( evt . NewValue ) ) , " SbaXDataBrowserController::propertyChange : could not forward the new filter to my parser ! " ) ;
2004-10-22 08:04:30 +00:00
}
2009-04-23 10:42:05 +00:00
InvalidateFeature ( ID_BROWSER_REMOVEFILTER ) ;
}
else if ( evt . PropertyName . equals ( PROPERTY_HAVING_CLAUSE ) )
{
initializeParser ( ) ;
if ( m_xParser . is ( ) & & m_xParser - > getHavingClause ( ) ! = : : comphelper : : getString ( evt . NewValue ) )
2004-10-22 08:04:30 +00:00
{
2009-04-23 10:42:05 +00:00
DO_SAFE ( m_xParser - > setHavingClause ( : : comphelper : : getString ( evt . NewValue ) ) , " SbaXDataBrowserController::propertyChange : could not forward the new filter to my parser ! " ) ;
2000-10-26 13:46:14 +00:00
}
2009-04-23 10:42:05 +00:00
InvalidateFeature ( ID_BROWSER_REMOVEFILTER ) ;
}
else if ( evt . PropertyName . equals ( PROPERTY_ORDER ) )
{
initializeParser ( ) ;
if ( m_xParser . is ( ) & & m_xParser - > getOrder ( ) ! = : : comphelper : : getString ( evt . NewValue ) )
2000-10-26 13:46:14 +00:00
{
2009-04-23 10:42:05 +00:00
DO_SAFE ( m_xParser - > setOrder ( : : comphelper : : getString ( evt . NewValue ) ) , " SbaXDataBrowserController::propertyChange : could not forward the new order to my parser ! " ) ;
2000-10-26 13:46:14 +00:00
}
2009-04-23 10:42:05 +00:00
InvalidateFeature ( ID_BROWSER_REMOVEFILTER ) ;
2000-10-26 13:46:14 +00:00
}
// a new record count ? -> may be our search availability has changed
if ( evt . PropertyName . equals ( PROPERTY_ROWCOUNT ) )
2001-08-10 07:21:12 +00:00
{
2006-11-21 16:16:14 +00:00
sal_Int32 nNewValue = 0 , nOldValue = 0 ;
2001-08-10 07:21:12 +00:00
evt . NewValue > > = nNewValue ;
evt . OldValue > > = nOldValue ;
if ( ( nOldValue = = 0 & & nNewValue ! = 0 ) | | ( nOldValue ! = 0 & & nNewValue = = 0 ) )
InvalidateAll ( ) ;
}
2000-10-26 13:46:14 +00:00
}
//------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SbaXDataBrowserController : : modified ( const : : com : : sun : : star : : lang : : EventObject & /*aEvent*/ ) throw ( RuntimeException )
2000-10-26 13:46:14 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::modified " ) ;
2001-10-29 14:14:28 +00:00
setCurrentModified ( sal_True ) ;
2000-10-26 13:46:14 +00:00
}
// -----------------------------------------------------------------------
void SbaXDataBrowserController : : elementInserted ( const : : com : : sun : : star : : container : : ContainerEvent & evt ) throw ( RuntimeException )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::elementInserted " ) ;
2000-12-10 15:11:02 +00:00
DBG_ASSERT ( Reference < XInterface > ( evt . Source , UNO_QUERY ) . get ( ) = = Reference < XInterface > ( getControlModel ( ) , UNO_QUERY ) . get ( ) ,
" SbaXDataBrowserController::elementInserted: where did this come from (not from the grid model)?! " ) ;
2004-08-02 14:31:55 +00:00
Reference < XPropertySet > xNewColumn ( evt . Element , UNO_QUERY ) ;
if ( xNewColumn . is ( ) )
AddColumnListener ( xNewColumn ) ;
2000-10-26 13:46:14 +00:00
}
// -----------------------------------------------------------------------
void SbaXDataBrowserController : : elementRemoved ( const : : com : : sun : : star : : container : : ContainerEvent & evt ) throw ( RuntimeException )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::elementRemoved " ) ;
2000-12-10 15:11:02 +00:00
DBG_ASSERT ( Reference < XInterface > ( evt . Source , UNO_QUERY ) . get ( ) = = Reference < XInterface > ( getControlModel ( ) , UNO_QUERY ) . get ( ) ,
" SbaXDataBrowserController::elementRemoved: where did this come from (not from the grid model)?! " ) ;
2004-08-02 14:31:55 +00:00
Reference < XPropertySet > xOldColumn ( evt . Element , UNO_QUERY ) ;
if ( xOldColumn . is ( ) )
RemoveColumnListener ( xOldColumn ) ;
2000-10-26 13:46:14 +00:00
}
// -----------------------------------------------------------------------
void SbaXDataBrowserController : : elementReplaced ( const : : com : : sun : : star : : container : : ContainerEvent & evt ) throw ( RuntimeException )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::elementReplaced " ) ;
2000-12-10 15:11:02 +00:00
DBG_ASSERT ( Reference < XInterface > ( evt . Source , UNO_QUERY ) . get ( ) = = Reference < XInterface > ( getControlModel ( ) , UNO_QUERY ) . get ( ) ,
" SbaXDataBrowserController::elementReplaced: where did this come from (not from the grid model)?! " ) ;
2004-08-02 14:31:55 +00:00
Reference < XPropertySet > xOldColumn ( evt . ReplacedElement , UNO_QUERY ) ;
if ( xOldColumn . is ( ) )
RemoveColumnListener ( xOldColumn ) ;
2000-10-26 13:46:14 +00:00
2004-08-02 14:31:55 +00:00
Reference < XPropertySet > xNewColumn ( evt . Element , UNO_QUERY ) ;
if ( xNewColumn . is ( ) )
AddColumnListener ( xNewColumn ) ;
2000-10-26 13:46:14 +00:00
}
// -----------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
sal_Bool SbaXDataBrowserController : : suspend ( sal_Bool /*bSuspend*/ ) throw ( RuntimeException )
2000-10-26 13:46:14 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::suspend " ) ;
2000-10-26 13:46:14 +00:00
// have a pending open operation ?
if ( PendingLoad ( ) )
{
: : vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
if ( m_nPendingLoadFinished ! = 0 )
{ // clean up directly. Otherwise there may be a pending asynchronous call
// to OnOpenFinishedMainThread, which won't be executed before we leave
// this method. Sounds like a classic infinite loop.
Application : : RemoveUserEvent ( m_nPendingLoadFinished ) ;
LINK ( this , SbaXDataBrowserController , OnOpenFinishedMainThread ) . Call ( NULL ) ;
}
else
{ // set m_bClosingKillOpen to ensure that the our termination handler reacts according
// it's context
m_bClosingKillOpen = sal_True ;
// normally we would now just wait for termination of the load thread, but there is a small problem :
// In the current thread the global solar mutex is locked (that's for sure). If the loading of the
// form tries to acquire (blocking) the solar mutex, too, and we loop waiting for the other thread
// we have a classic deadlock. And bet your ass that ANYBODY in the foreign thread tries to lock
// the solar mutex. Almost all the UNO-capsules around normal C++ classes use the solar mutex for
2008-03-06 17:13:16 +00:00
// "thread safety" (which doesn't deserve that name anymore ;), e.g. the XNumberFormatter-implementation
2000-10-26 13:46:14 +00:00
// does.
// So we have to do a fake : we tell the loading thread that we aren't interested in the results anymore
// and the thread deletes itself (and the data source) as soon as it is done. As it holds the last
// references to the form (and thus, indirectly, to the grid) they will be cleared as soon as the thread dies.
// So all is fine. Except the small flaw that the form is still loading in the background while the
// window that should display it is already dead.
// If we could release the solar mutex in this thread and block it 'til the loader is finished we could
// solve it in a less dirty way, but uinfortunatelly we don't know how often this thread acquired the mutex.
// With high effort we could reach this with releasing the mutex until a third thread - which has to be
// created - can acquire it.Then we block, the third thread releases the mutex (and dies) and the loader
// thread would be able to finish. But that sounds difficult and fault-prone, so I think it's not worth it ...
( ( LoadFormThread * ) m_pLoadThread ) - > SetTerminationHdl ( Link ( ) ) ;
// and of course we tell the thread to stop ....
( ( LoadFormThread * ) m_pLoadThread ) - > StopIt ( ) ;
}
}
DBG_ASSERT ( m_nPendingLoadFinished = = 0 , " SbaXDataBrowserController::suspend : there shouldn't be a pending load ! " ) ;
m_aAsyncGetCellFocus . CancelCall ( ) ;
m_aAsyncInvalidateAll . CancelCall ( ) ;
2002-01-24 16:43:35 +00:00
sal_Bool bSuccess = SaveModified ( ) ;
return bSuccess ;
2000-10-26 13:46:14 +00:00
}
// -----------------------------------------------------------------------
2001-03-01 14:17:55 +00:00
void SbaXDataBrowserController : : disposing ( )
2000-10-26 13:46:14 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::disposing " ) ;
2001-05-16 13:27:19 +00:00
// and dispose the aggregate
if ( m_xFormControllerImpl . is ( ) )
{
Reference < XComponent > xAggComp ;
m_xFormControllerImpl - > queryAggregation ( : : getCppuType ( & xAggComp ) ) > > = xAggComp ;
if ( xAggComp . is ( ) )
xAggComp - > dispose ( ) ;
}
// the base class
2008-03-06 17:13:16 +00:00
SbaXDataBrowserController_Base : : OGenericUnoController : : disposing ( ) ;
2000-10-26 13:46:14 +00:00
if ( ! PendingLoad ( ) )
{
// don't do the removeXxxListener calls if there is a pending load, this may lead to a deadlock :
// as in this thread the SolarMutex is locked (that's for sure) and removeXxxListener locks
// the form's mutex. But in the loading thread both mutexes are acquired in reverse order.
// That's no problem that we don't remove ourself here, as the load thread is responsible for the form
// at the moment. So if the loading is finished, the form will be disposed (by the load thread), and
// we get the "disposing" event where we can do the removeXxxListener calls.
// The alternative for this handling would be that the form has two mutexes : one for handling it's
// listeners and properties and so on, on for it's pure cursor actions
// the data source
Reference < XPropertySet > xFormSet ( getRowSet ( ) , UNO_QUERY ) ;
if ( xFormSet . is ( ) )
{
2001-06-21 16:52:32 +00:00
xFormSet - > removePropertyChangeListener ( PROPERTY_ISNEW , static_cast < XPropertyChangeListener * > ( this ) ) ;
xFormSet - > removePropertyChangeListener ( PROPERTY_ISMODIFIED , static_cast < XPropertyChangeListener * > ( this ) ) ;
xFormSet - > removePropertyChangeListener ( PROPERTY_ROWCOUNT , static_cast < XPropertyChangeListener * > ( this ) ) ;
xFormSet - > removePropertyChangeListener ( PROPERTY_ACTIVECOMMAND , static_cast < XPropertyChangeListener * > ( this ) ) ;
xFormSet - > removePropertyChangeListener ( PROPERTY_ORDER , static_cast < XPropertyChangeListener * > ( this ) ) ;
xFormSet - > removePropertyChangeListener ( PROPERTY_FILTER , static_cast < XPropertyChangeListener * > ( this ) ) ;
2004-10-22 08:04:30 +00:00
xFormSet - > removePropertyChangeListener ( PROPERTY_HAVING_CLAUSE , static_cast < XPropertyChangeListener * > ( this ) ) ;
2001-06-21 16:52:32 +00:00
xFormSet - > removePropertyChangeListener ( PROPERTY_APPLYFILTER , static_cast < XPropertyChangeListener * > ( this ) ) ;
2000-10-26 13:46:14 +00:00
}
Reference < : : com : : sun : : star : : sdb : : XSQLErrorBroadcaster > xFormError ( getRowSet ( ) , UNO_QUERY ) ;
if ( xFormError . is ( ) )
xFormError - > removeSQLErrorListener ( ( : : com : : sun : : star : : sdb : : XSQLErrorListener * ) this ) ;
2001-08-27 05:57:24 +00:00
if ( m_xLoadable . is ( ) )
m_xLoadable - > removeLoadListener ( this ) ;
2000-10-26 13:46:14 +00:00
Reference < : : com : : sun : : star : : form : : XDatabaseParameterBroadcaster > xFormParameter ( getRowSet ( ) , UNO_QUERY ) ;
if ( xFormParameter . is ( ) )
xFormParameter - > removeParameterListener ( ( : : com : : sun : : star : : form : : XDatabaseParameterListener * ) this ) ;
}
removeModelListeners ( getControlModel ( ) ) ;
2006-08-15 09:49:12 +00:00
if ( getView ( ) & & m_pClipbordNotifier )
2002-05-23 11:25:52 +00:00
{
2004-08-02 14:31:55 +00:00
m_pClipbordNotifier - > ClearCallbackLink ( ) ;
2002-05-23 11:25:52 +00:00
m_pClipbordNotifier - > AddRemoveListener ( getView ( ) , sal_False ) ;
m_pClipbordNotifier - > release ( ) ;
m_pClipbordNotifier = NULL ;
}
2001-01-09 14:52:33 +00:00
if ( getBrowserView ( ) )
2000-10-26 13:46:14 +00:00
{
2001-01-09 14:52:33 +00:00
removeControlListeners ( getBrowserView ( ) - > getGridControl ( ) ) ;
2000-10-26 13:46:14 +00:00
// don't delete explicitly, this is done by the owner (and user) of this controller (me hopes ...)
2001-01-09 14:52:33 +00:00
m_pView = NULL ;
2000-10-26 13:46:14 +00:00
}
if ( m_aInvalidateClipboard . IsActive ( ) )
m_aInvalidateClipboard . Stop ( ) ;
// dispose the data source
// if there is a pending load we decided to give the responsibility for the data source to the open thread
// (see ::suspend)
if ( ! PendingLoad ( ) )
{
2001-01-11 08:17:43 +00:00
try
{
: : comphelper : : disposeComponent ( m_xRowSet ) ;
2001-08-27 05:57:24 +00:00
m_xRowSet = NULL ;
m_xColumnsSupplier = NULL ;
m_xLoadable = NULL ;
2001-01-11 08:17:43 +00:00
}
catch ( Exception & )
{
OSL_ENSURE ( 0 , " Exception thrown by dispose " ) ;
}
2000-10-26 13:46:14 +00:00
}
2004-08-02 14:31:55 +00:00
try
{
: : comphelper : : disposeComponent ( m_xParser ) ;
}
catch ( Exception & )
{
OSL_ENSURE ( 0 , " Exception thrown by dispose " ) ;
}
2000-10-26 13:46:14 +00:00
}
//------------------------------------------------------------------------------
void SbaXDataBrowserController : : frameAction ( const : : com : : sun : : star : : frame : : FrameActionEvent & aEvent ) throw ( RuntimeException )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::frameAction " ) ;
2008-12-01 12:31:27 +00:00
: : osl : : MutexGuard aGuard ( getMutex ( ) ) ;
2008-03-06 17:13:16 +00:00
SbaXDataBrowserController_Base : : frameAction ( aEvent ) ;
if ( aEvent . Source = = getFrame ( ) )
switch ( aEvent . Action )
2000-10-26 13:46:14 +00:00
{
2008-03-06 17:13:16 +00:00
case FrameAction_FRAME_ACTIVATED :
case FrameAction_FRAME_UI_ACTIVATED :
2000-10-26 13:46:14 +00:00
// ensure that the active cell (if any) has the focus
m_aAsyncGetCellFocus . Call ( ) ;
// start the clipboard timer
2001-01-09 14:52:33 +00:00
if ( getBrowserView ( ) & & getBrowserView ( ) - > getVclControl ( ) & & ! m_aInvalidateClipboard . IsActive ( ) )
2000-10-26 13:46:14 +00:00
{
m_aInvalidateClipboard . Start ( ) ;
2006-08-15 09:49:12 +00:00
OnInvalidateClipboard ( NULL ) ;
2000-10-26 13:46:14 +00:00
}
break ;
2008-03-06 17:13:16 +00:00
case FrameAction_FRAME_DEACTIVATING :
case FrameAction_FRAME_UI_DEACTIVATING :
2000-10-26 13:46:14 +00:00
// stop the clipboard invalidator
2001-01-09 14:52:33 +00:00
if ( getBrowserView ( ) & & getBrowserView ( ) - > getVclControl ( ) & & m_aInvalidateClipboard . IsActive ( ) )
2000-10-26 13:46:14 +00:00
{
m_aInvalidateClipboard . Stop ( ) ;
2006-08-15 09:49:12 +00:00
OnInvalidateClipboard ( NULL ) ;
2000-10-26 13:46:14 +00:00
}
// remove the "get cell focus"-event
m_aAsyncGetCellFocus . CancelCall ( ) ;
break ;
2006-06-20 01:55:50 +00:00
default :
break ;
2000-10-26 13:46:14 +00:00
}
}
//------------------------------------------------------------------------------
void SbaXDataBrowserController : : errorOccured ( const : : com : : sun : : star : : sdb : : SQLErrorEvent & aEvent ) throw ( RuntimeException )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::errorOccured " ) ;
2000-11-09 06:33:33 +00:00
SQLExceptionInfo aInfo ( aEvent . Reason ) ;
2004-06-01 09:11:12 +00:00
if ( aInfo . isValid ( ) )
2000-10-26 13:46:14 +00:00
{
: : vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
CWS-TOOLING: integrate CWS evoab2def
2009-05-28 16:00:19 +0200 fs r272412 : don't use createFalse - Evo 2.22 simply hangs when ask for all contacts without a first name. Instead, in the WHERE 0=1 case, simply create an empty result set
2009-05-22 14:25:51 +0200 fs r272193 : #i10000#
2009-05-22 14:25:37 +0200 fs r272192 : oops, ENABLE_EVOAB2 for some platforms only, not generically
2009-05-22 14:19:00 +0200 fs r272191 : #i10000#
2009-05-22 12:42:38 +0200 fs r272183 : when sorting, properly use a syslocale collator, instead of comparing the numerical values of the string's UTF-16 code points
2009-05-20 15:09:00 +0200 fs r272131 : clear/getWarnings: also allowed without cache
2009-05-20 14:11:19 +0200 fs r272128 : removed debug traces
2009-05-20 14:03:31 +0200 fs r272126 : #i55701# +STR_SORT_BY_COL_ONLY
2009-05-20 14:02:29 +0200 fs r272125 : implement sorting
2009-05-20 10:10:19 +0200 fs r272107 : #i10000#
2009-05-19 16:02:17 +0200 fs r272089 : #i10000#
2009-05-19 16:02:02 +0200 fs r272088 : #i55701# strings for new error condition DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 16:01:31 +0200 fs r272087 : #i55701# use DATA_CANNOT_SELECT_UNFILTERED as standardized error code
2009-05-19 15:59:59 +0200 fs r272086 : #i55701# +DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 15:46:12 +0200 fs r272084 : #i55701# recognize the DATA_CANNOT_SELECT_UNFILTERED error condition, and allow filtering in this case, even when the result set is empty
2009-05-19 09:06:50 +0200 fs r272059 : merging changes from CWS dba32b, to prevent future conflicts with upcoming local changes
2009-05-18 21:48:58 +0200 fs r272054 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:48:42 +0200 fs r272053 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:47:41 +0200 fs r272052 : +setExternalWarnings
2009-05-18 21:47:12 +0200 fs r272051 : #i55701# when re/loading the form, display any possible warnings
2009-05-18 21:43:26 +0200 fs r272050 : #i55701# implement XWarningsSupplier, exposing the warnings of our result set
2009-05-18 21:42:51 +0200 fs r272049 : #i55701# implement XWarningsSupplier, exposing the warnings of our aggregate RowSet
2009-05-18 17:53:59 +0200 fs r272041 : #i55701# moved the (I)WarningsContainer from dbaccess to connectivity, to be able to use it in the latter module, too
2009-05-18 17:24:10 +0200 fs r272040 : #i55701# properly enable the various Evolution types
2009-05-18 14:52:19 +0200 fs r272024 : #i55701# properly enable the Evolution types
2009-05-18 13:57:10 +0200 fs r272018 : fixed/extended whereAnalysis (column searching still not enabled, as neither LIKE nor = seem to work with my (somewhat older) Evolution version)
2009-05-18 13:56:08 +0200 fs r272017 : extended showParseTree
2009-05-18 13:55:25 +0200 fs r272016 : extended showParseTree
2009-05-18 11:40:16 +0200 fs r272008 : #i55701#
2009-05-18 11:39:02 +0200 fs r272006 : let the PreparedStatement return proper meta data, too
2009-05-18 10:05:37 +0200 fs r271999 : moved the XStatement interface to from OCommonStatement to OStatement - the former class is also the base for other classes which should not have this interface
2009-05-15 21:53:22 +0200 fs r271973 : collectColumnInformation: report invalid meta data as assertion
2009-05-15 21:51:40 +0200 fs r271972 : showParseTree should be const
2009-05-15 21:51:26 +0200 fs r271971 : showParseTree should be const
2009-05-15 21:51:03 +0200 fs r271970 : properly recognize the 'WHERE 0 = 1' clause, this way having proper statement meta data, this way saving much much calls from the DBA framework
2009-05-15 20:29:03 +0200 fs r271969 : cleaned up the mess with the statement classes
2009-05-15 15:51:11 +0200 fs r271944 : let the result set properly init its meta data
2009-05-15 15:29:54 +0200 fs r271939 : proper property implementations for the resultset class
2009-05-15 15:01:31 +0200 fs r271936 : proper property implementations for the statement class
2009-05-08 14:46:33 +0200 fs r271717 : component_foo must be PUBLIC
2009-05-06 09:20:05 +0200 fs r271565 : #i10000# (warnings on unxlngi6)
2009-05-06 09:01:30 +0200 fs r271564 : #i101493#
2009-05-05 23:08:12 +0200 fs r271560 : #i55701# merging the changes from the ancient (CVS-based) CWS evoab2default into this CWS here
2009-06-05 12:31:05 +00:00
showError ( aInfo ) ;
2000-10-26 13:46:14 +00:00
}
if ( m_nFormActionNestingLevel )
m_bErrorOccured = true ;
}
//------------------------------------------------------------------------------
sal_Bool SbaXDataBrowserController : : approveParameter ( const : : com : : sun : : star : : form : : DatabaseParameterEvent & aEvent ) throw ( RuntimeException )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::approveParameter " ) ;
2000-10-26 13:46:14 +00:00
if ( aEvent . Source ! = getRowSet ( ) )
{
// not my data source -> allow anything
DBG_ERROR ( " SbaXDataBrowserController::approveParameter : invalid event source ! " ) ;
return sal_True ;
}
Reference < : : com : : sun : : star : : container : : XIndexAccess > xParameters = aEvent . Parameters ;
2006-06-20 01:55:50 +00:00
: : vos : : OGuard aSolarGuard ( Application : : GetSolarMutex ( ) ) ;
2000-10-26 13:46:14 +00:00
// this may be executed in a non-main thread and we want to use vcl ...
Window * pParent = Application : : GetDefDialogParent ( ) ;
// don't use the content as parent if it isn't visible
// (and don't use NULL as parent : this may be displayed in the beamer and really shouldn't be task-local)
// 69297 - FS - 25.10.99
2001-01-09 14:52:33 +00:00
if ( getBrowserView ( ) & & getBrowserView ( ) - > IsVisible ( ) )
pParent = getBrowserView ( ) ;
2000-10-26 13:46:14 +00:00
2000-10-31 09:00:53 +00:00
// default handling: instantiate an interaction handler and let it handle the parameter request
try
2000-10-26 13:46:14 +00:00
{
2000-10-31 09:00:53 +00:00
// two continuations allowed: OK and Cancel
OParameterContinuation * pParamValues = new OParameterContinuation ;
OInteractionAbort * pAbort = new OInteractionAbort ;
// the request
ParametersRequest aRequest ;
aRequest . Parameters = xParameters ;
aRequest . Connection = getConnection ( Reference < XRowSet > ( aEvent . Source , UNO_QUERY ) ) ;
OInteractionRequest * pParamRequest = new OInteractionRequest ( makeAny ( aRequest ) ) ;
Reference < XInteractionRequest > xParamRequest ( pParamRequest ) ;
// some knittings
pParamRequest - > addContinuation ( pParamValues ) ;
pParamRequest - > addContinuation ( pAbort ) ;
// create the handler, let it handle the request
2001-06-21 16:52:32 +00:00
Reference < XInteractionHandler > xHandler ( getORB ( ) - > createInstance ( SERVICE_SDB_INTERACTION_HANDLER ) , UNO_QUERY ) ;
2000-10-31 09:00:53 +00:00
if ( xHandler . is ( ) )
xHandler - > handle ( xParamRequest ) ;
if ( ! pParamValues - > wasSelected ( ) )
{ // canceled
2002-01-29 11:23:58 +00:00
setLoadingCancelled ( ) ;
2000-10-31 09:00:53 +00:00
return sal_False ;
}
// transfer the values into the parameter supplier
Sequence < PropertyValue > aFinalValues = pParamValues - > getValues ( ) ;
if ( aFinalValues . getLength ( ) ! = aRequest . Parameters - > getCount ( ) )
{
DBG_ERROR ( " SbaXDataBrowserController::approveParameter: the InteractionHandler returned nonsense! " ) ;
2002-01-29 11:23:58 +00:00
setLoadingCancelled ( ) ;
2000-10-31 09:00:53 +00:00
return sal_False ;
}
const PropertyValue * pFinalValues = aFinalValues . getConstArray ( ) ;
for ( sal_Int32 i = 0 ; i < aFinalValues . getLength ( ) ; + + i , + + pFinalValues )
{
Reference < XPropertySet > xParam ;
: : cppu : : extractInterface ( xParam , aRequest . Parameters - > getByIndex ( i ) ) ;
DBG_ASSERT ( xParam . is ( ) , " SbaXDataBrowserController::approveParameter: one of the parameters is no property set! " ) ;
if ( xParam . is ( ) )
{
# ifdef DBG_UTIL
: : rtl : : OUString sName ;
xParam - > getPropertyValue ( PROPERTY_NAME ) > > = sName ;
DBG_ASSERT ( sName . equals ( pFinalValues - > Name ) , " SbaXDataBrowserController::approveParameter: suspicious value names! " ) ;
# endif
try { xParam - > setPropertyValue ( PROPERTY_VALUE , pFinalValues - > Value ) ; }
catch ( Exception & )
{
DBG_ERROR ( " SbaXDataBrowserController::approveParameter: setting one of the properties failed! " ) ;
}
}
}
}
2008-05-05 14:52:38 +00:00
catch ( const Exception & )
2000-10-31 09:00:53 +00:00
{
2008-05-05 14:52:38 +00:00
DBG_UNHANDLED_EXCEPTION ( ) ;
2000-10-26 13:46:14 +00:00
}
return sal_True ;
}
//------------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
sal_Bool SbaXDataBrowserController : : approveReset ( const : : com : : sun : : star : : lang : : EventObject & /*rEvent*/ ) throw ( RuntimeException )
2000-10-26 13:46:14 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::approveReset " ) ;
2000-10-26 13:46:14 +00:00
return sal_True ;
}
//------------------------------------------------------------------------------
void SbaXDataBrowserController : : resetted ( const : : com : : sun : : star : : lang : : EventObject & rEvent ) throw ( RuntimeException )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::resetted " ) ;
2000-10-26 13:46:14 +00:00
DBG_ASSERT ( rEvent . Source = = getControlModel ( ) , " SbaXDataBrowserController::resetted : where did this come from ? " ) ;
2006-06-20 01:55:50 +00:00
( void ) rEvent ;
2001-10-29 14:14:28 +00:00
setCurrentModified ( sal_False ) ;
2000-10-26 13:46:14 +00:00
}
//------------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
sal_Bool SbaXDataBrowserController : : confirmDelete ( const : : com : : sun : : star : : sdb : : RowChangeEvent & /*aEvent*/ ) throw ( RuntimeException )
2000-10-26 13:46:14 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::confirmDelete " ) ;
2001-01-09 14:52:33 +00:00
if ( QueryBox ( getBrowserView ( ) , ModuleRes ( QUERY_BRW_DELETE_ROWS ) ) . Execute ( ) ! = RET_YES )
2000-10-26 13:46:14 +00:00
return sal_False ;
return sal_True ;
}
//------------------------------------------------------------------------------
2002-01-24 16:43:35 +00:00
FeatureState SbaXDataBrowserController : : GetState ( sal_uInt16 nId ) const
2000-10-26 13:46:14 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::GetState " ) ;
2000-10-26 13:46:14 +00:00
FeatureState aReturn ;
// (disabled automatically)
try
{
// no chance without a view
2001-01-09 14:52:33 +00:00
if ( ! getBrowserView ( ) | | ! getBrowserView ( ) - > getVclControl ( ) )
2000-10-26 13:46:14 +00:00
return aReturn ;
2005-09-23 11:19:18 +00:00
switch ( nId )
{
case ID_BROWSER_REMOVEFILTER :
if ( ! m_xParser . is ( ) )
2009-04-23 10:42:05 +00:00
{
aReturn . bEnabled = false ;
return aReturn ;
}
2005-09-23 11:19:18 +00:00
// any filter or sort order set ?
aReturn . bEnabled = m_xParser - > getFilter ( ) . getLength ( ) | | m_xParser - > getHavingClause ( ) . getLength ( ) | | m_xParser - > getOrder ( ) . getLength ( ) ;
return aReturn ;
}
2000-10-26 13:46:14 +00:00
// no chance while loading the form
if ( PendingLoad ( ) )
return aReturn ;
2005-09-23 11:19:18 +00:00
// no chance without valid models
if ( isValid ( ) & & ! isValidCursor ( ) )
return aReturn ;
2000-10-26 13:46:14 +00:00
switch ( nId )
{
case ID_BROWSER_SEARCH :
{
Reference < XPropertySet > xFormSet ( getRowSet ( ) , UNO_QUERY ) ;
sal_Int32 nCount = : : comphelper : : getINT32 ( xFormSet - > getPropertyValue ( PROPERTY_ROWCOUNT ) ) ;
aReturn . bEnabled = nCount ! = 0 ;
}
break ;
2008-03-05 15:52:29 +00:00
case ID_BROWSER_INSERT_ROW :
{
// check if it is available
Reference < XPropertySet > xDataSourceSet ( getRowSet ( ) , UNO_QUERY ) ;
if ( ! xDataSourceSet . is ( ) )
break ; // no datasource -> no edit mode
sal_Int32 nDataSourcePrivileges = : : comphelper : : getINT32 ( xDataSourceSet - > getPropertyValue ( PROPERTY_PRIVILEGES ) ) ;
aReturn . bEnabled = ( ( nDataSourcePrivileges & : : com : : sun : : star : : sdbcx : : Privilege : : INSERT ) ! = 0 ) & & : : comphelper : : getBOOL ( xDataSourceSet - > getPropertyValue ( : : rtl : : OUString : : createFromAscii ( " AllowInserts " ) ) ) ;
}
break ;
case SID_FM_DELETEROWS :
{
Reference < XPropertySet > xFormSet ( getRowSet ( ) , UNO_QUERY ) ;
sal_Int32 nCount = : : comphelper : : getINT32 ( xFormSet - > getPropertyValue ( PROPERTY_ROWCOUNT ) ) ;
sal_Bool bNew = sal_False ;
xFormSet - > getPropertyValue ( PROPERTY_ISNEW ) > > = bNew ;
aReturn . bEnabled = nCount ! = 0 & & ! bNew ;
}
break ;
2000-10-26 13:46:14 +00:00
2002-09-11 09:00:31 +00:00
case ID_BROWSER_PASTE :
2000-10-26 13:46:14 +00:00
case ID_BROWSER_COPY :
case ID_BROWSER_CUT :
{
2001-06-29 07:45:10 +00:00
CellControllerRef xCurrentController = getBrowserView ( ) - > getVclControl ( ) - > Controller ( ) ;
if ( xCurrentController . Is ( ) & & xCurrentController - > ISA ( EditCellController ) )
2000-10-26 13:46:14 +00:00
{
Edit & rEdit = ( Edit & ) xCurrentController - > GetWindow ( ) ;
sal_Bool bHasLen = ( rEdit . GetSelection ( ) . Len ( ) ! = 0 ) ;
sal_Bool bIsReadOnly = rEdit . IsReadOnly ( ) ;
switch ( nId )
{
2008-03-06 17:13:16 +00:00
case ID_BROWSER_CUT : aReturn . bEnabled = m_aCurrentFrame . isActive ( ) & & bHasLen & & ! bIsReadOnly ; break ;
case SID_COPY : aReturn . bEnabled = m_aCurrentFrame . isActive ( ) & & bHasLen ; break ;
2001-07-26 06:11:02 +00:00
case ID_BROWSER_PASTE :
2008-03-06 17:13:16 +00:00
aReturn . bEnabled = m_aCurrentFrame . isActive ( ) & & ! bIsReadOnly ;
2002-05-22 13:03:34 +00:00
if ( aReturn . bEnabled )
2001-07-26 06:11:02 +00:00
{
2002-05-23 11:25:52 +00:00
aReturn . bEnabled = aReturn . bEnabled & & IsFormatSupported ( m_aSystemClipboard . GetDataFlavorExVector ( ) , FORMAT_STRING ) ;
2001-07-26 06:11:02 +00:00
}
2002-05-22 13:03:34 +00:00
break ;
2000-10-26 13:46:14 +00:00
}
}
}
break ;
case ID_BROWSER_SORTUP :
case ID_BROWSER_SORTDOWN :
case ID_BROWSER_AUTOFILTER :
{
// a native statement can't be filtered or sorted
2009-04-23 10:42:05 +00:00
const Reference < XPropertySet > xFormSet ( getRowSet ( ) , UNO_QUERY ) ;
if ( ! : : comphelper : : getBOOL ( xFormSet - > getPropertyValue ( PROPERTY_ESCAPE_PROCESSING ) ) )
2000-10-26 13:46:14 +00:00
break ;
Reference < XPropertySet > xCurrentField = getBoundField ( ) ;
if ( ! xCurrentField . is ( ) )
break ;
aReturn . bEnabled = : : comphelper : : getBOOL ( xCurrentField - > getPropertyValue ( PROPERTY_ISSEARCHABLE ) ) ;
2009-04-23 10:42:05 +00:00
const Reference < XRowSet > xRow = getRowSet ( ) ;
CWS-TOOLING: integrate CWS evoab2def
2009-05-28 16:00:19 +0200 fs r272412 : don't use createFalse - Evo 2.22 simply hangs when ask for all contacts without a first name. Instead, in the WHERE 0=1 case, simply create an empty result set
2009-05-22 14:25:51 +0200 fs r272193 : #i10000#
2009-05-22 14:25:37 +0200 fs r272192 : oops, ENABLE_EVOAB2 for some platforms only, not generically
2009-05-22 14:19:00 +0200 fs r272191 : #i10000#
2009-05-22 12:42:38 +0200 fs r272183 : when sorting, properly use a syslocale collator, instead of comparing the numerical values of the string's UTF-16 code points
2009-05-20 15:09:00 +0200 fs r272131 : clear/getWarnings: also allowed without cache
2009-05-20 14:11:19 +0200 fs r272128 : removed debug traces
2009-05-20 14:03:31 +0200 fs r272126 : #i55701# +STR_SORT_BY_COL_ONLY
2009-05-20 14:02:29 +0200 fs r272125 : implement sorting
2009-05-20 10:10:19 +0200 fs r272107 : #i10000#
2009-05-19 16:02:17 +0200 fs r272089 : #i10000#
2009-05-19 16:02:02 +0200 fs r272088 : #i55701# strings for new error condition DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 16:01:31 +0200 fs r272087 : #i55701# use DATA_CANNOT_SELECT_UNFILTERED as standardized error code
2009-05-19 15:59:59 +0200 fs r272086 : #i55701# +DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 15:46:12 +0200 fs r272084 : #i55701# recognize the DATA_CANNOT_SELECT_UNFILTERED error condition, and allow filtering in this case, even when the result set is empty
2009-05-19 09:06:50 +0200 fs r272059 : merging changes from CWS dba32b, to prevent future conflicts with upcoming local changes
2009-05-18 21:48:58 +0200 fs r272054 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:48:42 +0200 fs r272053 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:47:41 +0200 fs r272052 : +setExternalWarnings
2009-05-18 21:47:12 +0200 fs r272051 : #i55701# when re/loading the form, display any possible warnings
2009-05-18 21:43:26 +0200 fs r272050 : #i55701# implement XWarningsSupplier, exposing the warnings of our result set
2009-05-18 21:42:51 +0200 fs r272049 : #i55701# implement XWarningsSupplier, exposing the warnings of our aggregate RowSet
2009-05-18 17:53:59 +0200 fs r272041 : #i55701# moved the (I)WarningsContainer from dbaccess to connectivity, to be able to use it in the latter module, too
2009-05-18 17:24:10 +0200 fs r272040 : #i55701# properly enable the various Evolution types
2009-05-18 14:52:19 +0200 fs r272024 : #i55701# properly enable the Evolution types
2009-05-18 13:57:10 +0200 fs r272018 : fixed/extended whereAnalysis (column searching still not enabled, as neither LIKE nor = seem to work with my (somewhat older) Evolution version)
2009-05-18 13:56:08 +0200 fs r272017 : extended showParseTree
2009-05-18 13:55:25 +0200 fs r272016 : extended showParseTree
2009-05-18 11:40:16 +0200 fs r272008 : #i55701#
2009-05-18 11:39:02 +0200 fs r272006 : let the PreparedStatement return proper meta data, too
2009-05-18 10:05:37 +0200 fs r271999 : moved the XStatement interface to from OCommonStatement to OStatement - the former class is also the base for other classes which should not have this interface
2009-05-15 21:53:22 +0200 fs r271973 : collectColumnInformation: report invalid meta data as assertion
2009-05-15 21:51:40 +0200 fs r271972 : showParseTree should be const
2009-05-15 21:51:26 +0200 fs r271971 : showParseTree should be const
2009-05-15 21:51:03 +0200 fs r271970 : properly recognize the 'WHERE 0 = 1' clause, this way having proper statement meta data, this way saving much much calls from the DBA framework
2009-05-15 20:29:03 +0200 fs r271969 : cleaned up the mess with the statement classes
2009-05-15 15:51:11 +0200 fs r271944 : let the result set properly init its meta data
2009-05-15 15:29:54 +0200 fs r271939 : proper property implementations for the resultset class
2009-05-15 15:01:31 +0200 fs r271936 : proper property implementations for the statement class
2009-05-08 14:46:33 +0200 fs r271717 : component_foo must be PUBLIC
2009-05-06 09:20:05 +0200 fs r271565 : #i10000# (warnings on unxlngi6)
2009-05-06 09:01:30 +0200 fs r271564 : #i101493#
2009-05-05 23:08:12 +0200 fs r271560 : #i55701# merging the changes from the ancient (CVS-based) CWS evoab2default into this CWS here
2009-06-05 12:31:05 +00:00
aReturn . bEnabled = aReturn . bEnabled
& & xRow . is ( )
& & ! xRow - > isBeforeFirst ( )
& & ! xRow - > isAfterLast ( )
& & ! xRow - > rowDeleted ( )
& & ( : : comphelper : : getINT32 ( xFormSet - > getPropertyValue ( PROPERTY_ROWCOUNT ) ) ! = 0 ) ;
2000-10-26 13:46:14 +00:00
}
break ;
case ID_BROWSER_FILTERCRIT :
CWS-TOOLING: integrate CWS evoab2def
2009-05-28 16:00:19 +0200 fs r272412 : don't use createFalse - Evo 2.22 simply hangs when ask for all contacts without a first name. Instead, in the WHERE 0=1 case, simply create an empty result set
2009-05-22 14:25:51 +0200 fs r272193 : #i10000#
2009-05-22 14:25:37 +0200 fs r272192 : oops, ENABLE_EVOAB2 for some platforms only, not generically
2009-05-22 14:19:00 +0200 fs r272191 : #i10000#
2009-05-22 12:42:38 +0200 fs r272183 : when sorting, properly use a syslocale collator, instead of comparing the numerical values of the string's UTF-16 code points
2009-05-20 15:09:00 +0200 fs r272131 : clear/getWarnings: also allowed without cache
2009-05-20 14:11:19 +0200 fs r272128 : removed debug traces
2009-05-20 14:03:31 +0200 fs r272126 : #i55701# +STR_SORT_BY_COL_ONLY
2009-05-20 14:02:29 +0200 fs r272125 : implement sorting
2009-05-20 10:10:19 +0200 fs r272107 : #i10000#
2009-05-19 16:02:17 +0200 fs r272089 : #i10000#
2009-05-19 16:02:02 +0200 fs r272088 : #i55701# strings for new error condition DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 16:01:31 +0200 fs r272087 : #i55701# use DATA_CANNOT_SELECT_UNFILTERED as standardized error code
2009-05-19 15:59:59 +0200 fs r272086 : #i55701# +DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 15:46:12 +0200 fs r272084 : #i55701# recognize the DATA_CANNOT_SELECT_UNFILTERED error condition, and allow filtering in this case, even when the result set is empty
2009-05-19 09:06:50 +0200 fs r272059 : merging changes from CWS dba32b, to prevent future conflicts with upcoming local changes
2009-05-18 21:48:58 +0200 fs r272054 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:48:42 +0200 fs r272053 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:47:41 +0200 fs r272052 : +setExternalWarnings
2009-05-18 21:47:12 +0200 fs r272051 : #i55701# when re/loading the form, display any possible warnings
2009-05-18 21:43:26 +0200 fs r272050 : #i55701# implement XWarningsSupplier, exposing the warnings of our result set
2009-05-18 21:42:51 +0200 fs r272049 : #i55701# implement XWarningsSupplier, exposing the warnings of our aggregate RowSet
2009-05-18 17:53:59 +0200 fs r272041 : #i55701# moved the (I)WarningsContainer from dbaccess to connectivity, to be able to use it in the latter module, too
2009-05-18 17:24:10 +0200 fs r272040 : #i55701# properly enable the various Evolution types
2009-05-18 14:52:19 +0200 fs r272024 : #i55701# properly enable the Evolution types
2009-05-18 13:57:10 +0200 fs r272018 : fixed/extended whereAnalysis (column searching still not enabled, as neither LIKE nor = seem to work with my (somewhat older) Evolution version)
2009-05-18 13:56:08 +0200 fs r272017 : extended showParseTree
2009-05-18 13:55:25 +0200 fs r272016 : extended showParseTree
2009-05-18 11:40:16 +0200 fs r272008 : #i55701#
2009-05-18 11:39:02 +0200 fs r272006 : let the PreparedStatement return proper meta data, too
2009-05-18 10:05:37 +0200 fs r271999 : moved the XStatement interface to from OCommonStatement to OStatement - the former class is also the base for other classes which should not have this interface
2009-05-15 21:53:22 +0200 fs r271973 : collectColumnInformation: report invalid meta data as assertion
2009-05-15 21:51:40 +0200 fs r271972 : showParseTree should be const
2009-05-15 21:51:26 +0200 fs r271971 : showParseTree should be const
2009-05-15 21:51:03 +0200 fs r271970 : properly recognize the 'WHERE 0 = 1' clause, this way having proper statement meta data, this way saving much much calls from the DBA framework
2009-05-15 20:29:03 +0200 fs r271969 : cleaned up the mess with the statement classes
2009-05-15 15:51:11 +0200 fs r271944 : let the result set properly init its meta data
2009-05-15 15:29:54 +0200 fs r271939 : proper property implementations for the resultset class
2009-05-15 15:01:31 +0200 fs r271936 : proper property implementations for the statement class
2009-05-08 14:46:33 +0200 fs r271717 : component_foo must be PUBLIC
2009-05-06 09:20:05 +0200 fs r271565 : #i10000# (warnings on unxlngi6)
2009-05-06 09:01:30 +0200 fs r271564 : #i101493#
2009-05-05 23:08:12 +0200 fs r271560 : #i55701# merging the changes from the ancient (CVS-based) CWS evoab2default into this CWS here
2009-06-05 12:31:05 +00:00
if ( m_bCannotSelectUnfiltered )
{
aReturn . bEnabled = sal_True ;
break ;
}
// no break
case ID_BROWSER_ORDERCRIT :
2001-07-16 06:42:07 +00:00
{
2009-04-23 10:42:05 +00:00
const Reference < XPropertySet > xFormSet ( getRowSet ( ) , UNO_QUERY ) ;
if ( ! : : comphelper : : getBOOL ( xFormSet - > getPropertyValue ( PROPERTY_ESCAPE_PROCESSING ) ) )
break ;
CWS-TOOLING: integrate CWS evoab2def
2009-05-28 16:00:19 +0200 fs r272412 : don't use createFalse - Evo 2.22 simply hangs when ask for all contacts without a first name. Instead, in the WHERE 0=1 case, simply create an empty result set
2009-05-22 14:25:51 +0200 fs r272193 : #i10000#
2009-05-22 14:25:37 +0200 fs r272192 : oops, ENABLE_EVOAB2 for some platforms only, not generically
2009-05-22 14:19:00 +0200 fs r272191 : #i10000#
2009-05-22 12:42:38 +0200 fs r272183 : when sorting, properly use a syslocale collator, instead of comparing the numerical values of the string's UTF-16 code points
2009-05-20 15:09:00 +0200 fs r272131 : clear/getWarnings: also allowed without cache
2009-05-20 14:11:19 +0200 fs r272128 : removed debug traces
2009-05-20 14:03:31 +0200 fs r272126 : #i55701# +STR_SORT_BY_COL_ONLY
2009-05-20 14:02:29 +0200 fs r272125 : implement sorting
2009-05-20 10:10:19 +0200 fs r272107 : #i10000#
2009-05-19 16:02:17 +0200 fs r272089 : #i10000#
2009-05-19 16:02:02 +0200 fs r272088 : #i55701# strings for new error condition DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 16:01:31 +0200 fs r272087 : #i55701# use DATA_CANNOT_SELECT_UNFILTERED as standardized error code
2009-05-19 15:59:59 +0200 fs r272086 : #i55701# +DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 15:46:12 +0200 fs r272084 : #i55701# recognize the DATA_CANNOT_SELECT_UNFILTERED error condition, and allow filtering in this case, even when the result set is empty
2009-05-19 09:06:50 +0200 fs r272059 : merging changes from CWS dba32b, to prevent future conflicts with upcoming local changes
2009-05-18 21:48:58 +0200 fs r272054 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:48:42 +0200 fs r272053 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:47:41 +0200 fs r272052 : +setExternalWarnings
2009-05-18 21:47:12 +0200 fs r272051 : #i55701# when re/loading the form, display any possible warnings
2009-05-18 21:43:26 +0200 fs r272050 : #i55701# implement XWarningsSupplier, exposing the warnings of our result set
2009-05-18 21:42:51 +0200 fs r272049 : #i55701# implement XWarningsSupplier, exposing the warnings of our aggregate RowSet
2009-05-18 17:53:59 +0200 fs r272041 : #i55701# moved the (I)WarningsContainer from dbaccess to connectivity, to be able to use it in the latter module, too
2009-05-18 17:24:10 +0200 fs r272040 : #i55701# properly enable the various Evolution types
2009-05-18 14:52:19 +0200 fs r272024 : #i55701# properly enable the Evolution types
2009-05-18 13:57:10 +0200 fs r272018 : fixed/extended whereAnalysis (column searching still not enabled, as neither LIKE nor = seem to work with my (somewhat older) Evolution version)
2009-05-18 13:56:08 +0200 fs r272017 : extended showParseTree
2009-05-18 13:55:25 +0200 fs r272016 : extended showParseTree
2009-05-18 11:40:16 +0200 fs r272008 : #i55701#
2009-05-18 11:39:02 +0200 fs r272006 : let the PreparedStatement return proper meta data, too
2009-05-18 10:05:37 +0200 fs r271999 : moved the XStatement interface to from OCommonStatement to OStatement - the former class is also the base for other classes which should not have this interface
2009-05-15 21:53:22 +0200 fs r271973 : collectColumnInformation: report invalid meta data as assertion
2009-05-15 21:51:40 +0200 fs r271972 : showParseTree should be const
2009-05-15 21:51:26 +0200 fs r271971 : showParseTree should be const
2009-05-15 21:51:03 +0200 fs r271970 : properly recognize the 'WHERE 0 = 1' clause, this way having proper statement meta data, this way saving much much calls from the DBA framework
2009-05-15 20:29:03 +0200 fs r271969 : cleaned up the mess with the statement classes
2009-05-15 15:51:11 +0200 fs r271944 : let the result set properly init its meta data
2009-05-15 15:29:54 +0200 fs r271939 : proper property implementations for the resultset class
2009-05-15 15:01:31 +0200 fs r271936 : proper property implementations for the statement class
2009-05-08 14:46:33 +0200 fs r271717 : component_foo must be PUBLIC
2009-05-06 09:20:05 +0200 fs r271565 : #i10000# (warnings on unxlngi6)
2009-05-06 09:01:30 +0200 fs r271564 : #i101493#
2009-05-05 23:08:12 +0200 fs r271560 : #i55701# merging the changes from the ancient (CVS-based) CWS evoab2default into this CWS here
2009-06-05 12:31:05 +00:00
aReturn . bEnabled = getRowSet ( ) . is ( )
& & ( : : comphelper : : getINT32 ( xFormSet - > getPropertyValue ( PROPERTY_ROWCOUNT ) ) ! = 0 ) ;
2001-07-16 06:42:07 +00:00
}
2000-10-26 13:46:14 +00:00
break ;
case ID_BROWSER_REFRESH :
2004-10-22 08:04:30 +00:00
aReturn . bEnabled = sal_True ;
2000-10-26 13:46:14 +00:00
break ;
case ID_BROWSER_REDO :
aReturn . bEnabled = sal_False ; // simply forget it ;). no redo possible.
break ;
2002-05-22 13:03:34 +00:00
case ID_BROWSER_UNDORECORD :
case ID_BROWSER_SAVERECORD :
2000-10-26 13:46:14 +00:00
{
if ( ! m_bCurrentlyModified )
{
Reference < XPropertySet > xFormSet ( getRowSet ( ) , UNO_QUERY ) ;
if ( xFormSet . is ( ) )
aReturn . bEnabled = : : comphelper : : getBOOL ( xFormSet - > getPropertyValue ( PROPERTY_ISMODIFIED ) ) ;
}
else
aReturn . bEnabled = sal_True ;
2006-07-10 14:23:44 +00:00
aReturn . sTitle = ( ID_BROWSER_UNDORECORD = = nId ) ? m_sStateUndoRecord : m_sStateSaveRecord ;
2000-10-26 13:46:14 +00:00
}
break ;
case ID_BROWSER_EDITDOC :
{
// check if it is available
Reference < XPropertySet > xDataSourceSet ( getRowSet ( ) , UNO_QUERY ) ;
if ( ! xDataSourceSet . is ( ) )
break ; // no datasource -> no edit mode
sal_Int32 nDataSourcePrivileges = : : comphelper : : getINT32 ( xDataSourceSet - > getPropertyValue ( PROPERTY_PRIVILEGES ) ) ;
sal_Bool bInsertAllowedAndPossible = ( ( nDataSourcePrivileges & : : com : : sun : : star : : sdbcx : : Privilege : : INSERT ) ! = 0 ) & & : : comphelper : : getBOOL ( xDataSourceSet - > getPropertyValue ( : : rtl : : OUString : : createFromAscii ( " AllowInserts " ) ) ) ;
sal_Bool bUpdateAllowedAndPossible = ( ( nDataSourcePrivileges & : : com : : sun : : star : : sdbcx : : Privilege : : UPDATE ) ! = 0 ) & & : : comphelper : : getBOOL ( xDataSourceSet - > getPropertyValue ( : : rtl : : OUString : : createFromAscii ( " AllowUpdates " ) ) ) ;
sal_Bool bDeleteAllowedAndPossible = ( ( nDataSourcePrivileges & : : com : : sun : : star : : sdbcx : : Privilege : : DELETE ) ! = 0 ) & & : : comphelper : : getBOOL ( xDataSourceSet - > getPropertyValue ( : : rtl : : OUString : : createFromAscii ( " AllowDeletes " ) ) ) ;
if ( ! bInsertAllowedAndPossible & & ! bUpdateAllowedAndPossible & & ! bDeleteAllowedAndPossible )
break ; // no insert/update/delete -> no edit mode
2001-07-17 12:07:48 +00:00
if ( ! isValidCursor ( ) | | ! isLoaded ( ) )
2000-10-26 13:46:14 +00:00
break ; // no cursor -> no edit mode
aReturn . bEnabled = sal_True ;
2001-01-09 14:52:33 +00:00
sal_Int16 nGridMode = getBrowserView ( ) - > getVclControl ( ) - > GetOptions ( ) ;
2006-07-10 14:23:44 +00:00
aReturn . bChecked = nGridMode > DbGridControl : : OPT_READONLY ;
2000-10-26 13:46:14 +00:00
}
break ;
case ID_BROWSER_FILTERED :
{
aReturn . bEnabled = sal_False ;
Reference < XPropertySet > xActiveSet ( getRowSet ( ) , UNO_QUERY ) ;
: : rtl : : OUString aFilter = : : comphelper : : getString ( xActiveSet - > getPropertyValue ( PROPERTY_FILTER ) ) ;
2004-10-22 08:04:30 +00:00
: : rtl : : OUString aHaving = : : comphelper : : getString ( xActiveSet - > getPropertyValue ( PROPERTY_HAVING_CLAUSE ) ) ;
if ( aFilter . getLength ( ) | | aHaving . getLength ( ) )
2000-10-26 13:46:14 +00:00
{
2006-07-10 14:23:44 +00:00
xActiveSet - > getPropertyValue ( PROPERTY_APPLYFILTER ) > > = aReturn . bChecked ;
2000-10-26 13:46:14 +00:00
aReturn . bEnabled = sal_True ;
}
else
{
2006-07-10 14:23:44 +00:00
aReturn . bChecked = sal_False ;
2000-10-26 13:46:14 +00:00
aReturn . bEnabled = sal_False ;
}
}
break ;
2004-09-09 08:41:14 +00:00
default :
2008-03-06 17:13:16 +00:00
return SbaXDataBrowserController_Base : : GetState ( nId ) ;
2000-10-26 13:46:14 +00:00
}
}
2006-06-20 01:55:50 +00:00
catch ( const Exception & )
2000-10-26 13:46:14 +00:00
{
2006-06-20 01:55:50 +00:00
DBG_UNHANDLED_EXCEPTION ( ) ;
2000-10-26 13:46:14 +00:00
}
return aReturn ;
}
2001-07-17 12:07:48 +00:00
//------------------------------------------------------------------------------
void SbaXDataBrowserController : : applyParserOrder ( const : : rtl : : OUString & _rOldOrder )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::applyParserOrder " ) ;
2001-07-17 12:07:48 +00:00
Reference < XPropertySet > xFormSet ( getRowSet ( ) , UNO_QUERY ) ;
2001-08-27 05:57:24 +00:00
if ( ! m_xLoadable . is ( ) )
2001-07-17 12:07:48 +00:00
{
OSL_ENSURE ( sal_False , " SbaXDataBrowserController::applyParserOrder: invalid row set! " ) ;
return ;
}
2003-04-01 13:01:01 +00:00
sal_uInt16 nPos = getCurrentColumnPosition ( ) ;
2001-07-17 12:07:48 +00:00
sal_Bool bSuccess = sal_False ;
try
{
xFormSet - > setPropertyValue ( PROPERTY_ORDER , makeAny ( m_xParser - > getOrder ( ) ) ) ;
2001-08-27 05:57:24 +00:00
bSuccess = reloadForm ( m_xLoadable ) ;
2001-07-17 12:07:48 +00:00
}
catch ( Exception & )
{
}
if ( ! bSuccess )
{
xFormSet - > setPropertyValue ( PROPERTY_ORDER , makeAny ( _rOldOrder ) ) ;
2005-01-05 11:33:18 +00:00
DO_SAFE ( m_xParser - > setOrder ( _rOldOrder ) , " SbaXDataBrowserController::applyParserOrder: could not restore the old order of my parser ! " ) ;
2001-07-17 12:07:48 +00:00
try
{
2002-01-29 11:23:58 +00:00
if ( loadingCancelled ( ) | | ! reloadForm ( m_xLoadable ) )
2001-07-17 12:07:48 +00:00
criticalFail ( ) ;
}
catch ( Exception & )
{
criticalFail ( ) ;
}
InvalidateAll ( ) ;
}
InvalidateFeature ( ID_BROWSER_REMOVEFILTER ) ;
2003-04-01 13:01:01 +00:00
setCurrentColumnPosition ( nPos ) ;
2001-07-17 12:07:48 +00:00
}
//------------------------------------------------------------------------------
2004-10-22 08:04:30 +00:00
void SbaXDataBrowserController : : applyParserFilter ( const : : rtl : : OUString & _rOldFilter , sal_Bool _bOldFilterApplied , const : : rtl : : OUString & _sOldHaving )
2001-07-17 12:07:48 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::applyParserFilter " ) ;
2001-07-17 12:07:48 +00:00
Reference < XPropertySet > xFormSet ( getRowSet ( ) , UNO_QUERY ) ;
2001-08-27 05:57:24 +00:00
if ( ! m_xLoadable . is ( ) )
2001-07-17 12:07:48 +00:00
{
OSL_ENSURE ( sal_False , " SbaXDataBrowserController::applyParserFilter: invalid row set! " ) ;
return ;
}
2003-04-01 13:01:01 +00:00
sal_uInt16 nPos = getCurrentColumnPosition ( ) ;
2001-07-17 12:07:48 +00:00
sal_Bool bSuccess = sal_False ;
try
{
FormErrorHelper aError ( this ) ;
xFormSet - > setPropertyValue ( PROPERTY_FILTER , makeAny ( m_xParser - > getFilter ( ) ) ) ;
2004-10-22 08:04:30 +00:00
xFormSet - > setPropertyValue ( PROPERTY_HAVING_CLAUSE , makeAny ( m_xParser - > getHavingClause ( ) ) ) ;
2001-07-17 12:07:48 +00:00
xFormSet - > setPropertyValue ( PROPERTY_APPLYFILTER , : : comphelper : : makeBoolAny ( sal_Bool ( sal_True ) ) ) ;
2001-08-27 05:57:24 +00:00
bSuccess = reloadForm ( m_xLoadable ) ;
2001-07-17 12:07:48 +00:00
}
catch ( Exception & )
{
}
if ( ! bSuccess )
{
xFormSet - > setPropertyValue ( PROPERTY_FILTER , makeAny ( _rOldFilter ) ) ;
2004-10-22 08:04:30 +00:00
xFormSet - > setPropertyValue ( PROPERTY_HAVING_CLAUSE , makeAny ( _sOldHaving ) ) ;
2001-07-17 12:07:48 +00:00
xFormSet - > setPropertyValue ( PROPERTY_APPLYFILTER , : : comphelper : : makeBoolAny ( _bOldFilterApplied ) ) ;
try
{
2002-01-29 11:23:58 +00:00
if ( loadingCancelled ( ) | | ! reloadForm ( m_xLoadable ) )
2001-07-17 12:07:48 +00:00
criticalFail ( ) ;
}
catch ( Exception & )
{
criticalFail ( ) ;
}
InvalidateAll ( ) ;
}
InvalidateFeature ( ID_BROWSER_REMOVEFILTER ) ;
2003-04-01 13:01:01 +00:00
setCurrentColumnPosition ( nPos ) ;
2001-07-17 12:07:48 +00:00
}
2000-10-26 13:46:14 +00:00
//------------------------------------------------------------------------------
void SbaXDataBrowserController : : ExecuteFilterSortCrit ( sal_Bool bFilter )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::ExecuteFilterSortCrit " ) ;
2000-10-26 13:46:14 +00:00
if ( ! SaveModified ( ) )
return ;
Reference < XPropertySet > xFormSet ( getRowSet ( ) , UNO_QUERY ) ;
2009-04-23 10:42:05 +00:00
initializeParser ( ) ;
const : : rtl : : OUString sOldVal = bFilter ? m_xParser - > getFilter ( ) : m_xParser - > getOrder ( ) ;
const : : rtl : : OUString sOldHaving = m_xParser - > getHavingClause ( ) ;
2000-10-26 13:46:14 +00:00
try
{
2001-08-27 05:57:24 +00:00
Reference < : : com : : sun : : star : : sdbcx : : XColumnsSupplier > xSup = getColumnsSupplier ( ) ;
2008-01-30 07:42:45 +00:00
Reference < XConnection > xCon ( xFormSet - > getPropertyValue ( PROPERTY_ACTIVE_CONNECTION ) , UNO_QUERY ) ;
2000-11-10 15:14:45 +00:00
if ( bFilter )
{
2007-07-06 07:02:38 +00:00
DlgFilterCrit aDlg ( getBrowserView ( ) , getORB ( ) , xCon , m_xParser , xSup - > getColumns ( ) ) ;
2000-11-10 15:14:45 +00:00
String aFilter ;
if ( ! aDlg . Execute ( ) )
{
2005-01-05 11:33:18 +00:00
m_xParser - > setFilter ( sOldVal ) ;
m_xParser - > setHavingClause ( sOldHaving ) ;
2000-11-10 15:14:45 +00:00
return ; // if so we don't need to actualize the grid
}
2005-01-05 11:33:18 +00:00
aDlg . BuildWherePart ( ) ;
2000-11-10 15:14:45 +00:00
}
2000-10-26 13:46:14 +00:00
else
2000-11-10 15:14:45 +00:00
{
2004-05-10 12:04:40 +00:00
DlgOrderCrit aDlg ( getBrowserView ( ) , xCon , m_xParser , xSup - > getColumns ( ) ) ;
2000-11-10 15:14:45 +00:00
String aOrder ;
if ( ! aDlg . Execute ( ) )
{
2005-01-05 11:33:18 +00:00
m_xParser - > setOrder ( sOldVal ) ;
2000-11-10 15:14:45 +00:00
return ; // if so we don't need to actualize the grid
}
aDlg . BuildOrderPart ( ) ;
}
2000-10-26 13:46:14 +00:00
}
CWS-TOOLING: integrate CWS evoab2def
2009-05-28 16:00:19 +0200 fs r272412 : don't use createFalse - Evo 2.22 simply hangs when ask for all contacts without a first name. Instead, in the WHERE 0=1 case, simply create an empty result set
2009-05-22 14:25:51 +0200 fs r272193 : #i10000#
2009-05-22 14:25:37 +0200 fs r272192 : oops, ENABLE_EVOAB2 for some platforms only, not generically
2009-05-22 14:19:00 +0200 fs r272191 : #i10000#
2009-05-22 12:42:38 +0200 fs r272183 : when sorting, properly use a syslocale collator, instead of comparing the numerical values of the string's UTF-16 code points
2009-05-20 15:09:00 +0200 fs r272131 : clear/getWarnings: also allowed without cache
2009-05-20 14:11:19 +0200 fs r272128 : removed debug traces
2009-05-20 14:03:31 +0200 fs r272126 : #i55701# +STR_SORT_BY_COL_ONLY
2009-05-20 14:02:29 +0200 fs r272125 : implement sorting
2009-05-20 10:10:19 +0200 fs r272107 : #i10000#
2009-05-19 16:02:17 +0200 fs r272089 : #i10000#
2009-05-19 16:02:02 +0200 fs r272088 : #i55701# strings for new error condition DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 16:01:31 +0200 fs r272087 : #i55701# use DATA_CANNOT_SELECT_UNFILTERED as standardized error code
2009-05-19 15:59:59 +0200 fs r272086 : #i55701# +DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 15:46:12 +0200 fs r272084 : #i55701# recognize the DATA_CANNOT_SELECT_UNFILTERED error condition, and allow filtering in this case, even when the result set is empty
2009-05-19 09:06:50 +0200 fs r272059 : merging changes from CWS dba32b, to prevent future conflicts with upcoming local changes
2009-05-18 21:48:58 +0200 fs r272054 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:48:42 +0200 fs r272053 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:47:41 +0200 fs r272052 : +setExternalWarnings
2009-05-18 21:47:12 +0200 fs r272051 : #i55701# when re/loading the form, display any possible warnings
2009-05-18 21:43:26 +0200 fs r272050 : #i55701# implement XWarningsSupplier, exposing the warnings of our result set
2009-05-18 21:42:51 +0200 fs r272049 : #i55701# implement XWarningsSupplier, exposing the warnings of our aggregate RowSet
2009-05-18 17:53:59 +0200 fs r272041 : #i55701# moved the (I)WarningsContainer from dbaccess to connectivity, to be able to use it in the latter module, too
2009-05-18 17:24:10 +0200 fs r272040 : #i55701# properly enable the various Evolution types
2009-05-18 14:52:19 +0200 fs r272024 : #i55701# properly enable the Evolution types
2009-05-18 13:57:10 +0200 fs r272018 : fixed/extended whereAnalysis (column searching still not enabled, as neither LIKE nor = seem to work with my (somewhat older) Evolution version)
2009-05-18 13:56:08 +0200 fs r272017 : extended showParseTree
2009-05-18 13:55:25 +0200 fs r272016 : extended showParseTree
2009-05-18 11:40:16 +0200 fs r272008 : #i55701#
2009-05-18 11:39:02 +0200 fs r272006 : let the PreparedStatement return proper meta data, too
2009-05-18 10:05:37 +0200 fs r271999 : moved the XStatement interface to from OCommonStatement to OStatement - the former class is also the base for other classes which should not have this interface
2009-05-15 21:53:22 +0200 fs r271973 : collectColumnInformation: report invalid meta data as assertion
2009-05-15 21:51:40 +0200 fs r271972 : showParseTree should be const
2009-05-15 21:51:26 +0200 fs r271971 : showParseTree should be const
2009-05-15 21:51:03 +0200 fs r271970 : properly recognize the 'WHERE 0 = 1' clause, this way having proper statement meta data, this way saving much much calls from the DBA framework
2009-05-15 20:29:03 +0200 fs r271969 : cleaned up the mess with the statement classes
2009-05-15 15:51:11 +0200 fs r271944 : let the result set properly init its meta data
2009-05-15 15:29:54 +0200 fs r271939 : proper property implementations for the resultset class
2009-05-15 15:01:31 +0200 fs r271936 : proper property implementations for the statement class
2009-05-08 14:46:33 +0200 fs r271717 : component_foo must be PUBLIC
2009-05-06 09:20:05 +0200 fs r271565 : #i10000# (warnings on unxlngi6)
2009-05-06 09:01:30 +0200 fs r271564 : #i101493#
2009-05-05 23:08:12 +0200 fs r271560 : #i55701# merging the changes from the ancient (CVS-based) CWS evoab2default into this CWS here
2009-06-05 12:31:05 +00:00
catch ( const SQLException & )
{
SQLExceptionInfo aError ( : : cppu : : getCaughtException ( ) ) ;
showError ( aError ) ;
return ;
}
2001-01-09 14:52:33 +00:00
catch ( Exception & )
2000-10-26 13:46:14 +00:00
{
return ;
}
: : rtl : : OUString sNewVal = bFilter ? m_xParser - > getFilter ( ) : m_xParser - > getOrder ( ) ;
sal_Bool bOldFilterApplied ( sal_False ) ;
if ( bFilter )
{
2001-01-09 14:52:33 +00:00
try { bOldFilterApplied = : : comphelper : : getBOOL ( xFormSet - > getPropertyValue ( PROPERTY_APPLYFILTER ) ) ; } catch ( Exception & ) { } ;
2000-10-26 13:46:14 +00:00
}
2004-10-22 08:04:30 +00:00
: : rtl : : OUString sNewHaving = m_xParser - > getHavingClause ( ) ;
if ( sOldVal . equals ( sNewVal ) & & ( ! bFilter | | sOldHaving . equals ( sNewHaving ) ) )
2000-10-26 13:46:14 +00:00
// nothing to be done
return ;
2001-07-17 12:07:48 +00:00
if ( bFilter )
2004-10-22 08:04:30 +00:00
applyParserFilter ( sOldVal , bOldFilterApplied , sOldHaving ) ;
2001-07-17 12:07:48 +00:00
else
applyParserOrder ( sOldVal ) ;
2003-04-01 13:01:01 +00:00
2000-10-26 13:46:14 +00:00
}
//------------------------------------------------------------------------------
void SbaXDataBrowserController : : ExecuteSearch ( )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::ExecuteSearch " ) ;
2000-10-26 13:46:14 +00:00
// calculate the control source of the active field
2001-01-09 14:52:33 +00:00
Reference < : : com : : sun : : star : : form : : XGrid > xGrid ( getBrowserView ( ) - > getGridControl ( ) , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
DBG_ASSERT ( xGrid . is ( ) , " SbaXDataBrowserController::ExecuteSearch : the control should have an ::com::sun::star::form::XGrid interface ! " ) ;
2001-01-09 14:52:33 +00:00
Reference < : : com : : sun : : star : : form : : XGridPeer > xGridPeer ( getBrowserView ( ) - > getGridControl ( ) - > getPeer ( ) , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
Reference < : : com : : sun : : star : : container : : XIndexContainer > xColumns = xGridPeer - > getColumns ( ) ;
DBG_ASSERT ( xGridPeer . is ( ) & & xColumns . is ( ) , " SbaXDataBrowserController::ExecuteSearch : invalid peer ! " ) ;
sal_Int16 nViewCol = xGrid - > getCurrentColumnPosition ( ) ;
2001-01-09 14:52:33 +00:00
sal_Int16 nModelCol = getBrowserView ( ) - > View2ModelPos ( nViewCol ) ;
2000-10-26 13:46:14 +00:00
2004-08-02 14:31:55 +00:00
Reference < XPropertySet > xCurrentCol ( xColumns - > getByIndex ( nModelCol ) , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
String sActiveField = : : comphelper : : getString ( xCurrentCol - > getPropertyValue ( PROPERTY_CONTROLSOURCE ) ) ;
// the text within the current cell
String sInitialText ;
Reference < : : com : : sun : : star : : container : : XIndexAccess > xColControls ( xGridPeer , UNO_QUERY ) ;
2004-08-02 14:31:55 +00:00
Reference < XInterface > xCurControl ( xColControls - > getByIndex ( nViewCol ) , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
: : rtl : : OUString aInitialText ;
if ( IsSearchableControl ( xCurControl , & aInitialText ) )
sInitialText = ( const sal_Unicode * ) aInitialText ;
// prohibit the synchronization of the grid's display with the cursor's position
Reference < XPropertySet > xModelSet ( getControlModel ( ) , UNO_QUERY ) ;
DBG_ASSERT ( xModelSet . is ( ) , " SbaXDataBrowserController::ExecuteSearch : no model set ?! " ) ;
xModelSet - > setPropertyValue ( : : rtl : : OUString : : createFromAscii ( " DisplayIsSynchron " ) , : : comphelper : : makeBoolAny ( sal_Bool ( sal_False ) ) ) ;
xModelSet - > setPropertyValue ( : : rtl : : OUString : : createFromAscii ( " AlwaysShowCursor " ) , : : comphelper : : makeBoolAny ( sal_Bool ( sal_True ) ) ) ;
xModelSet - > setPropertyValue ( : : rtl : : OUString : : createFromAscii ( " CursorColor " ) , makeAny ( sal_Int32 ( COL_LIGHTRED ) ) ) ;
2007-07-06 07:02:38 +00:00
Reference < : : com : : sun : : star : : util : : XNumberFormatsSupplier > xNFS ( : : dbtools : : getNumberFormats ( : : dbtools : : getConnection ( m_xRowSet ) , sal_True , getORB ( ) ) ) ;
2000-10-26 13:46:14 +00:00
2004-02-03 19:41:49 +00:00
SvxAbstractDialogFactory * pFact = SvxAbstractDialogFactory : : Create ( ) ;
2004-11-16 13:30:31 +00:00
AbstractFmSearchDialog * pDialog = NULL ;
if ( pFact )
2007-07-31 13:01:29 +00:00
{
: : std : : vector < String > aContextNames ;
aContextNames . push_back ( String : : CreateFromAscii ( " Standard " ) ) ;
pDialog = pFact - > CreateFmSearchDialog ( getBrowserView ( ) , sInitialText , aContextNames , 0 , LINK ( this , SbaXDataBrowserController , OnSearchContextRequest ) ) ;
}
2004-11-16 13:30:31 +00:00
DBG_ASSERT ( pDialog , " SbaXDataBrowserController::ExecuteSearch: could not get the search dialog! " ) ;
if ( pDialog )
{
pDialog - > SetActiveField ( sActiveField ) ;
pDialog - > SetFoundHandler ( LINK ( this , SbaXDataBrowserController , OnFoundData ) ) ;
pDialog - > SetCanceledNotFoundHdl ( LINK ( this , SbaXDataBrowserController , OnCanceledNotFound ) ) ;
pDialog - > Execute ( ) ;
delete pDialog ;
}
2000-10-26 13:46:14 +00:00
// restore the grid's normal operating state
xModelSet - > setPropertyValue ( : : rtl : : OUString : : createFromAscii ( " DisplayIsSynchron " ) , : : comphelper : : makeBoolAny ( sal_Bool ( sal_True ) ) ) ;
xModelSet - > setPropertyValue ( : : rtl : : OUString : : createFromAscii ( " AlwaysShowCursor " ) , : : comphelper : : makeBoolAny ( sal_Bool ( sal_False ) ) ) ;
xModelSet - > setPropertyValue ( : : rtl : : OUString : : createFromAscii ( " CursorColor " ) , Any ( ) ) ;
}
//------------------------------------------------------------------------------
2008-06-25 11:39:41 +00:00
void SbaXDataBrowserController : : Execute ( sal_uInt16 nId , const Sequence < PropertyValue > & _rArgs )
2000-10-26 13:46:14 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::Execute " ) ;
2000-10-26 13:46:14 +00:00
sal_Bool bSortUp = sal_True ;
switch ( nId )
{
2008-06-25 11:39:41 +00:00
default :
SbaXDataBrowserController_Base : : Execute ( nId , _rArgs ) ;
return ;
2008-03-05 15:52:29 +00:00
case ID_BROWSER_INSERT_ROW :
try
{
if ( SaveModified ( ) )
{
getRowSet ( ) - > afterLast ( ) ;
// check if it is available
Reference < XResultSetUpdate > xUpdateCursor ( getRowSet ( ) , UNO_QUERY_THROW ) ;
xUpdateCursor - > moveToInsertRow ( ) ;
}
}
catch ( Exception & )
{
OSL_ENSURE ( 0 , " Exception caught! " ) ;
}
break ;
case SID_FM_DELETEROWS :
if ( SaveModified ( ) )
{
SbaGridControl * pVclGrid = getBrowserView ( ) - > getVclControl ( ) ;
if ( pVclGrid )
{
if ( ! pVclGrid - > GetSelectRowCount ( ) )
{
pVclGrid - > DeactivateCell ( ) ;
pVclGrid - > SelectRow ( pVclGrid - > GetCurRow ( ) ) ;
}
pVclGrid - > DeleteSelectedRows ( ) ;
}
}
break ;
2000-10-26 13:46:14 +00:00
case ID_BROWSER_FILTERED :
if ( SaveModified ( ) )
{
Reference < XPropertySet > xActiveSet ( getRowSet ( ) , UNO_QUERY ) ;
sal_Bool bApplied = : : comphelper : : getBOOL ( xActiveSet - > getPropertyValue ( PROPERTY_APPLYFILTER ) ) ;
xActiveSet - > setPropertyValue ( PROPERTY_APPLYFILTER , : : comphelper : : makeBoolAny ( sal_Bool ( ! bApplied ) ) ) ;
2005-09-23 11:19:18 +00:00
reloadForm ( m_xLoadable ) ;
2000-10-26 13:46:14 +00:00
}
InvalidateFeature ( ID_BROWSER_FILTERED ) ;
break ;
case ID_BROWSER_EDITDOC :
{
2001-01-09 14:52:33 +00:00
sal_Int16 nGridMode = getBrowserView ( ) - > getVclControl ( ) - > GetOptions ( ) ;
2000-10-26 13:46:14 +00:00
if ( nGridMode = = DbGridControl : : OPT_READONLY )
2001-01-09 14:52:33 +00:00
getBrowserView ( ) - > getVclControl ( ) - > SetOptions ( DbGridControl : : OPT_UPDATE | DbGridControl : : OPT_INSERT | DbGridControl : : OPT_DELETE ) ;
2000-10-26 13:46:14 +00:00
// the options not supported by the data source will be removed automatically
else
{
2002-01-24 16:43:35 +00:00
if ( ! SaveModified ( ) )
2000-10-26 13:46:14 +00:00
// give the user a chance to save the current record (if neccessary)
break ;
// maybe the user wanted to reject the modified record ?
2002-05-22 13:03:34 +00:00
if ( GetState ( ID_BROWSER_UNDORECORD ) . bEnabled )
2004-09-09 08:41:14 +00:00
Execute ( ID_BROWSER_UNDORECORD , Sequence < PropertyValue > ( ) ) ;
2000-10-26 13:46:14 +00:00
2001-01-09 14:52:33 +00:00
getBrowserView ( ) - > getVclControl ( ) - > SetOptions ( DbGridControl : : OPT_READONLY ) ;
2000-10-26 13:46:14 +00:00
}
InvalidateFeature ( ID_BROWSER_EDITDOC ) ;
}
break ;
case ID_BROWSER_SEARCH :
2002-01-24 16:43:35 +00:00
if ( SaveModified ( ) )
2000-10-26 13:46:14 +00:00
ExecuteSearch ( ) ;
break ;
case ID_BROWSER_COPY :
case ID_BROWSER_CUT :
case ID_BROWSER_PASTE :
{
2001-06-29 07:45:10 +00:00
CellControllerRef xCurrentController = getBrowserView ( ) - > getVclControl ( ) - > Controller ( ) ;
2000-10-26 13:46:14 +00:00
if ( ! xCurrentController . Is ( ) )
// should be intercepted by GetState. Normally.
// Unfortunately ID_BROWSER_PASTE is a 'fast call' slot, which means it may be executed without checking if it is
// enabled. This would be really deadly herein if the current cell has no controller ...
// (FS - 13.04.99 - #64694#)
return ;
Edit & rEdit = ( Edit & ) xCurrentController - > GetWindow ( ) ;
switch ( nId )
{
case ID_BROWSER_CUT : rEdit . Cut ( ) ; break ;
case SID_COPY : rEdit . Copy ( ) ; break ;
case ID_BROWSER_PASTE : rEdit . Paste ( ) ; break ;
}
if ( ID_BROWSER_CUT = = nId | | ID_BROWSER_PASTE = = nId )
{
xCurrentController - > SetModified ( ) ;
rEdit . Modify ( ) ;
}
}
break ;
case ID_BROWSER_SORTDOWN :
bSortUp = sal_False ;
// DON'T break
case ID_BROWSER_SORTUP :
{
if ( ! SaveModified ( ) )
break ;
if ( ! isValidCursor ( ) )
break ;
// only one sort order
Reference < XPropertySet > xField ( getBoundField ( ) , UNO_QUERY ) ;
if ( ! xField . is ( ) )
break ;
2009-04-23 10:42:05 +00:00
initializeParser ( ) ;
const : : rtl : : OUString sOldSort = m_xParser - > getOrder ( ) ;
2007-11-13 14:33:26 +00:00
sal_Bool bParserSuccess = sal_False ;
2000-10-26 13:46:14 +00:00
HANDLE_SQL_ERRORS (
2005-01-05 11:33:18 +00:00
m_xParser - > setOrder ( : : rtl : : OUString ( ) ) ; m_xParser - > appendOrderByColumn ( xField , bSortUp ) ,
2000-10-26 13:46:14 +00:00
bParserSuccess ,
UniString ( ModuleRes ( SBA_BROWSER_SETTING_ORDER ) ) ,
2001-08-14 11:11:45 +00:00
" SbaXDataBrowserController::Execute : caught an exception while composing the new filter ! "
2000-10-26 13:46:14 +00:00
)
if ( bParserSuccess )
2001-07-17 12:07:48 +00:00
applyParserOrder ( sOldSort ) ;
2000-10-26 13:46:14 +00:00
}
break ;
case ID_BROWSER_AUTOFILTER :
{
if ( ! SaveModified ( ) )
break ;
if ( ! isValidCursor ( ) )
break ;
Reference < XPropertySet > xField ( getBoundField ( ) , UNO_QUERY ) ;
if ( ! xField . is ( ) )
break ;
2004-10-22 08:04:30 +00:00
// check if the column is a aggregate function
sal_Bool bHaving = sal_False ;
: : rtl : : OUString sName ;
xField - > getPropertyValue ( PROPERTY_NAME ) > > = sName ;
2009-04-23 10:42:05 +00:00
initializeParser ( ) ;
2004-10-22 08:04:30 +00:00
Reference < XColumnsSupplier > xColumnsSupplier ( m_xParser , UNO_QUERY ) ;
Reference < : : com : : sun : : star : : container : : XNameAccess > xCols = xColumnsSupplier . is ( ) ? xColumnsSupplier - > getColumns ( ) : Reference < : : com : : sun : : star : : container : : XNameAccess > ( ) ;
if ( xCols . is ( ) & & xCols - > hasByName ( sName ) )
{
Reference < XPropertySet > xProp ( xCols - > getByName ( sName ) , UNO_QUERY ) ;
static : : rtl : : OUString sAgg ( RTL_CONSTASCII_USTRINGPARAM ( " AggregateFunction " ) ) ;
if ( xProp - > getPropertySetInfo ( ) - > hasPropertyByName ( sAgg ) )
xProp - > getPropertyValue ( sAgg ) > > = bHaving ;
}
2009-04-23 10:42:05 +00:00
const : : rtl : : OUString sOldFilter = m_xParser - > getFilter ( ) ;
const : : rtl : : OUString sOldHaving = m_xParser - > getHavingClause ( ) ;
2000-10-26 13:46:14 +00:00
Reference < XPropertySet > xFormSet ( getRowSet ( ) , UNO_QUERY ) ;
sal_Bool bApplied = : : comphelper : : getBOOL ( xFormSet - > getPropertyValue ( PROPERTY_APPLYFILTER ) ) ;
// do we have a filter but it's not applied ?
// -> completely overwrite it, else append one
if ( ! bApplied )
{
2005-01-05 11:33:18 +00:00
DO_SAFE ( ( bHaving ? m_xParser - > setHavingClause ( : : rtl : : OUString ( ) ) : m_xParser - > setFilter ( : : rtl : : OUString ( ) ) ) , " SbaXDataBrowserController::Execute : caught an exception while resetting the new filter ! " ) ;
2000-10-26 13:46:14 +00:00
}
2007-11-13 14:33:26 +00:00
sal_Bool bParserSuccess = sal_False ;
2004-10-22 08:04:30 +00:00
if ( bHaving )
{
HANDLE_SQL_ERRORS (
2005-01-05 11:33:18 +00:00
m_xParser - > appendHavingClauseByColumn ( xField , sal_True ) ,
2004-10-22 08:04:30 +00:00
bParserSuccess ,
UniString ( ModuleRes ( SBA_BROWSER_SETTING_FILTER ) ) ,
" SbaXDataBrowserController::Execute : caught an exception while composing the new filter ! "
)
}
else
{
HANDLE_SQL_ERRORS (
2005-01-05 11:33:18 +00:00
m_xParser - > appendFilterByColumn ( xField , sal_True ) ,
2004-10-22 08:04:30 +00:00
bParserSuccess ,
UniString ( ModuleRes ( SBA_BROWSER_SETTING_FILTER ) ) ,
" SbaXDataBrowserController::Execute : caught an exception while composing the new filter ! "
)
}
2000-10-26 13:46:14 +00:00
if ( bParserSuccess )
2004-10-22 08:04:30 +00:00
applyParserFilter ( sOldFilter , bApplied , sOldHaving ) ;
2000-10-26 13:46:14 +00:00
InvalidateFeature ( ID_BROWSER_REMOVEFILTER ) ;
InvalidateFeature ( ID_BROWSER_FILTERED ) ;
}
break ;
case ID_BROWSER_ORDERCRIT :
ExecuteFilterSortCrit ( sal_False ) ;
break ;
case ID_BROWSER_FILTERCRIT :
ExecuteFilterSortCrit ( sal_True ) ;
InvalidateFeature ( ID_BROWSER_FILTERED ) ;
break ;
case ID_BROWSER_REMOVEFILTER :
{
if ( ! SaveModified ( ) )
break ;
2005-09-23 11:19:18 +00:00
sal_Bool bNeedPostReload = preReloadForm ( ) ;
2000-10-26 13:46:14 +00:00
// reset the filter and the sort property simutaneously so only _one_ new statement has to be
// sent
Reference < XPropertySet > xSet ( getRowSet ( ) , UNO_QUERY ) ;
2005-09-23 11:19:18 +00:00
if ( xSet . is ( ) )
{
xSet - > setPropertyValue ( PROPERTY_FILTER , makeAny ( : : rtl : : OUString ( ) ) ) ;
xSet - > setPropertyValue ( PROPERTY_HAVING_CLAUSE , makeAny ( : : rtl : : OUString ( ) ) ) ;
xSet - > setPropertyValue ( PROPERTY_ORDER , makeAny ( : : rtl : : OUString ( ) ) ) ;
}
try
{
reloadForm ( m_xLoadable ) ;
if ( bNeedPostReload )
postReloadForm ( ) ;
}
catch ( Exception & )
2000-10-26 13:46:14 +00:00
{
}
InvalidateFeature ( ID_BROWSER_REMOVEFILTER ) ;
InvalidateFeature ( ID_BROWSER_FILTERED ) ;
}
break ;
case ID_BROWSER_REFRESH :
2002-01-24 16:43:35 +00:00
if ( SaveModified ( ) )
2001-08-14 11:11:45 +00:00
{
2005-09-23 11:19:18 +00:00
if ( ! reloadForm ( m_xLoadable ) )
2001-07-17 12:07:48 +00:00
criticalFail ( ) ;
2001-08-14 11:11:45 +00:00
}
2000-10-26 13:46:14 +00:00
break ;
2002-05-22 13:03:34 +00:00
case ID_BROWSER_SAVERECORD :
2002-07-22 11:59:36 +00:00
if ( SaveModified ( sal_False ) )
2001-10-29 14:14:28 +00:00
setCurrentModified ( sal_False ) ;
break ;
2000-10-26 13:46:14 +00:00
2002-05-22 13:03:34 +00:00
case ID_BROWSER_UNDORECORD :
2000-10-26 13:46:14 +00:00
{
2001-10-26 06:55:37 +00:00
try
2000-10-26 13:46:14 +00:00
{
2001-10-26 06:55:37 +00:00
// restore the cursor state
Reference < XResultSetUpdate > xCursor ( getRowSet ( ) , UNO_QUERY ) ;
Reference < XPropertySet > xSet ( xCursor , UNO_QUERY ) ;
Any aVal = xSet - > getPropertyValue ( PROPERTY_ISNEW ) ;
if ( aVal . hasValue ( ) & & : : comphelper : : getBOOL ( aVal ) )
{
xCursor - > moveToInsertRow ( ) ;
// no need to reset the grid model after we moved to the insert row, this is done implicitly by the
// form
// (and in some cases it may be deadly to do the reset explicitly after the form did it implicitly,
// cause the form's reset may be async, and this leads to some nice deadlock scenarios ....)
}
else
{
xCursor - > cancelRowUpdates ( ) ;
// restore the grids state
Reference < : : com : : sun : : star : : form : : XReset > xReset ( getControlModel ( ) , UNO_QUERY ) ;
if ( xReset . is ( ) )
xReset - > reset ( ) ;
}
2000-10-26 13:46:14 +00:00
}
2001-10-26 06:55:37 +00:00
catch ( SQLException & )
2000-10-26 13:46:14 +00:00
{
}
2001-10-29 14:14:28 +00:00
setCurrentModified ( sal_False ) ;
2000-10-26 13:46:14 +00:00
}
}
}
//------------------------------------------------------------------------------
2002-07-22 11:59:36 +00:00
sal_Bool SbaXDataBrowserController : : SaveModified ( sal_Bool bAskFor )
2000-10-26 13:46:14 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::SaveModified " ) ;
2002-07-22 11:59:36 +00:00
if ( bAskFor & & GetState ( ID_BROWSER_SAVERECORD ) . bEnabled )
{
getBrowserView ( ) - > getVclControl ( ) - > GrabFocus ( ) ;
QueryBox aQry ( getBrowserView ( ) - > getVclControl ( ) , ModuleRes ( QUERY_BRW_SAVEMODIFIED ) ) ;
switch ( aQry . Execute ( ) )
{
case RET_NO :
2004-09-09 08:41:14 +00:00
Execute ( ID_BROWSER_UNDORECORD , Sequence < PropertyValue > ( ) ) ;
2002-07-22 11:59:36 +00:00
return sal_True ;
case RET_CANCEL :
return sal_False ;
}
}
if ( ! CommitCurrent ( ) ) // das aktuelle Control committen lassen
2000-10-26 13:46:14 +00:00
return sal_False ;
Reference < XPropertySet > xFormSet ( getRowSet ( ) , UNO_QUERY ) ;
sal_Bool bResult = sal_False ;
try
{
if ( : : comphelper : : getBOOL ( xFormSet - > getPropertyValue ( PROPERTY_ISMODIFIED ) ) )
{
Reference < XResultSetUpdate > xCursor ( getRowSet ( ) , UNO_QUERY ) ;
if ( : : comphelper : : getBOOL ( xFormSet - > getPropertyValue ( PROPERTY_ISNEW ) ) )
xCursor - > insertRow ( ) ;
else
xCursor - > updateRow ( ) ;
}
bResult = sal_True ;
}
catch ( SQLException & )
{
}
2001-01-09 14:52:33 +00:00
catch ( Exception & )
2000-10-26 13:46:14 +00:00
{
DBG_ERROR ( " SbaXDataBrowserController::SaveModified : could not save the current record ! " ) ;
bResult = sal_False ;
}
2002-07-22 11:59:36 +00:00
InvalidateFeature ( ID_BROWSER_SAVERECORD ) ;
InvalidateFeature ( ID_BROWSER_UNDORECORD ) ;
2000-10-26 13:46:14 +00:00
return bResult ;
}
//------------------------------------------------------------------------------
sal_Bool SbaXDataBrowserController : : CommitCurrent ( )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::CommitCurrent " ) ;
2001-01-09 14:52:33 +00:00
if ( ! getBrowserView ( ) )
2000-10-26 13:46:14 +00:00
return sal_True ;
2001-01-09 14:52:33 +00:00
Reference < : : com : : sun : : star : : awt : : XControl > xActiveControl ( getBrowserView ( ) - > getGridControl ( ) ) ;
2000-10-26 13:46:14 +00:00
Reference < : : com : : sun : : star : : form : : XBoundControl > xLockingTest ( xActiveControl , UNO_QUERY ) ;
sal_Bool bControlIsLocked = xLockingTest . is ( ) & & xLockingTest - > getLock ( ) ;
if ( xActiveControl . is ( ) & & ! bControlIsLocked )
{
// zunaechst das Control fragen ob es das IFace unterstuetzt
Reference < : : com : : sun : : star : : form : : XBoundComponent > xBoundControl ( xActiveControl , UNO_QUERY ) ;
if ( ! xBoundControl . is ( ) )
xBoundControl = Reference < : : com : : sun : : star : : form : : XBoundComponent > ( xActiveControl - > getModel ( ) , UNO_QUERY ) ;
if ( xBoundControl . is ( ) & & ! xBoundControl - > commit ( ) )
return sal_False ;
}
return sal_True ;
}
2001-10-29 14:14:28 +00:00
//------------------------------------------------------------------------------
void SbaXDataBrowserController : : setCurrentModified ( sal_Bool _bSet )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::setCurrentModified " ) ;
2001-10-29 14:14:28 +00:00
m_bCurrentlyModified = _bSet ;
2002-05-22 13:03:34 +00:00
InvalidateFeature ( ID_BROWSER_SAVERECORD ) ;
2001-10-29 14:14:28 +00:00
InvalidateFeature ( ID_BROWSER_UNDORECORD ) ;
}
//------------------------------------------------------------------------------
void SbaXDataBrowserController : : RowChanged ( )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::RowChanged " ) ;
2001-10-29 14:14:28 +00:00
setCurrentModified ( sal_False ) ;
}
2000-10-26 13:46:14 +00:00
//------------------------------------------------------------------------------
void SbaXDataBrowserController : : ColumnChanged ( )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::ColumnChanged " ) ;
2000-10-26 13:46:14 +00:00
InvalidateFeature ( ID_BROWSER_SORTUP ) ;
InvalidateFeature ( ID_BROWSER_SORTDOWN ) ;
InvalidateFeature ( ID_BROWSER_ORDERCRIT ) ;
InvalidateFeature ( ID_BROWSER_FILTERCRIT ) ;
InvalidateFeature ( ID_BROWSER_AUTOFILTER ) ;
InvalidateFeature ( ID_BROWSER_REMOVEFILTER ) ;
2001-10-29 14:14:28 +00:00
setCurrentModified ( sal_False ) ;
2000-10-26 13:46:14 +00:00
}
//------------------------------------------------------------------------------
void SbaXDataBrowserController : : SelectionChanged ( )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::SelectionChanged " ) ;
2005-07-08 09:38:08 +00:00
// not interested in
2000-10-26 13:46:14 +00:00
}
//------------------------------------------------------------------------------
void SbaXDataBrowserController : : CellActivated ( )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::CellActivated " ) ;
2000-10-26 13:46:14 +00:00
m_aInvalidateClipboard . Start ( ) ;
2006-08-15 09:49:12 +00:00
OnInvalidateClipboard ( NULL ) ;
2000-10-26 13:46:14 +00:00
}
//------------------------------------------------------------------------------
void SbaXDataBrowserController : : CellDeactivated ( )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::CellDeactivated " ) ;
2000-10-26 13:46:14 +00:00
m_aInvalidateClipboard . Stop ( ) ;
2006-08-15 09:49:12 +00:00
OnInvalidateClipboard ( NULL ) ;
2000-10-26 13:46:14 +00:00
}
2002-05-23 11:25:52 +00:00
//------------------------------------------------------------------------------
IMPL_LINK ( SbaXDataBrowserController , OnClipboardChanged , void * , EMPTYARG )
{
2006-08-15 09:49:12 +00:00
: : vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
2002-05-23 11:25:52 +00:00
return OnInvalidateClipboard ( NULL ) ;
}
2000-10-26 13:46:14 +00:00
//------------------------------------------------------------------------------
2006-08-15 09:49:12 +00:00
IMPL_LINK ( SbaXDataBrowserController , OnInvalidateClipboard , AutoTimer * , _pTimer )
2000-10-26 13:46:14 +00:00
{
InvalidateFeature ( ID_BROWSER_CUT ) ;
InvalidateFeature ( ID_BROWSER_COPY ) ;
2006-08-15 09:49:12 +00:00
// if the invalidation was triggered by the timer, we do not need to invalidate PASTE.
// The timer is only for checking the CUT/COPY slots regulariry, which depend on the
// selection state of the active cell
// TODO: get a callback at the Edit which allows to be notified when the selection
// changes. This would be much better than this cycle-eating polling mechanism here ....
if ( _pTimer ! = & m_aInvalidateClipboard )
InvalidateFeature ( ID_BROWSER_PASTE ) ;
2000-10-26 13:46:14 +00:00
return 0L ;
}
// -------------------------------------------------------------------------
Reference < XPropertySet > SbaXDataBrowserController : : getBoundField ( sal_uInt16 nViewPos ) const
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::SaveData " ) ;
2000-10-26 13:46:14 +00:00
Reference < XPropertySet > xEmptyReturn ;
// get the current column from the grid
if ( nViewPos = = ( sal_uInt16 ) - 1 )
{
2001-01-09 14:52:33 +00:00
Reference < : : com : : sun : : star : : form : : XGrid > xGrid ( getBrowserView ( ) - > getGridControl ( ) , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
if ( ! xGrid . is ( ) )
return xEmptyReturn ;
nViewPos = xGrid - > getCurrentColumnPosition ( ) ;
}
2001-01-09 14:52:33 +00:00
sal_uInt16 nCurrentCol = getBrowserView ( ) - > View2ModelPos ( nViewPos ) ;
2000-10-26 13:46:14 +00:00
if ( nCurrentCol = = ( sal_uInt16 ) - 1 )
return xEmptyReturn ;
// get the according column from the model
Reference < : : com : : sun : : star : : container : : XIndexContainer > xCols ( getControlModel ( ) , UNO_QUERY ) ;
2004-08-02 14:31:55 +00:00
Reference < XPropertySet > xCurrentCol ( xCols - > getByIndex ( nCurrentCol ) , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
if ( ! xCurrentCol . is ( ) )
return xEmptyReturn ;
2004-08-02 14:31:55 +00:00
xEmptyReturn . set ( xCurrentCol - > getPropertyValue ( PROPERTY_BOUNDFIELD ) , UNO_QUERY ) ;
2001-08-27 05:57:24 +00:00
return xEmptyReturn ;
2000-10-26 13:46:14 +00:00
}
//------------------------------------------------------------------------------
IMPL_LINK ( SbaXDataBrowserController , OnSearchContextRequest , FmSearchContext * , pContext )
{
2001-01-09 14:52:33 +00:00
Reference < : : com : : sun : : star : : container : : XIndexAccess > xPeerContainer ( getBrowserView ( ) - > getGridControl ( ) , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
// check all grid columns for their control source
Reference < : : com : : sun : : star : : container : : XIndexAccess > xModelColumns ( getFormComponent ( ) , UNO_QUERY ) ;
DBG_ASSERT ( xModelColumns . is ( ) , " SbaXDataBrowserController::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 ( ) , " SbaXDataBrowserController::OnSearchContextRequest : impossible : have more view than model columns ! " ) ;
String sFieldList ;
for ( sal_Int32 nViewPos = 0 ; nViewPos < xPeerContainer - > getCount ( ) ; + + nViewPos )
{
2004-08-02 14:31:55 +00:00
Reference < XInterface > xCurrentColumn ( xPeerContainer - > getByIndex ( nViewPos ) , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
if ( ! xCurrentColumn . is ( ) )
continue ;
// can we use this column control fo searching ?
if ( ! IsSearchableControl ( xCurrentColumn ) )
continue ;
2001-04-24 13:36:44 +00:00
sal_uInt16 nModelPos = getBrowserView ( ) - > View2ModelPos ( ( sal_uInt16 ) nViewPos ) ;
2004-08-02 14:31:55 +00:00
Reference < XPropertySet > xCurrentColModel ( xModelColumns - > getByIndex ( nModelPos ) , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
: : rtl : : OUString aName = : : comphelper : : getString ( xCurrentColModel - > getPropertyValue ( PROPERTY_CONTROLSOURCE ) ) ;
sFieldList + = ( const sal_Unicode * ) aName ;
sFieldList + = ' ; ' ;
pContext - > arrFields . push_back ( xCurrentColumn ) ;
}
sFieldList . EraseTrailingChars ( ' ; ' ) ;
2004-08-02 14:31:55 +00:00
pContext - > xCursor . set ( getRowSet ( ) , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
pContext - > strUsedFields = sFieldList ;
// if the cursor is in a mode other than STANDARD -> reset
Reference < XPropertySet > xCursorSet ( pContext - > xCursor , UNO_QUERY ) ;
DBG_ASSERT ( xCursorSet . is ( ) & & ! : : comphelper : : getBOOL ( xCursorSet - > getPropertyValue ( PROPERTY_ISMODIFIED ) ) ,
" SbaXDataBrowserController::OnSearchContextRequest : please do not call for cursors with modified rows ! " ) ;
if ( xCursorSet . is ( ) & & : : comphelper : : getBOOL ( xCursorSet - > getPropertyValue ( PROPERTY_ISNEW ) ) )
{
Reference < XResultSetUpdate > xUpdateCursor ( pContext - > xCursor , UNO_QUERY ) ;
xUpdateCursor - > moveToCurrentRow ( ) ;
}
return pContext - > arrFields . size ( ) ;
}
//------------------------------------------------------------------------------
IMPL_LINK ( SbaXDataBrowserController , OnFoundData , FmFoundRecordInformation * , pInfo )
{
Reference < : : com : : sun : : star : : sdbcx : : XRowLocate > xCursor ( getRowSet ( ) , UNO_QUERY ) ;
DBG_ASSERT ( xCursor . is ( ) , " SbaXDataBrowserController::OnFoundData : shit happens. sometimes. but this is simply impossible ! " ) ;
// move the cursor
xCursor - > moveToBookmark ( pInfo - > aPosition ) ;
// let the grid snyc it's display with the cursor
Reference < XPropertySet > xModelSet ( getControlModel ( ) , UNO_QUERY ) ;
DBG_ASSERT ( xModelSet . is ( ) , " SbaXDataBrowserController::OnFoundData : no model set ?! " ) ;
Any aOld = xModelSet - > getPropertyValue ( : : rtl : : OUString : : createFromAscii ( " DisplayIsSynchron " ) ) ;
xModelSet - > setPropertyValue ( : : rtl : : OUString : : createFromAscii ( " DisplayIsSynchron " ) , : : comphelper : : makeBoolAny ( sal_Bool ( sal_True ) ) ) ;
xModelSet - > setPropertyValue ( : : rtl : : OUString : : createFromAscii ( " DisplayIsSynchron " ) , aOld ) ;
// and move to the field
2001-01-09 14:52:33 +00:00
Reference < : : com : : sun : : star : : container : : XIndexAccess > aColumnControls ( getBrowserView ( ) - > getGridControl ( ) - > getPeer ( ) , UNO_QUERY ) ;
2003-12-01 17:01:33 +00:00
sal_uInt16 nViewPos ;
for ( nViewPos = 0 ; nViewPos < aColumnControls - > getCount ( ) ; + + nViewPos )
2000-10-26 13:46:14 +00:00
{
2004-08-02 14:31:55 +00:00
Reference < XInterface > xCurrent ( aColumnControls - > getByIndex ( nViewPos ) , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
if ( IsSearchableControl ( xCurrent ) )
2008-12-11 07:05:03 +00:00
{
2000-10-31 13:09:13 +00:00
if ( pInfo - > nFieldPos )
2000-10-26 13:46:14 +00:00
- - pInfo - > nFieldPos ;
2000-10-31 13:09:13 +00:00
else
break ;
2008-12-11 07:05:03 +00:00
}
2000-10-26 13:46:14 +00:00
}
2001-01-09 14:52:33 +00:00
Reference < : : com : : sun : : star : : form : : XGrid > xGrid ( getBrowserView ( ) - > getGridControl ( ) , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
xGrid - > setCurrentColumnPosition ( nViewPos ) ;
return 0 ;
}
//------------------------------------------------------------------------------
IMPL_LINK ( SbaXDataBrowserController , OnCanceledNotFound , FmFoundRecordInformation * , pInfo )
{
Reference < : : com : : sun : : star : : sdbcx : : XRowLocate > xCursor ( getRowSet ( ) , UNO_QUERY ) ;
2005-12-21 12:36:29 +00:00
try
{
DBG_ASSERT ( xCursor . is ( ) , " SbaXDataBrowserController::OnCanceledNotFound : shit happens. sometimes. but this is simply impossible ! " ) ;
// move the cursor
xCursor - > moveToBookmark ( pInfo - > aPosition ) ;
}
catch ( const Exception & )
{
DBG_UNHANDLED_EXCEPTION ( ) ;
}
2000-10-26 13:46:14 +00:00
2005-12-21 12:36:29 +00:00
try
{
// let the grid snyc it's display with the cursor
Reference < XPropertySet > xModelSet ( getControlModel ( ) , UNO_QUERY ) ;
DBG_ASSERT ( xModelSet . is ( ) , " SbaXDataBrowserController::OnCanceledNotFound : no model set ?! " ) ;
Any aOld = xModelSet - > getPropertyValue ( : : rtl : : OUString : : createFromAscii ( " DisplayIsSynchron " ) ) ;
xModelSet - > setPropertyValue ( : : rtl : : OUString : : createFromAscii ( " DisplayIsSynchron " ) , : : comphelper : : makeBoolAny ( sal_Bool ( sal_True ) ) ) ;
xModelSet - > setPropertyValue ( : : rtl : : OUString : : createFromAscii ( " DisplayIsSynchron " ) , aOld ) ;
}
catch ( const Exception & )
{
DBG_UNHANDLED_EXCEPTION ( ) ;
}
2000-10-26 13:46:14 +00:00
return 0L ;
}
//------------------------------------------------------------------------------
IMPL_LINK ( SbaXDataBrowserController , OnOpenFinishedMainThread , void * , EMPTYARG )
{
: : vos : : OGuard aGuard ( Application : : GetSolarMutex ( ) ) ;
if ( ! m_nPendingLoadFinished )
// it's possible that the direct call of this link from within suspend caused this method to be executed
// in another thread while we were waiting for the mutex in this thread
return 0 ;
m_nPendingLoadFinished = 0 ;
2002-01-29 11:23:58 +00:00
if ( static_cast < LoadFormThread * > ( m_pLoadThread ) - > WasCanceled ( ) )
setLoadingCancelled ( ) ;
2000-10-26 13:46:14 +00:00
delete m_pLoadThread ;
m_pLoadThread = NULL ;
2001-07-17 12:07:48 +00:00
LoadFinished ( sal_False ) ;
2000-10-26 13:46:14 +00:00
return 0L ;
}
//------------------------------------------------------------------------------
IMPL_LINK ( SbaXDataBrowserController , OnOpenFinished , void * , EMPTYARG )
{
: : osl : : MutexGuard aCheckGuard ( m_aAsyncLoadSafety ) ;
if ( m_bClosingKillOpen )
{
delete m_pLoadThread ;
m_pLoadThread = NULL ;
}
else
// all cleaning has to run in the main thread, not here (this is called synchronously from the LoadThread)
// so we use an user event
m_nPendingLoadFinished = Application : : PostUserEvent ( LINK ( this , SbaXDataBrowserController , OnOpenFinishedMainThread ) ) ;
return 0L ;
}
//------------------------------------------------------------------------------
IMPL_LINK ( SbaXDataBrowserController , OnAsyncGetCellFocus , void * , EMPTYARG )
{
2001-01-09 14:52:33 +00:00
SbaGridControl * pVclGrid = getBrowserView ( ) ? getBrowserView ( ) - > getVclControl ( ) : NULL ;
2000-10-26 13:46:14 +00:00
// if we have a controller, but the window for the controller doesn't have the focus, we correct this
2000-12-07 13:14:31 +00:00
if ( pVclGrid )
{
if ( ! pVclGrid - > IsEditing ( ) )
return 0L ;
2000-10-26 13:46:14 +00:00
2000-12-07 13:14:31 +00:00
if ( pVclGrid - > HasChildPathFocus ( ) )
pVclGrid - > Controller ( ) - > GetWindow ( ) . GrabFocus ( ) ;
}
2000-10-26 13:46:14 +00:00
return 0L ;
}
//------------------------------------------------------------------------------
2001-07-17 12:07:48 +00:00
void SbaXDataBrowserController : : criticalFail ( )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::criticalFail " ) ;
2001-07-17 12:07:48 +00:00
InvalidateAll ( ) ;
}
//------------------------------------------------------------------------------
void SbaXDataBrowserController : : LoadFinished ( sal_Bool /*bWasSynch*/ )
2000-10-26 13:46:14 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::LoadFinished " ) ;
2001-08-16 09:39:55 +00:00
if ( isValid ( ) & & ! loadingCancelled ( ) )
2000-10-26 13:46:14 +00:00
{
// --------------------------------
// switch the control to alive mode
2001-01-09 14:52:33 +00:00
getBrowserView ( ) - > getGridControl ( ) - > setDesignMode ( sal_False ) ;
2000-10-26 13:46:14 +00:00
2009-04-23 10:42:05 +00:00
// -------------------------------
InvalidateAll ( ) ;
m_aAsyncGetCellFocus . Call ( ) ;
}
}
// -----------------------------------------------------------------------------
void SbaXDataBrowserController : : initializeParser ( ) const
{
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::initializeParser " ) ;
if ( ! m_xParser . is ( ) )
{
2000-10-26 13:46:14 +00:00
// ----------------------------------------------
// create a parser (needed for filtering/sorting)
try
{
2009-04-23 10:42:05 +00:00
const Reference < XPropertySet > xFormSet ( getRowSet ( ) , UNO_QUERY ) ;
2007-11-21 14:50:24 +00:00
if ( : : comphelper : : getBOOL ( xFormSet - > getPropertyValue ( PROPERTY_ESCAPE_PROCESSING ) ) )
2000-10-26 13:46:14 +00:00
{ // (only if the statement isn't native)
// (it is allowed to use the PROPERTY_ISPASSTHROUGH : _after_ loading a form it is valid)
2009-04-23 10:42:05 +00:00
const Reference < XMultiServiceFactory > xFactory ( : : dbtools : : getConnection ( getRowSet ( ) ) , UNO_QUERY ) ;
2004-10-22 08:04:30 +00:00
if ( xFactory . is ( ) )
m_xParser . set ( xFactory - > createInstance ( SERVICE_NAME_SINGLESELECTQUERYCOMPOSER ) , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
}
// initialize the parser with the current sql-statement of the form
2004-10-22 08:04:30 +00:00
if ( m_xParser . is ( ) )
2000-10-26 13:46:14 +00:00
{
2005-01-05 11:33:18 +00:00
m_xParser - > setElementaryQuery ( : : comphelper : : getString ( xFormSet - > getPropertyValue ( PROPERTY_ACTIVECOMMAND ) ) ) ;
m_xParser - > setFilter ( : : comphelper : : getString ( xFormSet - > getPropertyValue ( PROPERTY_FILTER ) ) ) ;
m_xParser - > setHavingClause ( : : comphelper : : getString ( xFormSet - > getPropertyValue ( PROPERTY_HAVING_CLAUSE ) ) ) ;
m_xParser - > setOrder ( : : comphelper : : getString ( xFormSet - > getPropertyValue ( PROPERTY_ORDER ) ) ) ;
2000-10-26 13:46:14 +00:00
}
}
2001-01-09 14:52:33 +00:00
catch ( Exception & )
2000-10-26 13:46:14 +00:00
{
2009-04-23 10:42:05 +00:00
DBG_WARNING ( " SbaXDataBrowserController::initializeParser: something went wrong while creating the parser ! " ) ;
2000-10-26 13:46:14 +00:00
m_xParser = NULL ;
// no further handling, we ignore the error
}
}
}
2001-01-09 14:52:33 +00:00
//------------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SbaXDataBrowserController : : loaded ( const EventObject & /*aEvent*/ ) throw ( RuntimeException )
2001-01-09 14:52:33 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::loaded " ) ;
2001-01-09 14:52:33 +00:00
// not interested in
// we're loading within an separate thread and have a handling for it's "finished event"
}
//------------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SbaXDataBrowserController : : unloading ( const EventObject & /*aEvent*/ ) throw ( RuntimeException )
2001-01-09 14:52:33 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::unloading " ) ;
2001-01-09 14:52:33 +00:00
// not interested in
}
//------------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SbaXDataBrowserController : : unloaded ( const EventObject & /*aEvent*/ ) throw ( RuntimeException )
2001-01-09 14:52:33 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::unloaded " ) ;
2001-01-09 14:52:33 +00:00
InvalidateAll ( ) ;
// do this asynchron, there are other listeners reacting on this message ...
// (it's a little hack : the grid columns are listening to this event, too, and their bound field may
// change as a reaction on that event. as we have no chance to be notified of this change (which is
// the one we're interested in) we give them time to do what they want to before invalidating our
// bound-field-dependent slots ....
2004-08-02 14:31:55 +00:00
try
{
: : comphelper : : disposeComponent ( m_xParser ) ;
}
catch ( Exception & )
{
OSL_ENSURE ( 0 , " Exception thrown by dispose " ) ;
}
2001-01-09 14:52:33 +00:00
}
//------------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SbaXDataBrowserController : : reloading ( const EventObject & /*aEvent*/ ) throw ( RuntimeException )
2001-01-09 14:52:33 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::reloading " ) ;
2001-01-09 14:52:33 +00:00
// not interested in
}
2000-10-26 13:46:14 +00:00
2001-01-09 14:52:33 +00:00
//------------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SbaXDataBrowserController : : reloaded ( const EventObject & /*aEvent*/ ) throw ( RuntimeException )
2001-01-09 14:52:33 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::reloaded " ) ;
2001-01-09 14:52:33 +00:00
InvalidateAll ( ) ;
2006-06-20 01:55:50 +00:00
// do this asynchronously, there are other listeners reacting on this message ...
2001-01-09 14:52:33 +00:00
// (it's a little hack : the grid columns are listening to this event, too, and their bound field may
// change as a reaction on that event. as we have no chance to be notified of this change (which is
// the one we're interested in) we give them time to do what they want to before invalidating our
// bound-field-dependent slots ....
}
2000-10-26 13:46:14 +00:00
//------------------------------------------------------------------------------
void SbaXDataBrowserController : : enterFormAction ( )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::enterFormAction " ) ;
2000-10-26 13:46:14 +00:00
if ( ! m_nFormActionNestingLevel )
// first action -> reset flag
m_bErrorOccured = false ;
+ + m_nFormActionNestingLevel ;
}
//------------------------------------------------------------------------------
void SbaXDataBrowserController : : leaveFormAction ( )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::leaveFormAction " ) ;
2000-10-26 13:46:14 +00:00
DBG_ASSERT ( m_nFormActionNestingLevel > 0 , " SbaXDataBrowserController::leaveFormAction : invalid call ! " ) ;
- - m_nFormActionNestingLevel ;
}
2001-07-17 12:07:48 +00:00
// -------------------------------------------------------------------------
sal_Bool SbaXDataBrowserController : : isLoaded ( ) const
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::isLoaded " ) ;
2001-08-27 05:57:24 +00:00
return m_xLoadable . is ( ) & & m_xLoadable - > isLoaded ( ) ;
2001-07-17 12:07:48 +00:00
}
2000-10-26 13:46:14 +00:00
// -------------------------------------------------------------------------
sal_Bool SbaXDataBrowserController : : isValidCursor ( ) const
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::isValidCursor " ) ;
2001-08-27 05:57:24 +00:00
if ( ! m_xColumnsSupplier . is ( ) )
2000-10-26 13:46:14 +00:00
return sal_False ;
2001-08-27 05:57:24 +00:00
Reference < : : com : : sun : : star : : container : : XNameAccess > xCols = m_xColumnsSupplier - > getColumns ( ) ;
2001-08-24 05:40:35 +00:00
if ( ! xCols . is ( ) | | ! xCols - > hasElements ( ) )
2000-10-26 13:46:14 +00:00
return sal_False ;
2001-01-15 08:36:15 +00:00
2009-04-23 10:42:05 +00:00
sal_Bool bIsValid = ! ( m_xRowSet - > isBeforeFirst ( ) | | m_xRowSet - > isAfterLast ( ) ) ;
if ( ! bIsValid )
{
Reference < XPropertySet > xProp ( m_xRowSet , UNO_QUERY ) ;
bIsValid = : : cppu : : any2bool ( xProp - > getPropertyValue ( PROPERTY_ISNEW ) ) ;
if ( ! bIsValid )
{
initializeParser ( ) ;
CWS-TOOLING: integrate CWS evoab2def
2009-05-28 16:00:19 +0200 fs r272412 : don't use createFalse - Evo 2.22 simply hangs when ask for all contacts without a first name. Instead, in the WHERE 0=1 case, simply create an empty result set
2009-05-22 14:25:51 +0200 fs r272193 : #i10000#
2009-05-22 14:25:37 +0200 fs r272192 : oops, ENABLE_EVOAB2 for some platforms only, not generically
2009-05-22 14:19:00 +0200 fs r272191 : #i10000#
2009-05-22 12:42:38 +0200 fs r272183 : when sorting, properly use a syslocale collator, instead of comparing the numerical values of the string's UTF-16 code points
2009-05-20 15:09:00 +0200 fs r272131 : clear/getWarnings: also allowed without cache
2009-05-20 14:11:19 +0200 fs r272128 : removed debug traces
2009-05-20 14:03:31 +0200 fs r272126 : #i55701# +STR_SORT_BY_COL_ONLY
2009-05-20 14:02:29 +0200 fs r272125 : implement sorting
2009-05-20 10:10:19 +0200 fs r272107 : #i10000#
2009-05-19 16:02:17 +0200 fs r272089 : #i10000#
2009-05-19 16:02:02 +0200 fs r272088 : #i55701# strings for new error condition DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 16:01:31 +0200 fs r272087 : #i55701# use DATA_CANNOT_SELECT_UNFILTERED as standardized error code
2009-05-19 15:59:59 +0200 fs r272086 : #i55701# +DATA_CANNOT_SELECT_UNFILTERED
2009-05-19 15:46:12 +0200 fs r272084 : #i55701# recognize the DATA_CANNOT_SELECT_UNFILTERED error condition, and allow filtering in this case, even when the result set is empty
2009-05-19 09:06:50 +0200 fs r272059 : merging changes from CWS dba32b, to prevent future conflicts with upcoming local changes
2009-05-18 21:48:58 +0200 fs r272054 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:48:42 +0200 fs r272053 : accessing a non-local unfiltered address book now returns an empty result set, and reports a warning, instead of ungracefully failing
2009-05-18 21:47:41 +0200 fs r272052 : +setExternalWarnings
2009-05-18 21:47:12 +0200 fs r272051 : #i55701# when re/loading the form, display any possible warnings
2009-05-18 21:43:26 +0200 fs r272050 : #i55701# implement XWarningsSupplier, exposing the warnings of our result set
2009-05-18 21:42:51 +0200 fs r272049 : #i55701# implement XWarningsSupplier, exposing the warnings of our aggregate RowSet
2009-05-18 17:53:59 +0200 fs r272041 : #i55701# moved the (I)WarningsContainer from dbaccess to connectivity, to be able to use it in the latter module, too
2009-05-18 17:24:10 +0200 fs r272040 : #i55701# properly enable the various Evolution types
2009-05-18 14:52:19 +0200 fs r272024 : #i55701# properly enable the Evolution types
2009-05-18 13:57:10 +0200 fs r272018 : fixed/extended whereAnalysis (column searching still not enabled, as neither LIKE nor = seem to work with my (somewhat older) Evolution version)
2009-05-18 13:56:08 +0200 fs r272017 : extended showParseTree
2009-05-18 13:55:25 +0200 fs r272016 : extended showParseTree
2009-05-18 11:40:16 +0200 fs r272008 : #i55701#
2009-05-18 11:39:02 +0200 fs r272006 : let the PreparedStatement return proper meta data, too
2009-05-18 10:05:37 +0200 fs r271999 : moved the XStatement interface to from OCommonStatement to OStatement - the former class is also the base for other classes which should not have this interface
2009-05-15 21:53:22 +0200 fs r271973 : collectColumnInformation: report invalid meta data as assertion
2009-05-15 21:51:40 +0200 fs r271972 : showParseTree should be const
2009-05-15 21:51:26 +0200 fs r271971 : showParseTree should be const
2009-05-15 21:51:03 +0200 fs r271970 : properly recognize the 'WHERE 0 = 1' clause, this way having proper statement meta data, this way saving much much calls from the DBA framework
2009-05-15 20:29:03 +0200 fs r271969 : cleaned up the mess with the statement classes
2009-05-15 15:51:11 +0200 fs r271944 : let the result set properly init its meta data
2009-05-15 15:29:54 +0200 fs r271939 : proper property implementations for the resultset class
2009-05-15 15:01:31 +0200 fs r271936 : proper property implementations for the statement class
2009-05-08 14:46:33 +0200 fs r271717 : component_foo must be PUBLIC
2009-05-06 09:20:05 +0200 fs r271565 : #i10000# (warnings on unxlngi6)
2009-05-06 09:01:30 +0200 fs r271564 : #i101493#
2009-05-05 23:08:12 +0200 fs r271560 : #i55701# merging the changes from the ancient (CVS-based) CWS evoab2default into this CWS here
2009-06-05 12:31:05 +00:00
bIsValid = m_xParser . is ( ) ;
2009-04-23 10:42:05 +00:00
}
} // if ( !bIsValid )
return bIsValid ;
2000-10-26 13:46:14 +00:00
}
2000-11-07 17:34:39 +00:00
2000-10-26 13:46:14 +00:00
//==================================================================
// LoadFormHelper
//==================================================================
class LoadFormHelper : public : : cppu : : WeakImplHelper2 < : : com : : sun : : star : : form : : XLoadListener ,
XRowSetListener >
{
enum STATE { STARTED , LOADED , POSITIONED , DISPOSED } ;
STATE m_eState ;
Reference < XRowSet > m_xForm ;
: : osl : : Mutex m_aAccessSafety ;
public :
LoadFormHelper ( const Reference < XRowSet > & _rxForm ) ;
// ::com::sun::star::form::XLoadListener
virtual void SAL_CALL loaded ( const : : com : : sun : : star : : lang : : EventObject & aEvent ) throw ( RuntimeException ) ;
virtual void SAL_CALL unloaded ( const : : com : : sun : : star : : lang : : EventObject & aEvent ) throw ( RuntimeException ) ;
virtual void SAL_CALL unloading ( const : : com : : sun : : star : : lang : : EventObject & aEvent ) throw ( RuntimeException ) ;
virtual void SAL_CALL reloading ( const : : com : : sun : : star : : lang : : EventObject & aEvent ) throw ( RuntimeException ) ;
virtual void SAL_CALL reloaded ( const : : com : : sun : : star : : lang : : EventObject & aEvent ) throw ( RuntimeException ) ;
// XRowSetListener
virtual void SAL_CALL cursorMoved ( const : : com : : sun : : star : : lang : : EventObject & event ) throw ( RuntimeException ) ;
2006-06-20 01:55:50 +00:00
virtual void SAL_CALL rowChanged ( const : : com : : sun : : star : : lang : : EventObject & event ) throw ( RuntimeException ) ;
virtual void SAL_CALL rowSetChanged ( const : : com : : sun : : star : : lang : : EventObject & event ) throw ( RuntimeException ) ;
2000-10-26 13:46:14 +00:00
// ::com::sun::star::lang::XEventListener
virtual void SAL_CALL disposing ( const : : com : : sun : : star : : lang : : EventObject & Source ) throw ( RuntimeException ) ;
bool WaitUntilReallyLoaded ( bool _bOnlyIfLoaded ) ;
// waits 'til the first positioned event after the loaded event. returns true if successfull,
// false if the form was disposed or unloaded before or while waiting
// if _bOnlyIfLoaded is false and the form isn't loaded already loaded, false will be returned
// (without any wating)
void cancel ( ) ;
protected :
~ LoadFormHelper ( ) ;
void implDispose ( ) ;
} ;
2005-09-23 11:19:18 +00:00
DBG_NAME ( LoadFormHelper )
2000-10-26 13:46:14 +00:00
//------------------------------------------------------------------------------
LoadFormHelper : : LoadFormHelper ( const Reference < XRowSet > & _rxForm )
2006-06-20 01:55:50 +00:00
: m_eState ( STARTED )
, m_xForm ( _rxForm )
2000-10-26 13:46:14 +00:00
{
2005-09-23 11:19:18 +00:00
DBG_CTOR ( LoadFormHelper , NULL ) ;
2000-10-26 13:46:14 +00:00
Reference < : : com : : sun : : star : : form : : XLoadable > ( m_xForm , UNO_QUERY ) - > addLoadListener ( this ) ;
m_xForm - > addRowSetListener ( this ) ;
}
//------------------------------------------------------------------------------
LoadFormHelper : : ~ LoadFormHelper ( )
{
: : osl : : MutexGuard aGuard ( m_aAccessSafety ) ;
implDispose ( ) ;
2005-09-23 11:19:18 +00:00
DBG_DTOR ( LoadFormHelper , NULL ) ;
2000-10-26 13:46:14 +00:00
}
//------------------------------------------------------------------------------
void LoadFormHelper : : implDispose ( )
{
if ( DISPOSED ! = m_eState )
{
Reference < : : com : : sun : : star : : form : : XLoadable > ( m_xForm , UNO_QUERY ) - > removeLoadListener ( this ) ;
m_xForm - > removeRowSetListener ( this ) ;
m_xForm = NULL ;
m_eState = DISPOSED ;
}
}
//------------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SAL_CALL LoadFormHelper : : loaded ( const : : com : : sun : : star : : lang : : EventObject & /*aEvent*/ ) throw ( RuntimeException )
2000-10-26 13:46:14 +00:00
{
: : osl : : MutexGuard aGuard ( m_aAccessSafety ) ;
DBG_ASSERT ( m_eState = = STARTED | | m_eState = = DISPOSED , " LoadFormHelper::loaded : wrong call ! " ) ;
if ( m_eState = = STARTED )
m_eState = LOADED ;
}
//------------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SAL_CALL LoadFormHelper : : unloaded ( const : : com : : sun : : star : : lang : : EventObject & /*aEvent*/ ) throw ( RuntimeException )
2000-10-26 13:46:14 +00:00
{
: : osl : : MutexGuard aGuard ( m_aAccessSafety ) ;
DBG_ERROR ( " LoadFormHelper::unloaded : shouldn't be called ! " ) ;
implDispose ( ) ;
}
//------------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SAL_CALL LoadFormHelper : : unloading ( const : : com : : sun : : star : : lang : : EventObject & /*aEvent*/ ) throw ( RuntimeException )
2000-10-26 13:46:14 +00:00
{
}
//------------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SAL_CALL LoadFormHelper : : reloading ( const : : com : : sun : : star : : lang : : EventObject & /*aEvent*/ ) throw ( RuntimeException )
2000-10-26 13:46:14 +00:00
{
}
//------------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SAL_CALL LoadFormHelper : : reloaded ( const : : com : : sun : : star : : lang : : EventObject & /*aEvent*/ ) throw ( RuntimeException )
2000-10-26 13:46:14 +00:00
{
}
//------------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SAL_CALL LoadFormHelper : : cursorMoved ( const : : com : : sun : : star : : lang : : EventObject & /*event*/ ) throw ( RuntimeException )
2000-10-26 13:46:14 +00:00
{
: : osl : : MutexGuard aGuard ( m_aAccessSafety ) ;
if ( m_eState = = LOADED )
m_eState = POSITIONED ;
}
//------------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SAL_CALL LoadFormHelper : : rowChanged ( const : : com : : sun : : star : : lang : : EventObject & /*event*/ ) throw ( RuntimeException )
{
}
//------------------------------------------------------------------------------
void SAL_CALL LoadFormHelper : : rowSetChanged ( const : : com : : sun : : star : : lang : : EventObject & /*event*/ ) throw ( RuntimeException )
{
}
//------------------------------------------------------------------------------
void SAL_CALL LoadFormHelper : : disposing ( const : : com : : sun : : star : : lang : : EventObject & /*Source*/ ) throw ( RuntimeException )
2000-10-26 13:46:14 +00:00
{
: : osl : : MutexGuard aGuard ( m_aAccessSafety ) ;
implDispose ( ) ;
}
//------------------------------------------------------------------------------
void LoadFormHelper : : cancel ( )
{
implDispose ( ) ;
}
//------------------------------------------------------------------------------
bool LoadFormHelper : : WaitUntilReallyLoaded ( bool _bOnlyIfLoaded )
{
2006-06-20 01:55:50 +00:00
: : osl : : ResettableMutexGuard aGuard ( m_aAccessSafety ) ;
2000-10-26 13:46:14 +00:00
if ( DISPOSED = = m_eState )
return false ;
if ( _bOnlyIfLoaded & & ( STARTED = = m_eState ) )
// we did't get a "loaded" event ....
return false ;
sal_Bool bDone = ( POSITIONED = = m_eState ) ;
aGuard . clear ( ) ;
while ( ! bDone )
{
2006-06-20 01:55:50 +00:00
aGuard . reset ( ) ;
2000-10-26 13:46:14 +00:00
bDone = ( POSITIONED = = m_eState ) ;
2006-06-20 01:55:50 +00:00
aGuard . clear ( ) ;
2000-10-26 13:46:14 +00:00
}
2006-06-20 01:55:50 +00:00
aGuard . reset ( ) ;
2000-10-26 13:46:14 +00:00
implDispose ( ) ;
return true ;
}
//==================================================================
// LoadFormThread - a thread for asynchronously loading a form
//==================================================================
//------------------------------------------------------------------------------
void LoadFormThread : : run ( )
{
// On instantiation of a SfxCancellable the application is notified and 'switches on' the red stop button.
// Unfortunally this is conditioned with the acquirement of the solar mutex, and the application tries
// only once and ignores the notification if it fails.
// To prevent that we get the solar mutex and _block_ 'til we got it.
// As we are in the 'top level execution' of this thread (with a rather small stack and no other mutexes locked)
// we shouldn't experience problems with deadlocks ...
: : vos : : OClearableGuard aSolarGuard ( Application : : GetSolarMutex ( ) ) ;
ThreadStopper * pStopper = new ThreadStopper ( this , m_sStopperCaption ) ;
aSolarGuard . clear ( ) ;
// we're not canceled yet
: : osl : : ClearableMutexGuard aResetGuard ( m_aAccessSafety ) ;
m_bCanceled = sal_False ;
aResetGuard . clear ( ) ;
LoadFormHelper * pHelper = new LoadFormHelper ( m_xRowSet ) ;
pHelper - > acquire ( ) ;
// start it
bool bErrorOccured = false ;
2001-08-27 05:57:24 +00:00
Reference < XLoadable > xLoadable ( m_xRowSet , UNO_QUERY ) ;
2000-10-26 13:46:14 +00:00
try
{
Reference < XRowSet > xMove ( m_xRowSet , UNO_QUERY ) ;
2001-08-27 05:57:24 +00:00
DBG_ASSERT ( xLoadable . is ( ) & & xMove . is ( ) , " LoadFormThread::run : invalid cursor ! " ) ;
xLoadable - > load ( ) ;
2000-10-26 13:46:14 +00:00
// go to the first record if the load was successfull.
2001-08-27 05:57:24 +00:00
Reference < XColumnsSupplier > xColumnsSupplier ( m_xRowSet , UNO_QUERY ) ;
Reference < : : com : : sun : : star : : container : : XNameAccess > xCols = xColumnsSupplier . is ( ) ? xColumnsSupplier - > getColumns ( ) : Reference < : : com : : sun : : star : : container : : XNameAccess > ( ) ;
if ( xCols . is ( ) & & xCols - > hasElements ( ) )
2000-10-26 13:46:14 +00:00
xMove - > first ( ) ;
else
bErrorOccured = true ;
}
2001-01-09 14:52:33 +00:00
catch ( Exception & )
2000-10-26 13:46:14 +00:00
{
bErrorOccured = true ;
}
// check if we were canceled
: : osl : : ClearableMutexGuard aTestGuard ( m_aAccessSafety ) ;
2001-04-24 13:36:44 +00:00
bool bReallyCanceled = m_bCanceled ? true : false ; ;
2000-10-26 13:46:14 +00:00
aTestGuard . clear ( ) ;
bReallyCanceled | = bErrorOccured ;
// the load on the form is "slightly asyncronous" (which isn't covered by it's specification, anyway), so wait
// some time ....
// (though me thinks that the load of the new api is synchronous, so we won't need this LoadFormHelper anymore ...)
if ( ! bReallyCanceled )
pHelper - > WaitUntilReallyLoaded ( true ) ;
pHelper - > cancel ( ) ;
pHelper - > release ( ) ;
// yes, we were, but eventually the cancel request didn't reach the data source in time
if ( bReallyCanceled & & xLoadable . is ( ) & & xLoadable - > isLoaded ( ) )
xLoadable - > unload ( ) ;
pStopper - > OwnerTerminated ( ) ;
// this will cause the stopper to delete itself (in the main thread) so we don't have to take care of the
// solar mutex
}
//------------------------------------------------------------------------------
void LoadFormThread : : onTerminated ( )
{
: : osl : : ClearableMutexGuard aGuard ( m_aAccessSafety ) ;
if ( m_aTerminationHandler . IsSet ( ) )
{
// within the call of our termination handler we may be deleted, so do anything which is a member
// access before the call ...
// FS - #69801# - 02.12.99
Link aHandler ( m_aTerminationHandler ) ;
aGuard . clear ( ) ;
aHandler . Call ( this ) ;
}
else
{
// we are fully responsible for the data source and for ourself, so dispose the former ...
2001-08-27 05:57:24 +00:00
try
{
: : comphelper : : disposeComponent ( m_xRowSet ) ;
m_xRowSet = NULL ;
}
catch ( Exception & )
{
OSL_ENSURE ( 0 , " Exception thrown by dispose " ) ;
}
2000-10-26 13:46:14 +00:00
// ... and delete the latter
aGuard . clear ( ) ; // like above - releasing the mutex is a member access ...
delete this ;
}
}
//------------------------------------------------------------------------------
void LoadFormThread : : StopIt ( )
{
: : osl : : ClearableMutexGuard aResetGuard ( m_aAccessSafety ) ;
m_bCanceled = sal_True ;
aResetGuard . clear ( ) ;
2001-08-27 05:57:24 +00:00
Reference < XColumnsSupplier > xColumnsSupplier ( m_xRowSet , UNO_QUERY ) ;
if ( ! xColumnsSupplier . is ( ) )
2000-10-26 13:46:14 +00:00
{
DBG_ERROR ( " LoadFormThread::StopIt : invalid data source ! " ) ;
return ;
}
2001-08-27 05:57:24 +00:00
Reference < : : com : : sun : : star : : container : : XNameAccess > xCols ( xColumnsSupplier - > getColumns ( ) , UNO_QUERY ) ;
if ( ! xCols . is ( ) | | ! xCols - > hasElements ( ) )
2000-10-26 13:46:14 +00:00
// the cursor isn't alive, don't need to cancel
return ;
Reference < : : com : : sun : : star : : util : : XCancellable > xCancel ( m_xRowSet , UNO_QUERY ) ;
if ( xCancel . is ( ) )
{
try { xCancel - > cancel ( ) ; } catch ( SQLException & ) { }
// with this the cursor returns from it's load call, this terminates our run, this get's our termination handler to
// be called
// (the try-catch is just in case the cancel wasn't neccessary anymore)
}
}
//------------------------------------------------------------------------------
LoadFormThread : : ThreadStopper : : ThreadStopper ( LoadFormThread * pOwner , const String & rTitle )
: SfxCancellable ( SFX_APP ( ) - > GetCancelManager ( ) , rTitle )
, m_pOwner ( pOwner )
{
}
//------------------------------------------------------------------------------
void LoadFormThread : : ThreadStopper : : Cancel ( )
{
if ( ! m_pOwner )
return ;
: : osl : : MutexGuard aGuard ( m_pOwner - > m_aAccessSafety ) ;
if ( IsCancelled ( ) )
// we already did pass this to our owner
return ;
SfxCancellable : : Cancel ( ) ;
m_pOwner - > StopIt ( ) ;
}
//------------------------------------------------------------------------------
void LoadFormThread : : ThreadStopper : : OwnerTerminated ( )
{
m_pOwner = NULL ;
Application : : PostUserEvent ( LINK ( this , LoadFormThread : : ThreadStopper , OnDeleteInMainThread ) , this ) ;
}
//------------------------------------------------------------------------------
IMPL_LINK ( LoadFormThread : : ThreadStopper , OnDeleteInMainThread , LoadFormThread : : ThreadStopper * , pThis )
{
delete pThis ;
return 0L ;
}
2003-04-01 13:01:01 +00:00
// -----------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
sal_Int16 SbaXDataBrowserController : : getCurrentColumnPosition ( )
2003-04-01 13:01:01 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::getCurrentColumnPosition " ) ;
2003-04-01 13:01:01 +00:00
Reference < : : com : : sun : : star : : form : : XGrid > xGrid ( getBrowserView ( ) - > getGridControl ( ) , UNO_QUERY ) ;
2006-06-20 01:55:50 +00:00
sal_Int16 nViewPos = - 1 ;
2003-04-01 13:01:01 +00:00
try
{
if ( xGrid . is ( ) )
nViewPos = xGrid - > getCurrentColumnPosition ( ) ;
}
catch ( Exception & ) { }
return nViewPos ;
}
// -----------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
void SbaXDataBrowserController : : setCurrentColumnPosition ( sal_Int16 _nPos )
2003-04-01 13:01:01 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::setCurrentColumnPosition " ) ;
2003-04-01 13:01:01 +00:00
Reference < : : com : : sun : : star : : form : : XGrid > xGrid ( getBrowserView ( ) - > getGridControl ( ) , UNO_QUERY ) ;
try
{
if ( - 1 ! = _nPos )
xGrid - > setCurrentColumnPosition ( _nPos ) ;
}
catch ( Exception & ) { }
}
2004-06-01 09:11:12 +00:00
// -----------------------------------------------------------------------------
void SbaXDataBrowserController : : BeforeDrop ( )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::BeforeDrop " ) ;
2004-06-01 09:11:12 +00:00
Reference < : : com : : sun : : star : : sdb : : XSQLErrorBroadcaster > xFormError ( getRowSet ( ) , UNO_QUERY ) ;
if ( xFormError . is ( ) )
xFormError - > removeSQLErrorListener ( ( : : com : : sun : : star : : sdb : : XSQLErrorListener * ) this ) ;
}
// -----------------------------------------------------------------------------
void SbaXDataBrowserController : : AfterDrop ( )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::AfterDrop " ) ;
2004-06-01 09:11:12 +00:00
Reference < : : com : : sun : : star : : sdb : : XSQLErrorBroadcaster > xFormError ( getRowSet ( ) , UNO_QUERY ) ;
if ( xFormError . is ( ) )
xFormError - > addSQLErrorListener ( ( : : com : : sun : : star : : sdb : : XSQLErrorListener * ) this ) ;
}
2004-09-09 08:41:14 +00:00
// -----------------------------------------------------------------------------
2005-09-23 11:19:18 +00:00
void SbaXDataBrowserController : : addColumnListeners ( const Reference < : : com : : sun : : star : : awt : : XControlModel > & _xGridControlModel )
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::addColumnListeners " ) ;
2005-09-23 11:19:18 +00:00
// ... all the grid columns
Reference < : : com : : sun : : star : : container : : XIndexContainer > xColumns ( _xGridControlModel , UNO_QUERY ) ;
if ( xColumns . is ( ) )
{
sal_Int32 nCount = xColumns - > getCount ( ) ;
for ( sal_uInt16 i = 0 ; i < nCount ; + + i )
{
Reference < XPropertySet > xCol ( xColumns - > getByIndex ( i ) , UNO_QUERY ) ;
AddColumnListener ( xCol ) ;
}
}
}
// -----------------------------------------------------------------------------
2006-06-20 01:55:50 +00:00
sal_Bool SbaXDataBrowserController : : InitializeGridModel ( const Reference < : : com : : sun : : star : : form : : XFormComponent > & /*xGrid*/ )
2005-09-23 11:19:18 +00:00
{
2009-04-23 10:42:05 +00:00
RTL_LOGFILE_CONTEXT_AUTHOR ( aLogger , " dbaui " , " Ocke.Janssen@sun.com " , " SbaXDataBrowserController::InitializeGridModel " ) ;
2005-09-23 11:19:18 +00:00
return sal_True ;
}
2000-10-31 09:00:53 +00:00
//..................................................................
} // namespace dbaui
//..................................................................