]> git.lyx.org Git - lyx.git/blob - src/Bidi.h
Tracking correctly available translations (take 2)
[lyx.git] / src / Bidi.h
1 // -*- C++ -*-
2 /**
3  * \file Bidi.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Dekel Tsur
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef BIDI_H
13 #define BIDI_H
14
15 #include "support/types.h"
16
17 #include <vector>
18
19
20 namespace lyx {
21
22 class Buffer;
23 class Cursor;
24 class Paragraph;
25 class Row;
26 class Font;
27
28
29 /// bidi stuff
30 class Bidi {
31 public:
32         ///
33         bool isBoundary(Buffer const &, Paragraph const & par,
34                         pos_type pos) const;
35         ///
36         bool isBoundary(Buffer const &, Paragraph const & par,
37                                 pos_type pos, Font const & font) const;
38         ///
39         pos_type log2vis(pos_type pos) const;
40         /** Maps positions in the logical string to positions
41          *  in visual string.
42          */
43         pos_type vis2log(pos_type pos) const;
44         ///
45         pos_type level(pos_type pos) const;
46         ///
47         bool inRange(pos_type pos) const;
48         /// same_direction?
49         bool same_direction() const;
50         ///
51         void computeTables(Paragraph const & par,
52                            Buffer const &, Row const & row);
53 private:
54         ///
55         bool same_direction_;
56         ///
57         std::vector<pos_type> log2vis_list_;
58         /** Maps positions in the visual string to positions
59          *  in logical string.
60          */
61         std::vector<pos_type> vis2log_list_;
62         ///
63         std::vector<pos_type> levels_;
64         ///
65         pos_type start_;
66         ///
67         pos_type end_;
68 };
69
70 /// Should interpretation of the arrow keys be reversed?
71 bool reverseDirectionNeeded(Cursor const & cur);
72
73 /// Is current paragraph in RTL mode?
74 bool isWithinRtlParagraph(Cursor const & cur);
75
76 } // namespace lyx
77
78 #endif // BIDI_H