]> git.lyx.org Git - lyx.git/blob - src/Bidi.h
Make doExport() helper private
[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         /** Maps positions in the visual string to positions
39          *  in logical string.
40          */
41         pos_type log2vis(pos_type pos) const;
42         /** Maps positions in the logical string to positions
43          *  in visual string.
44          */
45         pos_type vis2log(pos_type pos) const;
46         /* 
47          * The text direction at logical position \param pos.
48          * Possible values are
49          *  0: left-to-right text
50          *  1: right-to-left text
51          *  2: left-to-right text in right-to-left language (aka numbers)
52          */
53         pos_type level(pos_type pos) const;
54         /// Is logical position covered by this row?
55         bool inRange(pos_type pos) const;
56         /// Is the whole row in the same direction as the paragraph?
57         bool same_direction() const;
58         /// Compute the data for visual positions. 
59         void computeTables(Paragraph const & par,
60                            Buffer const &, Row const & row);
61 private:
62         ///
63         bool same_direction_;
64         ///
65         std::vector<pos_type> log2vis_list_;
66         /** Maps positions in the visual string to positions
67          *  in logical string.
68          */
69         std::vector<pos_type> vis2log_list_;
70         ///
71         std::vector<pos_type> levels_;
72         ///
73         pos_type start_;
74         ///
75         pos_type end_;
76 };
77
78 /// Should interpretation of the arrow keys be reversed?
79 bool reverseDirectionNeeded(Cursor const & cur);
80
81 /// Is current paragraph in RTL mode?
82 bool isWithinRtlParagraph(Cursor const & cur);
83
84 } // namespace lyx
85
86 #endif // BIDI_H