xref: /AOO41X/main/sc/inc/userlist.hxx (revision 38d50f7b14e1cf975d8c6468d9633894cd59b523)
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 SC_USERLIST_HXX
25 #define SC_USERLIST_HXX
26 
27 #include <tools/stream.hxx>
28 #include "scdllapi.h"
29 #include "collect.hxx"
30 
31 //------------------------------------------------------------------------
32 class SC_DLLPUBLIC ScUserListData : public ScDataObject
33 {
34 friend class ScUserList;
35     String  aStr;
36     sal_uInt16  nTokenCount;
37     String* pSubStrings;
38     String* pUpperSub;
39 
40     SC_DLLPRIVATE void  InitTokens();
41 
42 public:
43                     ScUserListData(const String& rStr);
44                     ScUserListData(const ScUserListData& rData);
45     virtual         ~ScUserListData();
46 
Clone() const47     virtual ScDataObject*       Clone() const { return new ScUserListData(*this); }
48 
GetString() const49     const   String&         GetString() const { return aStr; }
50             void            SetString( const String& rStr);
51             sal_uInt16          GetSubCount() const;
52             sal_Bool            GetSubIndex(const String& rSubStr, sal_uInt16& rIndex) const;
53             String          GetSubStr(sal_uInt16 nIndex) const;
54             StringCompare   Compare(const String& rSubStr1, const String& rSubStr2) const;
55             StringCompare   ICompare(const String& rSubStr1, const String& rSubStr2) const;
56 };
57 
58 //------------------------------------------------------------------------
59 class SC_DLLPUBLIC ScUserList : public ScCollection
60 {
61 public:
62                     ScUserList( sal_uInt16 nLim = 4, sal_uInt16 nDel = 4);
ScUserList(const ScUserList & rUserList)63                     ScUserList( const ScUserList& rUserList ) : ScCollection ( rUserList ) {}
64 
65     virtual ScDataObject*       Clone() const;
66 
67             ScUserListData* GetData( const String& rSubStr ) const;
68             /// If the list in rStr is already inserted
69             sal_Bool            HasEntry( const String& rStr ) const;
70 
71     inline  ScUserListData* operator[]( const sal_uInt16 nIndex) const;
72     inline  ScUserList&     operator= ( const ScUserList& r );
73             sal_Bool            operator==( const ScUserList& r ) const;
74     inline  sal_Bool            operator!=( const ScUserList& r ) const;
75 };
76 
operator =(const ScUserList & r)77 inline  ScUserList& ScUserList::operator=( const ScUserList& r )
78     { return (ScUserList&)ScCollection::operator=( r ); }
79 
operator [](const sal_uInt16 nIndex) const80 inline ScUserListData* ScUserList::operator[]( const sal_uInt16 nIndex) const
81     { return (ScUserListData*)At(nIndex); }
82 
operator !=(const ScUserList & r) const83 inline sal_Bool ScUserList::operator!=( const ScUserList& r ) const
84     { return !operator==( r ); }
85 
86 #endif
87 
88