X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBidi.h;h=c406a7a2b52ed995ab5e5f8f0f8a1be2c5f8524f;hb=5b336954d7eb234f424164a8e4d039db74002afa;hp=deb6cd31004fc7eacae8dafeee69b1928887cdf6;hpb=c9f9ba315c8e475ad47c64fef6c9c755dea3d55c;p=lyx.git diff --git a/src/Bidi.h b/src/Bidi.h index deb6cd3100..c406a7a2b5 100644 --- a/src/Bidi.h +++ b/src/Bidi.h @@ -12,15 +12,18 @@ #ifndef BIDI_H #define BIDI_H -#include - #include "support/types.h" + #include + +namespace lyx { + class Buffer; +class Cursor; class Paragraph; class Row; -class LyXFont; +class Font; /// bidi stuff @@ -28,40 +31,56 @@ class Bidi { public: /// bool isBoundary(Buffer const &, Paragraph const & par, - lyx::pos_type pos) const; + pos_type pos) const; /// bool isBoundary(Buffer const &, Paragraph const & par, - lyx::pos_type pos, LyXFont const & font) const; - /// - lyx::pos_type log2vis(lyx::pos_type pos) const; + pos_type pos, Font const & font) const; + /** Maps positions in the visual string to positions + * in logical string. + */ + pos_type log2vis(pos_type pos) const; /** Maps positions in the logical string to positions * in visual string. */ - lyx::pos_type vis2log(lyx::pos_type pos) const; - /// - lyx::pos_type level(lyx::pos_type pos) const; - /// - bool inRange(lyx::pos_type pos) const; - /// same_direction? + pos_type vis2log(pos_type pos) const; + /* + * The text direction at logical position \param pos. + * Possible values are + * 0: left-to-right text + * 1: right-to-left text + * 2: left-to-right text in right-to-left language (aka numbers) + */ + pos_type level(pos_type pos) const; + /// Is logical position covered by this row? + bool inRange(pos_type pos) const; + /// Is the whole row in the same direction as the paragraph? bool same_direction() const; - /// + /// Compute the data for visual positions. void computeTables(Paragraph const & par, Buffer const &, Row const & row); private: /// bool same_direction_; /// - std::vector log2vis_list_; + std::vector log2vis_list_; /** Maps positions in the visual string to positions * in logical string. */ - std::vector vis2log_list_; + std::vector vis2log_list_; /// - std::vector levels_; + std::vector levels_; /// - lyx::pos_type start_; + pos_type start_; /// - lyx::pos_type end_; + pos_type end_; }; +/// Should interpretation of the arrow keys be reversed? +bool reverseDirectionNeeded(Cursor const & cur); + +/// Is current paragraph in RTL mode? +bool isWithinRtlParagraph(Cursor const & cur); + +} // namespace lyx + #endif // BIDI_H