Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_USERLIST_HXX
30 : : #define SC_USERLIST_HXX
31 : :
32 : : #include <tools/stream.hxx>
33 : : #include "scdllapi.h"
34 : :
35 : : #include <boost/ptr_container/ptr_vector.hpp>
36 : :
37 : : /**
38 : : * Stores individual user-defined sort list.
39 : : */
40 : : class SC_DLLPUBLIC ScUserListData
41 : : {
42 : : public:
43 : 4182 : struct SubStr
44 : : {
45 : : ::rtl::OUString maReal;
46 : : ::rtl::OUString maUpper;
47 : : SubStr(const ::rtl::OUString& rReal, const ::rtl::OUString& rUpper);
48 : : };
49 : : private:
50 : : typedef ::boost::ptr_vector<SubStr> SubStringsType;
51 : : SubStringsType maSubStrings;
52 : : ::rtl::OUString aStr;
53 : :
54 : : SC_DLLPRIVATE void InitTokens();
55 : :
56 : : public:
57 : : ScUserListData(const ::rtl::OUString& rStr);
58 : : ScUserListData(const ScUserListData& rData);
59 : : ~ScUserListData();
60 : :
61 : 1184 : const ::rtl::OUString& GetString() const { return aStr; }
62 : : void SetString(const ::rtl::OUString& rStr);
63 : : size_t GetSubCount() const;
64 : : bool GetSubIndex(const ::rtl::OUString& rSubStr, sal_uInt16& rIndex) const;
65 : : ::rtl::OUString GetSubStr(sal_uInt16 nIndex) const;
66 : : StringCompare Compare(const ::rtl::OUString& rSubStr1, const ::rtl::OUString& rSubStr2) const;
67 : : StringCompare ICompare(const ::rtl::OUString& rSubStr1, const ::rtl::OUString& rSubStr2) const;
68 : : };
69 : :
70 : : /**
71 : : * Collection of user-defined sort lists.
72 : : */
73 : 69 : class SC_DLLPUBLIC ScUserList
74 : : {
75 : : typedef ::boost::ptr_vector<ScUserListData> DataType;
76 : : DataType maData;
77 : : public:
78 : : typedef DataType::iterator iterator;
79 : : typedef DataType::const_iterator const_iterator;
80 : :
81 : : ScUserList();
82 : : ScUserList(const ScUserList& r);
83 : :
84 : : const ScUserListData* GetData( const ::rtl::OUString& rSubStr ) const;
85 : : /// If the list in rStr is already inserted
86 : : bool HasEntry( const ::rtl::OUString& rStr ) const;
87 : :
88 : : const ScUserListData* operator[](size_t nIndex) const;
89 : : ScUserListData* operator[](size_t nIndex);
90 : : ScUserList& operator= ( const ScUserList& r );
91 : : bool operator==( const ScUserList& r ) const;
92 : : bool operator!=( const ScUserList& r ) const;
93 : :
94 : : iterator begin();
95 : : const_iterator begin() const;
96 : : void clear();
97 : : size_t size() const;
98 : : void push_back(ScUserListData* p);
99 : : void erase(iterator itr);
100 : : };
101 : :
102 : : #endif
103 : :
104 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|