1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
23 #include <sal/types.h>
24 #include <rtl/ustring.hxx>
25 #include <editeng/editengdllapi.h>
27 /** LookupTree is an interface class that allows for unified access to tree
28 * structures used for storing dictionnary words as well as their respective
30 * It allows you to insert or remove words from the tree, navigate threw the
31 * tree along its branches and request for a suggestion for autocompletion
32 * according to the position within the tree.
33 * It also allows you to attribute a specific language to each tree so that
34 * it is possible to serve the correct auto completions even within a document
35 * that contains content in more than one language.
37 class EDITENG_DLLPUBLIC LookupTree
40 explicit inline LookupTree(OUString sLanguage
);
41 virtual ~LookupTree() {}
43 inline OUString
language() const;
45 // Resets the current item to root.
46 virtual void returnToRoot() = 0;
48 // Advances from the root position key by key towards the node keyed with
49 // the last char of sKey.
50 virtual void gotoNode(OUString sNode
) = 0;
52 // Advances from the current position towards the node keyed with cKey.
53 virtual void advance(const sal_Unicode cKey
) = 0;
55 // Sets the focus to the parent of the current node. Removes the current
56 // node if it is invalid.
57 virtual void goBack() = 0;
59 // Inserts a complete keyword starting from the root node of the tree.
60 // Does not change the current position within the tree.
61 virtual void insert(OUString sKey
, const int nProbability
= 1) = 0;
63 // Inserts a keyword with the given probability at the current position
64 // within the tree. Does not change the current position within the tree.
65 virtual void insert(const int nProbability
= 1) = 0;
67 // Removes a complete keyword starting from the root node of the tree.
68 // Does not change the current position within the tree.
69 virtual void remove(OUString sKey
) = 0;
71 // Returns the suggested autocompletion for the current location within
73 virtual OUString
suggestAutoCompletion() const = 0;
75 // Clears the tree and removes any information it contains.
76 virtual void clear() = 0;
80 const OUString m_sLanguage
; // language handled by this tree
83 LookupTree::LookupTree(OUString sLanguage
) :
84 m_sLanguage( sLanguage
)
88 OUString
LookupTree::language() const
93 #endif // LOOKUPTREE_H
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */