diff options
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/cui/dbregister.cxx | 147 | ||||
-rw-r--r-- | svx/source/cui/dbregister.hxx | 2 | ||||
-rw-r--r-- | svx/source/cui/dbregisterednamesconfig.cxx | 176 | ||||
-rw-r--r-- | svx/source/cui/dbregistersettings.cxx | 18 | ||||
-rw-r--r-- | svx/source/cui/dbregistersettings.hxx | 40 | ||||
-rw-r--r-- | svx/source/fmcomp/fmgridcl.cxx | 14 | ||||
-rw-r--r-- | svx/source/fmcomp/fmgridif.cxx | 66 | ||||
-rw-r--r-- | svx/source/fmcomp/gridctrl.cxx | 46 | ||||
-rw-r--r-- | svx/source/form/fmvwimp.cxx | 6 | ||||
-rw-r--r-- | svx/source/form/formcontrolfactory.cxx | 3 | ||||
-rw-r--r-- | svx/source/src/app.src | 19 |
11 files changed, 271 insertions, 266 deletions
diff --git a/svx/source/cui/dbregister.cxx b/svx/source/cui/dbregister.cxx index 0a38f57481..eb5ac61b4c 100644 --- a/svx/source/cui/dbregister.cxx +++ b/svx/source/cui/dbregister.cxx @@ -197,7 +197,7 @@ DbRegistrationOptionsPage::~DbRegistrationOptionsPage() pHeaderBar->Hide(); for ( USHORT i = 0; i < pPathBox->GetEntryCount(); ++i ) - delete static_cast<String*>(pPathBox->GetEntry(i)->GetUserData()); + delete static_cast< DatabaseRegistration* >( pPathBox->GetEntry(i)->GetUserData() ); delete pPathBox; delete pHeaderBar; } @@ -216,21 +216,22 @@ BOOL DbRegistrationOptionsPage::FillItemSet( SfxItemSet& rCoreSet ) { // the settings for the single drivers sal_Bool bModified = sal_False; - TNameLocationMap aMap; + DatabaseRegistrations aRegistrations; ULONG nCount = pPathBox->GetEntryCount(); for ( ULONG i = 0; i < nCount; ++i ) { SvLBoxEntry* pEntry = pPathBox->GetEntry(i); - String* pPath = static_cast<String*>(pEntry->GetUserData()); - if ( pPath && pPath->Len() ) + DatabaseRegistration* pRegistration = static_cast< DatabaseRegistration* >( pEntry->GetUserData() ); + if ( pRegistration && pRegistration->sLocation.getLength() ) { - OFileNotation aTransformer(*pPath); - aMap.insert(TNameLocationMap::value_type(::rtl::OUString(pPathBox->GetEntryText(pEntry,0)),aTransformer.get(OFileNotation::N_URL))); + ::rtl::OUString sName( pPathBox->GetEntryText( pEntry, 0 ) ); + OFileNotation aTransformer( pRegistration->sLocation ); + aRegistrations[ sName ] = DatabaseRegistration( aTransformer.get( OFileNotation::N_URL ), pRegistration->bReadOnly ); } } - if ( m_nOldCount != aMap.size() || m_bModified ) + if ( m_nOldCount != aRegistrations.size() || m_bModified ) { - rCoreSet.Put(DatabaseMapItem(SID_SB_DB_REGISTER, aMap), SID_SB_DB_REGISTER); + rCoreSet.Put(DatabaseMapItem( SID_SB_DB_REGISTER, aRegistrations ), SID_SB_DB_REGISTER); bModified = sal_True; } @@ -242,47 +243,44 @@ BOOL DbRegistrationOptionsPage::FillItemSet( SfxItemSet& rCoreSet ) void DbRegistrationOptionsPage::Reset( const SfxItemSet& rSet ) { // the settings for the single drivers - SFX_ITEMSET_GET( rSet, pSettings, DatabaseMapItem, SID_SB_DB_REGISTER, sal_True ); + SFX_ITEMSET_GET( rSet, pRegistrations, DatabaseMapItem, SID_SB_DB_REGISTER, sal_True ); + if ( !pRegistrations ) + return; - if ( pSettings ) + pPathBox->Clear(); + + const DatabaseRegistrations& rRegistrations = pRegistrations->getRegistrations(); + m_nOldCount = rRegistrations.size(); + DatabaseRegistrations::const_iterator aIter = rRegistrations.begin(); + DatabaseRegistrations::const_iterator aEnd = rRegistrations.end(); + for ( ; aIter != aEnd; ++aIter ) + { + OFileNotation aTransformer( aIter->second.sLocation ); + insertNewEntry( aIter->first, aTransformer.get( OFileNotation::N_SYSTEM ), aIter->second.bReadOnly ); + } + + String aUserData = GetUserData(); + if ( aUserData.Len() ) { - // TabListBox f"ullen - pPathBox->Clear(); - - const TNameLocationMap& rMap = pSettings->getSettings(); - m_nOldCount = rMap.size(); - TNameLocationMap::const_iterator aIter = rMap.begin(); - TNameLocationMap::const_iterator aEnd = rMap.end(); - for (; aIter != aEnd; ++aIter) + // Spaltenbreite restaurieren + pHeaderBar->SetItemSize( ITEMID_TYPE, aUserData.GetToken(0).ToInt32() ); + HeaderEndDrag_Impl( NULL ); + // Sortierrichtung restaurieren + BOOL bUp = (BOOL)(USHORT)aUserData.GetToken(1).ToInt32(); + HeaderBarItemBits nBits = pHeaderBar->GetItemBits(ITEMID_TYPE); + + if ( bUp ) { - OFileNotation aTransformer(aIter->second); - insertNewEntry(aIter->first,aTransformer.get(OFileNotation::N_SYSTEM)); + nBits &= ~HIB_UPARROW; + nBits |= HIB_DOWNARROW; } - - String aUserData = GetUserData(); - - if ( aUserData.Len() ) + else { - // Spaltenbreite restaurieren - pHeaderBar->SetItemSize( ITEMID_TYPE, aUserData.GetToken(0).ToInt32() ); - HeaderEndDrag_Impl( NULL ); - // Sortierrichtung restaurieren - BOOL bUp = (BOOL)(USHORT)aUserData.GetToken(1).ToInt32(); - HeaderBarItemBits nBits = pHeaderBar->GetItemBits(ITEMID_TYPE); - - if ( bUp ) - { - nBits &= ~HIB_UPARROW; - nBits |= HIB_DOWNARROW; - } - else - { - nBits &= ~HIB_DOWNARROW; - nBits |= HIB_UPARROW; - } - pHeaderBar->SetItemBits( ITEMID_TYPE, nBits ); - HeaderSelect_Impl( NULL ); + nBits &= ~HIB_DOWNARROW; + nBits |= HIB_UPARROW; } + pHeaderBar->SetItemBits( ITEMID_TYPE, nBits ); + HeaderSelect_Impl( NULL ); } } @@ -323,16 +321,19 @@ IMPL_LINK( DbRegistrationOptionsPage, NewHdl, void *, EMPTYARG ) IMPL_LINK( DbRegistrationOptionsPage, EditHdl, void *, EMPTYARG ) { SvLBoxEntry* pEntry = pPathBox->GetCurEntry(); - if ( pEntry ) - { - String* pOldLocation = static_cast<String*>(pEntry->GetUserData()); - String sOldName = pPathBox->GetEntryText(pEntry,0); - m_pCurEntry = pEntry; - openLinkDialog(sOldName,*pOldLocation,pEntry); - m_pCurEntry = NULL; - } + if ( !pEntry ) + return 0L; - return 0; + DatabaseRegistration* pOldRegistration = static_cast< DatabaseRegistration* >( pEntry->GetUserData() ); + if ( !pOldRegistration || pOldRegistration->bReadOnly ) + return 0L; + + String sOldName = pPathBox->GetEntryText(pEntry,0); + m_pCurEntry = pEntry; + openLinkDialog( sOldName, pOldRegistration->sLocation, pEntry ); + m_pCurEntry = NULL; + + return 1L; } // ----------------------------------------------------------------------- @@ -397,28 +398,42 @@ IMPL_LINK( DbRegistrationOptionsPage, HeaderEndDrag_Impl, HeaderBar*, pBar ) // ----------------------------------------------------------------------- IMPL_LINK( DbRegistrationOptionsPage, PathSelect_Impl, SvTabListBox *, EMPTYARG ) - -/* [Beschreibung] - -*/ - { SvLBoxEntry* pEntry = pPathBox->FirstSelected(); - m_aEdit.Enable( pEntry != NULL); - m_aDelete.Enable( pEntry != NULL); + bool bReadOnly = true; + if ( pEntry ) + { + DatabaseRegistration* pRegistration = static_cast< DatabaseRegistration* >( pEntry->GetUserData() ); + bReadOnly = pRegistration->bReadOnly; + } + + m_aEdit.Enable( !bReadOnly ); + m_aDelete.Enable( !bReadOnly ); return 0; } // ----------------------------------------------------------------------------- -void DbRegistrationOptionsPage::insertNewEntry(const ::rtl::OUString& _sName,const ::rtl::OUString& _sLocation) +void DbRegistrationOptionsPage::insertNewEntry( const ::rtl::OUString& _sName,const ::rtl::OUString& _sLocation, const bool _bReadOnly ) { String aStr( _sName ); aStr += '\t'; aStr += String(_sLocation); - SvLBoxEntry* pEntry = pPathBox->InsertEntry( aStr ); - String* pLocation = new String( _sLocation ); - pEntry->SetUserData( pLocation ); + + SvLBoxEntry* pEntry = NULL; + if ( _bReadOnly ) + { + sal_Bool bHighContrast = pPathBox->GetDisplayBackground().GetColor().IsDark(); + Image aLocked( SVX_RES( bHighContrast ? RID_SVXBMP_LOCK_HC : RID_SVXBMP_LOCK ) ); + pEntry = pPathBox->InsertEntry( aStr, aLocked, aLocked ); + } + else + { + pEntry = pPathBox->InsertEntry( aStr ); + } + + pEntry->SetUserData( new DatabaseRegistration( _sLocation, _bReadOnly ) ); } + // ----------------------------------------------------------------------------- String DbRegistrationOptionsPage::getFileLocation(const String& _sLocation) { @@ -489,10 +504,10 @@ void DbRegistrationOptionsPage::openLinkDialog(const String& _sOldName,const Str { if ( _pEntry ) { - delete static_cast<String*>(_pEntry->GetUserData()); - pPathBox->GetModel()->Remove(_pEntry); + delete static_cast< DatabaseRegistration* >( _pEntry->GetUserData() ); + pPathBox->GetModel()->Remove( _pEntry ); } - insertNewEntry(sNewName,sNewLocation); + insertNewEntry( sNewName, sNewLocation, false ); m_bModified = sal_True; } } diff --git a/svx/source/cui/dbregister.hxx b/svx/source/cui/dbregister.hxx index 303687300e..b27e153ba2 100644 --- a/svx/source/cui/dbregister.hxx +++ b/svx/source/cui/dbregister.hxx @@ -87,7 +87,7 @@ namespace svx @param _sLocation The location of the file. */ - void insertNewEntry(const ::rtl::OUString& _sName,const ::rtl::OUString& _sLocation); + void insertNewEntry( const ::rtl::OUString& _sName,const ::rtl::OUString& _sLocation, const bool bReadOnly ); /** opens the LinkDialog to create a register pair @param _sOldName diff --git a/svx/source/cui/dbregisterednamesconfig.cxx b/svx/source/cui/dbregisterednamesconfig.cxx index 3fdfa74f9d..406835abfd 100644 --- a/svx/source/cui/dbregisterednamesconfig.cxx +++ b/svx/source/cui/dbregisterednamesconfig.cxx @@ -35,22 +35,22 @@ #undef SVX_DLLIMPLEMENTATION #endif +#include "connpooloptions.hxx" #include "dbregisterednamesconfig.hxx" +#include "dbregistersettings.hxx" +#include "svx/svxids.hrc" +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/sdb/XDatabaseRegistrations.hpp> -#include <svtools/itemset.hxx> -#include <tools/diagnose_ex.h> - -#include <svx/svxids.hrc> -#include <unotools/confignode.hxx> +#include <comphelper/componentcontext.hxx> #include <comphelper/extract.hxx> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/uno/XNamingService.hpp> -#include <svtools/eitem.hxx> #include <comphelper/processfactory.hxx> +#include <svtools/eitem.hxx> +#include <svtools/itemset.hxx> #include <svtools/pathoptions.hxx> -#include "dbregistersettings.hxx" -#include "connpooloptions.hxx" +#include <tools/diagnose_ex.h> +#include <unotools/confignode.hxx> //........................................................................ namespace svx @@ -59,136 +59,92 @@ namespace svx using namespace ::utl; using namespace ::com::sun::star::uno; + using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::container; - //-------------------------------------------------------------------- - static const ::rtl::OUString& getDbRegisteredNamesNodeName() - { - static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("org.openoffice.Office.DataAccess/RegisteredNames"); - return s_sNodeName; - } - - //-------------------------------------------------------------------- - static const ::rtl::OUString& getDbNameNodeName() - { - static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("Name"); - return s_sNodeName; - } - - //-------------------------------------------------------------------- - static const ::rtl::OUString& getDbLocationNodeName() - { - static ::rtl::OUString s_sNodeName = ::rtl::OUString::createFromAscii("Location"); - return s_sNodeName; - } - //==================================================================== //= DbRegisteredNamesConfig //==================================================================== //-------------------------------------------------------------------- - void DbRegisteredNamesConfig::GetOptions(SfxItemSet& _rFillItems) + void DbRegisteredNamesConfig::GetOptions( SfxItemSet& _rFillItems ) { - // the config node where all pooling relevant info are stored under - OConfigurationTreeRoot aDbRegisteredNamesRoot = OConfigurationTreeRoot::createWithServiceFactory( - ::comphelper::getProcessServiceFactory(), getDbRegisteredNamesNodeName(), -1, OConfigurationTreeRoot::CM_READONLY); - - TNameLocationMap aSettings; + DatabaseRegistrations aSettings; - // then look for which of them settings are stored in the configuration - Sequence< ::rtl::OUString > aDriverKeys = aDbRegisteredNamesRoot.getNodeNames(); - const ::rtl::OUString* pDriverKeys = aDriverKeys.getConstArray(); - const ::rtl::OUString* pDriverKeysEnd = pDriverKeys + aDriverKeys.getLength(); - for (;pDriverKeys != pDriverKeysEnd; ++pDriverKeys) + try { - // the name of the driver in this round - OConfigurationNode aThisDriverSettings = aDbRegisteredNamesRoot.openNode(*pDriverKeys); - ::rtl::OUString sName, sLocation; - aThisDriverSettings.getNodeValue(getDbNameNodeName()) >>= sName; - aThisDriverSettings.getNodeValue(getDbLocationNodeName()) >>= sLocation; - sLocation = SvtPathOptions().SubstituteVariable(sLocation); - - aSettings.insert(TNameLocationMap::value_type(sName,sLocation)); + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + Reference< XDatabaseRegistrations > xRegistrations( + aContext.createComponent( "com.sun.star.sdb.DatabaseContext" ), UNO_QUERY_THROW ); + + Sequence< ::rtl::OUString > aRegistrationNames( xRegistrations->getRegistrationNames() ); + const ::rtl::OUString* pRegistrationName = aRegistrationNames.getConstArray(); + const ::rtl::OUString* pRegistrationNamesEnd = pRegistrationName + aRegistrationNames.getLength(); + for ( ; pRegistrationName != pRegistrationNamesEnd; ++pRegistrationName ) + { + ::rtl::OUString sLocation( xRegistrations->getDatabaseLocation( *pRegistrationName ) ); + aSettings[ *pRegistrationName ] = + DatabaseRegistration( sLocation, xRegistrations->isDatabaseRegistrationReadOnly( *pRegistrationName ) ); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); } - _rFillItems.Put(DatabaseMapItem(SID_SB_DB_REGISTER, aSettings)); + _rFillItems.Put( DatabaseMapItem( SID_SB_DB_REGISTER, aSettings ) ); } //-------------------------------------------------------------------- void DbRegisteredNamesConfig::SetOptions(const SfxItemSet& _rSourceItems) { - // the config node where all pooling relevant info are stored under - OConfigurationTreeRoot aDbRegisteredNamesRoot = OConfigurationTreeRoot::createWithServiceFactory( - ::comphelper::getProcessServiceFactory(), getDbRegisteredNamesNodeName(), -1, OConfigurationTreeRoot::CM_UPDATABLE); - - if (!aDbRegisteredNamesRoot.isValid()) - // already asserted by the OConfigurationTreeRoot + // the settings for the single drivers + SFX_ITEMSET_GET( _rSourceItems, pRegistrations, DatabaseMapItem, SID_SB_DB_REGISTER, sal_True ); + if ( !pRegistrations ) return; - sal_Bool bNeedCommit = sal_False; - - - // the settings for the single drivers - SFX_ITEMSET_GET( _rSourceItems, pDriverSettings, DatabaseMapItem, SID_SB_DB_REGISTER, sal_True ); - if (pDriverSettings) + try { - Reference< XNameAccess > xDatabaseContext = Reference< XNameAccess >(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.DatabaseContext"))), UNO_QUERY); - Reference< XNamingService> xNamingService(xDatabaseContext,UNO_QUERY); - ::rtl::OUString sName, sLocation; - OConfigurationNode aThisDriverSettings; - - const TNameLocationMap& rNewSettings = pDriverSettings->getSettings(); - TNameLocationMap::const_iterator aEnd = rNewSettings.end(); - for ( TNameLocationMap::const_iterator aLoop = rNewSettings.begin(); - aLoop != aEnd; - ++aLoop + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + Reference< XDatabaseRegistrations > xRegistrations( + aContext.createComponent( "com.sun.star.sdb.DatabaseContext" ), UNO_QUERY_THROW ); + + const DatabaseRegistrations& rNewRegistrations = pRegistrations->getRegistrations(); + for ( DatabaseRegistrations::const_iterator reg = rNewRegistrations.begin(); + reg != rNewRegistrations.end(); + ++reg ) { - // need the name as ::rtl::OUString - sName = aLoop->first; + const ::rtl::OUString sName = reg->first; + const ::rtl::OUString sLocation = reg->second.sLocation; - // the sub-node for this driver - if (aDbRegisteredNamesRoot.hasByName(sName)) - { - aThisDriverSettings = aDbRegisteredNamesRoot.openNode(sName); - // set the values - aThisDriverSettings.setNodeValue(getDbNameNodeName(), makeAny(sName)); - aThisDriverSettings.setNodeValue(getDbLocationNodeName(), makeAny(aLoop->second)); - bNeedCommit = sal_True; - } - else + if ( xRegistrations->hasRegisteredDatabase( sName ) ) { - try - { - xNamingService->registerObject(sName,Reference< ::com::sun::star::uno::XInterface >(xDatabaseContext->getByName(aLoop->second),UNO_QUERY)); - } - catch( const Exception& ) + if ( !xRegistrations->isDatabaseRegistrationReadOnly( sName ) ) + xRegistrations->changeDatabaseLocation( sName, sLocation ); + else { - DBG_UNHANDLED_EXCEPTION(); + OSL_ENSURE( xRegistrations->getDatabaseLocation( sName ) == sLocation, + "DbRegisteredNamesConfig::SetOptions: somebody changed a read-only registration. How unrespectful." ); } } + else + xRegistrations->registerDatabaseLocation( sName, sLocation ); } - if (bNeedCommit) - aDbRegisteredNamesRoot.commit(); - - // delete unused entry - Sequence< ::rtl::OUString > aDriverKeys = xDatabaseContext->getElementNames(); - const ::rtl::OUString* pDriverKeys = aDriverKeys.getConstArray(); - const ::rtl::OUString* pDriverKeysEnd = pDriverKeys + aDriverKeys.getLength(); - for (;pDriverKeys != pDriverKeysEnd; ++pDriverKeys) + + // delete unused entries + Sequence< ::rtl::OUString > aRegistrationNames = xRegistrations->getRegistrationNames(); + const ::rtl::OUString* pRegistrationName = aRegistrationNames.getConstArray(); + const ::rtl::OUString* pRegistrationNamesEnd = pRegistrationName + aRegistrationNames.getLength(); + for ( ; pRegistrationName != pRegistrationNamesEnd; ++pRegistrationName ) { - if ( rNewSettings.find(*pDriverKeys) == rNewSettings.end() ) - { - try - { - xNamingService->revokeObject(*pDriverKeys); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } + if ( rNewRegistrations.find( *pRegistrationName ) == rNewRegistrations.end() ) + xRegistrations->revokeDatabaseLocation( *pRegistrationName ); } } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } } //........................................................................ diff --git a/svx/source/cui/dbregistersettings.cxx b/svx/source/cui/dbregistersettings.cxx index 77aad8c7d2..8a6214644d 100644 --- a/svx/source/cui/dbregistersettings.cxx +++ b/svx/source/cui/dbregistersettings.cxx @@ -37,6 +37,8 @@ #include "dbregistersettings.hxx" +#include <rtl/ustring.hxx> + //........................................................................ namespace svx { @@ -47,9 +49,9 @@ namespace svx //==================================================================== TYPEINIT1( DatabaseMapItem, SfxPoolItem ) //-------------------------------------------------------------------- - DatabaseMapItem::DatabaseMapItem( sal_uInt16 _nId, const TNameLocationMap& _rSettings ) - :SfxPoolItem(_nId) - ,m_aSettings(_rSettings) + DatabaseMapItem::DatabaseMapItem( sal_uInt16 _nId, const DatabaseRegistrations& _rRegistrations ) + :SfxPoolItem( _nId ) + ,m_aRegistrations( _rRegistrations ) { } @@ -57,19 +59,19 @@ namespace svx int DatabaseMapItem::operator==( const SfxPoolItem& _rCompare ) const { const DatabaseMapItem* pItem = PTR_CAST(DatabaseMapItem, &_rCompare); - if (!pItem) + if ( !pItem ) return sal_False; - if (m_aSettings.size() != pItem->m_aSettings.size()) + if ( m_aRegistrations.size() != pItem->m_aRegistrations.size() ) return sal_False; - return m_aSettings != pItem->m_aSettings; + return m_aRegistrations == pItem->m_aRegistrations; } //-------------------------------------------------------------------- - SfxPoolItem* DatabaseMapItem::Clone( SfxItemPool * ) const + SfxPoolItem* DatabaseMapItem::Clone( SfxItemPool* ) const { - return new DatabaseMapItem(Which(), m_aSettings); + return new DatabaseMapItem( Which(), m_aRegistrations ); } //-------------------------------------------------------------------- diff --git a/svx/source/cui/dbregistersettings.hxx b/svx/source/cui/dbregistersettings.hxx index c6639a66bb..237664ba02 100644 --- a/svx/source/cui/dbregistersettings.hxx +++ b/svx/source/cui/dbregistersettings.hxx @@ -39,24 +39,56 @@ namespace svx { //........................................................................ + struct DatabaseRegistration + { + ::rtl::OUString sLocation; + bool bReadOnly; + + DatabaseRegistration() + :sLocation() + ,bReadOnly( true ) + { + } + + DatabaseRegistration( const ::rtl::OUString& _rLocation, const sal_Bool _bReadOnly ) + :sLocation( _rLocation ) + ,bReadOnly( _bReadOnly ) + { + } + + bool operator==( const DatabaseRegistration& _rhs ) const + { + return ( sLocation == _rhs.sLocation ); + // do not take the read-only-ness into account, this is not maintained everywhere, but only + // properly set when filling the struct from the XDatabaseRegistrations data + } + + bool operator!=( const DatabaseRegistration& _rhs ) const + { + return !( this->operator==( _rhs ) ); + } + }; + + typedef ::std::map< ::rtl::OUString, DatabaseRegistration, ::comphelper::UStringLess > DatabaseRegistrations; + //==================================================================== //= DatabaseMapItem //==================================================================== - DECLARE_STL_USTRINGACCESS_MAP(::rtl::OUString,TNameLocationMap); class DatabaseMapItem : public SfxPoolItem { protected: - TNameLocationMap m_aSettings; + DatabaseRegistrations m_aRegistrations; public: TYPEINFO(); - DatabaseMapItem( sal_uInt16 _nId, const TNameLocationMap& _rSettings ); + DatabaseMapItem( sal_uInt16 _nId, const DatabaseRegistrations& _rRegistrations ); virtual int operator==( const SfxPoolItem& ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - const TNameLocationMap& getSettings() const { return m_aSettings; } + const DatabaseRegistrations& + getRegistrations() const { return m_aRegistrations; } }; //........................................................................ diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index 4c5fee052e..05cf4c3485 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -436,6 +436,7 @@ IMPL_LINK( FmGridHeader, OnAsyncExecuteDrop, void*, /*NOTINTERESTEDIN*/ ) // diese Datentypen koennen im Gridcontrol nicht verarbeitet werden switch (nDataType) { + case DataType::BLOB: case DataType::LONGVARBINARY: case DataType::BINARY: case DataType::VARBINARY: @@ -1725,6 +1726,7 @@ void FmGridControl::InitColumnByField( sal_Bool bIllegalType = sal_False; switch ( nDataType ) { + case DataType::BLOB: case DataType::LONGVARBINARY: case DataType::BINARY: case DataType::VARBINARY: @@ -1769,14 +1771,18 @@ void FmGridControl::InitColumnsByFields(const Reference< ::com::sun::star::conta Reference< XIndexContainer > xColumns( GetPeer()->getColumns() ); Reference< XNameAccess > xFieldsAsNames( _rxFields, UNO_QUERY ); - // Einfuegen mu� sich an den Column Positionen orientieren + // Einfuegen muss sich an den Column Positionen orientieren for (sal_Int32 i = 0; i < xColumns->getCount(); i++) { DbGridColumn* pCol = GetColumns().GetObject(i); - Reference< XPropertySet > xColumnModel; - ::cppu::extractInterface( xColumnModel, xColumns->getByIndex( i ) ); + OSL_ENSURE(pCol,"No grid column!"); + if ( pCol ) + { + Reference< XPropertySet > xColumnModel; + ::cppu::extractInterface( xColumnModel, xColumns->getByIndex( i ) ); - InitColumnByField( pCol, xColumnModel, xFieldsAsNames, _rxFields ); + InitColumnByField( pCol, xColumnModel, xFieldsAsNames, _rxFields ); + } } } diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index 8fc6b0fb1a..df0df0b94f 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -69,6 +69,7 @@ using namespace ::svxform; using namespace ::com::sun::star::container; +using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::view; @@ -1393,8 +1394,8 @@ Sequence< Any > SAL_CALL FmXGridPeer::queryFieldData( sal_Int32 nRow, const Type // don't use GetCurrentRow as this isn't affected by the above SeekRow // FS - 30.09.99 - 68644 - DbGridRowRef aRow = pGrid->GetSeekRow(); - DBG_ASSERT(aRow.Is(), "FmXGridPeer::queryFieldData : invalid current Row !"); + DbGridRowRef xPaintRow = pGrid->GetPaintRow(); + ENSURE_OR_THROW( xPaintRow.Is(), "invalid paint row" ); // die Columns des Controls brauche ich fuer GetFieldText DbGridColumns aColumns = pGrid->GetColumns(); @@ -1416,39 +1417,40 @@ Sequence< Any > SAL_CALL FmXGridPeer::queryFieldData( sal_Int32 nRow, const Type // don't use GetCurrentFieldValue to determine the field content as this isn't affected by the above SeekRow // FS - 30.09.99 - 68644 pCol = aColumns.GetObject(nModelPos); - const DbGridRowRef xRow = pGrid->GetSeekRow(); - xFieldContent = (xRow.Is() && xRow->HasField(pCol->GetFieldPos())) ? xRow->GetField(pCol->GetFieldPos()).getColumn() : Reference< ::com::sun::star::sdb::XColumn > (); + xFieldContent = xPaintRow->HasField( pCol->GetFieldPos() ) + ? xPaintRow->GetField( pCol->GetFieldPos() ).getColumn() + : Reference< XColumn > (); + + if ( !xFieldContent.is() ) + continue; - if (xFieldContent.is()) + if (bRequestedAsAny) { - if (bRequestedAsAny) - { - Reference< XPropertySet > xFieldSet(xFieldContent, UNO_QUERY); - pReturnArray[i] = xFieldSet->getPropertyValue(FM_PROP_VALUE); - } - else + Reference< XPropertySet > xFieldSet(xFieldContent, UNO_QUERY); + pReturnArray[i] = xFieldSet->getPropertyValue(FM_PROP_VALUE); + } + else + { + switch (xType.getTypeClass()) { - switch (xType.getTypeClass()) + // Strings werden direkt ueber das GetFieldText abgehandelt + case TypeClass_STRING : { - // Strings werden direkt ueber das GetFieldText abgehandelt - case TypeClass_STRING : - { - String sText = aColumns.GetObject(nModelPos)->GetCellText(aRow, pGrid->getNumberFormatter()); - pReturnArray[i] <<= ::rtl::OUString(sText); - } - break; - // alles andere wird an der DatabaseVariant erfragt - case TypeClass_FLOAT : pReturnArray[i] <<= xFieldContent->getFloat(); break; - case TypeClass_DOUBLE : pReturnArray[i] <<= xFieldContent->getDouble(); break; - case TypeClass_SHORT : pReturnArray[i] <<= (sal_Int16)xFieldContent->getShort(); break; - case TypeClass_LONG : pReturnArray[i] <<= (sal_Int32)xFieldContent->getLong(); break; - case TypeClass_UNSIGNED_SHORT: pReturnArray[i] <<= (sal_uInt16)xFieldContent->getShort(); break; - case TypeClass_UNSIGNED_LONG : pReturnArray[i] <<= (sal_uInt32)xFieldContent->getLong(); break; - case TypeClass_BOOLEAN : ::comphelper::setBOOL(pReturnArray[i],xFieldContent->getBoolean()); break; - default: - { - throw IllegalArgumentException(); - } + String sText = aColumns.GetObject(nModelPos)->GetCellText( xPaintRow, pGrid->getNumberFormatter() ); + pReturnArray[i] <<= ::rtl::OUString(sText); + } + break; + // alles andere wird an der DatabaseVariant erfragt + case TypeClass_FLOAT : pReturnArray[i] <<= xFieldContent->getFloat(); break; + case TypeClass_DOUBLE : pReturnArray[i] <<= xFieldContent->getDouble(); break; + case TypeClass_SHORT : pReturnArray[i] <<= (sal_Int16)xFieldContent->getShort(); break; + case TypeClass_LONG : pReturnArray[i] <<= (sal_Int32)xFieldContent->getLong(); break; + case TypeClass_UNSIGNED_SHORT : pReturnArray[i] <<= (sal_uInt16)xFieldContent->getShort(); break; + case TypeClass_UNSIGNED_LONG : pReturnArray[i] <<= (sal_uInt32)xFieldContent->getLong(); break; + case TypeClass_BOOLEAN : ::comphelper::setBOOL(pReturnArray[i],xFieldContent->getBoolean()); break; + default: + { + throw IllegalArgumentException(); } } } @@ -1727,6 +1729,8 @@ void FmXGridPeer::removeColumnListeners(const Reference< XPropertySet >& xCol) //------------------------------------------------------------------------------ void FmXGridPeer::setColumns(const Reference< XIndexContainer >& Columns) throw( RuntimeException ) { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + FmGridControl* pGrid = static_cast< FmGridControl* >( GetWindow() ); if (m_xColumns.is()) diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index bbd3358d58..d0d0262f5c 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -874,7 +874,7 @@ void DbGridRow::SetState(CursorWrapper* pCur, sal_Bool bPaintCursor) } catch(SQLException&) { - OSL_ENSURE(0,"SQLException catched while getting the bookmark"); + DBG_UNHANDLED_EXCEPTION(); m_aBookmark = Any(); m_eStatus = GRS_INVALID; m_bIsNew = sal_False; @@ -1787,30 +1787,32 @@ void DbGridControl::ColumnMoved(sal_uInt16 nId) sal_Bool DbGridControl::SeekRow(long nRow) { // in filter mode or in insert only mode we don't have any cursor! - if (SeekCursor(nRow)) + if ( !SeekCursor( nRow ) ) + return sal_False; + + if ( IsFilterMode() ) { - if (m_pSeekCursor) - { - // on the current position we have to take the current row for display as we want - // to have the most recent values for display - if ((nRow == m_nCurrentPos) && getDisplaySynchron()) - m_xPaintRow = m_xCurrentRow; - // seek to the empty insert row - else if (IsInsertionRow(nRow)) - m_xPaintRow = m_xEmptyRow; - else - { - m_xSeekRow->SetState(m_pSeekCursor, sal_True); - m_xPaintRow = m_xSeekRow; - } - } - else if (IsFilterMode()) - { - DBG_ASSERT(IsFilterRow(nRow), "DbGridControl::SeekRow(): No filter row, wrong mode"); + DBG_ASSERT( IsFilterRow( nRow ), "DbGridControl::SeekRow(): No filter row, wrong mode" ); + m_xPaintRow = m_xEmptyRow; + } + else + { + // on the current position we have to take the current row for display as we want + // to have the most recent values for display + if ( ( nRow == m_nCurrentPos ) && getDisplaySynchron() ) + m_xPaintRow = m_xCurrentRow; + // seek to the empty insert row + else if ( IsInsertionRow( nRow ) ) m_xPaintRow = m_xEmptyRow; + else + { + m_xSeekRow->SetState( m_pSeekCursor, sal_True ); + m_xPaintRow = m_xSeekRow; } - DbGridControl_Base::SeekRow(nRow); } + + DbGridControl_Base::SeekRow(nRow); + return m_nSeekPos >= 0; } //------------------------------------------------------------------------------ @@ -2382,7 +2384,7 @@ sal_Bool DbGridControl::SeekCursor(long nRow, sal_Bool bAbsolute) // da der letzte Datensatz bereits erreicht wurde! if (nRow == m_nCurrentPos) { - // auf die aktuelle Zeile bewegt, dann mu� kein abgleich gemacht werden, wenn + // auf die aktuelle Zeile bewegt, dann muß kein abgleich gemacht werden, wenn // gerade ein Datensatz eingefuegt wird m_nSeekPos = nRow; } diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index a5125f0406..e73d416aff 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -1287,10 +1287,12 @@ SdrObject* FmXFormView::implCreateFieldControl( const ::svx::ODataAccessDescript else switch (nDataType) { + case DataType::BLOB: case DataType::LONGVARBINARY: nOBJID = OBJ_FM_IMAGECONTROL; break; case DataType::LONGVARCHAR: + case DataType::CLOB: nOBJID = OBJ_FM_EDIT; break; case DataType::BINARY: @@ -1622,7 +1624,9 @@ bool FmXFormView::createControlLabelPair( const ::comphelper::ComponentContext& aControlSize = aDefSize; break; case DataType::LONGVARCHAR: + case DataType::CLOB: case DataType::LONGVARBINARY: + case DataType::BLOB: aControlSize = aDefImageSize; break; } @@ -1655,7 +1659,7 @@ bool FmXFormView::createControlLabelPair( const ::comphelper::ComponentContext& } } - if ( nDataType == DataType::LONGVARCHAR && xControlPropInfo->hasPropertyByName( FM_PROP_MULTILINE ) ) + if ( (nDataType == DataType::LONGVARCHAR || nDataType == DataType::CLOB) && xControlPropInfo->hasPropertyByName( FM_PROP_MULTILINE ) ) { xControlSet->setPropertyValue( FM_PROP_MULTILINE, makeAny( sal_Bool( sal_True ) ) ); } diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx index 4e28c62a83..fbc869ba9e 100644 --- a/svx/source/form/formcontrolfactory.cxx +++ b/svx/source/form/formcontrolfactory.cxx @@ -519,7 +519,8 @@ namespace svxform case FormComponentType::COMBOBOX: { sal_Bool bDropDown = !_rControlBoundRect.IsEmpty() && ( _rControlBoundRect.GetWidth() >= 3 * _rControlBoundRect.GetHeight() ); - _rxControlModel->setPropertyValue( FM_PROP_DROPDOWN, makeAny( (sal_Bool)bDropDown ) ); + if ( xPSI->hasPropertyByName( FM_PROP_DROPDOWN ) ) + _rxControlModel->setPropertyValue( FM_PROP_DROPDOWN, makeAny( (sal_Bool)bDropDown ) ); _rxControlModel->setPropertyValue( FM_PROP_LINECOUNT, makeAny( sal_Int16( 20 ) ) ); } break; diff --git a/svx/source/src/app.src b/svx/source/src/app.src index 7001281945..b988d1d67d 100644 --- a/svx/source/src/app.src +++ b/svx/source/src/app.src @@ -58,26 +58,9 @@ ErrorBox RID_ERRBOX_MODULENOTINSTALLED SID_HLINKBAR_SEARCH; \ SID_HLINKBAR_TARGET; \ SID_HYPERLINK_DIALOG; \ - SID_FM_RECORD_ABSOLUTE; \ - SID_FM_RECORD_FIRST; \ - SID_FM_RECORD_PREV; \ - SID_FM_RECORD_NEXT; \ - SID_FM_RECORD_LAST; \ - SID_FM_RECORD_SAVE; \ - SID_FM_RECORD_UNDO; \ - SID_FM_RECORD_NEW; \ - SID_FM_RECORD_DELETE; \ - SID_FM_REFRESH; \ - SID_FM_SORTUP; \ - SID_FM_SORTDOWN; \ - SID_FM_ORDERCRIT; \ - SID_FM_AUTOFILTER; \ - SID_FM_FILTERCRIT; \ - SID_FM_FORM_FILTERED; \ - SID_FM_REMOVE_FILTER_SORT; \ };\ IdCount = {\ - 21;\ + 4;\ }; ImageList RID_DEFAULTIMAGELIST_SC |