1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <com/sun/star/container/XNameAccess.hpp>
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include "indexes.hxx"
30 class OIndexCollection
32 css::uno::Reference
< css::container::XNameAccess
>
41 OIndexCollection(const OIndexCollection
& _rSource
);
42 // OIndexCollection(const css::uno::Reference< css::container::XNameAccess >& _rxIndexes);
44 OIndexCollection
& operator=(const OIndexCollection
& _rSource
);
46 // iterating through the collection
47 typedef OIndex
* iterator
;
48 typedef OIndex
const* const_iterator
;
50 /// get access to the first element of the index collection
51 Indexes::const_iterator
begin() const { return m_aIndexes
.begin(); }
52 /// get access to the first element of the index collection
53 Indexes::iterator
begin() { return m_aIndexes
.begin(); }
54 /// get access to the (last + 1st) element of the index collection
55 Indexes::const_iterator
end() const { return m_aIndexes
.end(); }
56 /// get access to the (last + 1st) element of the index collection
57 Indexes::iterator
end() { return m_aIndexes
.end(); }
60 Indexes::const_iterator
find(const OUString
& _rName
) const;
61 Indexes::iterator
find(const OUString
& _rName
);
62 Indexes::const_iterator
findOriginal(const OUString
& _rName
) const;
63 Indexes::iterator
findOriginal(const OUString
& _rName
);
65 // inserting without committing
66 // the OriginalName of the newly inserted index will be empty, thus indicating that it's new
67 Indexes::iterator
insert(const OUString
& _rName
);
68 // commit a new index, which is already part if the collection, but does not have an equivalent in the
70 void commitNewIndex(const Indexes::iterator
& _rPos
);
72 // reset the data for the given index
73 void resetIndex(const Indexes::iterator
& _rPos
);
75 // attach to a new key container
76 void attach(const css::uno::Reference
< css::container::XNameAccess
>& _rxIndexes
);
77 // detach from the container
80 /// drop an index, and remove it from the collection
81 bool drop(const Indexes::iterator
& _rPos
);
82 /// simply drop the index described by the name, but don't remove the descriptor from the collection
83 bool dropNoRemove(const Indexes::iterator
& _rPos
);
86 void implConstructFrom(const css::uno::Reference
< css::container::XNameAccess
>& _rxIndexes
);
87 static void implFillIndexInfo(OIndex
& _rIndex
, const css::uno::Reference
< css::beans::XPropertySet
>& _rxDescriptor
);
88 void implFillIndexInfo(OIndex
& _rIndex
);
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */