Commit 289968cf authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander.Trofimov

Добавлена возможность менять словарь для проверки орфографии у выделенной...

Добавлена возможность менять словарь для проверки орфографии у выделенной части текста. Сделана обработка с вариантами замены неправильно набранного слова. Доработан тестовый пример(варианты замены, изменение словаря)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47312 954022d7-b5bf-4e40-9824-e11837661b57
parent 231aedd5
...@@ -67,6 +67,7 @@ var historyitem_TextPr_SmallCaps = 15; // Изменяем все буквы н ...@@ -67,6 +67,7 @@ var historyitem_TextPr_SmallCaps = 15; // Изменяем все буквы н
var historyitem_TextPr_Position = 16; // Изменяем вертикальное положение var historyitem_TextPr_Position = 16; // Изменяем вертикальное положение
var historyitem_TextPr_Value = 17; // Изменяем целиком все настройки var historyitem_TextPr_Value = 17; // Изменяем целиком все настройки
var historyitem_TextPr_RFonts = 18; // Изменяем настройки шрифтов var historyitem_TextPr_RFonts = 18; // Изменяем настройки шрифтов
var historyitem_TextPr_Lang = 19; // Изменяем настройку языка
// Типы изменений в классе ParaDrawing // Типы изменений в классе ParaDrawing
var historyitem_Drawing_Size = 1; // Изменяем размер картинки var historyitem_Drawing_Size = 1; // Изменяем размер картинки
...@@ -81,7 +82,7 @@ var historyitem_Drawing_AbsoluteTransform = 9; ...@@ -81,7 +82,7 @@ var historyitem_Drawing_AbsoluteTransform = 9;
var historyitem_Drawing_BehindDoc = 10; // Изменяем положение объекта (за/перед текстом) var historyitem_Drawing_BehindDoc = 10; // Изменяем положение объекта (за/перед текстом)
var historyitem_Drawing_SetZIndex = 11; var historyitem_Drawing_SetZIndex = 11;
var historyitem_Drawing_SetGraphicObject = 12; var historyitem_Drawing_SetGraphicObject = 12;
var historyitem_CalculateAfterPaste = 13; var historyitem_CalculateAfterPaste = 13;
// Типы изменений в классе CDrawingObjects // Типы изменений в классе CDrawingObjects
......
...@@ -827,6 +827,10 @@ Paragraph.prototype = ...@@ -827,6 +827,10 @@ Paragraph.prototype =
{ {
this.SpellChecker.Clear(); this.SpellChecker.Clear();
var Pr = this.Get_CompiledPr();
var CurTextPr = Pr.TextPr;
var CurLcid = CurTextPr.Lang.Val;
var bWord = false; var bWord = false;
var sWord = ""; var sWord = "";
var nWordStart = 0; var nWordStart = 0;
...@@ -838,7 +842,19 @@ Paragraph.prototype = ...@@ -838,7 +842,19 @@ Paragraph.prototype =
var Item = this.Content[Pos]; var Item = this.Content[Pos];
if ( para_TextPr === Item.Type ) if ( para_TextPr === Item.Type )
{
CurTextPr = this.Internal_CalculateTextPr( Pos );
if ( true === bWord && CurLcid != CurTextPr.Lang.Val )
{
bWord = false;
this.SpellChecker.Add( nWordStart, nWordEnd, sWord, CurLcid );
}
CurLcid = CurTextPr.Lang.Val;
continue; continue;
}
else if ( para_Text === Item.Type && false === Item.Is_Punctuation() && false === Item.Is_NBSP() ) else if ( para_Text === Item.Type && false === Item.Is_Punctuation() && false === Item.Is_NBSP() )
{ {
if ( false === bWord ) if ( false === bWord )
...@@ -859,7 +875,7 @@ Paragraph.prototype = ...@@ -859,7 +875,7 @@ Paragraph.prototype =
if ( true === bWord ) if ( true === bWord )
{ {
bWord = false; bWord = false;
this.SpellChecker.Add( nWordStart, nWordEnd, sWord ); this.SpellChecker.Add( nWordStart, nWordEnd, sWord, CurLcid );
} }
} }
} }
...@@ -6539,8 +6555,24 @@ Paragraph.prototype = ...@@ -6539,8 +6555,24 @@ Paragraph.prototype =
} }
}, },
Internal_Clear_EmptyTextPr : function()
{
var Count = this.Content.length;
for ( var Pos = 0; Pos < Count - 1; Pos++ )
{
if ( para_TextPr === this.Content[Pos].Type && para_TextPr === this.Content[Pos + 1].Type )
{
this.Internal_Content_Remove( Pos );
Pos--;
Count--;
}
}
},
Internal_AddTextPr : function(TextPr) Internal_AddTextPr : function(TextPr)
{ {
this.Internal_Clear_EmptyTextPr();
if ( undefined != TextPr.FontFamily ) if ( undefined != TextPr.FontFamily )
{ {
var FName = TextPr.FontFamily.Name; var FName = TextPr.FontFamily.Name;
...@@ -9628,6 +9660,15 @@ Paragraph.prototype = ...@@ -9628,6 +9660,15 @@ Paragraph.prototype =
{ {
if ( true === this.Selection.Use ) if ( true === this.Selection.Use )
{ {
var StartPos = this.Selection.StartPos;
var EndPos = this.Selection.EndPos;
if ( StartPos > EndPos )
{
StartPos = this.Selection.EndPos;
EndPos = this.Selection.StartPos;
}
var Hyper_start = this.Check_Hyperlink2( this.Selection.StartPos ); var Hyper_start = this.Check_Hyperlink2( this.Selection.StartPos );
var Hyper_end = this.Check_Hyperlink2( this.Selection.EndPos ); var Hyper_end = this.Check_Hyperlink2( this.Selection.EndPos );
...@@ -9680,6 +9721,8 @@ Paragraph.prototype = ...@@ -9680,6 +9721,8 @@ Paragraph.prototype =
editor.sync_HyperlinkPropCallback( HyperProps ); editor.sync_HyperlinkPropCallback( HyperProps );
} }
this.SpellChecker.Document_UpdateInterfaceState( StartPos, EndPos );
} }
else else
{ {
...@@ -9733,6 +9776,8 @@ Paragraph.prototype = ...@@ -9733,6 +9776,8 @@ Paragraph.prototype =
editor.sync_HyperlinkPropCallback( HyperProps ); editor.sync_HyperlinkPropCallback( HyperProps );
} }
this.SpellChecker.Document_UpdateInterfaceState( this.CurPos.ContentPos, this.CurPos.ContentPos );
} }
}, },
...@@ -12213,9 +12258,9 @@ CParaSpellChecker.prototype = ...@@ -12213,9 +12258,9 @@ CParaSpellChecker.prototype =
this.RecalcId = RecalcId; this.RecalcId = RecalcId;
}, },
Add : function(StartPos, EndPos, Word) Add : function(StartPos, EndPos, Word, Lang)
{ {
this.Elements.push( new CParaSpellCheckerElement( StartPos, EndPos, Word ) ); this.Elements.push( new CParaSpellCheckerElement( StartPos, EndPos, Word, Lang ) );
}, },
Check : function() Check : function()
...@@ -12231,7 +12276,7 @@ CParaSpellChecker.prototype = ...@@ -12231,7 +12276,7 @@ CParaSpellChecker.prototype =
} }
if ( 0 < usrWords.length ) if ( 0 < usrWords.length )
spellCheck(editor, SpellCheck_CallBack, JSON.stringify({"type": "spell", "ParagraphId": this.ParaId, "RecalcId" : this.RecalcId, "usrWords" : usrWords, "usrLang" : usrLang }) ); spellCheck(editor, SpellCheck_CallBack, JSON.stringify({"type": "spell", "ParagraphId": this.ParaId, "RecalcId" : this.RecalcId, "ElementId" : 0, "usrWords" : usrWords, "usrLang" : usrLang }) );
}, },
Check_CallBack : function(RecalcId, UsrCorrect) Check_CallBack : function(RecalcId, UsrCorrect)
...@@ -12265,19 +12310,66 @@ CParaSpellChecker.prototype = ...@@ -12265,19 +12310,66 @@ CParaSpellChecker.prototype =
return true; return true;
}, },
Set_RecalcId : function(RecalcId) Document_UpdateInterfaceState : function(StartPos, EndPos)
{ {
this.RecalcId = RecalcId; // Надо определить, попадает ли какое-либо неверно набранное слово в заданный промежуток, и одно ли оно
var Count = this.Elements.length;
var FoundElement = null;
var FoundIndex = -1;
for ( var Index = 0; Index < Count; Index++ )
{
var Element = this.Elements[Index];
if ( Element.StartPos <= EndPos && Element.EndPos >= StartPos && false === Element.Checked )
{
if ( null != FoundElement )
{
FoundElement = null;
break;
}
else
{
FoundIndex = Index;
FoundElement = Element;
}
}
}
var Word = "";
var Variants = null;
var Checked = true;
if ( null != FoundElement )
{
Word = FoundElement.Word;
Variants = FoundElement.Variants;
Checked = FoundElement.Checked;
if ( null === Variants )
{
spellCheck(editor, SpellCheck_CallBack, JSON.stringify({"type": "suggest", "ParagraphId": this.ParaId, "RecalcId" : this.RecalcId, "ElementId" : FoundIndex, "usrWords" : [Word], "usrLang" : [FoundElement.Lang] }) );
}
}
editor.sync_SpellCheckCallback( Word, Checked, Variants );
},
Check_CallBack2: function(RecalcId, ElementId, usrVariants)
{
if ( RecalcId == this.RecalcId )
{
this.Elements[ElementId].Variants = usrVariants[0];
}
} }
}; };
function CParaSpellCheckerElement(StartPos, EndPos, Word) function CParaSpellCheckerElement(StartPos, EndPos, Word, Lang)
{ {
this.StartPos = StartPos; this.StartPos = StartPos;
this.EndPos = EndPos; this.EndPos = EndPos;
this.Word = Word; this.Word = Word;
this.Lang = lcid_enUS; this.Lang = Lang;
this.Checked = true; this.Checked = true;
this.Variants = null;
} }
CParaSpellCheckerElement.prototype = CParaSpellCheckerElement.prototype =
...@@ -12291,10 +12383,19 @@ function SpellCheck_CallBack(Obj) ...@@ -12291,10 +12383,19 @@ function SpellCheck_CallBack(Obj)
{ {
var ParaId = Obj["ParagraphId"]; var ParaId = Obj["ParagraphId"];
var Paragraph = g_oTableId.Get_ById( ParaId ); var Paragraph = g_oTableId.Get_ById( ParaId );
var Type = Obj["type"];
if ( null != Paragraph ) if ( null != Paragraph )
{ {
Paragraph.SpellChecker.Check_CallBack( Obj["RecalcId"], Obj["usrCorrect"] ); if ( "spell" === Type )
Paragraph.ReDraw(); {
Paragraph.SpellChecker.Check_CallBack( Obj["RecalcId"], Obj["usrCorrect"] );
Paragraph.ReDraw();
}
else if ( "suggest" === Type )
{
Paragraph.SpellChecker.Check_CallBack2( Obj["RecalcId"], Obj["ElementId"], Obj["usrSuggest"] );
editor.sync_SpellCheckVariantsFound();
}
} }
} }
} }
\ No newline at end of file
...@@ -50,7 +50,7 @@ var g_aPunctuation = ...@@ -50,7 +50,7 @@ var g_aPunctuation =
[ [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
...@@ -60,6 +60,8 @@ var g_aPunctuation = ...@@ -60,6 +60,8 @@ var g_aPunctuation =
g_aPunctuation[0x00AB] = 1; // символ « g_aPunctuation[0x00AB] = 1; // символ «
g_aPunctuation[0x00BB] = 1; // символ » g_aPunctuation[0x00BB] = 1; // символ »
g_aPunctuation[0x2013] = 1; // символ –
g_aPunctuation[0x2026] = 1; // символ ...
// Класс ParaText // Класс ParaText
function ParaText(value) function ParaText(value)
...@@ -122,8 +124,9 @@ ParaText.prototype = ...@@ -122,8 +124,9 @@ ParaText.prototype =
var Hint = TextPr.RFonts.Hint; var Hint = TextPr.RFonts.Hint;
var bCS = TextPr.CS; var bCS = TextPr.CS;
var bRTL = TextPr.RTL; var bRTL = TextPr.RTL;
var lcid = TextPr.Lang.EastAsia;
this.FontSlot = g_font_detector.Get_FontClass( this.CalcValue.charCodeAt(0), Hint, lcid_unknown, bCS, bRTL ); this.FontSlot = g_font_detector.Get_FontClass( this.CalcValue.charCodeAt(0), Hint, lcid, bCS, bRTL );
Context.SetFontSlot( this.FontSlot, this.FontKoef ); Context.SetFontSlot( this.FontSlot, this.FontKoef );
var Temp = Context.Measure( this.CalcValue ); var Temp = Context.Measure( this.CalcValue );
...@@ -425,6 +428,9 @@ ParaTextPr.prototype = ...@@ -425,6 +428,9 @@ ParaTextPr.prototype =
if ( undefined != TextPr.RFonts ) if ( undefined != TextPr.RFonts )
this.Set_RFonts( TextPr.RFonts ); this.Set_RFonts( TextPr.RFonts );
if ( undefined != TextPr.Lang )
this.Set_Lang( TextPr.Lang );
}, },
Set_Prop : function(Prop, Value) Set_Prop : function(Prop, Value)
...@@ -645,6 +651,19 @@ ParaTextPr.prototype = ...@@ -645,6 +651,19 @@ ParaTextPr.prototype =
History.Add( this, { Type : historyitem_TextPr_RFonts, New : Value, Old : OldValue } ); History.Add( this, { Type : historyitem_TextPr_RFonts, New : Value, Old : OldValue } );
}, },
Set_Lang : function(Value)
{
var OldValue = this.Value;
var NewValue = new CLang();
if ( undefined != Value )
NewValue.Set_FromObject( Value );
this.Value.Lang = NewValue;
History.Add( this, { Type : historyitem_TextPr_Lang, New : NewValue, Old : OldValue } );
},
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Undo/Redo функции // Undo/Redo функции
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
...@@ -827,6 +846,16 @@ ParaTextPr.prototype = ...@@ -827,6 +846,16 @@ ParaTextPr.prototype =
break; break;
} }
case historyitem_TextPr_Lang:
{
if ( undefined != Data.Old )
this.Value = Data.Old;
else
this.Value = new CLang();
break;
}
} }
}, },
...@@ -1012,6 +1041,16 @@ ParaTextPr.prototype = ...@@ -1012,6 +1041,16 @@ ParaTextPr.prototype =
break; break;
} }
case historyitem_TextPr_Lang:
{
if ( undefined != Data.New )
this.Value = Data.New;
else
this.Value = new CLang();
break;
}
} }
}, },
...@@ -1270,6 +1309,21 @@ ParaTextPr.prototype = ...@@ -1270,6 +1309,21 @@ ParaTextPr.prototype =
break; break;
} }
case historyitem_TextPr_Lang:
{
// Bool : undefined ?
// false -> CLang
if ( undefined != Data.Old )
{
Writer.WriteBool( false );
Data.New.Write_ToBinary( Writer );
}
else
Writer.WriteBool( true );
break;
}
} }
return Writer; return Writer;
...@@ -1546,6 +1600,21 @@ ParaTextPr.prototype = ...@@ -1546,6 +1600,21 @@ ParaTextPr.prototype =
break; break;
} }
case historyitem_TextPr_Lang:
{
// Bool : undefined ?
// false -> Lang
if ( false === Reader.GetBool() )
{
this.Value.Lang = new CLang();
this.Value.Lang.Read_FromBinary( Reader );
}
else
this.Value.Lang = new CLang();
break;
}
} }
} }
}; };
......
...@@ -4229,6 +4229,117 @@ CRFonts.prototype = ...@@ -4229,6 +4229,117 @@ CRFonts.prototype =
} }
}; };
function CLang()
{
this.Bidi = undefined;
this.EastAsia = undefined;
this.Val = undefined;
}
CLang.prototype =
{
Copy : function()
{
var Lang = new CLang();
Lang.Bidi = this.Bidi;
Lang.EastAsia = this.EastAsia;
Lang.Val = this.Val;
return Lang;
},
Merge : function(Lang)
{
if ( undefined !== Lang.Bidi )
this.Bidi = Lang.Bidi;
if ( undefined !== Lang.EastAsia )
this.EastAsia = Lang.EastAsia;
if ( undefined !== Lang.Val )
this.Val = Lang.Val;
},
Init_Default : function()
{
this.Bidi = lcid_ruRU;
this.EastAsia = lcid_ruRU;
this.Val = lcid_ruRU;
},
Set_FromObject : function(Lang)
{
this.Bidi = Lang.Bidi;
this.EastAsia = Lang.EastAsia;
this.Val = Lang.Val;
},
Compare : function(Lang)
{
var Result_Lang = new CLang();
// Bidi
if ( this.Bidi === Lang.Bidi )
Result_Lang.Bidi = Lang.Bidi;
// EastAsia
if ( this.EastAsia === Lang.EastAsia )
Result_Lang.EastAsia = Lang.EastAsia;
// Val
if ( this.Val === Lang.Val )
Result_Lang.Val = Lang.Val;
return Result_Lang;
},
Write_ToBinary : function(Writer)
{
var StartPos = Writer.GetCurPosition();
Writer.Skip(4);
var Flags = 0;
if ( undefined != this.Bidi )
{
Writer.WriteLong( this.Bidi );
Flags |= 1;
}
if ( undefined != this.EastAsia )
{
Writer.WriteLong( this.EastAsia );
Flags |= 2;
}
if ( undefined != this.Val )
{
Writer.WriteLong( this.Val );
Flags |= 4;
}
var EndPos = Writer.GetCurPosition();
Writer.Seek( StartPos );
Writer.WriteLong( Flags );
Writer.Seek( EndPos );
},
Read_FromBinary : function(Reader)
{
var Flags = Reader.GetLong();
// Bidi
if ( Flags & 1 )
this.Bidi = Reader.GetLong();
// EastAsia
if ( Flags & 2 )
this.EastAsia = Reader.GetLong();
// Val
if ( Flags & 4 )
this.Val = Reader.GetLong();
}
};
function CTextPr() function CTextPr()
{ {
this.Bold = undefined; // Жирный текст this.Bold = undefined; // Жирный текст
...@@ -4247,12 +4358,13 @@ function CTextPr() ...@@ -4247,12 +4358,13 @@ function CTextPr()
this.SmallCaps = undefined; this.SmallCaps = undefined;
this.Position = undefined; // Смещение по Y this.Position = undefined; // Смещение по Y
this.RFonts = new CRFonts(); this.RFonts = new CRFonts();
this.BoldCS = undefined; this.BoldCS = undefined;
this.ItalicCS = undefined; this.ItalicCS = undefined;
this.FontSizeCS = undefined; this.FontSizeCS = undefined;
this.CS = undefined; this.CS = undefined;
this.RTL = undefined; this.RTL = undefined;
this.Lang = new CLang();
} }
CTextPr.prototype = CTextPr.prototype =
...@@ -4275,12 +4387,13 @@ CTextPr.prototype = ...@@ -4275,12 +4387,13 @@ CTextPr.prototype =
this.SmallCaps = undefined; this.SmallCaps = undefined;
this.Position = undefined; this.Position = undefined;
this.RFonts = new CRFonts(); this.RFonts = new CRFonts();
this.BoldCS = undefined; this.BoldCS = undefined;
this.ItalicCS = undefined; this.ItalicCS = undefined;
this.FontSizeCS = undefined; this.FontSizeCS = undefined;
this.CS = undefined; this.CS = undefined;
this.RTL = undefined; this.RTL = undefined;
this.Lang = undefined;
}, },
Copy : function() Copy : function()
...@@ -4318,13 +4431,13 @@ CTextPr.prototype = ...@@ -4318,13 +4431,13 @@ CTextPr.prototype =
TextPr.Caps = this.Caps; TextPr.Caps = this.Caps;
TextPr.SmallCaps = this.SmallCaps; TextPr.SmallCaps = this.SmallCaps;
TextPr.Position = this.Position; TextPr.Position = this.Position;
TextPr.RFonts = this.RFonts.Copy();
TextPr.RFonts = this.RFonts.Copy(); TextPr.BoldCS = this.BoldCS;
TextPr.BoldCS = this.BoldCS; TextPr.ItalicCS = this.ItalicCS;
TextPr.ItalicCS = this.ItalicCS; TextPr.FontSizeCS = this.FontSizeCS;
TextPr.FontSizeCS = this.FontSizeCS; TextPr.CS = this.CS;
TextPr.CS = this.CS; TextPr.RTL = this.RTL;
TextPr.RTL = this.RTL; TextPr.Lang = this.Lang.Copy();
return TextPr; return TextPr;
}, },
...@@ -4400,6 +4513,8 @@ CTextPr.prototype = ...@@ -4400,6 +4513,8 @@ CTextPr.prototype =
if ( undefined != TextPr.RTL ) if ( undefined != TextPr.RTL )
this.RTL = TextPr.RTL; this.RTL = TextPr.RTL;
this.Lang.Merge( TextPr.Lang );
}, },
Init_Default : function() Init_Default : function()
...@@ -4423,13 +4538,13 @@ CTextPr.prototype = ...@@ -4423,13 +4538,13 @@ CTextPr.prototype =
this.SmallCaps = false; this.SmallCaps = false;
this.Caps = false; this.Caps = false;
this.Position = 0; this.Position = 0;
this.RFonts.Init_Default(); this.RFonts.Init_Default();
this.BoldCS = false; this.BoldCS = false;
this.ItalicCS = false; this.ItalicCS = false;
this.FontSizeCS = 11; this.FontSizeCS = 11;
this.CS = false; this.CS = false;
this.RTL = false; this.RTL = false;
this.Lang.Init_Default();
}, },
Set_FromObject : function(TextPr) Set_FromObject : function(TextPr)
...@@ -4481,6 +4596,9 @@ CTextPr.prototype = ...@@ -4481,6 +4596,9 @@ CTextPr.prototype =
this.FontSizeCS = TextPr.FontSizeCS; this.FontSizeCS = TextPr.FontSizeCS;
this.CS = TextPr.CS; this.CS = TextPr.CS;
this.RTL = TextPr.RTL; this.RTL = TextPr.RTL;
if ( undefined != TextPr.Lang )
this.Lang.Set_FromObject( TextPr.Lang );
}, },
Compare : function(TextPr) Compare : function(TextPr)
...@@ -4579,6 +4697,9 @@ CTextPr.prototype = ...@@ -4579,6 +4697,9 @@ CTextPr.prototype =
if ( this.RTL === TextPr.RTL ) if ( this.RTL === TextPr.RTL )
Result_TextPr.RTL = TextPr.RTL; Result_TextPr.RTL = TextPr.RTL;
// Lang
Result_TextPr.Lang = this.Lang.Compare( TextPr.Lang );
return Result_TextPr; return Result_TextPr;
}, },
...@@ -4723,6 +4844,12 @@ CTextPr.prototype = ...@@ -4723,6 +4844,12 @@ CTextPr.prototype =
Flags |= 1048576; Flags |= 1048576;
} }
if ( undefined != this.Lang )
{
this.Lang.Write_ToBinary( Writer );
Flags |= 2097152;
}
var EndPos = Writer.GetCurPosition(); var EndPos = Writer.GetCurPosition();
Writer.Seek( StartPos ); Writer.Seek( StartPos );
Writer.WriteLong( Flags ); Writer.WriteLong( Flags );
...@@ -4828,6 +4955,10 @@ CTextPr.prototype = ...@@ -4828,6 +4955,10 @@ CTextPr.prototype =
// RTL // RTL
if ( Flags & 1048576 ) if ( Flags & 1048576 )
this.RTL = Reader.GetBool(); this.RTL = Reader.GetBool();
// Lang
if ( Flags & 2097152 )
this.Lang.Read_FromBinary( Reader );
}, },
Check_NeedRecalc : function() Check_NeedRecalc : function()
...@@ -4874,6 +5005,9 @@ CTextPr.prototype = ...@@ -4874,6 +5005,9 @@ CTextPr.prototype =
if ( undefined != this.RTL || undefined != this.CS || undefined != this.BoldCS || undefined != this.ItalicCS || undefined != this.FontSizeCS ) if ( undefined != this.RTL || undefined != this.CS || undefined != this.BoldCS || undefined != this.ItalicCS || undefined != this.FontSizeCS )
return true; return true;
if ( undefined != this.Lang.Val )
return true;
return false; return false;
}, },
......
...@@ -2145,6 +2145,16 @@ ...@@ -2145,6 +2145,16 @@
<input id="prTextPosition" style="width:30px;" value="0"/> Position <input id="prTextPosition" style="width:30px;" value="0"/> Position
</div> </div>
</div> </div>
<div style="float:left;border-top: 2px ridge silver;width:300px">
<select id="prLang" style="float:left">
<option value="0">Английский (США)</option>
<option value="1">Русский</option>
<option value="2">Немецкий</option>
</select>
<select id="prSpellingVariants" style="float:left">
</select>
</div>
</div> </div>
<div id="prUsersDrag" style="display:none;width:200px;background-color:#fff;top:215px;right:50px;z-index:100;position:absolute;border: 4px ridge silver;cursor:move;"> <div id="prUsersDrag" style="display:none;width:200px;background-color:#fff;top:215px;right:50px;z-index:100;position:absolute;border: 4px ridge silver;cursor:move;">
<div style="float:left;width:180px;text-align: center;cursor:move;"> <div style="float:left;width:180px;text-align: center;cursor:move;">
......
...@@ -2696,6 +2696,19 @@ asc_docs_api.prototype.put_TextPrPosition = function(value) ...@@ -2696,6 +2696,19 @@ asc_docs_api.prototype.put_TextPrPosition = function(value)
} }
} }
asc_docs_api.prototype.put_TextPrLang = function(value)
{
if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content) )
{
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint();
this.WordControl.m_oLogicDocument.Paragraph_Add( new ParaTextPr( { Lang : { Val : value } } ) );
if ( true === this.isMarkerFormat )
this.sync_MarkerFormatCallback( false );
}
}
asc_docs_api.prototype.put_PrLineSpacing = function(Type, Value) asc_docs_api.prototype.put_PrLineSpacing = function(Type, Value)
{ {
if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Properties) ) if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Properties) )
...@@ -4817,6 +4830,30 @@ asc_docs_api.prototype.sync_DialogAddHyperlink = function() ...@@ -4817,6 +4830,30 @@ asc_docs_api.prototype.sync_DialogAddHyperlink = function()
{ {
this.asc_fireCallback("asc_onDialogAddHyperlink"); this.asc_fireCallback("asc_onDialogAddHyperlink");
} }
//-----------------------------------------------------------------
// Функции для работы с орфографией
//-----------------------------------------------------------------
function asc_CSpellCheckProperty( Word, Checked, Variants )
{
this.Word = Word;
this.Checked = Checked;
this.Variants = Variants;
}
asc_CSpellCheckProperty.prototype.get_Word = function() { return this.Word; }
asc_CSpellCheckProperty.prototype.get_Checked = function() { return this.Checked; }
asc_CSpellCheckProperty.prototype.get_Variants = function() { return this.Variants; }
asc_docs_api.prototype.sync_SpellCheckCallback = function(Word, Checked, Variants)
{
this.SelectedObjectsStack[this.SelectedObjectsStack.length] = new CSelectedObject( c_oAscTypeSelectElement.SpellCheck, new asc_CSpellCheckProperty( Word, Checked, Variants ) );
}
asc_docs_api.prototype.sync_SpellCheckVariantsFound = function()
{
this.asc_fireCallback("asc_onSpellCheckVariantsFound");
}
//----------------------------------------------------------------- //-----------------------------------------------------------------
// Функции для работы с комментариями // Функции для работы с комментариями
//----------------------------------------------------------------- //-----------------------------------------------------------------
......
...@@ -105,11 +105,12 @@ var c_oAscError = { ...@@ -105,11 +105,12 @@ var c_oAscError = {
var c_oAscTypeSelectElement = var c_oAscTypeSelectElement =
{ {
Paragraph : 0, Paragraph : 0,
Table : 1, Table : 1,
Image : 2, Image : 2,
Header : 3, Header : 3,
Hyperlink : 4 Hyperlink : 4,
SpellCheck : 5
} }
var c_oAscTableBordersType = { var c_oAscTableBordersType = {
......
...@@ -1806,6 +1806,12 @@ $(".colorWatch").mouseover(function(){ ...@@ -1806,6 +1806,12 @@ $(".colorWatch").mouseover(function(){
sendStatus( "There're some changed to be updated" ); sendStatus( "There're some changed to be updated" );
}); });
editor.asc_registerCallback("asc_onSpellCheckVariantsFound", function()
{
editor.WordControl.m_oLogicDocument.Document_UpdateInterfaceState();
});
$("#hafFP").click(function(){ $("#hafFP").click(function(){
editor.HeadersAndFooters_DifferentFirstPage(document.getElementById ("hafFP").checked); editor.HeadersAndFooters_DifferentFirstPage(document.getElementById ("hafFP").checked);
}) })
...@@ -1997,6 +2003,19 @@ $(".colorWatch").mouseover(function(){ ...@@ -1997,6 +2003,19 @@ $(".colorWatch").mouseover(function(){
editor.tblApply( { TableStyle : TableStyleId } ); editor.tblApply( { TableStyle : TableStyleId } );
}) })
$("#prLang").change(function(evt)
{
var lcid = lcid_enUS;
switch (this.selectedIndex)
{
case 0 : lcid = lcid_enUS; break;
case 1 : lcid = lcid_ruRU; break;
case 2 : lcid = lcid_deDE; break;
}
editor.put_TextPrLang( lcid );
})
$("#tblLookFirstRow, #tblLookLastRow, #tblLookFirstCol, #tblLookLastCol, #tblLookHorBand, #tblLookVerBand,").change(function(evt) $("#tblLookFirstRow, #tblLookLastRow, #tblLookFirstCol, #tblLookLastCol, #tblLookHorBand, #tblLookVerBand,").change(function(evt)
{ {
var TableLook = var TableLook =
...@@ -2739,6 +2758,41 @@ $(".colorWatch").mouseover(function(){ ...@@ -2739,6 +2758,41 @@ $(".colorWatch").mouseover(function(){
$("#hyperToolTip").val( elemVal.ToolTip ); $("#hyperToolTip").val( elemVal.ToolTip );
else else
$("#hyperToolTip").val(""); $("#hyperToolTip").val("");
}
else if ( ObjectType == c_oAscTypeSelectElement.SpellCheck )
{
var elemVal = elemArg.get_ObjectValue();
var Word = elemVal.get_Word();
var Checked = elemVal.get_Checked();
var Variants = elemVal.get_Variants();
var SpellingVariants = document.getElementById("prSpellingVariants");
SpellingVariants.options.length = 0;
if ( true === Checked )
{
}
else
{
var SpellingVariants = document.getElementById("prSpellingVariants");
SpellingVariants.options.length = 0;
if ( null != Variants && 0 < Variants.length )
{
SpellingVariants.disabled = 0;
for ( var Index = 0; Index < Variants.length; Index++ )
{
$('#prSpellingVariants').append($('<option>', { Index : Index } ).text(Variants[Index]));
}
}
else
{
SpellingVariants.disabled = "disabled";
$('#prSpellingVariants').append($('<option>', { Index : 0 } ).text("Нет вариантов"));
}
}
} }
} }
} }
......
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