summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2010-01-15 14:01:24 +0100
committerKurt Zenker <kz@openoffice.org>2010-01-15 14:01:24 +0100
commit341b78bd15504496e4c2177842a40657cef277d7 (patch)
tree0ee09458c57ff7d5df370a164c855f82a5f36463 /cui
parented6f1394d17eb0b570d2a4dd64b5c604934eaabb (diff)
parentf691a76d7227a84c6ccc13863d1f246ceccf9ba8 (diff)
CWS-TOOLING: integrate CWS dba33b
Diffstat (limited to 'cui')
-rw-r--r--cui/source/inc/dbregister.hxx2
-rw-r--r--cui/source/options/dbregister.cxx147
-rw-r--r--cui/source/options/dbregisterednamesconfig.cxx171
-rw-r--r--cui/source/options/dbregistersettings.cxx18
-rw-r--r--cui/source/options/dbregistersettings.hxx40
5 files changed, 192 insertions, 186 deletions
diff --git a/cui/source/inc/dbregister.hxx b/cui/source/inc/dbregister.hxx
index 00cf4cc911c2..84bc2fa4054c 100644
--- a/cui/source/inc/dbregister.hxx
+++ b/cui/source/inc/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/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx
index 23e8bf865626..91635d80f5f1 100644
--- a/cui/source/options/dbregister.cxx
+++ b/cui/source/options/dbregister.cxx
@@ -190,7 +190,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;
}
@@ -209,21 +209,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;
}
@@ -235,47 +236,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 );
}
}
@@ -316,16 +314,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;
}
// -----------------------------------------------------------------------
@@ -390,28 +391,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( CUI_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)
{
@@ -482,10 +497,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/cui/source/options/dbregisterednamesconfig.cxx b/cui/source/options/dbregisterednamesconfig.cxx
index 6fd7e34b2729..4ab867eaa44e 100644
--- a/cui/source/options/dbregisterednamesconfig.cxx
+++ b/cui/source/options/dbregisterednamesconfig.cxx
@@ -30,18 +30,19 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_cui.hxx"
+#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 <comphelper/componentcontext.hxx>
+#include <comphelper/extract.hxx>
+#include <comphelper/processfactory.hxx>
+#include <svl/eitem.hxx>
#include <svl/itemset.hxx>
#include <tools/diagnose_ex.h>
#include <unotools/confignode.hxx>
-#include <comphelper/extract.hxx>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/uno/XNamingService.hpp>
-#include <svl/eitem.hxx>
-#include <comphelper/processfactory.hxx>
-#include <unotools/pathoptions.hxx>
-#include "dbregistersettings.hxx"
-#include "connpooloptions.hxx"
//........................................................................
namespace svx
@@ -50,136 +51,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))
+ if ( xRegistrations->hasRegisteredDatabase( sName ) )
{
- aThisDriverSettings = aDbRegisteredNamesRoot.openNode(sName);
- // set the values
- aThisDriverSettings.setNodeValue(getDbNameNodeName(), makeAny(sName));
- aThisDriverSettings.setNodeValue(getDbLocationNodeName(), makeAny(aLoop->second));
- bNeedCommit = sal_True;
- }
- else
- {
- 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/cui/source/options/dbregistersettings.cxx b/cui/source/options/dbregistersettings.cxx
index c3d3b7e8c244..cdcb899c2567 100644
--- a/cui/source/options/dbregistersettings.cxx
+++ b/cui/source/options/dbregistersettings.cxx
@@ -33,6 +33,8 @@
#include "dbregistersettings.hxx"
+#include <rtl/ustring.hxx>
+
//........................................................................
namespace svx
{
@@ -43,9 +45,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 )
{
}
@@ -53,19 +55,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/cui/source/options/dbregistersettings.hxx b/cui/source/options/dbregistersettings.hxx
index 672d4bf63bcd..b78031f06786 100644
--- a/cui/source/options/dbregistersettings.hxx
+++ b/cui/source/options/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; }
};
//........................................................................