User: obo Date: 2006/07/10 08:46:24 Modified: dba/dbaccess/source/ui/tabledesign/TableController.cxx
Log: INTEGRATION: CWS qiq (1.103.2); FILE MERGED 2006/06/27 13:00:12 fs 1.103.2.6: RESYNC: (1.103-1.104); FILE MERGED 2006/06/19 09:27:53 fs 1.103.2.5: during #i51143#: A FeatureState can now transport more than one state. In particular, it has typed bChecked and sTitle members, instead of the previous unchecked aState 2006/05/24 06:49:31 fs 1.103.2.4: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/18 09:18:41 fs 1.103.2.3: #i51143# when creating/pasting/saving a table/query, care for name collisions with both tables and queries (usign a DynamicTableOrQueryNameCheck), if the database supports queries in queries 2006/05/17 11:49:03 fs 1.103.2.2: refactored OSaveAsDlg in preparation of #i51143# 2006/05/12 13:47:02 fs 1.103.2.1: #i51143# refactoring of controller initialization, which allows accessing the load arguments even during Construct (and not only in the - later - impl_initialize) File Changes: Directory: /dba/dbaccess/source/ui/tabledesign/ =============================================== File [changed]: TableController.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/tabledesign/TableController.cxx?r1=1.104&r2=1.105 Delta lines: +29 -40 --------------------- --- TableController.cxx 20 Jun 2006 03:32:34 -0000 1.104 +++ TableController.cxx 10 Jul 2006 15:46:21 -0000 1.105 @@ -57,6 +57,9 @@ #ifndef DBACCESS_SHARED_DBUSTRINGS_HRC #include "dbustrings.hrc" #endif +#ifndef DBACCESS_SOURCE_UI_INC_DEFAULTOBJECTNAMECHECK_HXX +#include "defaultobjectnamecheck.hxx" +#endif #ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> #endif @@ -292,7 +295,7 @@ aReturn.bEnabled = sal_True; break; case ID_BROWSER_EDITDOC: - aReturn.aState = ::cppu::bool2any(isEditable()); + aReturn.bChecked = isEditable(); aReturn.bEnabled = m_bNew || isEditable();// the editable flag is set through this one -> || isAddAllowed() || isDropAllowed() || isAlterAllowed(); break; case ID_BROWSER_SAVEDOC: @@ -422,16 +425,15 @@ aDefaultName = ::dbaui::createDefaultName(getConnection()->getMetaData(),xTables,aName); } - OSaveAsDlg aDlg(getView(),CommandType::TABLE,xTables,getConnection()->getMetaData(),getConnection(),aDefaultName); - if(aDlg.Execute() == RET_OK) - { + DynamicTableOrQueryNameCheck aNameChecker( getConnection(), CommandType::TABLE ); + OSaveAsDlg aDlg( getView(), CommandType::TABLE, getORB(), getConnection(), aDefaultName, aNameChecker ); + if ( aDlg.Execute() != RET_OK ) + return sal_False; + m_sName = aDlg.getName(); sCatalog = aDlg.getCatalog(); sSchema = aDlg.getSchema(); } - else - return sal_False; - } // did we get a name if(!m_sName.getLength()) @@ -486,7 +488,7 @@ if(!m_xTable.is()) // correct name and try again { // it can be that someone inserted new data for us - m_sName = ::dbtools::composeTableName(getConnection()->getMetaData(),xTable,sal_False,::dbtools::eInDataManipulation); + m_sName = ::dbtools::composeTableName( getConnection()->getMetaData(), xTable, ::dbtools::eInDataManipulation, false, false, false ); assignTable(); } // now check if our datasource has set a tablefilter and if append the new table name to it @@ -513,9 +515,9 @@ } catch(const ElementExistException& ) { - String sText( ModuleRes(STR_OBJECT_ALREADY_EXISTS)); + String sText( ModuleRes( STR_NAME_ALREADY_EXISTS ) ); sText.SearchAndReplaceAscii( "#" , m_sName); - OSQLMessageBox aDlg(getView(), String(ModuleRes(STR_OBJECT_ALREADY_EXSISTS)), sText, WB_OK, OSQLMessageBox::Error); + OSQLMessageBox aDlg( getView(), String( ModuleRes( STR_ERROR_DURING_CREATION ) ), sText, WB_OK, OSQLMessageBox::Error ); aDlg.Execute(); bError = sal_True; @@ -596,35 +598,22 @@ } // ----------------------------------------------------------------------------- -void OTableController::impl_initialize( const Sequence< Any >& aArguments ) +void OTableController::impl_initialize() { try { - OTableController_BASE::impl_initialize(aArguments); + OTableController_BASE::impl_initialize(); - PropertyValue aValue; - const Any* pIter = aArguments.getConstArray(); - const Any* pEnd = pIter + aArguments.getLength(); + const NamedValueCollection& rArguments( getInitParams() ); - for(;pIter != pEnd;++pIter) - { - if (!(*pIter >>= aValue)) - throw Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid type in argument list. PropertyValue expected.")),*this); - if ( 0 == aValue.Name.compareToAscii(PROPERTY_ACTIVECONNECTION) ) - { - Reference< XConnection > xConn; - if ( !(aValue.Value >>= xConn) ) - throw Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid argument type for ActiveConnection.")),*this); - OSL_ENSURE( xConn.is(), "OTableController::initialize: invalid connection given!!" ); - if ( xConn.is() ) - initializeConnection( xConn ); - } - else if (0 == aValue.Name.compareToAscii(PROPERTY_CURRENTTABLE)) - { - if ( !(aValue.Value >>= m_sName) ) + Reference< XConnection > xConnection; + xConnection = rArguments.getOrDefault( (::rtl::OUString)PROPERTY_ACTIVECONNECTION, xConnection ); + if ( xConnection.is() ) + initializeConnection( xConnection ); + + if ( !rArguments.getIfExists_ensureType( (::rtl::OUString)PROPERTY_CURRENTTABLE, m_sName ) ) throw Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid argument type for CurrentTable.")),*this); - } - } + // read autoincrement value set in the datasource ::dbaui::fillAutoIncrementValue(getDataSource(),m_bAllowAutoIncrementValue,m_sAutoIncrementValue); @@ -1645,7 +1634,7 @@ if ( m_sName.getLength() && getConnection().is() ) { if ( m_xTable.is() ) - sTitle = ::dbtools::composeTableName(getConnection()->getMetaData(),m_xTable,sal_False,::dbtools::eInDataManipulation); + sTitle = ::dbtools::composeTableName( getConnection()->getMetaData(), m_xTable, ::dbtools::eInDataManipulation, false, false, false ); else sTitle = m_sName; } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
