LibreOffice Module cui (master)  1
dbregistersettings.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #pragma once
21 
22 #include <sal/config.h>
23 
24 #include <map>
25 
26 #include <svl/poolitem.hxx>
27 
28 
29 namespace svx
30 {
31 
32 
34  {
35  OUString sLocation;
36  bool bReadOnly;
37 
39  :sLocation()
40  ,bReadOnly( true )
41  {
42  }
43 
44  DatabaseRegistration( const OUString& _rLocation, const bool _bReadOnly )
45  :sLocation( _rLocation )
46  ,bReadOnly( _bReadOnly )
47  {
48  }
49 
50  bool operator==( const DatabaseRegistration& _rhs ) const
51  {
52  return ( sLocation == _rhs.sLocation );
53  // do not take the read-only-ness into account, this is not maintained everywhere, but only
54  // properly set when filling the struct from the XDatabaseRegistrations data
55  }
56 
57  };
58 
59  typedef std::map< OUString, DatabaseRegistration > DatabaseRegistrations;
60 
61  class DatabaseMapItem final : public SfxPoolItem
62  {
63  DatabaseRegistrations m_aRegistrations;
64 
65  public:
66 
67  DatabaseMapItem( sal_uInt16 _nId, const DatabaseRegistrations& _rRegistrations );
68 
69  virtual bool operator==( const SfxPoolItem& ) const override;
70  virtual DatabaseMapItem* Clone( SfxItemPool *pPool = nullptr ) const override;
71 
72  const DatabaseRegistrations&
73  getRegistrations() const { return m_aRegistrations; }
74  };
75 
76 
77 }
78 
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DatabaseMapItem(sal_uInt16 _nId, const DatabaseRegistrations &_rRegistrations)
std::map< OUString, DatabaseRegistration > DatabaseRegistrations
DatabaseRegistrations m_aRegistrations
virtual DatabaseMapItem * Clone(SfxItemPool *pPool=nullptr) const override
bool operator==(const DatabaseRegistration &_rhs) const
DatabaseRegistration(const OUString &_rLocation, const bool _bReadOnly)
virtual bool operator==(const SfxPoolItem &) const override
const DatabaseRegistrations & getRegistrations() const