1*c4eee24dSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*c4eee24dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*c4eee24dSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*c4eee24dSAndrew Rist * distributed with this work for additional information 6*c4eee24dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*c4eee24dSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*c4eee24dSAndrew Rist * "License"); you may not use this file except in compliance 9*c4eee24dSAndrew Rist * with the License. You may obtain a copy of the License at 10*c4eee24dSAndrew Rist * 11*c4eee24dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*c4eee24dSAndrew Rist * 13*c4eee24dSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*c4eee24dSAndrew Rist * software distributed under the License is distributed on an 15*c4eee24dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*c4eee24dSAndrew Rist * KIND, either express or implied. See the License for the 17*c4eee24dSAndrew Rist * specific language governing permissions and limitations 18*c4eee24dSAndrew Rist * under the License. 19*c4eee24dSAndrew Rist * 20*c4eee24dSAndrew Rist *************************************************************/ 21*c4eee24dSAndrew Rist 22*c4eee24dSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SVX_DBREGISTERSETTING_HXX 25cdf0e10cSrcweir #define SVX_DBREGISTERSETTING_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <comphelper/stl_types.hxx> 28cdf0e10cSrcweir #include <svl/poolitem.hxx> 29cdf0e10cSrcweir 30cdf0e10cSrcweir //........................................................................ 31cdf0e10cSrcweir namespace svx 32cdf0e10cSrcweir { 33cdf0e10cSrcweir //........................................................................ 34cdf0e10cSrcweir 35cdf0e10cSrcweir struct DatabaseRegistration 36cdf0e10cSrcweir { 37cdf0e10cSrcweir ::rtl::OUString sLocation; 38cdf0e10cSrcweir bool bReadOnly; 39cdf0e10cSrcweir DatabaseRegistrationsvx::DatabaseRegistration40cdf0e10cSrcweir DatabaseRegistration() 41cdf0e10cSrcweir :sLocation() 42cdf0e10cSrcweir ,bReadOnly( true ) 43cdf0e10cSrcweir { 44cdf0e10cSrcweir } 45cdf0e10cSrcweir DatabaseRegistrationsvx::DatabaseRegistration46cdf0e10cSrcweir DatabaseRegistration( const ::rtl::OUString& _rLocation, const sal_Bool _bReadOnly ) 47cdf0e10cSrcweir :sLocation( _rLocation ) 48cdf0e10cSrcweir ,bReadOnly( _bReadOnly ) 49cdf0e10cSrcweir { 50cdf0e10cSrcweir } 51cdf0e10cSrcweir operator ==svx::DatabaseRegistration52cdf0e10cSrcweir bool operator==( const DatabaseRegistration& _rhs ) const 53cdf0e10cSrcweir { 54cdf0e10cSrcweir return ( sLocation == _rhs.sLocation ); 55cdf0e10cSrcweir // do not take the read-only-ness into account, this is not maintained everywhere, but only 56cdf0e10cSrcweir // properly set when filling the struct from the XDatabaseRegistrations data 57cdf0e10cSrcweir } 58cdf0e10cSrcweir operator !=svx::DatabaseRegistration59cdf0e10cSrcweir bool operator!=( const DatabaseRegistration& _rhs ) const 60cdf0e10cSrcweir { 61cdf0e10cSrcweir return !( this->operator==( _rhs ) ); 62cdf0e10cSrcweir } 63cdf0e10cSrcweir }; 64cdf0e10cSrcweir 65cdf0e10cSrcweir typedef ::std::map< ::rtl::OUString, DatabaseRegistration, ::comphelper::UStringLess > DatabaseRegistrations; 66cdf0e10cSrcweir 67cdf0e10cSrcweir //==================================================================== 68cdf0e10cSrcweir //= DatabaseMapItem 69cdf0e10cSrcweir //==================================================================== 70cdf0e10cSrcweir class DatabaseMapItem : public SfxPoolItem 71cdf0e10cSrcweir { 72cdf0e10cSrcweir protected: 73cdf0e10cSrcweir DatabaseRegistrations m_aRegistrations; 74cdf0e10cSrcweir 75cdf0e10cSrcweir public: 76cdf0e10cSrcweir TYPEINFO(); 77cdf0e10cSrcweir 78cdf0e10cSrcweir DatabaseMapItem( sal_uInt16 _nId, const DatabaseRegistrations& _rRegistrations ); 79cdf0e10cSrcweir 80cdf0e10cSrcweir virtual int operator==( const SfxPoolItem& ) const; 81cdf0e10cSrcweir virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 82cdf0e10cSrcweir 83cdf0e10cSrcweir const DatabaseRegistrations& getRegistrations() const84cdf0e10cSrcweir getRegistrations() const { return m_aRegistrations; } 85cdf0e10cSrcweir }; 86cdf0e10cSrcweir 87cdf0e10cSrcweir //........................................................................ 88cdf0e10cSrcweir } // namespace svx 89cdf0e10cSrcweir //........................................................................ 90cdf0e10cSrcweir #endif // SVX_DBREGISTERSETTING_HXX 91cdf0e10cSrcweir 92