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