Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 : : *
5 : : * Copyright 2009 by Sun Microsystems, Inc.
6 : : *
7 : : * OpenOffice.org - a multi-platform office productivity suite
8 : : *
9 : : * This file is part of OpenOffice.org.
10 : : *
11 : : * OpenOffice.org is free software: you can redistribute it and/or modify
12 : : * it under the terms of the GNU Lesser General Public License version 3
13 : : * only, as published by the Free Software Foundation.
14 : : *
15 : : * OpenOffice.org is distributed in the hope that it will be useful,
16 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 : : * GNU Lesser General Public License version 3 for more details
19 : : * (a copy is included in the LICENSE file that accompanied this code).
20 : : *
21 : : * You should have received a copy of the GNU Lesser General Public License
22 : : * version 3 along with OpenOffice.org. If not, see
23 : : * <http://www.openoffice.org/license.html>
24 : : * for a copy of the LGPLv3 License.
25 : : ************************************************************************/
26 : :
27 : : #ifndef VCL_QUICKSELECTIONENGINE_HXX
28 : : #define VCL_QUICKSELECTIONENGINE_HXX
29 : :
30 : : #include "dllapi.h"
31 : :
32 : : #include <tools/string.hxx>
33 : :
34 : : #include <memory>
35 : :
36 : : class KeyEvent;
37 : :
38 : : //........................................................................
39 : : namespace vcl
40 : : {
41 : : //........................................................................
42 : :
43 : : typedef const void* StringEntryIdentifier;
44 : :
45 : : //====================================================================
46 : : //= ISearchableStringList
47 : : //====================================================================
48 : : // TODO: consolidate this with ::vcl::IMnemonicEntryList
49 : 122 : class SAL_NO_VTABLE VCL_DLLPUBLIC ISearchableStringList
50 : : {
51 : : public:
52 : : /** returns the current entry in the list of searchable strings.
53 : :
54 : : Search operations will start with this entry.
55 : : */
56 : : virtual StringEntryIdentifier CurrentEntry( String& _out_entryText ) const = 0;
57 : :
58 : : /** returns the next entry in the list.
59 : :
60 : : The implementation is expected to wrap around. That is, if the given entry denotes the last
61 : : entry in the list, then NextEntry should return the first entry.
62 : : */
63 : : virtual StringEntryIdentifier NextEntry( StringEntryIdentifier _currentEntry, String& _out_entryText ) const = 0;
64 : :
65 : : /** selects a given entry
66 : : */
67 : : virtual void SelectEntry( StringEntryIdentifier _entry ) = 0;
68 : :
69 : : protected:
70 : 122 : ~ISearchableStringList() {}
71 : : };
72 : :
73 : : //====================================================================
74 : : //= QuickSelectionEngine
75 : : //====================================================================
76 : : struct QuickSelectionEngine_Data;
77 : : class VCL_DLLPUBLIC QuickSelectionEngine
78 : : {
79 : : public:
80 : : QuickSelectionEngine( ISearchableStringList& _entryList );
81 : : ~QuickSelectionEngine();
82 : :
83 : : bool HandleKeyEvent( const KeyEvent& _rKEvt );
84 : : void Reset();
85 : :
86 : : private:
87 : : ::std::auto_ptr< QuickSelectionEngine_Data > m_pData;
88 : :
89 : : private:
90 : : QuickSelectionEngine(); // never implemented
91 : : QuickSelectionEngine( const QuickSelectionEngine& ); // never implemented
92 : : QuickSelectionEngine& operator=( const QuickSelectionEngine& ); // never implemented
93 : : };
94 : :
95 : : //........................................................................
96 : : } // namespace vcl
97 : : //........................................................................
98 : :
99 : : #endif // VCL_QUICKSELECTIONENGINE_HXX
100 : :
101 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|