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 SW_ACMPLWRD_HXX
30 : : #define SW_ACMPLWRD_HXX
31 : :
32 : : #include <deque>
33 : :
34 : : #include <editeng/swafopt.hxx>
35 : : #include <editeng/LatinLookupTree.hxx>
36 : :
37 : : class SwDoc;
38 : : class SwAutoCompleteWord_Impl;
39 : : class SwAutoCompleteClient;
40 : : class SwAutoCompleteString;
41 : :
42 : : typedef std::deque<SwAutoCompleteString*> SwAutoCompleteStringPtrDeque;
43 : :
44 : : class SwAutoCompleteWord
45 : : {
46 : : friend class SwAutoCompleteClient;
47 : :
48 : : /// contains extended strings carrying source information
49 : : editeng::SortedAutoCompleteStrings m_WordList;
50 : : LookupTree* m_LookupTree;
51 : : SwAutoCompleteStringPtrDeque aLRULst;
52 : :
53 : : SwAutoCompleteWord_Impl* pImpl;
54 : : sal_uInt16 nMaxCount, nMinWrdLen;
55 : : bool bLockWordLst;
56 : :
57 : : void DocumentDying(const SwDoc& rDoc);
58 : : public:
59 : : SwAutoCompleteWord( sal_uInt16 nWords = 500, sal_uInt16 nMWrdLen = 10 );
60 : : ~SwAutoCompleteWord();
61 : :
62 : : sal_Bool InsertWord( const String& rWord, SwDoc& rDoc );
63 : :
64 : : sal_Bool GetRange( const String& rWord, sal_uInt16& rStt, sal_uInt16& rEnd ) const;
65 : :
66 : : const String& operator[](size_t n) const
67 : : { return m_WordList[n]->GetAutoCompleteString(); }
68 : :
69 : 7409 : bool IsLockWordLstLocked() const { return bLockWordLst; }
70 : 0 : void SetLockWordLstLocked( bool bFlag ) { bLockWordLst = bFlag; }
71 : :
72 : : void SetMaxCount( sal_uInt16 n );
73 : :
74 : 25099 : sal_uInt16 GetMinWordLen() const { return nMinWrdLen; }
75 : : void SetMinWordLen( sal_uInt16 n );
76 : :
77 : 0 : const editeng::SortedAutoCompleteStrings& GetWordList() const
78 : 0 : { return m_WordList; }
79 : :
80 : : void CheckChangedList(const editeng::SortedAutoCompleteStrings& rNewLst);
81 : :
82 : : bool GetWordsMatching(String aMatch, std::vector<String>& aWords) const;
83 : : };
84 : :
85 : :
86 : : #endif
87 : :
88 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|