xref: /aoo42x/main/sw/inc/acmplwrd.hxx (revision 1d2dbeb0)
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 #ifndef _ACMPLWRD_HXX
24 #define _ACMPLWRD_HXX
25 
26 
27 #define _SVSTDARR_STRINGSISORTDTOR
28 #include <svl/svstdarr.hxx>
29 
30 class SwDoc;
31 class SwAutoCompleteWord_Impl;
32 class SwAutoCompleteClient;
33 
34 class SwAutoCompleteWord
35 {
36     friend class SwAutoCompleteClient;
37 
38     SvStringsISortDtor aWordLst; // contains extended strings carrying source information
39 	SvPtrarr aLRULst;
40 
41     SwAutoCompleteWord_Impl* pImpl;
42 	sal_uInt16 nMaxCount, nMinWrdLen;
43 	sal_Bool bLockWordLst;
44 
45     void DocumentDying(const SwDoc& rDoc);
46 public:
47 	SwAutoCompleteWord( sal_uInt16 nWords = 500, sal_uInt16 nMWrdLen = 10 );
48 	~SwAutoCompleteWord();
49 
50     sal_Bool InsertWord( const String& rWord, SwDoc& rDoc );
51 
52 	sal_Bool GetRange( const String& rWord, sal_uInt16& rStt, sal_uInt16& rEnd ) const;
53 
operator [](sal_uInt16 n) const54     const String& operator[]( sal_uInt16 n ) const { return *aWordLst[ n ]; }
55 
IsLockWordLstLocked() const56 	sal_Bool IsLockWordLstLocked() const 		{ return bLockWordLst; }
SetLockWordLstLocked(sal_Bool bFlag)57 	void SetLockWordLstLocked( sal_Bool bFlag ) { bLockWordLst = bFlag; }
58 
59     void SetMaxCount( sal_uInt16 n );
60 
GetMinWordLen() const61 	sal_uInt16 GetMinWordLen() const 				{ return nMinWrdLen; }
62 	void SetMinWordLen( sal_uInt16 n );
63 
GetWordList() const64 	const SvStringsISortDtor& GetWordList() const { return aWordLst; }
65 	void CheckChangedList( const SvStringsISortDtor& rNewLst );
66 };
67 
68 
69 #endif
70