xref: /aoo4110/main/dbaccess/source/ui/inc/indexes.hxx (revision b1cdbd2c)
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 _DBAUI_INDEXES_HXX_
25 #define _DBAUI_INDEXES_HXX_
26 
27 #ifndef _STRING_HXX
28 #include <tools/string.hxx>
29 #endif
30 #ifndef _COMPHELPER_STLTYPES_HXX_
31 #include <comphelper/stl_types.hxx>
32 #endif
33 
34 //......................................................................
35 namespace dbaui
36 {
37 //......................................................................
38 	//==================================================================
39 	//= OIndexField
40 	//==================================================================
41 	struct OIndexField
42 	{
43 		String				sFieldName;
44 		sal_Bool			bSortAscending;
45 
OIndexFielddbaui::OIndexField46 		OIndexField() : bSortAscending(sal_True) { }
47 	};
48 
49 	DECLARE_STL_VECTOR( OIndexField, IndexFields );
50 
51 	//==================================================================
52 	//= OIndex
53 	//==================================================================
54 	struct GrantIndexAccess
55 	{
56 		friend class OIndexCollection;
57 	private:
GrantIndexAccessdbaui::GrantIndexAccess58 		GrantIndexAccess() { }
59 	};
60 
61 	//..................................................................
62 	struct OIndex
63 	{
64 	protected:
65 		::rtl::OUString		sOriginalName;
66 		sal_Bool			bModified;
67 
68 	public:
69 		::rtl::OUString		sName;
70 		::rtl::OUString		sDescription;
71 		sal_Bool			bPrimaryKey;
72 		sal_Bool			bUnique;
73 		IndexFields			aFields;
74 
75 	public:
OIndexdbaui::OIndex76 		OIndex(const ::rtl::OUString& _rOriginalName)
77 			: sOriginalName(_rOriginalName), bModified(sal_False), sName(_rOriginalName), bPrimaryKey(sal_False), bUnique(sal_False)
78 		{
79 		}
80 
getOriginalNamedbaui::OIndex81 		const ::rtl::OUString& getOriginalName() const { return sOriginalName; }
82 
isModifieddbaui::OIndex83 		sal_Bool	isModified() const { return bModified; }
setModifieddbaui::OIndex84 		void		setModified(sal_Bool _bModified) { bModified = _bModified; }
clearModifieddbaui::OIndex85 		void		clearModified() { setModified(sal_False); }
86 
isNewdbaui::OIndex87 		sal_Bool	isNew() const { return 0 == getOriginalName().getLength(); }
flagAsNewdbaui::OIndex88 		void		flagAsNew(const GrantIndexAccess&) { sOriginalName = ::rtl::OUString(); }
flagAsCommitteddbaui::OIndex89 		void		flagAsCommitted(const GrantIndexAccess&) { sOriginalName = sName; }
90 
91 
92 	private:
93 		OIndex();	// not implemented
94 	};
95 
96 	DECLARE_STL_VECTOR( OIndex, Indexes );
97 
98 //......................................................................
99 }	// namespace dbaui
100 //......................................................................
101 
102 #endif // _DBAUI_INDEXES_HXX_
103 
104