using std::endl;
using std::pair;
-extern string DoAccent(string const &, tex_accent);
-extern string DoAccent(char, tex_accent);
+extern string const DoAccent(string const &, tex_accent);
+extern string const DoAccent(char, tex_accent);
extern BufferView * current_view;
}
-string TransInitState::normalkey(char c, char * t)
+string const TransInitState::normalkey(char c, string const & t)
{
string res;
- if (t) res = t;
+ if (!t.empty()) res = t;
else res = c;
return res;
}
-string TransInitState::deadkey(char c, KmodInfo d)
+string const TransInitState::deadkey(char c, KmodInfo d)
{
deadkey_ = c;
deadkey_info_ = d;
}
-string TransDeadkeyState::normalkey(char c, char * trans)
+string const TransDeadkeyState::normalkey(char c, string const & trans)
{
string res;
}
if (l == 0) {
// Not an exception. Check if it allowed
- if (current_view->buffer()->params.allowAccents == true ||
- countChar(deadkey_info_.allowed, c) > 0) {
+ if (countChar(deadkey_info_.allowed, c) > 0) {
res = DoAccent(c, deadkey_info_.accent);
} else {
// Not allowed
}
-string TransDeadkeyState::deadkey(char c, KmodInfo d)
+string const TransDeadkeyState::deadkey(char c, KmodInfo d)
{
string res;
}
-string TransCombinedState::normalkey(char c, char * trans)
+string const TransCombinedState::normalkey(char c, string const & trans)
{
string res;
}
-string TransCombinedState::deadkey(char c, KmodInfo d)
+string const TransCombinedState::deadkey(char c, KmodInfo d)
{
// Third key in a row. Output the first one and
// reenter with shifted deadkeys
}
-bool TransManager::setCharset(char const * set)
+bool TransManager::setCharset(string const & str)
{
- return chset_.loadFile(set);
+ return chset_.loadFile(str);
}
void TransManager::insertVerbatim(string const & str, LyXText * text)
{
- int l = str.length();
+ string::size_type const l = str.length();
- for (int i = 0; i < l; ++i){
+ for (string::size_type i = 0; i < l; ++i) {
if (str[i] == '\"'
- && text->GetFont(text->cursor.par,
- text->cursor.pos).latex() == LyXFont::OFF)
+ && text->GetFont(current_view->buffer(),text->cursor.par(),
+ text->cursor.pos()).latex() == LyXFont::OFF
+ && text->GetFont(current_view->buffer(),text->cursor.par(),
+ text->cursor.pos()).language()->lang() != "hebrew")
current_view->insertCorrectQuote();
else
- text->InsertChar(str[i]);
+ text->InsertChar(current_view, str[i]);
}
}
-void TransManager::insert(string str, LyXText * text)
+void TransManager::insert(string const & str, LyXText * text)
{
// Go through the character encoding only if the current
// encoding (chset_->name()) matches the current font_norm
// Could not find an encoding
InsetLatexAccent ins(str);
if (ins.CanDisplay()) {
- text->InsertInset(new InsetLatexAccent(ins));
+ text->InsertInset(current_view, new InsetLatexAccent(ins));
} else {
insertVerbatim(str, text);
}