2003-10-23 13:28:49 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file Bidi.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Dekel Tsur
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BIDI_H
|
|
|
|
#define BIDI_H
|
|
|
|
|
|
|
|
#include "support/types.h"
|
2007-05-15 17:19:05 +00:00
|
|
|
#include "Cursor.h"
|
2003-10-23 13:28:49 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2003-10-23 13:28:49 +00:00
|
|
|
class Buffer;
|
|
|
|
class Paragraph;
|
|
|
|
class Row;
|
2007-04-29 18:17:15 +00:00
|
|
|
class Font;
|
2003-10-23 13:28:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
/// bidi stuff
|
2005-01-19 15:03:31 +00:00
|
|
|
class Bidi {
|
|
|
|
public:
|
2003-10-23 13:28:49 +00:00
|
|
|
///
|
|
|
|
bool isBoundary(Buffer const &, Paragraph const & par,
|
2006-10-21 00:16:43 +00:00
|
|
|
pos_type pos) const;
|
2003-10-23 13:28:49 +00:00
|
|
|
///
|
|
|
|
bool isBoundary(Buffer const &, Paragraph const & par,
|
2007-04-29 18:17:15 +00:00
|
|
|
pos_type pos, Font const & font) const;
|
2003-10-23 13:28:49 +00:00
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
pos_type log2vis(pos_type pos) const;
|
2003-10-23 13:28:49 +00:00
|
|
|
/** Maps positions in the logical string to positions
|
|
|
|
* in visual string.
|
|
|
|
*/
|
2006-10-21 00:16:43 +00:00
|
|
|
pos_type vis2log(pos_type pos) const;
|
2003-10-23 13:28:49 +00:00
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
pos_type level(pos_type pos) const;
|
2003-10-23 13:28:49 +00:00
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
bool inRange(pos_type pos) const;
|
2003-10-23 13:28:49 +00:00
|
|
|
/// same_direction?
|
|
|
|
bool same_direction() const;
|
|
|
|
///
|
|
|
|
void computeTables(Paragraph const & par,
|
2004-03-01 12:23:17 +00:00
|
|
|
Buffer const &, Row const & row);
|
2004-04-03 08:37:12 +00:00
|
|
|
private:
|
|
|
|
///
|
2003-10-23 13:28:49 +00:00
|
|
|
bool same_direction_;
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
std::vector<pos_type> log2vis_list_;
|
2003-10-23 13:28:49 +00:00
|
|
|
/** Maps positions in the visual string to positions
|
|
|
|
* in logical string.
|
|
|
|
*/
|
2006-10-21 00:16:43 +00:00
|
|
|
std::vector<pos_type> vis2log_list_;
|
2003-10-23 13:28:49 +00:00
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
std::vector<pos_type> levels_;
|
2003-10-23 13:28:49 +00:00
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
pos_type start_;
|
2003-10-23 13:28:49 +00:00
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
pos_type end_;
|
2003-10-23 13:28:49 +00:00
|
|
|
};
|
|
|
|
|
2007-05-15 17:19:05 +00:00
|
|
|
/// Should interpretation of the arrow keys be reversed?
|
|
|
|
bool reverseDirectionNeeded(Cursor const & cur);
|
2006-10-21 00:16:43 +00:00
|
|
|
|
2007-05-16 09:35:12 +00:00
|
|
|
/// Is current paragraph in RTL mode?
|
|
|
|
bool isWithinRtlParagraph(Cursor const & cur);
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
|
|
|
|
2003-10-23 13:28:49 +00:00
|
|
|
#endif // BIDI_H
|