Tag: cws_dev300_odbmacros3 User: fs Date: 2008-06-11 13:06:02+0000 Removed: dba/dbaccess/source/core/api/CKey.cxx dba/dbaccess/source/core/api/CKey.hxx dba/dbaccess/source/core/api/CKeyColumn.hxx dba/dbaccess/source/core/api/CKeyColumns.cxx dba/dbaccess/source/core/api/CKeyColumns.hxx dba/dbaccess/source/core/api/CKeys.cxx dba/dbaccess/source/core/api/CKeys.hxx dba/dbaccess/util/defs/wntmsci11 dba/dbaccess/util/defs/wntmsci12
Modified: dba/dbaccess/source/core/dataaccess/ModelImpl.cxx dba/dbaccess/source/core/dataaccess/documentdefinition.cxx dba/dbaccess/source/filter/xml/dbloader2.cxx dba/dbaccess/source/ui/browser/dbloader.cxx dba/dbaccess/source/ui/browser/unodatbr.cxx dba/dbaccess/source/ui/misc/TokenWriter.cxx dba/dbaccess/source/ui/misc/UITools.cxx dba/dbaccess/source/ui/misc/singledoccontroller.cxx dba/dbaccess/source/ui/querydesign/QueryDesignView.cxx dba/dbaccess/source/ui/relationdesign/RelationController.cxx dba/dbaccess/source/ui/tabledesign/TableController.cxx Log: RESYNC:; FILE REMOVED File Changes: Directory: /dba/dbaccess/source/core/api/ ========================================= File [removed]: CKey.cxx Directory: /dba/dbaccess/source/core/api/ ========================================= File [removed]: CKey.hxx Directory: /dba/dbaccess/source/core/api/ ========================================= File [removed]: CKeyColumn.hxx Directory: /dba/dbaccess/source/core/api/ ========================================= File [removed]: CKeyColumns.cxx Directory: /dba/dbaccess/source/core/api/ ========================================= File [removed]: CKeyColumns.hxx Directory: /dba/dbaccess/source/core/api/ ========================================= File [removed]: CKeys.cxx Directory: /dba/dbaccess/source/core/api/ ========================================= File [removed]: CKeys.hxx Directory: /dba/dbaccess/source/core/dataaccess/ ================================================ File [changed]: ModelImpl.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/ModelImpl.cxx?r1=1.25.6.4&r2=1.25.6.5 Delta lines: +20 -13 --------------------- --- ModelImpl.cxx 2008-05-09 09:26:40+0000 1.25.6.4 +++ ModelImpl.cxx 2008-06-11 13:04:42+0000 1.25.6.5 @@ -439,7 +439,7 @@ } // ......................................................................... - bool lcl_hasObjectWithMacros_throw( const ODefinitionContainer_Impl& _rObjectDefinitions, const SharedStorage& _rxContainerStorage ) + bool lcl_hasObjectWithMacros_throw( const ODefinitionContainer_Impl& _rObjectDefinitions, const Reference< XStorage >& _rxContainerStorage ) { bool bSomeDocHasMacros = false; @@ -477,8 +477,15 @@ try { - SharedStorage xContainerStorage( _rModel.getStorage( - _rModel.getObjectContainerStorageName( _eType ), ElementModes::READ ) ); + Reference< XStorage > xContainerStorage( _rModel.getStorage( + _rModel.getObjectContainerStorageName( _eType ), ElementModes::READWRITE ) ); + // note the READWRITE here: If the storage already existed before, then the OpenMode will + // be ignored, anyway. + // If the storage did not yet exist, then it will be created. If the database document + // is read-only, the OpenMode will be automatically downgraded to READ. Otherwise, + // the storage will in fact be created as READWRITE. While this is not strictly necessary + // for this particular use case here, it is required since the storage is *cached*, and + // later use cases will need the READWRITE mode. if ( xContainerStorage.is() ) bSomeDocHasMacros = lcl_hasObjectWithMacros_throw( rObjectDefinitions, xContainerStorage ); @@ -506,7 +513,7 @@ if ( !_rxContainerStorage->hasByName( _rPersistentName ) ) return false; - SharedStorage xObjectStor( _rxContainerStorage->openStorageElement( + Reference< XStorage > xObjectStor( _rxContainerStorage->openStorageElement( _rPersistentName, ElementModes::READ ) ); bHasMacros = ::sfx2::DocumentMacroMode::storageHasMacros( xObjectStor ); @@ -1053,25 +1060,25 @@ } // ----------------------------------------------------------------------------- -bool ODatabaseModelImpl::adjustMacroMode_AutoReject() +void ODatabaseModelImpl::revokeDataSource() const { - return m_aMacroMode.adjustMacroMode( NULL ); + if ( m_pDBContext && m_sDocumentURL.getLength() ) + m_pDBContext->deregisterPrivate( m_sDocumentURL ); } // ----------------------------------------------------------------------------- -void ODatabaseModelImpl::revokeDataSource() const +bool ODatabaseModelImpl::adjustMacroMode_AutoReject() { - if ( m_pDBContext && m_sDocumentURL.getLength() ) - m_pDBContext->deregisterPrivate( m_sDocumentURL ); + return m_aMacroMode.adjustMacroMode( NULL ); } // ----------------------------------------------------------------------------- -void ODatabaseModelImpl::checkMacrosOnLoading() +bool ODatabaseModelImpl::checkMacrosOnLoading() { ::comphelper::NamedValueCollection aArgs( m_aArgs ); Reference< XInteractionHandler > xInteraction; xInteraction = aArgs.getOrDefault( "InteractionHandler", xInteraction ); - m_aMacroMode.checkMacrosOnLoading( xInteraction ); + return m_aMacroMode.checkMacrosOnLoading( xInteraction ); } // ----------------------------------------------------------------------------- @@ -1175,8 +1182,8 @@ { if ( _rxNewRootStorage.is() ) _rxContainer->setRootStorage( _rxNewRootStorage ); - else - ; // TODO: what to do here? dispose the container? +// else + // TODO: what to do here? dispose the container? } } } Directory: /dba/dbaccess/source/core/dataaccess/ ================================================ File [changed]: documentdefinition.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/documentdefinition.cxx?r1=1.56.6.5&r2=1.56.6.6 Delta lines: +22 -16 --------------------- --- documentdefinition.cxx 2008-05-09 09:26:51+0000 1.56.6.5 +++ documentdefinition.cxx 2008-06-11 13:04:48+0000 1.56.6.6 @@ -898,9 +898,14 @@ } } - bool bExecuteDBDocMacros = m_pImpl->m_pDataSource->adjustMacroMode_AutoReject(); - // Note that we don't pass an interaction handler here. If the user has not been asked/notified - // by now (i.e. during loading the whole DB document), then this won't happen anymore. + bool bExecuteDBDocMacros = m_pImpl->m_pDataSource->checkMacrosOnLoading(); + // Note that this call implies the user might be asked for the macro execution mode. + // Normally, this would happen when the database document is loaded, and subsequent calls + // will simply use the user's decision from this point in time. + // However, it is possible to programmatically load forms/reports, without actually + // loading the database document into a frame. In this case, the user will be asked + // here and now. + // #i87741# / 2008-05-05 / [EMAIL PROTECTED] // allow the command arguments to downgrade the macro execution mode, but not to upgrade // it @@ -1690,6 +1695,7 @@ lcl_putLoadArgs( aMediaDesc, optional_bool(), optional_bool() ); // don't put _bSuppressMacros and _bReadOnly here - if the document was already // loaded, we should not tamper with its settings. + // #i88977# / 2008-05-05 / [EMAIL PROTECTED] // #i86872# / 2008-03-13 / [EMAIL PROTECTED] aMediaDesc >>= aArgs; Directory: /dba/dbaccess/source/filter/xml/ =========================================== File [changed]: dbloader2.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/filter/xml/dbloader2.cxx?r1=1.32.28.3&r2=1.32.28.4 Delta lines: +15 -3 -------------------- --- dbloader2.cxx 2008-05-07 08:30:52+0000 1.32.28.3 +++ dbloader2.cxx 2008-06-11 13:04:52+0000 1.32.28.4 @@ -59,6 +59,7 @@ #include <com/sun/star/task/XJobExecutor.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> /** === end UNO includes === **/ #include <comphelper/componentcontext.hxx> @@ -99,7 +100,6 @@ using namespace ::com::sun::star::embed; namespace css = ::com::sun::star; using namespace ::com::sun::star::ui::dialogs; -namespace css = ::com::sun::star; using ::com::sun::star::awt::XWindow; // ------------------------------------------------------------------------- @@ -435,12 +435,12 @@ ::rtl::OUString sViewName = aMediaDesc.getOrDefault( "ViewName", ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Default" ) ) ); aMediaDesc.remove( "ViewName" ); + sal_Bool bInteractive = sal_False; if ( !xModel.is() ) { Reference< XSingleServiceFactory > xDatabaseContext; if ( !m_aContext.createComponent( (::rtl::OUString)SERVICE_SDB_DATABASECONTEXT, xDatabaseContext ) ) throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "css.sdb.DatabaseContext not available" ) ), NULL ); - sal_Bool bInteractive = sal_False; ::rtl::OUString sFactoryName = SvtModuleOptions().GetFactoryEmptyDocumentURL(SvtModuleOptions::E_DATABASE); bCreateNew = sFactoryName.match(_rURL); @@ -560,6 +560,18 @@ if ( rListener.is() ) rListener->loadFinished(this); + if ( bCreateNew && bInteractive ) + { + Reference< css::view::XSelectionSupplier > xDocView( xModel->getCurrentController(), UNO_QUERY ); + if ( xDocView.is() ) + { + Sequence< NamedValue > aSelection(1); + aSelection[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Type")); + aSelection[0].Value <<= sal_Int32(0); + xDocView->select(makeAny(aSelection)); + } + } + if ( bStartTableWizard ) { // reset the data of the previous async drop (if any) Directory: /dba/dbaccess/source/ui/browser/ =========================================== File [changed]: dbloader.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/browser/dbloader.cxx?r1=1.36.2.1&r2=1.36.2.2 Delta lines: +4 -3 ------------------- --- dbloader.cxx 2008-05-08 12:59:49+0000 1.36.2.1 +++ dbloader.cxx 2008-06-11 13:04:55+0000 1.36.2.2 @@ -211,7 +211,8 @@ ServiceNameToImplName( URL_COMPONENT_DATASOURCEBROWSER, "org.openoffice.comp.dbu.ODatasourceBrowser" ), ServiceNameToImplName( URL_COMPONENT_QUERYDESIGN, "org.openoffice.comp.dbu.OQueryDesign" ), ServiceNameToImplName( URL_COMPONENT_TABLEDESIGN, "org.openoffice.comp.dbu.OTableDesign" ), - ServiceNameToImplName( URL_COMPONENT_RELATIONDESIGN, "org.openoffice.comp.dbu.ORelationDesign" ) + ServiceNameToImplName( URL_COMPONENT_RELATIONDESIGN, "org.openoffice.comp.dbu.ORelationDesign" ), + ServiceNameToImplName( URL_COMPONENT_VIEWDESIGN, "org.openoffice.comp.dbu.OViewDesign" ) }; INetURLObject aParser( rURL ); Directory: /dba/dbaccess/source/ui/browser/ =========================================== File [changed]: unodatbr.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/browser/unodatbr.cxx?r1=1.196.6.3&r2=1.196.6.4 Delta lines: +1 -1 ------------------- --- unodatbr.cxx 2008-05-09 09:27:17+0000 1.196.6.3 +++ unodatbr.cxx 2008-06-11 13:05:03+0000 1.196.6.4 @@ -2860,7 +2860,7 @@ { DBG_UNHANDLED_EXCEPTION(); } - return xDataSource; + return xDataSource.get(); } } Directory: /dba/dbaccess/source/ui/misc/ ======================================== File [changed]: TokenWriter.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/misc/TokenWriter.cxx?r1=1.36.14.2&r2=1.36.14.3 Delta lines: +62 -23 --------------------- --- TokenWriter.cxx 2008-04-15 13:13:03+0000 1.36.14.2 +++ TokenWriter.cxx 2008-06-11 13:05:07+0000 1.36.14.3 @@ -121,6 +121,10 @@ #ifndef _RTFOUT_HXX #include <svtools/rtfout.hxx> #endif +#include <svx/htmlcfg.hxx> +#include <connectivity/formattedcolumnvalue.hxx> +#include <svtools/syslocale.hxx> +#include <comphelper/componentcontext.hxx> using namespace dbaui; using namespace dbtools; @@ -164,9 +168,10 @@ ,m_bInInitialize(sal_False) ,m_bCheckOnly(sal_False) { - DBG_CTOR(ODatabaseImportExport,NULL); + m_eDestEnc = osl_getThreadTextEncoding(); + osl_incrementInterlockedCount( &m_refCount ); impl_initFromDescriptor( _aDataDescriptor, false ); @@ -193,6 +198,15 @@ ,m_bCheckOnly(sal_False) { DBG_CTOR(ODatabaseImportExport,NULL); + m_eDestEnc = osl_getThreadTextEncoding(); + try + { + SvtSysLocale aSysLocale; + m_aLocale = aSysLocale.GetLocaleData().getLocale(); + } + catch(Exception&) + { + } } //------------------------------------------------------------------- ODatabaseImportExport::~ODatabaseImportExport() @@ -277,6 +291,15 @@ if ( _bPlusDefaultInit ) initialize(); + + try + { + SvtSysLocale aSysLocale; + m_aLocale = aSysLocale.GetLocaleData().getLocale(); + } + catch(Exception&) + { + } } // ----------------------------------------------------------------------------- void ODatabaseImportExport::initialize() @@ -350,12 +373,7 @@ m_xObject->getPropertyValue(PROPERTY_FONT) >>= m_aFont; // the result set may be already set with the datadescriptor - if ( m_xResultSet.is() ) - { - m_xRow.set(m_xResultSet,UNO_QUERY); - m_xResultSetMetaData = Reference<XResultSetMetaDataSupplier>(m_xRow,UNO_QUERY)->getMetaData(); - } - else + if ( !m_xResultSet.is() ) { m_xResultSet.set(m_xFactory->createInstance(::rtl::OUString::createFromAscii("com.sun.star.sdb.RowSet")),UNO_QUERY); Reference<XPropertySet > xProp(m_xResultSet,UNO_QUERY); @@ -366,12 +384,11 @@ xProp->setPropertyValue(PROPERTY_COMMAND,makeAny(m_sName)); Reference<XRowSet> xRowSet(xProp,UNO_QUERY); xRowSet->execute(); - m_xRow.set(xRowSet,UNO_QUERY); - m_xResultSetMetaData = Reference<XResultSetMetaDataSupplier>(m_xRow,UNO_QUERY)->getMetaData(); } else OSL_ENSURE(sal_False, "ODatabaseImportExport::initialize: could not instantiate a rowset!"); - } + } // if ( !m_xResultSet.is() ) + impl_initializeRowMember_throw(); } catch(Exception& ) { @@ -393,6 +410,17 @@ m_bInInitialize = sal_False; } +// ----------------------------------------------------------------------------- +void ODatabaseImportExport::impl_initializeRowMember_throw() +{ + if ( !m_xRow.is() && m_xResultSet.is() ) + { + m_xRow.set(m_xResultSet,UNO_QUERY); + m_xResultSetMetaData = Reference<XResultSetMetaDataSupplier>(m_xRow,UNO_QUERY)->getMetaData(); + Reference<XColumnsSupplier> xSup(m_xResultSet,UNO_QUERY_THROW); + m_xRowSetColumns.set(xSup->getColumns(),UNO_QUERY_THROW); + } +} //====================================================================== BOOL ORTFImportExport::Write() { @@ -579,6 +607,8 @@ (*m_pStream) << ODatabaseImportExport::sNewLine << '}'; (*m_pStream) << ODatabaseImportExport::sNewLine; + ::comphelper::ComponentContext aContext(m_xFactory); + Reference< XRowSet > xRowSet(m_xRow,UNO_QUERY); sal_Int32 k=1; sal_Int32 kk=0; m_xResultSet->beforeFirst(); // set back before the first row @@ -616,9 +646,13 @@ try { - ::rtl::OUString sValue = m_xRow->getString(i); - if (!m_xRow->wasNull()) - RTFOutFuncs::Out_String(*m_pStream,sValue,eDestEnc); + Reference<XPropertySet> xColumn(m_xRowSetColumns->getByIndex(i-1),UNO_QUERY_THROW); + dbtools::FormattedColumnValue aFormatedValue(aContext,xRowSet,xColumn); + ::rtl::OUString sValue = aFormatedValue.getFormattedValue(); + // m_xRow->getString(i); + //if (!m_xRow->wasNull()) + if ( sValue.getLength() ) + RTFOutFuncs::Out_String(*m_pStream,sValue,m_eDestEnc); } catch (Exception&) { @@ -699,6 +733,9 @@ ,m_bCheckFont(FALSE) #endif { + // set HTML configuration + SvxHtmlOptions* pHtmlOptions = SvxHtmlOptions::Get(); + m_eDestEnc = pHtmlOptions->GetTextEncoding(); strncpy( sIndent, sIndentSource ,std::min(sizeof(sIndent),sizeof(sIndentSource))); sIndent[0] = 0; } @@ -911,7 +948,8 @@ TAG_ON_LF( sHTML_tbody ); // 2. und jetzt die Daten - + ::comphelper::ComponentContext aContext(m_xFactory); + Reference< XRowSet > xRowSet(m_xRow,UNO_QUERY); sal_Int32 j=1; sal_Int32 kk=0; m_xResultSet->beforeFirst(); // set back before the first row @@ -931,8 +969,10 @@ String aValue; try { - ::rtl::OUString sValue = m_xRow->getString(i); - if (!m_xRow->wasNull()) + Reference<XPropertySet> xColumn(m_xRowSetColumns->getByIndex(i-1),UNO_QUERY_THROW); + dbtools::FormattedColumnValue aFormatedValue(aContext,xRowSet,xColumn); + ::rtl::OUString sValue = aFormatedValue.getFormattedValue(); + if (sValue.getLength()) { aValue = sValue; } @@ -966,11 +1006,9 @@ IncIndent(-1); TAG_OFF_LF( sHTML_table ); } //----------------------------------------------------------------------- -void OHTMLImportExport::WriteCell( sal_Int32 nFormat,sal_Int32 nWidthPixel,sal_Int32 nHeightPixel,const char* pChar,const String& rValue,const char* pHtmlTag) +void OHTMLImportExport::WriteCell( sal_Int32 nFormat,sal_Int32 nWidthPixel,sal_Int32 nHeightPixel,const char* pChar, + const String& rValue,const char* pHtmlTag) { - BOOL bValueData; - bValueData = FALSE; - ::rtl::OString aStrTD = pHtmlTag; nWidthPixel = nWidthPixel ? nWidthPixel : 86; @@ -1005,12 +1043,12 @@ { fVal = m_xFormatter->convertStringToNumber(nFormat,rValue); ByteString aTmpString(aStrTD); - HTMLOutFuncs::CreateTableDataOptionsValNum( aTmpString, bValueData, fVal,nFormat, *pFormatter ); + HTMLOutFuncs::CreateTableDataOptionsValNum( aTmpString, FALSE, fVal,nFormat, *pFormatter ); } catch(Exception&) { ByteString aTmpString(aStrTD); - HTMLOutFuncs::CreateTableDataOptionsValNum( aTmpString, bValueData, fVal,nFormat, *pFormatter ); + HTMLOutFuncs::CreateTableDataOptionsValNum( aTmpString, FALSE, fVal,nFormat, *pFormatter ); } } @@ -1031,7 +1069,8 @@ if ( !rValue.Len() ) TAG_ON( sHTML_linebreak ); // #42573# keine komplett leere Zelle else - OUT_STR( rValue ); + HTMLOutFuncs::Out_String( (*m_pStream), rValue ,m_eDestEnc); + if ( bStrikeout ) TAG_OFF( sHTML_strike ); if ( bUnderline ) TAG_OFF( sHTML_underline ); Directory: /dba/dbaccess/source/ui/misc/ ======================================== File [changed]: UITools.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/misc/UITools.cxx?r1=1.77.6.2&r2=1.77.6.3 Delta lines: +4 -10 -------------------- --- UITools.cxx 2008-04-15 13:13:07+0000 1.77.6.2 +++ UITools.cxx 2008-06-11 13:05:13+0000 1.77.6.3 @@ -487,24 +487,18 @@ } // ----------------------------------------------------------------------------- -::std::vector< Reference<XNameAccess> > getKeyColumns(const Reference<XPropertySet >& _rxTable, +::std::vector< Reference<XNameAccess> > getKeyColumns(const Reference<XIndexAccess >& _rxKeys, sal_Int32 _nKeyType) { // use keys and indexes for excat postioning // first the keys - Reference<XKeysSupplier> xKeySup(_rxTable,UNO_QUERY); - Reference<XIndexAccess> xKeys; - if(xKeySup.is()) - xKeys = xKeySup->getKeys(); - ::std::vector< Reference<XNameAccess> > vRet; - - if(xKeys.is()) + if(_rxKeys.is()) { Reference<XPropertySet> xProp; - for(sal_Int32 i=0;i< xKeys->getCount();++i) + for(sal_Int32 i=0;i< _rxKeys->getCount();++i) { - xKeys->getByIndex(i) >>= xProp; + _rxKeys->getByIndex(i) >>= xProp; sal_Int32 nKeyType = 0; xProp->getPropertyValue(PROPERTY_TYPE) >>= nKeyType; if(_nKeyType == nKeyType) Directory: /dba/dbaccess/source/ui/misc/ ======================================== File [changed]: singledoccontroller.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/misc/singledoccontroller.cxx?r1=1.23.6.2&r2=1.23.6.3 Delta lines: +12 -2 -------------------- --- singledoccontroller.cxx 2008-04-15 13:13:21+0000 1.23.6.2 +++ singledoccontroller.cxx 2008-06-11 13:05:17+0000 1.23.6.3 @@ -624,7 +624,17 @@ // ----------------------------------------------------------------------------- Reference< XDatabaseMetaData > OSingleDocumentController::getMetaData( ) const { - return isConnected() ? m_pImpl->m_xConnection->getMetaData() : Reference< XDatabaseMetaData >(); + Reference< XDatabaseMetaData > xMeta; + try + { + if ( isConnected() ) + xMeta.set( m_pImpl->m_xConnection->getMetaData(), UNO_SET_THROW ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return xMeta; } // ----------------------------------------------------------------------------- Directory: /dba/dbaccess/source/ui/querydesign/ =============================================== File [changed]: QueryDesignView.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/querydesign/QueryDesignView.cxx?r1=1.90.32.2&r2=1.90.32.3 Delta lines: +8 -0 ------------------- --- QueryDesignView.cxx 2008-04-15 13:13:24+0000 1.90.32.2 +++ QueryDesignView.cxx 2008-06-11 13:05:24+0000 1.90.32.3 @@ -1533,8 +1533,12 @@ OTableFieldDescRef aDragLeft = new OTableFieldDesc(); if ( eOk == ( eErrorCode = FillDragInfo(_pView,pValueExp,aDragLeft) )) + { + if ( bHaving ) + aDragLeft->SetGroupBy(sal_True); _pSelectionBrw->AddCondition(aDragLeft, aCondition, nLevel,bAddOrOnOneLine); } + } else if(SQL_ISRULEOR2(pValueExp,general_set_fct ,set_fct_spec) || SQL_ISRULEOR2(pValueExp,position_exp,extract_exp) || SQL_ISRULEOR2(pValueExp,fold,char_substring_fct) || @@ -1572,9 +1576,13 @@ ::rtl::OUString sCondition = ParseCondition(pController,pCondition,sDecimal,aLocale,1); OTableFieldDescRef aDragLeft = new OTableFieldDesc(); if ( eOk == ( eErrorCode = FillDragInfo(_pView,pCondition->getChild(0),aDragLeft)) ) + { + if ( bHaving ) + aDragLeft->SetGroupBy(sal_True); _pSelectionBrw->AddCondition(aDragLeft, sCondition, nLevel,bAddOrOnOneLine); } } + } else if( SQL_ISRULEOR2(pCondition,existence_test,unique_test) ) { Directory: /dba/dbaccess/source/ui/relationdesign/ ================================================== File [changed]: RelationController.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/relationdesign/RelationController.cxx?r1=1.51.6.2&r2=1.51.6.3 Delta lines: +85 -79 --------------------- --- RelationController.cxx 2008-04-15 13:13:33+0000 1.51.6.2 +++ RelationController.cxx 2008-06-11 13:05:28+0000 1.51.6.3 @@ -415,37 +415,42 @@ // ----------------------------------------------------------------------------- void ORelationController::loadTableData(const Any& _aTable) { - Reference<XIndexAccess> xKeys; - Reference<XKeysSupplier> xKeySup(_aTable,UNO_QUERY); + Reference<XPropertySet> xTableProp(_aTable,UNO_QUERY); + const ::rtl::OUString sSourceName = ::dbtools::composeTableName( getConnection()->getMetaData(), xTableProp, ::dbtools::eInTableDefinitions, false, false, false ); + TTableWindowData::value_type pReferencingTable = existsTable(sSourceName); + bool bNotFound = true, bAdded = false; + if ( !pReferencingTable ) + { + pReferencingTable.reset(new OTableWindowData(xTableProp,sSourceName, sSourceName)); + pReferencingTable->ShowAll(FALSE); + bAdded = true; + m_vTableData.push_back(pReferencingTable); + } + + Reference<XIndexAccess> xKeys = pReferencingTable->getKeys(); + Reference<XKeysSupplier> xKeySup(xTableProp,UNO_QUERY); - if ( xKeySup.is() ) + if ( !xKeys.is() && xKeySup.is() ) { xKeys = xKeySup->getKeys(); + } + if ( xKeys.is() ) { - Reference<XPropertySet> xTableProp(xKeySup,UNO_QUERY); Reference<XPropertySet> xKey; - for(sal_Int32 i=0;i< xKeys->getCount();++i) + const sal_Int32 nCount = xKeys->getCount(); + for(sal_Int32 i = 0 ; i < nCount ; ++i) { xKeys->getByIndex(i) >>= xKey; sal_Int32 nKeyType = 0; xKey->getPropertyValue(PROPERTY_TYPE) >>= nKeyType; if ( KeyType::FOREIGN == nKeyType ) { - ::rtl::OUString sSourceName,sReferencedTable; - - sSourceName = ::dbtools::composeTableName( getConnection()->getMetaData(), xTableProp, ::dbtools::eInTableDefinitions, false, false, false ); + bNotFound = false; + ::rtl::OUString sReferencedTable; xKey->getPropertyValue(PROPERTY_REFERENCEDTABLE) >>= sReferencedTable; ////////////////////////////////////////////////////////////////////// // insert windows - TTableWindowData::value_type pReferencingTable = existsTable(sSourceName); - if ( !pReferencingTable ) - { - pReferencingTable.reset(new OTableWindowData(xTableProp,sSourceName, sSourceName)); - pReferencingTable->ShowAll(FALSE); - m_vTableData.push_back(pReferencingTable); - } - TTableWindowData::value_type pReferencedTable = existsTable(sReferencedTable); if ( !pReferencedTable ) { @@ -502,8 +507,9 @@ pTabConnData->SetCardinality(); } } - } - } + } // if ( xKeys.is() ) + if ( bNotFound && bAdded ) + m_vTableData.pop_back(); } // ----------------------------------------------------------------------------- TTableWindowData::value_type ORelationController::existsTable(const ::rtl::OUString& _rComposedTableName) const 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.117.6.2&r2=1.117.6.3 Delta lines: +14 -1 -------------------- --- TableController.cxx 2008-04-15 13:13:39+0000 1.117.6.2 +++ TableController.cxx 2008-06-11 13:05:33+0000 1.117.6.3 @@ -861,7 +861,20 @@ return; // the database doesn't support keys OSL_ENSURE(_rxSup.is(),"No XKeysSupplier!"); - Reference<XDataDescriptorFactory> xKeyFactory(_rxSup->getKeys(),UNO_QUERY); + Reference<XIndexAccess> xKeys(_rxSup->getKeys(),UNO_QUERY); + Reference<XPropertySet> xProp; + const sal_Int32 nCount = xKeys->getCount(); + for(sal_Int32 i=0;i< nCount ;++i) + { + xKeys->getByIndex(i) >>= xProp; + sal_Int32 nKeyType = 0; + xProp->getPropertyValue(PROPERTY_TYPE) >>= nKeyType; + if(KeyType::PRIMARY == nKeyType) + { + return; // primary key already exists after appending a column + } + } + Reference<XDataDescriptorFactory> xKeyFactory(xKeys,UNO_QUERY); OSL_ENSURE(xKeyFactory.is(),"No XDataDescriptorFactory Interface!"); if ( !xKeyFactory.is() ) return; Directory: /dba/dbaccess/util/defs/ =================================== File [removed]: wntmsci11 Directory: /dba/dbaccess/util/defs/ =================================== File [removed]: wntmsci12 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
