Commit 1eea71a2 authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander.Trofimov

Сделана функция в апи asc_getKeyboardLanguage для получения текущей раскладки...

Сделана функция в апи asc_getKeyboardLanguage для получения текущей раскладки клавиатуры. Сделано, чтобы в зависимости от возвращаемого значения в этой функции менялся язык вводимого текста.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@61823 954022d7-b5bf-4e40-9824-e11837661b57
parent a3682c44
......@@ -792,9 +792,10 @@ function CDocument(DrawingDocument)
this.Spelling = new CDocumentSpelling();
// Дополнительные настройки
this.UseTextShd = true; // Использовать ли заливку текста
this.ForceCopySectPr = false; // Копировать ли настройки секции, если родительский класс параграфа не документ
this.CopyNumberingMap = null; // Мап старый индекс -> новый индекс для копирования нумерации
this.UseTextShd = true; // Использовать ли заливку текста
this.ForceCopySectPr = false; // Копировать ли настройки секции, если родительский класс параграфа не документ
this.CopyNumberingMap = null; // Мап старый индекс -> новый индекс для копирования нумерации
this.CheckLanguageOnTextAdd = false; // Проверять ли язык при добавлении текста в ран
// Мап для рассылки
this.MailMergeMap = null;
......@@ -9470,7 +9471,9 @@ CDocument.prototype =
this.DrawingDocument.TargetStart();
this.DrawingDocument.TargetShow();
this.CheckLanguageOnTextAdd = true;
this.Paragraph_Add(new ParaSpace());
this.CheckLanguageOnTextAdd = false;
}
}
}
......@@ -10294,7 +10297,10 @@ CDocument.prototype =
this.DrawingDocument.TargetStart();
this.DrawingDocument.TargetShow();
this.CheckLanguageOnTextAdd = true;
this.Paragraph_Add(new ParaText(String.fromCharCode(Code)));
this.CheckLanguageOnTextAdd = false;
}
bRetValue = true;
}
......
......@@ -282,6 +282,52 @@ ParaRun.prototype.Is_StartFromNewLine = function()
// Добавляем элемент в текущую позицию
ParaRun.prototype.Add = function(Item, bMath)
{
if (this.Paragraph && this.Paragraph.LogicDocument && true === this.Paragraph.LogicDocument.CheckLanguageOnTextAdd && editor)
{
var nRequiredLanguage = editor.asc_getKeyboardLanguage();
var nCurrentLanguage = this.Get_CompiledPr(false).Lang.Val;
if (-1 !== nRequiredLanguage && nRequiredLanguage !== nCurrentLanguage)
{
var NewLang = new CLang();
NewLang.Val = nRequiredLanguage;
if (this.Is_Empty())
this.Set_Lang(NewLang);
else
{
var Parent = this.Get_Parent();
var RunPos = this.private_GetPosInParent();
if (null !== Parent && -1 !== RunPos)
{
// Если мы стоим в начале рана, тогда добавим новый ран в начало, если мы стоим в конце рана, тогда
// добавим новый ран после текущего, а если мы в середине рана, тогда надо разбивать текущий ран.
var NewRun = new ParaRun(this.Paragraph, bMath);
NewRun.Set_Pr(this.Pr.Copy());
NewRun.Set_Lang(NewLang);
NewRun.Cursor_MoveToStartPos();
NewRun.Add(Item, bMath);
var CurPos = this.State.ContentPos;
if (0 === CurPos)
Parent.Add_ToContent(RunPos, NewRun);
else if (this.Content.length === CurPos)
Parent.Add_ToContent(RunPos + 1, NewRun);
else
{
// Нужно разделить данный ран в текущей позиции
var RightRun = this.Split2(CurPos);
Parent.Add_ToContent(RunPos + 1, NewRun);
Parent.Add_ToContent(RunPos + 2, RightRun);
}
NewRun.Make_ThisElementCurrent();
return;
}
}
}
}
var EditType = null;
if (this.Paragraph && this.Paragraph.LogicDocument)
EditType = this.Paragraph.LogicDocument.Get_EditingType();
......
......@@ -5267,6 +5267,11 @@ asc_docs_api.prototype.asc_getDefaultLanguage = function()
return editor.WordControl.m_oLogicDocument.Get_DefaultLanguage();
};
asc_docs_api.prototype.asc_getKeyboardLanguage = function()
{
return -1;
};
asc_docs_api.prototype.asc_setSpellCheck = function(isOn)
{
if (editor.WordControl.m_oLogicDocument)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment