Commit 42563ee5 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

добавление текста в автофигуры

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47819 954022d7-b5bf-4e40-9824-e11837661b57
parent 46314d80
......@@ -169,6 +169,13 @@
<script src="model/DrawingObjects/Format/GroupShape.js"></script>
<script src="model/DrawingObjects/Format/Image.js"></script>
<script src="model/DrawingObjects/Format/Shape.js"></script>
<script src="model/DrawingObjects/Format/TextBody.js"></script>
<script src="model/DrawingObjects/Format/Styles.js"></script>
<script src="model/DrawingObjects/Format/Numbering.js"></script>
<script src="model/DrawingObjects/Format/ParagraphContent.js"></script>
<script src="model/DrawingObjects/Format/Paragraph.js"></script>
<script src="model/DrawingObjects/Format/DocumentContent.js"></script>
<script src="model/DrawingObjects/Format/FontClassification.js"></script>
<script src="model/DrawingObjects/Tracks/AdjustmentTracks.js"></script>
<script src="model/DrawingObjects/Tracks/ResizeTracks.js"></script>
......
......@@ -5,6 +5,126 @@
*/
var docpostype_Content = 0x00;
var docpostype_FlowObjects = 0x01;
var docpostype_HdrFtr = 0x02;
var docpostype_DrawingObjects = 0x03;
// Типы которые возвращают классы CParagraph и CTable после пересчета страницы
var recalcresult_NextElement = 0x00; // Пересчитываем следующий элемент
var recalcresult_PrevPage = 0x01; // Пересчитываем заново предыдущую страницу
var recalcresult_CurPage = 0x02; // Пересчитываем заново текущую страницу
var recalcresult_NextPage = 0x03; // Пересчитываем следующую страницу
// Типы которые возвращают классы CDocument и CDocumentContent после пересчета страницы
var recalcresult2_End = 0x00; // Документ рассчитан до конца
var recalcresult2_NextPage = 0x01; // Рассчет нужно продолжить
var Page_Width = 210;
var Page_Height = 297;
var X_Left_Margin = 30; // 3 cm
var X_Right_Margin = 15; // 1.5 cm
var Y_Bottom_Margin = 20; // 2 cm
var Y_Top_Margin = 20; // 2 cm
var Y_Default_Header = 12.5; // 1.25 cm расстояние от верха страницы до верха верхнего колонтитула
var Y_Default_Footer = 12.5; // 1.25 cm расстояние от низа страницы до низа нижнего колонтитула
var X_Left_Field = X_Left_Margin;
var X_Right_Field = Page_Width - X_Right_Margin;
var Y_Bottom_Field = Page_Height - Y_Bottom_Margin;
var Y_Top_Field = Y_Top_Margin;
var align_Right = 0;
var align_Left = 1;
var align_Center = 2;
var align_Justify = 3;
var vertalign_Baseline = 0;
var vertalign_SuperScript = 1;
var vertalign_SubScript = 2;
var hdrftr_Header = 0x01;
var hdrftr_Footer = 0x02;
var hdrftr_Default = 0x01;
var hdrftr_Even = 0x02;
var hdrftr_First = 0x03;
var c_oAscTableSelectionType =
{
Cell : 0,
Row : 1,
Column : 2,
Table : 3
}
var linerule_AtLeast = 0;
var linerule_Auto = 1;
var linerule_Exact = 2;
var shd_Clear = 0;
var shd_Nil = 1;
var comments_NoComment = 0;
var comments_NonActiveComment = 1;
var comments_ActiveComment = 2;
function Document_Recalculate_Page()
{
var LogicDocument = editor.WordControl.m_oLogicDocument;
var FullRecalc = LogicDocument.FullRecalc;
LogicDocument.Recalculate_Page( FullRecalc.PageIndex, FullRecalc.Start, FullRecalc.StartIndex );
}
function CDocumentPage()
{
this.Width = Page_Width;
this.Height = Page_Height;
this.Margins =
{
Left : X_Left_Field,
Right : X_Right_Field,
Top : Y_Top_Field,
Bottom : Y_Bottom_Field
};
this.Bounds = new CDocumentBounds(0,0,0,0);
// this.FlowObjects = new FlowObjects(editor.WordControl.m_oLogicDocument, 0); // Используем данный объект только для хранения ссылок на Flow-таблицы
this.Pos = 0;
this.EndPos = 0;
this.X = 0;
this.Y = 0;
this.XLimit = 0;
this.YLimit = 0;
}
CDocumentPage.prototype =
{
Update_Limits : function(Limits)
{
this.X = Limits.X;
this.XLimit = Limits.XLimit;
this.Y = Limits.Y;
this.YLimit = Limits.YLimit;
},
Shift : function(Dx, Dy)
{
this.X += Dx;
this.XLimit += Dx;
this.Y += Dy;
this.YLimit += Dy;
this.Bounds.Shift( Dx, Dy );
}
};
// Класс CDocumentContent. Данный класс используется для работы с контентом ячеек таблицы,
// колонтитулов, сносок, надписей.
function CDocumentContent(Parent, DrawingDocument, X, Y, XLimit, YLimit, Split, TurnOffInnerWrap)
......@@ -21,7 +141,7 @@ function CDocumentContent(Parent, DrawingDocument, X, Y, XLimit, YLimit, Split,
this.Parent = Parent;
this.DrawingDocument = DrawingDocument;
this.LogicDocument = editor.WordControl.m_oLogicDocument;
// this.LogicDocument = editor.WordControl.m_oLogicDocument;
if ( "undefined" === typeof(TurnOffInnerWrap) )
TurnOffInnerWrap = false;
......@@ -70,10 +190,10 @@ function CDocumentContent(Parent, DrawingDocument, X, Y, XLimit, YLimit, Split,
};
// Массив укзателей на все инлайновые графические объекты
this.DrawingObjects = this.LogicDocument.DrawingObjects;
// this.DrawingObjects = this.LogicDocument.DrawingObjects;
this.Styles = editor.WordControl.m_oLogicDocument.Get_Styles();
this.Numbering = editor.WordControl.m_oLogicDocument.Get_Numbering();
this.Styles = this.Parent.Get_Styles();
//this.Numbering = editor.WordControl.m_oLogicDocument.Get_Numbering();
this.ClipInfo =
{
......@@ -181,11 +301,11 @@ CDocumentContent.prototype =
// что у них врапится текст не колонтитула, а документа.
CheckRange : function(X0, Y0, X1, Y1, _Y0, _Y1, X_lf, X_rf, PageNum_rel, Inner)
{
if ( undefined === Inner )
/* if ( undefined === Inner )
Inner = true;
if ( (false === this.TurnOffInnerWrap && true === Inner) || (false === Inner) )
return this.LogicDocument.DrawingObjects.CheckRange(X0, Y0, X1, Y1, _Y0, _Y1, X_lf, X_rf, PageNum_rel + this.Get_StartPage_Absolute(), [], this );
return this.LogicDocument.DrawingObjects.CheckRange(X0, Y0, X1, Y1, _Y0, _Y1, X_lf, X_rf, PageNum_rel + this.Get_StartPage_Absolute(), [], this ); */
return [];
},
......@@ -420,10 +540,9 @@ CDocumentContent.prototype =
Recalculate : function()
{
editor.WordControl.m_oLogicDocument.bRecalcDocContent = true;
editor.WordControl.m_oLogicDocument.recalcDocumentConten = this;
editor.WordControl.m_oLogicDocument.Recalculate();
// editor.WordControl.m_oLogicDocument.bRecalcDocContent = true;
// editor.WordControl.m_oLogicDocument.recalcDocumentConten = this;
// editor.WordControl.m_oLogicDocument.Recalculate();
},
Recalculate_ : function(bForceRecalc, LastChangeIndex)
......@@ -578,7 +697,7 @@ CDocumentContent.prototype =
this.Pages.length = PageIndex;
this.Pages[PageIndex] = new CDocumentPage();
this.Pages[PageIndex].Pos = StartIndex;
this.LogicDocument.DrawingObjects.resetDrawingArrays( this.Get_StartPage_Absolute() + PageIndex, this);
//this.LogicDocument.DrawingObjects.resetDrawingArrays( this.Get_StartPage_Absolute() + PageIndex, this);
}
var Count = this.Content.length;
......@@ -617,97 +736,15 @@ CDocumentContent.prototype =
var RecalcResult = recalcresult_NextElement;
var bFlowTable = false;
if ( type_Table === Element.GetType() && true != Element.Is_Inline() )
{
bFlowTable = true;
if ( null === this.RecalcInfo.FlowObject )
{
if ( ( 0 === Index && 0 === PageIndex ) || Index != StartIndex )
{
Element.Set_DocumentIndex( Index );
Element.Reset( X, Y, XLimit, YLimit, PageIndex );
}
this.RecalcInfo.FlowObjectPage = 0;
this.RecalcInfo.FlowObject = Element;
this.RecalcInfo.RecalcResult = Element.Recalculate_Page( PageIndex );
this.DrawingObjects.addFloatTable( new CFlowTable2( Element, PageIndex ) );
RecalcResult = recalcresult_CurPage;
}
else if ( Element === this.RecalcInfo.FlowObject )
{
// Если у нас текущая страница совпадает с той, которая указана в таблице, тогда пересчитываем дальше
if ( Element.PageNum > PageIndex || ( this.RecalcInfo.FlowObjectPage <= 0 && Element.PageNum < PageIndex ) || Element.PageNum === PageIndex )
{
if ( true === this.RecalcInfo.FlowObjectPageBreakBefore )
{
// Добавляем начало таблицы в конец страницы так, чтобы не убралось ничего
Element.Set_DocumentIndex( Index );
Element.Reset( X, Page_Height, XLimit, Page_Height, PageIndex );
Element.Recalculate_Page( PageIndex );
this.RecalcInfo.FlowObjectPage++;
RecalcResult = recalcresult_NextPage;
}
else
{
if ( ( 0 === Index && 0 === PageIndex ) || Index != StartIndex )
{
Element.Set_DocumentIndex( Index );
Element.Reset( X, Y, XLimit, YLimit, PageIndex );
}
RecalcResult = Element.Recalculate_Page( PageIndex );
if ( (( 0 === Index && 0 === PageIndex ) || Index != StartIndex) && true != Element.Is_ContentOnFirstPage() )
{
this.DrawingObjects.removeFloatTableById(PageIndex, Element.Get_Id());
this.RecalcInfo.FlowObjectPageBreakBefore = true;
RecalcResult = recalcresult_CurPage;
}
else
{
this.RecalcInfo.FlowObjectPage++;
if ( recalcresult_NextElement === RecalcResult )
{
this.RecalcInfo.FlowObject = null;
this.RecalcInfo.FlowObjectPageBreakBefore = false;
this.RecalcInfo.FlowObjectPage = 0;
this.RecalcInfo.RecalcResult = recalcresult_NextElement;
}
}
}
}
else
{
RecalcResult = Element.Recalculate_Page( PageIndex );
this.DrawingObjects.addFloatTable( new CFlowTable2( Element, PageIndex ) );
if ( recalcresult_NextElement === RecalcResult )
{
this.RecalcInfo.FlowObject = null;
this.RecalcInfo.FlowObjectPageBreakBefore = false;
this.RecalcInfo.RecalcResult = recalcresult_NextElement;
}
}
}
else
{
// Пропускаем
RecalcResult = recalcresult_NextElement;
}
}
else
if ( ( 0 === Index && 0 === PageIndex ) || Index != StartIndex )
{
if ( ( 0 === Index && 0 === PageIndex ) || Index != StartIndex )
{
Element.Set_DocumentIndex( Index );
Element.Reset( X, Y, XLimit, YLimit, PageIndex );
}
RecalcResult = Element.Recalculate_Page( PageIndex );
Element.Set_DocumentIndex( Index );
Element.Reset( X, Y, XLimit, YLimit, PageIndex );
}
RecalcResult = Element.Recalculate_Page( PageIndex );
Element.TurnOn_RecalcEvent();
if ( true != bFlowTable )
......@@ -881,33 +918,6 @@ CDocumentContent.prototype =
var Bounds = this.Pages[PageNum].Bounds;
if ( true != this.Is_HdrFtr(false) )
{
// Учитываем только Drawing-объекты с врапом (объекты над и под текстом не учитываются при пересчете размера)
// В колонтитуле не учитывается.
var AllDrawingObjects = this.Get_AllDrawingObjects();
var Count = AllDrawingObjects.length;
for ( var Index = 0; Index < Count; Index++ )
{
var Obj = AllDrawingObjects[Index];
if ( true === Obj.Use_TextWrap() && Obj.Y + Obj.H > Bounds.Bottom )
Bounds.Bottom = Obj.Y + Obj.H;
}
// Кроме этого пробежимся по всем Flow-таблицам и учтем их границы
var Count = this.Content.length;
for ( var Index = 0; Index < Count; Index++ )
{
var Element = this.Content[Index];
if ( type_Table === Element.GetType() && true != Element.Is_Inline() )
{
var TableBounds = Element.Get_PageBounds( PageNum - Element.PageNum );
if ( TableBounds.Bottom > Bounds.Bottom )
Bounds.Bottom = TableBounds.Bottom;
}
}
}
return Bounds;
},
......@@ -7547,4 +7557,148 @@ CDocumentContent.prototype =
return false;
}
};
\ No newline at end of file
};
var contentchanges_Add = 1;
var contentchanges_Remove = 2;
function CContentChangesElement(Type, Pos, Count, Data)
{
this.m_nType = Type; // Тип изменений (удаление или добавление)
this.m_nPos = Pos; // Позиция, в которой произошли изменения
this.m_nCount = Count; // Количество добавленных/удаленных элементов
this.m_pData = Data; // Связанные с данным изменением данные из истории
this.Refresh_BinaryData = function()
{
var Binary_Writer = History.BinaryWriter;
var Binary_Pos = Binary_Writer.GetCurPosition();
this.m_pData.Data.UseArray = true;
this.m_pData.Data.PosArray = this.m_aPositions;
this.m_pData.Class.Save_Changes( this.m_pData.Data, Binary_Writer );
var Binary_Len = Binary_Writer.GetCurPosition() - Binary_Pos;
this.m_pData.Binary.Pos = Binary_Pos;
this.m_pData.Binary.Len = Binary_Len;
};
this.Check_Changes = function(Type, Pos)
{
var CurPos = Pos;
if ( contentchanges_Add === Type )
{
for ( var Index = 0; Index < this.m_nCount; Index++ )
{
if ( false !== this.m_aPositions[Index] )
{
if ( CurPos <= this.m_aPositions[Index] )
this.m_aPositions[Index]++;
else
{
if ( contentchanges_Add === this.m_nType )
CurPos++;
else //if ( contentchanges_Remove === this.m_nType )
CurPos--;
}
}
}
}
else //if ( contentchanges_Remove === Type )
{
for ( var Index = 0; Index < this.m_nCount; Index++ )
{
if ( false !== this.m_aPositions[Index] )
{
if ( CurPos < this.m_aPositions[Index] )
this.m_aPositions[Index]--;
else if ( CurPos > this.m_aPositions[Index] )
{
if ( contentchanges_Add === this.m_nType )
CurPos++;
else //if ( contentchanges_Remove === this.m_nType )
CurPos--;
}
else //if ( CurPos === this.m_aPositions[Index] )
{
if ( contentchanges_Remove === this.m_nType )
{
// Отмечаем, что действия совпали
this.m_aPositions[Index] = false;
return false;
}
else
{
CurPos++;
}
}
}
}
}
return CurPos;
};
this.Make_ArrayOfSimpleActions = function(Type, Pos, Count)
{
// Разбиваем действие на простейшие
var Positions = new Array();
if ( contentchanges_Add === Type )
{
for ( var Index = 0; Index < Count; Index++ )
Positions[Index] = Pos + Index;
}
else //if ( contentchanges_Remove === Type )
{
for ( var Index = 0; Index < Count; Index++ )
Positions[Index] = Pos;
}
return Positions;
};
// Разбиваем сложное действие на простейшие
this.m_aPositions = this.Make_ArrayOfSimpleActions( Type, Pos, Count );
}
function CContentChanges()
{
this.m_aChanges = new Array();
this.Add = function(Changes)
{
this.m_aChanges.push( Changes );
};
this.Clear = function()
{
this.m_aChanges.length = 0;
};
this.Check = function(Type, Pos)
{
var CurPos = Pos;
var Count = this.m_aChanges.length;
for ( var Index = 0; Index < Count; Index++ )
{
var NewPos = this.m_aChanges[Index].Check_Changes(Type, CurPos);
if ( false === NewPos )
return false;
CurPos = NewPos;
}
return CurPos;
};
this.Refresh = function()
{
var Count = this.m_aChanges.length;
for ( var Index = 0; Index < Count; Index++ )
{
this.m_aChanges[Index].Refresh_BinaryData();
}
};
}
\ No newline at end of file
var fontslot_ASCII = 0x00;
var fontslot_EastAsia = 0x01;
var fontslot_CS = 0x02;
var fontslot_HAnsi = 0x03;
var fonthint_Default = 0x00;
var fonthint_CS = 0x01;
var fonthint_EastAsia = 0x02;
var lcid_unknown = 0x0000; // Unknown
var lcid_ar = 0x0001; // Arabic
var lcid_bg = 0x0002; // Bulgarian
var lcid_ca = 0x0003; // Catalan
var lcid_zhHans = 0x0004; // Chinese, Han (Simplified variant)
var lcid_cs = 0x0005; // Czech
var lcid_da = 0x0006; // Danish
var lcid_de = 0x0007; // German
var lcid_el = 0x0008; // Modern Greek (1453-)
var lcid_en = 0x0009; // English
var lcid_es = 0x000a; // Spanish
var lcid_fi = 0x000b; // Finnish
var lcid_fr = 0x000c; // French
var lcid_he = 0x000d; // Hebrew
var lcid_hu = 0x000e; // Hungarian
var lcid_is = 0x000f; // Icelandic
var lcid_it = 0x0010; // Italian
var lcid_ja = 0x0011; // Japanese
var lcid_ko = 0x0012; // Korean
var lcid_nl = 0x0013; // Dutch
var lcid_no = 0x0014; // Norwegian
var lcid_pl = 0x0015; // Polish
var lcid_pt = 0x0016; // Portuguese
var lcid_rm = 0x0017; // Romansh
var lcid_ro = 0x0018; // Romanian
var lcid_ru = 0x0019; // Russian
var lcid_hr = 0x001a; // Croatian
var lcid_sk = 0x001b; // Slovak
var lcid_sq = 0x001c; // Albanian
var lcid_sv = 0x001d; // Swedish
var lcid_th = 0x001e; // Thai
var lcid_tr = 0x001f; // Turkish
var lcid_ur = 0x0020; // Urdu
var lcid_id = 0x0021; // Indonesian
var lcid_uk = 0x0022; // Ukrainian
var lcid_be = 0x0023; // Belarusian
var lcid_sl = 0x0024; // Slovenian
var lcid_et = 0x0025; // Estonian
var lcid_lv = 0x0026; // Latvian
var lcid_lt = 0x0027; // Lithuanian
var lcid_tg = 0x0028; // Tajik
var lcid_fa = 0x0029; // Persian
var lcid_vi = 0x002a; // Vietnamese
var lcid_hy = 0x002b; // Armenian
var lcid_az = 0x002c; // Azerbaijani
var lcid_eu = 0x002d; // Basque
var lcid_hsb = 0x002e; // Upper Sorbian
var lcid_mk = 0x002f; // Macedonian
var lcid_tn = 0x0032; // Tswana
var lcid_xh = 0x0034; // Xhosa
var lcid_zu = 0x0035; // Zulu
var lcid_af = 0x0036; // Afrikaans
var lcid_ka = 0x0037; // Georgian
var lcid_fo = 0x0038; // Faroese
var lcid_hi = 0x0039; // Hindi
var lcid_mt = 0x003a; // Maltese
var lcid_se = 0x003b; // Northern Sami
var lcid_ga = 0x003c; // Irish
var lcid_ms = 0x003e; // Malay (macrolanguage)
var lcid_kk = 0x003f; // Kazakh
var lcid_ky = 0x0040; // Kirghiz
var lcid_sw = 0x0041; // Swahili (macrolanguage)
var lcid_tk = 0x0042; // Turkmen
var lcid_uz = 0x0043; // Uzbek
var lcid_tt = 0x0044; // Tatar
var lcid_bn = 0x0045; // Bengali
var lcid_pa = 0x0046; // Panjabi
var lcid_gu = 0x0047; // Gujarati
var lcid_or = 0x0048; // Oriya
var lcid_ta = 0x0049; // Tamil
var lcid_te = 0x004a; // Telugu
var lcid_kn = 0x004b; // Kannada
var lcid_ml = 0x004c; // Malayalam
var lcid_as = 0x004d; // Assamese
var lcid_mr = 0x004e; // Marathi
var lcid_sa = 0x004f; // Sanskrit
var lcid_mn = 0x0050; // Mongolian
var lcid_bo = 0x0051; // Tibetan
var lcid_cy = 0x0052; // Welsh
var lcid_km = 0x0053; // Central Khmer
var lcid_lo = 0x0054; // Lao
var lcid_gl = 0x0056; // Galician
var lcid_kok = 0x0057; // Konkani (macrolanguage)
var lcid_syr = 0x005a; // Syriac
var lcid_si = 0x005b; // Sinhala
var lcid_iu = 0x005d; // Inuktitut
var lcid_am = 0x005e; // Amharic
var lcid_tzm = 0x005f; // Central Atlas Tamazight
var lcid_ne = 0x0061; // Nepali
var lcid_fy = 0x0062; // Western Frisian
var lcid_ps = 0x0063; // Pushto
var lcid_fil = 0x0064; // Filipino
var lcid_dv = 0x0065; // Dhivehi
var lcid_ha = 0x0068; // Hausa
var lcid_yo = 0x006a; // Yoruba
var lcid_quz = 0x006b; // Cusco Quechua
var lcid_nso = 0x006c; // Pedi
var lcid_ba = 0x006d; // Bashkir
var lcid_lb = 0x006e; // Luxembourgish
var lcid_kl = 0x006f; // Kalaallisut
var lcid_ig = 0x0070; // Igbo
var lcid_ii = 0x0078; // Sichuan Yi
var lcid_arn = 0x007a; // Mapudungun
var lcid_moh = 0x007c; // Mohawk
var lcid_br = 0x007e; // Breton
var lcid_ug = 0x0080; // Uighur
var lcid_mi = 0x0081; // Maori
var lcid_oc = 0x0082; // Occitan (post 1500)
var lcid_co = 0x0083; // Corsican
var lcid_gsw = 0x0084; // Swiss German
var lcid_sah = 0x0085; // Yakut
var lcid_qut = 0x0086; //
var lcid_rw = 0x0087; // Kinyarwanda
var lcid_wo = 0x0088; // Wolof
var lcid_prs = 0x008c; // Dari
var lcid_gd = 0x0091; // Scottish Gaelic
var lcid_arSA = 0x0401; // Arabic, Saudi Arabia
var lcid_bgBG = 0x0402; // Bulgarian, Bulgaria
var lcid_caES = 0x0403; // Catalan, Spain
var lcid_zhTW = 0x0404; // Chinese, Taiwan, Province of China
var lcid_csCZ = 0x0405; // Czech, Czech Republic
var lcid_daDK = 0x0406; // Danish, Denmark
var lcid_deDE = 0x0407; // German, Germany
var lcid_elGR = 0x0408; // Modern Greek (1453-), Greece
var lcid_enUS = 0x0409; // English, United States
var lcid_esES_tradnl = 0x040a; // Spanish
var lcid_fiFI = 0x040b; // Finnish, Finland
var lcid_frFR = 0x040c; // French, France
var lcid_heIL = 0x040d; // Hebrew, Israel
var lcid_huHU = 0x040e; // Hungarian, Hungary
var lcid_isIS = 0x040f; // Icelandic, Iceland
var lcid_itIT = 0x0410; // Italian, Italy
var lcid_jaJP = 0x0411; // Japanese, Japan
var lcid_koKR = 0x0412; // Korean, Republic of Korea
var lcid_nlNL = 0x0413; // Dutch, Netherlands
var lcid_nbNO = 0x0414; // Norwegian Bokmal, Norway
var lcid_plPL = 0x0415; // Polish, Poland
var lcid_ptBR = 0x0416; // Portuguese, Brazil
var lcid_rmCH = 0x0417; // Romansh, Switzerland
var lcid_roRO = 0x0418; // Romanian, Romania
var lcid_ruRU = 0x0419; // Russian, Russian Federation
var lcid_hrHR = 0x041a; // Croatian, Croatia
var lcid_skSK = 0x041b; // Slovak, Slovakia
var lcid_sqAL = 0x041c; // Albanian, Albania
var lcid_svSE = 0x041d; // Swedish, Sweden
var lcid_thTH = 0x041e; // Thai, Thailand
var lcid_trTR = 0x041f; // Turkish, Turkey
var lcid_urPK = 0x0420; // Urdu, Pakistan
var lcid_idID = 0x0421; // Indonesian, Indonesia
var lcid_ukUA = 0x0422; // Ukrainian, Ukraine
var lcid_beBY = 0x0423; // Belarusian, Belarus
var lcid_slSI = 0x0424; // Slovenian, Slovenia
var lcid_etEE = 0x0425; // Estonian, Estonia
var lcid_lvLV = 0x0426; // Latvian, Latvia
var lcid_ltLT = 0x0427; // Lithuanian, Lithuania
var lcid_tgCyrlTJ = 0x0428; // Tajik, Cyrillic, Tajikistan
var lcid_faIR = 0x0429; // Persian, Islamic Republic of Iran
var lcid_viVN = 0x042a; // Vietnamese, Viet Nam
var lcid_hyAM = 0x042b; // Armenian, Armenia
var lcid_azLatnAZ = 0x042c; // Azerbaijani, Latin, Azerbaijan
var lcid_euES = 0x042d; // Basque, Spain
var lcid_wenDE = 0x042e; // Sorbian languages, Germany
var lcid_mkMK = 0x042f; // Macedonian, The Former Yugoslav Republic of Macedonia
var lcid_stZA = 0x0430; // Southern Sotho, South Africa
var lcid_tsZA = 0x0431; // Tsonga, South Africa
var lcid_tnZA = 0x0432; // Tswana, South Africa
var lcid_venZA = 0x0433; // South Africa
var lcid_xhZA = 0x0434; // Xhosa, South Africa
var lcid_zuZA = 0x0435; // Zulu, South Africa
var lcid_afZA = 0x0436; // Afrikaans, South Africa
var lcid_kaGE = 0x0437; // Georgian, Georgia
var lcid_foFO = 0x0438; // Faroese, Faroe Islands
var lcid_hiIN = 0x0439; // Hindi, India
var lcid_mtMT = 0x043a; // Maltese, Malta
var lcid_seNO = 0x043b; // Northern Sami, Norway
var lcid_msMY = 0x043e; // Malay (macrolanguage), Malaysia
var lcid_kkKZ = 0x043f; // Kazakh, Kazakhstan
var lcid_kyKG = 0x0440; // Kirghiz, Kyrgyzstan
var lcid_swKE = 0x0441; // Swahili (macrolanguage), Kenya
var lcid_tkTM = 0x0442; // Turkmen, Turkmenistan
var lcid_uzLatnUZ = 0x0443; // Uzbek, Latin, Uzbekistan
var lcid_ttRU = 0x0444; // Tatar, Russian Federation
var lcid_bnIN = 0x0445; // Bengali, India
var lcid_paIN = 0x0446; // Panjabi, India
var lcid_guIN = 0x0447; // Gujarati, India
var lcid_orIN = 0x0448; // Oriya, India
var lcid_taIN = 0x0449; // Tamil, India
var lcid_teIN = 0x044a; // Telugu, India
var lcid_knIN = 0x044b; // Kannada, India
var lcid_mlIN = 0x044c; // Malayalam, India
var lcid_asIN = 0x044d; // Assamese, India
var lcid_mrIN = 0x044e; // Marathi, India
var lcid_saIN = 0x044f; // Sanskrit, India
var lcid_mnMN = 0x0450; // Mongolian, Mongolia
var lcid_boCN = 0x0451; // Tibetan, China
var lcid_cyGB = 0x0452; // Welsh, United Kingdom
var lcid_kmKH = 0x0453; // Central Khmer, Cambodia
var lcid_loLA = 0x0454; // Lao, Lao People's Democratic Republic
var lcid_myMM = 0x0455; // Burmese, Myanmar
var lcid_glES = 0x0456; // Galician, Spain
var lcid_kokIN = 0x0457; // Konkani (macrolanguage), India
var lcid_mni = 0x0458; // Manipuri
var lcid_sdIN = 0x0459; // Sindhi, India
var lcid_syrSY = 0x045a; // Syriac, Syrian Arab Republic
var lcid_siLK = 0x045b; // Sinhala, Sri Lanka
var lcid_chrUS = 0x045c; // Cherokee, United States
var lcid_iuCansCA = 0x045d; // Inuktitut, Unified Canadian Aboriginal Syllabics, Canada
var lcid_amET = 0x045e; // Amharic, Ethiopia
var lcid_tmz = 0x045f; // Tamanaku
var lcid_neNP = 0x0461; // Nepali, Nepal
var lcid_fyNL = 0x0462; // Western Frisian, Netherlands
var lcid_psAF = 0x0463; // Pushto, Afghanistan
var lcid_filPH = 0x0464; // Filipino, Philippines
var lcid_dvMV = 0x0465; // Dhivehi, Maldives
var lcid_binNG = 0x0466; // Bini, Nigeria
var lcid_fuvNG = 0x0467; // Nigerian Fulfulde, Nigeria
var lcid_haLatnNG = 0x0468; // Hausa, Latin, Nigeria
var lcid_ibbNG = 0x0469; // Ibibio, Nigeria
var lcid_yoNG = 0x046a; // Yoruba, Nigeria
var lcid_quzBO = 0x046b; // Cusco Quechua, Bolivia
var lcid_nsoZA = 0x046c; // Pedi, South Africa
var lcid_baRU = 0x046d; // Bashkir, Russian Federation
var lcid_lbLU = 0x046e; // Luxembourgish, Luxembourg
var lcid_klGL = 0x046f; // Kalaallisut, Greenland
var lcid_igNG = 0x0470; // Igbo, Nigeria
var lcid_krNG = 0x0471; // Kanuri, Nigeria
var lcid_gazET = 0x0472; // West Central Oromo, Ethiopia
var lcid_tiER = 0x0473; // Tigrinya, Eritrea
var lcid_gnPY = 0x0474; // Guarani, Paraguay
var lcid_hawUS = 0x0475; // Hawaiian, United States
var lcid_soSO = 0x0477; // Somali, Somalia
var lcid_iiCN = 0x0478; // Sichuan Yi, China
var lcid_papAN = 0x0479; // Papiamento, Netherlands Antilles
var lcid_arnCL = 0x047a; // Mapudungun, Chile
var lcid_mohCA = 0x047c; // Mohawk, Canada
var lcid_brFR = 0x047e; // Breton, France
var lcid_ugCN = 0x0480; // Uighur, China
var lcid_miNZ = 0x0481; // Maori, New Zealand
var lcid_ocFR = 0x0482; // Occitan (post 1500), France
var lcid_coFR = 0x0483; // Corsican, France
var lcid_gswFR = 0x0484; // Swiss German, France
var lcid_sahRU = 0x0485; // Yakut, Russian Federation
var lcid_qutGT = 0x0486; // Guatemala
var lcid_rwRW = 0x0487; // Kinyarwanda, Rwanda
var lcid_woSN = 0x0488; // Wolof, Senegal
var lcid_prsAF = 0x048c; // Dari, Afghanistan
var lcid_pltMG = 0x048d; // Plateau Malagasy, Madagascar
var lcid_gdGB = 0x0491; // Scottish Gaelic, United Kingdom
var lcid_arIQ = 0x0801; // Arabic, Iraq
var lcid_zhCN = 0x0804; // Chinese, China
var lcid_deCH = 0x0807; // German, Switzerland
var lcid_enGB = 0x0809; // English, United Kingdom
var lcid_esMX = 0x080a; // Spanish, Mexico
var lcid_frBE = 0x080c; // French, Belgium
var lcid_itCH = 0x0810; // Italian, Switzerland
var lcid_nlBE = 0x0813; // Dutch, Belgium
var lcid_nnNO = 0x0814; // Norwegian Nynorsk, Norway
var lcid_ptPT = 0x0816; // Portuguese, Portugal
var lcid_roMO = 0x0818; // Romanian, Macao
var lcid_ruMO = 0x0819; // Russian, Macao
var lcid_srLatnCS = 0x081a; // Serbian, Latin, Serbia and Montenegro
var lcid_svFI = 0x081d; // Swedish, Finland
var lcid_urIN = 0x0820; // Urdu, India
var lcid_azCyrlAZ = 0x082c; // Azerbaijani, Cyrillic, Azerbaijan
var lcid_dsbDE = 0x082e; // Lower Sorbian, Germany
var lcid_seSE = 0x083b; // Northern Sami, Sweden
var lcid_gaIE = 0x083c; // Irish, Ireland
var lcid_msBN = 0x083e; // Malay (macrolanguage), Brunei Darussalam
var lcid_uzCyrlUZ = 0x0843; // Uzbek, Cyrillic, Uzbekistan
var lcid_bnBD = 0x0845; // Bengali, Bangladesh
var lcid_paPK = 0x0846; // Panjabi, Pakistan
var lcid_mnMongCN = 0x0850; // Mongolian, Mongolian, China
var lcid_boBT = 0x0851; // Tibetan, Bhutan
var lcid_sdPK = 0x0859; // Sindhi, Pakistan
var lcid_iuLatnCA = 0x085d; // Inuktitut, Latin, Canada
var lcid_tzmLatnDZ = 0x085f; // Central Atlas Tamazight, Latin, Algeria
var lcid_neIN = 0x0861; // Nepali, India
var lcid_quzEC = 0x086b; // Cusco Quechua, Ecuador
var lcid_tiET = 0x0873; // Tigrinya, Ethiopia
var lcid_arEG = 0x0c01; // Arabic, Egypt
var lcid_zhHK = 0x0c04; // Chinese, Hong Kong
var lcid_deAT = 0x0c07; // German, Austria
var lcid_enAU = 0x0c09; // English, Australia
var lcid_esES = 0x0c0a; // Spanish, Spain
var lcid_frCA = 0x0c0c; // French, Canada
var lcid_srCyrlCS = 0x0c1a; // Serbian, Cyrillic, Serbia and Montenegro
var lcid_seFI = 0x0c3b; // Northern Sami, Finland
var lcid_tmzMA = 0x0c5f; // Tamanaku, Morocco
var lcid_quzPE = 0x0c6b; // Cusco Quechua, Peru
var lcid_arLY = 0x1001; // Arabic, Libyan Arab Jamahiriya
var lcid_zhSG = 0x1004; // Chinese, Singapore
var lcid_deLU = 0x1007; // German, Luxembourg
var lcid_enCA = 0x1009; // English, Canada
var lcid_esGT = 0x100a; // Spanish, Guatemala
var lcid_frCH = 0x100c; // French, Switzerland
var lcid_hrBA = 0x101a; // Croatian, Bosnia and Herzegovina
var lcid_smjNO = 0x103b; // Lule Sami, Norway
var lcid_arDZ = 0x1401; // Arabic, Algeria
var lcid_zhMO = 0x1404; // Chinese, Macao
var lcid_deLI = 0x1407; // German, Liechtenstein
var lcid_enNZ = 0x1409; // English, New Zealand
var lcid_esCR = 0x140a; // Spanish, Costa Rica
var lcid_frLU = 0x140c; // French, Luxembourg
var lcid_bsLatnBA = 0x141a; // Bosnian, Latin, Bosnia and Herzegovina
var lcid_smjSE = 0x143b; // Lule Sami, Sweden
var lcid_arMA = 0x1801; // Arabic, Morocco
var lcid_enIE = 0x1809; // English, Ireland
var lcid_esPA = 0x180a; // Spanish, Panama
var lcid_frMC = 0x180c; // French, Monaco
var lcid_srLatnBA = 0x181a; // Serbian, Latin, Bosnia and Herzegovina
var lcid_smaNO = 0x183b; // Southern Sami, Norway
var lcid_arTN = 0x1c01; // Arabic, Tunisia
var lcid_enZA = 0x1c09; // English, South Africa
var lcid_esDO = 0x1c0a; // Spanish, Dominican Republic
var lcid_frWest = 0x1c0c; // French
var lcid_srCyrlBA = 0x1c1a; // Serbian, Cyrillic, Bosnia and Herzegovina
var lcid_smaSE = 0x1c3b; // Southern Sami, Sweden
var lcid_arOM = 0x2001; // Arabic, Oman
var lcid_enJM = 0x2009; // English, Jamaica
var lcid_esVE = 0x200a; // Spanish, Venezuela
var lcid_frRE = 0x200c; // French, Reunion
var lcid_bsCyrlBA = 0x201a; // Bosnian, Cyrillic, Bosnia and Herzegovina
var lcid_smsFI = 0x203b; // Skolt Sami, Finland
var lcid_arYE = 0x2401; // Arabic, Yemen
var lcid_enCB = 0x2409; // English
var lcid_esCO = 0x240a; // Spanish, Colombia
var lcid_frCG = 0x240c; // French, Congo
var lcid_srLatnRS = 0x241a; // Serbian, Latin, Serbia
var lcid_smnFI = 0x243b; // Inari Sami, Finland
var lcid_arSY = 0x2801; // Arabic, Syrian Arab Republic
var lcid_enBZ = 0x2809; // English, Belize
var lcid_esPE = 0x280a; // Spanish, Peru
var lcid_frSN = 0x280c; // French, Senegal
var lcid_srCyrlRS = 0x281a; // Serbian, Cyrillic, Serbia
var lcid_arJO = 0x2c01; // Arabic, Jordan
var lcid_enTT = 0x2c09; // English, Trinidad and Tobago
var lcid_esAR = 0x2c0a; // Spanish, Argentina
var lcid_frCM = 0x2c0c; // French, Cameroon
var lcid_srLatnME = 0x2c1a; // Serbian, Latin, Montenegro
var lcid_arLB = 0x3001; // Arabic, Lebanon
var lcid_enZW = 0x3009; // English, Zimbabwe
var lcid_esEC = 0x300a; // Spanish, Ecuador
var lcid_frCI = 0x300c; // French, Cote d'Ivoire
var lcid_srCyrlME = 0x301a; // Serbian, Cyrillic, Montenegro
var lcid_arKW = 0x3401; // Arabic, Kuwait
var lcid_enPH = 0x3409; // English, Philippines
var lcid_esCL = 0x340a; // Spanish, Chile
var lcid_frML = 0x340c; // French, Mali
var lcid_arAE = 0x3801; // Arabic, United Arab Emirates
var lcid_enID = 0x3809; // English, Indonesia
var lcid_esUY = 0x380a; // Spanish, Uruguay
var lcid_frMA = 0x380c; // French, Morocco
var lcid_arBH = 0x3c01; // Arabic, Bahrain
var lcid_enHK = 0x3c09; // English, Hong Kong
var lcid_esPY = 0x3c0a; // Spanish, Paraguay
var lcid_frHT = 0x3c0c; // French, Haiti
var lcid_arQA = 0x4001; // Arabic, Qatar
var lcid_enIN = 0x4009; // English, India
var lcid_esBO = 0x400a; // Spanish, Bolivia
var lcid_enMY = 0x4409; // English, Malaysia
var lcid_esSV = 0x440a; // Spanish, El Salvador
var lcid_enSG = 0x4809; // English, Singapore
var lcid_esHN = 0x480a; // Spanish, Honduras
var lcid_esNI = 0x4c0a; // Spanish, Nicaragua
var lcid_esPR = 0x500a; // Spanish, Puerto Rico
var lcid_esUS = 0x540a; // Spanish, United States
var lcid_bsCyrl = 0x641a; // Bosnian, Cyrillic
var lcid_bsLatn = 0x681a; // Bosnian, Latin
var lcid_srCyrl = 0x6c1a; // Serbian, Cyrillic
var lcid_srLatn = 0x701a; // Serbian, Latin
var lcid_smn = 0x703b; // Inari Sami
var lcid_azCyrl = 0x742c; // Azerbaijani, Cyrillic
var lcid_sms = 0x743b; // Skolt Sami
var lcid_zh = 0x7804; // Chinese
var lcid_nn = 0x7814; // Norwegian Nynorsk
var lcid_bs = 0x781a; // Bosnian
var lcid_azLatn = 0x782c; // Azerbaijani, Latin
var lcid_sma = 0x783b; // Southern Sami
var lcid_uzCyrl = 0x7843; // Uzbek, Cyrillic
var lcid_mnCyrl = 0x7850; // Mongolian, Cyrillic
var lcid_iuCans = 0x785d; // Inuktitut, Unified Canadian Aboriginal Syllabics
var lcid_zhHant = 0x7c04; // Chinese, Han (Traditional variant)
var lcid_nb = 0x7c14; // Norwegian Bokmal
var lcid_sr = 0x7c1a; // Serbian
var lcid_tgCyrl = 0x7c28; // Tajik, Cyrillic
var lcid_dsb = 0x7c2e; // Lower Sorbian
var lcid_smj = 0x7c3b; // Lule Sami
var lcid_uzLatn = 0x7c43; // Uzbek, Latin
var lcid_mnMong = 0x7c50; // Mongolian, Mongolian
var lcid_iuLatn = 0x7c5d; // Inuktitut, Latin
var lcid_tzmLatn = 0x7c5f; // Central Atlas Tamazight, Latin
var lcid_haLatn = 0x7c68; // Hausa, Latin
(function(document){
function CDetectFontUse()
{
this.DetectData = null;
this.TableChunkLen = 65536;
this.TableChunks = 4;
this.TableChunkMain = 0;
this.TableChunkHintEA = this.TableChunkLen;
this.TableChunkHintZH = 2 * this.TableChunkLen;
this.TableChunkHintEACS = 3 * this.TableChunkLen;
this.Init = function()
{
this.DetectData = g_memory.Alloc(this.TableChunkLen * this.TableChunks);
var _data = this.DetectData.data;
var i, j;
// ********************** 1st table *********************** //
j = 0;
for (i = 0x0000; i <= 0x007F; i++)
{
_data[i + j] = fontslot_ASCII;
}
for (i = 0x00A0; i <= 0x04FF; i++)
{
_data[i + j] = fontslot_HAnsi;
}
for (i = 0x0590; i <= 0x07BF; i++)
{
_data[i + j] = fontslot_ASCII;
}
for (i = 0x1100; i <= 0x11FF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0x1E00; i <= 0x1EFF; i++)
{
_data[i + j] = fontslot_HAnsi;
}
for (i = 0x1F00; i <= 0x27BF; i++)
{
_data[i + j] = fontslot_HAnsi;
}
for (i = 0x2E80; i <= 0x319F; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0x3200; i <= 0x4D8F; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0x4E00; i <= 0x9FAF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xA000; i <= 0xA4CF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xAC00; i <= 0xD7AF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xD800; i <= 0xDFFF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xE000; i <= 0xF8FF; i++)
{
_data[i + j] = fontslot_HAnsi;
}
for (i = 0xF900; i <= 0xFAFF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xFB00; i <= 0xFB1C; i++)
{
_data[i + j] = fontslot_HAnsi;
}
for (i = 0xFB1D; i <= 0xFDFF; i++)
{
_data[i + j] = fontslot_ASCII;
}
for (i = 0xFE30; i <= 0xFE6F; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xFE70; i <= 0xFEFE; i++)
{
_data[i + j] = fontslot_ASCII;
}
for (i = 0xFF00; i <= 0xFFEF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
// ********************** 2nd table *********************** //
j = this.TableChunkHintEA;
for (i = 0x0000; i <= 0x007F; i++)
{
_data[i + j] = fontslot_ASCII;
}
for (i = 0x00A0; i <= 0x04FF; i++)
{
_data[i + j] = fontslot_HAnsi;
}
_data[0xA1 + j] = fontslot_EastAsia;
_data[0xA4 + j] = fontslot_EastAsia;
_data[0xA7 + j] = fontslot_EastAsia;
_data[0xA8 + j] = fontslot_EastAsia;
_data[0xAA + j] = fontslot_EastAsia;
_data[0xAD + j] = fontslot_EastAsia;
_data[0xAF + j] = fontslot_EastAsia;
_data[0xB0 + j] = fontslot_EastAsia;
_data[0xB1 + j] = fontslot_EastAsia;
_data[0xB2 + j] = fontslot_EastAsia;
_data[0xB3 + j] = fontslot_EastAsia;
_data[0xB4 + j] = fontslot_EastAsia;
_data[0xB6 + j] = fontslot_EastAsia;
_data[0xB7 + j] = fontslot_EastAsia;
_data[0xB8 + j] = fontslot_EastAsia;
_data[0xB9 + j] = fontslot_EastAsia;
_data[0xBA + j] = fontslot_EastAsia;
_data[0xBC + j] = fontslot_EastAsia;
_data[0xBD + j] = fontslot_EastAsia;
_data[0xBE + j] = fontslot_EastAsia;
_data[0xBF + j] = fontslot_EastAsia;
_data[0xD7 + j] = fontslot_EastAsia;
_data[0xF7 + j] = fontslot_EastAsia;
for (i = 0x02B0; i <= 0x04FF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0x0590; i <= 0x07BF; i++)
{
_data[i + j] = fontslot_ASCII;
}
for (i = 0x1100; i <= 0x11FF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0x1E00; i <= 0x1EFF; i++)
{
_data[i + j] = fontslot_HAnsi;
}
for (i = 0x1F00; i <= 0x1FFF; i++)
{
_data[i + j] = fontslot_HAnsi;
}
for (i = 0x2000; i <= 0x27BF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0x2E80; i <= 0x319F; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0x3200; i <= 0x4D8F; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0x4E00; i <= 0x9FAF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xA000; i <= 0xA4CF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xAC00; i <= 0xD7AF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xD800; i <= 0xDFFF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xE000; i <= 0xF8FF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xF900; i <= 0xFAFF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xFB00; i <= 0xFB1C; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xFB1D; i <= 0xFDFF; i++)
{
_data[i + j] = fontslot_ASCII;
}
for (i = 0xFE30; i <= 0xFE6F; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xFE70; i <= 0xFEFE; i++)
{
_data[i + j] = fontslot_ASCII;
}
for (i = 0xFF00; i <= 0xFFEF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
// ********************** 3rd table *********************** //
j = this.TableChunkHintZH;
for (i = 0x0000; i <= 0x007F; i++)
{
_data[i + j] = fontslot_ASCII;
}
for (i = 0x00A0; i <= 0x00FF; i++)
{
_data[i + j] = fontslot_HAnsi;
}
_data[0xA1 + j] = fontslot_EastAsia;
_data[0xA4 + j] = fontslot_EastAsia;
_data[0xA7 + j] = fontslot_EastAsia;
_data[0xA8 + j] = fontslot_EastAsia;
_data[0xAA + j] = fontslot_EastAsia;
_data[0xAD + j] = fontslot_EastAsia;
_data[0xAF + j] = fontslot_EastAsia;
_data[0xB0 + j] = fontslot_EastAsia;
_data[0xB1 + j] = fontslot_EastAsia;
_data[0xB2 + j] = fontslot_EastAsia;
_data[0xB3 + j] = fontslot_EastAsia;
_data[0xB4 + j] = fontslot_EastAsia;
_data[0xB6 + j] = fontslot_EastAsia;
_data[0xB7 + j] = fontslot_EastAsia;
_data[0xB8 + j] = fontslot_EastAsia;
_data[0xB9 + j] = fontslot_EastAsia;
_data[0xBA + j] = fontslot_EastAsia;
_data[0xBC + j] = fontslot_EastAsia;
_data[0xBD + j] = fontslot_EastAsia;
_data[0xBE + j] = fontslot_EastAsia;
_data[0xBF + j] = fontslot_EastAsia;
_data[0xD7 + j] = fontslot_EastAsia;
_data[0xF7 + j] = fontslot_EastAsia;
_data[0xE0 + j] = fontslot_EastAsia;
_data[0xE1 + j] = fontslot_EastAsia;
_data[0xE8 + j] = fontslot_EastAsia;
_data[0xE9 + j] = fontslot_EastAsia;
_data[0xEA + j] = fontslot_EastAsia;
_data[0xEC + j] = fontslot_EastAsia;
_data[0xED + j] = fontslot_EastAsia;
_data[0xF2 + j] = fontslot_EastAsia;
_data[0xF3 + j] = fontslot_EastAsia;
_data[0xF9 + j] = fontslot_EastAsia;
_data[0xFA + j] = fontslot_EastAsia;
_data[0xFC + j] = fontslot_EastAsia;
for (i = 0x0100; i <= 0x02AF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0x02B0; i <= 0x04FF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0x0590; i <= 0x07BF; i++)
{
_data[i + j] = fontslot_ASCII;
}
for (i = 0x1100; i <= 0x11FF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0x1E00; i <= 0x1EFF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0x1F00; i <= 0x1FFF; i++)
{
_data[i + j] = fontslot_HAnsi;
}
for (i = 0x2000; i <= 0x27BF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0x2E80; i <= 0x319F; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0x3200; i <= 0x4D8F; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0x4E00; i <= 0x9FAF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xA000; i <= 0xA4CF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xAC00; i <= 0xD7AF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xD800; i <= 0xDFFF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xE000; i <= 0xF8FF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xF900; i <= 0xFAFF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xFB00; i <= 0xFB1C; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xFB1D; i <= 0xFDFF; i++)
{
_data[i + j] = fontslot_ASCII;
}
for (i = 0xFE30; i <= 0xFE6F; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xFE70; i <= 0xFEFE; i++)
{
_data[i + j] = fontslot_ASCII;
}
for (i = 0xFF00; i <= 0xFFEF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
// ********************** 4rd table *********************** //
j = this.TableChunkHintEACS;
for (i = 0x0000; i <= 0x007F; i++)
{
_data[i + j] = fontslot_ASCII;
}
for (i = 0x00A0; i <= 0x00FF; i++)
{
_data[i + j] = fontslot_HAnsi;
}
_data[0xA1 + j] = fontslot_EastAsia;
_data[0xA4 + j] = fontslot_EastAsia;
_data[0xA7 + j] = fontslot_EastAsia;
_data[0xA8 + j] = fontslot_EastAsia;
_data[0xAA + j] = fontslot_EastAsia;
_data[0xAD + j] = fontslot_EastAsia;
_data[0xAF + j] = fontslot_EastAsia;
_data[0xB0 + j] = fontslot_EastAsia;
_data[0xB1 + j] = fontslot_EastAsia;
_data[0xB2 + j] = fontslot_EastAsia;
_data[0xB3 + j] = fontslot_EastAsia;
_data[0xB4 + j] = fontslot_EastAsia;
_data[0xB6 + j] = fontslot_EastAsia;
_data[0xB7 + j] = fontslot_EastAsia;
_data[0xB8 + j] = fontslot_EastAsia;
_data[0xB9 + j] = fontslot_EastAsia;
_data[0xBA + j] = fontslot_EastAsia;
_data[0xBC + j] = fontslot_EastAsia;
_data[0xBD + j] = fontslot_EastAsia;
_data[0xBE + j] = fontslot_EastAsia;
_data[0xBF + j] = fontslot_EastAsia;
_data[0xD7 + j] = fontslot_EastAsia;
_data[0xF7 + j] = fontslot_EastAsia;
for (i = 0x0100; i <= 0x02AF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0x02B0; i <= 0x04FF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0x0590; i <= 0x07BF; i++)
{
_data[i + j] = fontslot_ASCII;
}
for (i = 0x1100; i <= 0x11FF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0x1E00; i <= 0x1EFF; i++)
{
_data[i + j] = fontslot_HAnsi;
}
for (i = 0x1F00; i <= 0x1FFF; i++)
{
_data[i + j] = fontslot_HAnsi;
}
for (i = 0x2000; i <= 0x27BF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0x2E80; i <= 0x319F; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0x3200; i <= 0x4D8F; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0x4E00; i <= 0x9FAF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xA000; i <= 0xA4CF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xAC00; i <= 0xD7AF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xD800; i <= 0xDFFF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xE000; i <= 0xF8FF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xF900; i <= 0xFAFF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xFB00; i <= 0xFB1C; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xFB1D; i <= 0xFDFF; i++)
{
_data[i + j] = fontslot_ASCII;
}
for (i = 0xFE30; i <= 0xFE6F; i++)
{
_data[i + j] = fontslot_EastAsia;
}
for (i = 0xFE70; i <= 0xFEFE; i++)
{
_data[i + j] = fontslot_ASCII;
}
for (i = 0xFF00; i <= 0xFFEF; i++)
{
_data[i + j] = fontslot_EastAsia;
}
}
this.Get_FontClass = function(nUnicode, nHint, nEastAsia_lcid, bCS, bRTL)
{
var _glyph_slot = fontslot_ASCII;
if (nHint != fonthint_EastAsia)
{
_glyph_slot = this.DetectData.data[nUnicode];
}
else
{
if (nEastAsia_lcid == lcid_zh)
_glyph_slot = this.DetectData.data[this.TableChunkHintZH + nUnicode];
else
_glyph_slot = this.DetectData.data[this.TableChunkHintEA + nUnicode];
if (_glyph_slot == fontslot_EastAsia)
return _glyph_slot;
}
if (bCS || bRTL)
return fontslot_CS;
return _glyph_slot;
}
}
window["CDetectFontUse"] = CDetectFontUse;
})(window.document);
var g_font_detector = new CDetectFontUse();
g_font_detector.Init();
\ No newline at end of file
......@@ -17,6 +17,15 @@ var type_Paragraph = 0x0001;
var UnknownValue = null;
var docpostype_Content = 0x00;
var docpostype_FlowObjects = 0x01;
var docpostype_HdrFtr = 0x02;
var docpostype_FlowShape = 0x03;
var selectionflag_Common = 0x00;
var selectionflag_Numbering = 0x01;
var selectionflag_DrawingObject = 0x002;
// Класс Paragraph
function Paragraph(DrawingDocument, Parent, PageNum, X, Y, XLimit, YLimit)
{
......@@ -46,7 +55,7 @@ function Paragraph(DrawingDocument, Parent, PageNum, X, Y, XLimit, YLimit)
this.TextPr = new ParaTextPr();
this.TextPr.Parent = this;
this.Bounds = new CDocumentBounds( X, Y, X_Right_Field, Y );
this.Bounds = new CDocumentBounds( X, Y, 4000, Y );
this.RecalcInfo = new CParaRecalcInfo();
......@@ -82,14 +91,14 @@ function Paragraph(DrawingDocument, Parent, PageNum, X, Y, XLimit, YLimit)
this.NeedReDraw = true;
this.DrawingDocument = DrawingDocument;
this.LogicDocument = editor.WordControl.m_oLogicDocument;
//this.LogicDocument = editor.WordControl.m_oLogicDocument;
this.TurnOffRecalcEvent = false;
this.ApplyToAll = false; // Специальный параметр, используемый в ячейках таблицы.
// True, если ячейка попадает в выделение по ячейкам.
this.Lock = new CLock(); // Зажат ли данный параграф другим пользователем
// this.Lock = new CLock(); // Зажат ли данный параграф другим пользователем
if ( false === g_oIdCounter.m_bLoad )
{
this.Lock.Set_Type( locktype_Mine, false );
......@@ -116,7 +125,7 @@ function Paragraph(DrawingDocument, Parent, PageNum, X, Y, XLimit, YLimit)
this.SearchResults = new Object();
this.SpellChecker = new CParaSpellChecker();
//this.SpellChecker = new CParaSpellChecker();
// Добавляем данный класс в таблицу Id (обязательно в конце конструктора)
g_oTableId.Add( this, this.Id );
......@@ -362,7 +371,7 @@ Paragraph.prototype =
}
// Передвинем все метки слов для проверки орфографии
this.SpellChecker.Update_OnAdd( this, Pos, Item.Type );
// this.SpellChecker.Update_OnAdd( this, Pos, Item.Type );
},
// Добавляем несколько элементов в конец параграфа.
......@@ -465,7 +474,7 @@ Paragraph.prototype =
}
// Передвинем все метки слов для проверки орфографии
this.SpellChecker.Update_OnRemove( this, Pos, 1 );
// this.SpellChecker.Update_OnRemove( this, Pos, 1 );
},
// Удаляем несколько элементов
......@@ -589,7 +598,7 @@ Paragraph.prototype =
}
// Передвинем все метки слов для проверки орфографии
this.SpellChecker.Update_OnRemove( this, Pos, Count );
// this.SpellChecker.Update_OnRemove( this, Pos, Count );
},
Clear_ContentChanges : function()
......@@ -2226,7 +2235,7 @@ Paragraph.prototype =
// при повторном обсчете строки, т.к. она стала меньше, то у нее и рассчитанная высота могла
// уменьшиться, а значит Ranges2 могло оказаться меньше чем Ranges). В таком случае не надо
// делать повторный пересчет, иначе будет зависание.
if ( -1 == FlowObjects_CompareRanges( Ranges, Ranges2 ) && true === FlowObjects_CheckInjection( Ranges, Ranges2 ) && false === bBreakPageLineEmpty )
/*if ( -1 == FlowObjects_CompareRanges( Ranges, Ranges2 ) && true === FlowObjects_CheckInjection( Ranges, Ranges2 ) && false === bBreakPageLineEmpty )
{
bEnd = false;
......@@ -2274,7 +2283,7 @@ Paragraph.prototype =
nWordLen = 0;
nSpacesCount = 0;
}
else
else */
{
if ( 0 != CurLine )
this.Lines[CurLine].W = X - this.X - ParaPr.Ind.Left;
......@@ -3376,7 +3385,7 @@ Paragraph.prototype =
this.FontMap.NeedRecalc = true;
this.Internal_Recalculate_0();
this.Internal_CheckSpelling();
// this.Internal_CheckSpelling();
var RecalcResult_1 = this.Internal_Recalculate_1_(StartPos, CurPage, CurLine);
var RecalcResult_2 = this.Internal_Recalculate_2_(StartPos, CurPage, CurLine);
......@@ -3432,7 +3441,7 @@ Paragraph.prototype =
Internal_Draw_1 : function(CurPage, pGraphics, Pr)
{
// Если данный параграф зажат другим пользователем, рисуем соответствующий знак
if ( locktype_None != this.Lock.Get_Type() )
/*if ( locktype_None != this.Lock.Get_Type() )
{
if ( ( CurPage > 0 || false === this.Is_StartFromNewPage() || null === this.Get_DocumentPrev() ) )
{
......@@ -3442,14 +3451,14 @@ Paragraph.prototype =
pGraphics.DrawLockParagraph(this.Lock.Get_Type(), X_min, Y_top, Y_bottom);
}
}
} */
},
Internal_Draw_2 : function(CurPage, pGraphics, Pr)
{
// TODO: Как только будет поддержка параметра KeepNext раскоментировать тут.
if ( true === editor.ShowParaMarks && ( ( 0 === CurPage && ( this.Pages.length <= 1 || this.Pages[1].FirstLine > 0 ) ) || ( 1 === CurPage && this.Pages.length > 1 && this.Pages[1].FirstLine === 0 ) ) && ( /*true === Pr.ParaPr.KeepNext ||*/ true === Pr.ParaPr.KeepLines || true === Pr.ParaPr.PageBreakBefore ) )
{
// if ( true === editor.ShowParaMarks && ( ( 0 === CurPage && ( this.Pages.length <= 1 || this.Pages[1].FirstLine > 0 ) ) || ( 1 === CurPage && this.Pages.length > 1 && this.Pages[1].FirstLine === 0 ) ) && ( /*true === Pr.ParaPr.KeepNext ||*/ true === Pr.ParaPr.KeepLines || true === Pr.ParaPr.PageBreakBefore ) )
/* {
var SpecFont = { FontFamily: { Name : "Arial", Index : -1 }, FontSize : 12, Italic : false, Bold : false };
var SpecSym = String.fromCharCode( 0x25AA );
pGraphics.SetFont( SpecFont );
......@@ -3464,14 +3473,14 @@ Paragraph.prototype =
var SpecX = Math.min( X, this.X ) - SpecW;
pGraphics.FillText( SpecX, Y, SpecSym );
}
} */
},
Internal_Draw_3 : function(CurPage, pGraphics)
{
var DocumentComments = editor.WordControl.m_oLogicDocument.Comments;
var bDrawComments = DocumentComments.Is_Use();
var CommentsFlag = DocumentComments.Check_CurrentDraw();
// var DocumentComments = editor.WordControl.m_oLogicDocument.Comments;
var bDrawComments = false;//DocumentComments.Is_Use();
var CommentsFlag = comments_NoComment;//DocumentComments.Check_CurrentDraw();
var CollaborativeChanges = 0;
var StartPagePos = this.Lines[this.Pages[CurPage].StartLine].StartPos;
......@@ -4235,8 +4244,8 @@ Paragraph.prototype =
if ( true === CurTextPr.Underline )
aUnderline.Add( Y + this.Lines[CurLine].Metrics.TextDescent * 0.4, Y + this.Lines[CurLine].Metrics.TextDescent * 0.4, X, X + Item.WidthVisible, (CurTextPr.FontSize / 18) * g_dKoef_pt_to_mm, CurTextPr.Color.r, CurTextPr.Color.g, CurTextPr.Color.b );
if ( true != this.SpellChecker.Check_Spelling(Pos) )
aSpelling.Add( Y + this.Lines[CurLine].Metrics.TextDescent * 0.4, Y + this.Lines[CurLine].Metrics.TextDescent * 0.4, X, X + Item.WidthVisible, (CurTextPr.FontSize / 18) * g_dKoef_pt_to_mm, 0, 0, 0 );
// if ( true != this.SpellChecker.Check_Spelling(Pos) )
// aSpelling.Add( Y + this.Lines[CurLine].Metrics.TextDescent * 0.4, Y + this.Lines[CurLine].Metrics.TextDescent * 0.4, X, X + Item.WidthVisible, (CurTextPr.FontSize / 18) * g_dKoef_pt_to_mm, 0, 0, 0 );
X += Item.WidthVisible;
}
......@@ -9437,7 +9446,7 @@ Paragraph.prototype =
editor.sync_HyperlinkPropCallback( HyperProps );
}
this.SpellChecker.Document_UpdateInterfaceState( StartPos, EndPos );
// this.SpellChecker.Document_UpdateInterfaceState( StartPos, EndPos );
}
else
{
......@@ -9492,7 +9501,7 @@ Paragraph.prototype =
editor.sync_HyperlinkPropCallback( HyperProps );
}
this.SpellChecker.Document_UpdateInterfaceState( this.CurPos.ContentPos, this.CurPos.ContentPos );
// this.SpellChecker.Document_UpdateInterfaceState( this.CurPos.ContentPos, this.CurPos.ContentPos );
}
},
......
......@@ -1661,7 +1661,7 @@ ParaEnd.prototype =
{
Draw : function(X,Y,Context, bEndCell)
{
Context.SetFontSlot( fontslot_ASCII );
/* Context.SetFontSlot( fontslot_ASCII );
if ( editor.ShowParaMarks )
{
......@@ -1669,7 +1669,7 @@ ParaEnd.prototype =
Context.FillText( X, Y, String.fromCharCode( 0x00A4 ) );
else
Context.FillText( X, Y, String.fromCharCode( 0x00B6 ) );
}
} */
},
Measure : function(Context, bEndCell)
......
......@@ -32,7 +32,7 @@ function CShape(drawingBase, drawingObjects)
this.flipV = null;
this.transform = new CMatrix();
this.invertTransform = null;
this.transformText = null;
this.transformText = new CMatrix();
this.invertTransformText = null;
this.cursorTypes = [];
......@@ -177,6 +177,385 @@ CShape.prototype =
}
},
paragraphAdd: function(paraItem, bRecalculate)
{
if(!isRealObject(this.txBody))
{
this.addTextBody(new CTxBody(this));
this.txBody.calculateContent();
}
this.txBody.paragraphAdd(paraItem, bRecalculate);
},
calculateContent: function()
{
if(this.txBody)
this.txBody.calculateContent();
},
calculateTransformTextMatrix: function()
{
if(this.txBody === null)
return;
this.transformText.Reset();
var _text_transform = this.transformText;
var _shape_transform = this.transform;
var _body_pr = this.txBody.getBodyPr();
var _content_height = this.txBody.getSummaryHeight();
var _l, _t, _r, _b;
var _t_x_lt, _t_y_lt, _t_x_rt, _t_y_rt, _t_x_lb, _t_y_lb, _t_x_rb, _t_y_rb;
if(isRealObject(this.spPr.geometry) && isRealObject(this.spPr.geometry.rect))
{
var _rect = this.spPr.geometry.rect;
_l = _rect.l + _body_pr.lIns;
_t = _rect.t + _body_pr.tIns;
_r = _rect.r - _body_pr.rIns;
_b = _rect.b - _body_pr.bIns;
}
else
{
_l = _body_pr.lIns;
_t = _body_pr.tIns;
_r = this.extX - _body_pr.rIns;
_b = this.extY - _body_pr.bIns;
}
if(_l >= _r)
{
var _c = (_l + _r)*0.5;
_l = _c - 0.01;
_r = _c + 0.01;
}
if(_t >= _b)
{
_c = (_t + _b)*0.5;
_t = _c - 0.01;
_b = _c + 0.01;
}
_t_x_lt = _shape_transform.TransformPointX(_l, _t);
_t_y_lt = _shape_transform.TransformPointY(_l, _t);
_t_x_rt = _shape_transform.TransformPointX(_r, _t);
_t_y_rt = _shape_transform.TransformPointY(_r, _t);
_t_x_lb = _shape_transform.TransformPointX(_l, _b);
_t_y_lb = _shape_transform.TransformPointY(_l, _b);
_t_x_rb = _shape_transform.TransformPointX(_r, _b);
_t_y_rb = _shape_transform.TransformPointY(_r, _b);
var _dx_t, _dy_t;
_dx_t = _t_x_rt - _t_x_lt;
_dy_t = _t_y_rt - _t_y_lt;
var _dx_lt_rb, _dy_lt_rb;
_dx_lt_rb = _t_x_rb - _t_x_lt;
_dy_lt_rb = _t_y_rb - _t_y_lt;
var _vertical_shift;
var _text_rect_height = _b - _t;
var _text_rect_width = _r - _l;
if(_body_pr.upright === false)
{
if(!(_body_pr.vert === nVertTTvert || _body_pr.vert === nVertTTvert270))
{
if(_content_height < _text_rect_height)
{
switch (_body_pr.anchor)
{
case 0 ://b
{ // (Text Anchor Enum ( Bottom ))
_vertical_shift = _text_rect_height - _content_height;
break;
}
case 1 : //ctr
{// (Text Anchor Enum ( Center ))
_vertical_shift = (_text_rect_height - _content_height)*0.5;
break;
}
case 2 : //dist
{// (Text Anchor Enum ( Distributed )) TODO: пока выравнивание по центру. Переделать!
_vertical_shift = (_text_rect_height - _content_height)*0.5;
break;
}
case 3 ://just
{// (Text Anchor Enum ( Justified )) TODO: пока выравнивание по центру. Переделать!
_vertical_shift = (_text_rect_height - _content_height)*0.5;
break;
}
case 4 ://t
{//Top
_vertical_shift = 0;
break;
}
}
}
else
{
_vertical_shift = 0;
//_vertical_shift = _text_rect_height - _content_height;
/*if(_body_pr.anchor === 0)
{
_vertical_shift = _text_rect_height - _content_height;
}
else
{
_vertical_shift = 0;
} */
}
global_MatrixTransformer.TranslateAppend(_text_transform, 0, _vertical_shift);
if(_dx_lt_rb*_dy_t - _dy_lt_rb*_dx_t <= 0)
{
var alpha = Math.atan2(_dy_t, _dx_t);
global_MatrixTransformer.RotateRadAppend(_text_transform, -alpha);
global_MatrixTransformer.TranslateAppend(_text_transform, _t_x_lt, _t_y_lt);
}
else
{
alpha = Math.atan2(_dy_t, _dx_t);
global_MatrixTransformer.RotateRadAppend(_text_transform, Math.PI-alpha);
global_MatrixTransformer.TranslateAppend(_text_transform, _t_x_rt, _t_y_rt);
}
}
else
{
if(_content_height < _text_rect_width)
{
switch (_body_pr.anchor)
{
case 0 ://b
{ // (Text Anchor Enum ( Bottom ))
_vertical_shift = _text_rect_width - _content_height;
break;
}
case 1 : //ctr
{// (Text Anchor Enum ( Center ))
_vertical_shift = (_text_rect_width - _content_height)*0.5;
break;
}
case 2 : //dist
{// (Text Anchor Enum ( Distributed ))
_vertical_shift = (_text_rect_width - _content_height)*0.5;
break;
}
case 3 ://just
{// (Text Anchor Enum ( Justified ))
_vertical_shift = (_text_rect_width - _content_height)*0.5;
break;
}
case 4 ://t
{//Top
_vertical_shift = 0;
break;
}
}
}
else
{
_vertical_shift = 0;
/*if(_body_pr.anchor === 0)
{
_vertical_shift = _text_rect_width - _content_height;
}
else
{
_vertical_shift = 0;
} */
}
global_MatrixTransformer.TranslateAppend(_text_transform, 0, _vertical_shift);
var _alpha;
_alpha = Math.atan2(_dy_t, _dx_t);
if(_body_pr.vert === nVertTTvert)
{
if(_dx_lt_rb*_dy_t - _dy_lt_rb*_dx_t <= 0)
{
global_MatrixTransformer.RotateRadAppend(_text_transform, -_alpha - Math.PI*0.5);
global_MatrixTransformer.TranslateAppend(_text_transform, _t_x_rt, _t_y_rt);
}
else
{
global_MatrixTransformer.RotateRadAppend(_text_transform, Math.PI*0.5-_alpha);
global_MatrixTransformer.TranslateAppend(_text_transform, _t_x_lt, _t_y_lt);
}
}
else
{
if(_dx_lt_rb*_dy_t - _dy_lt_rb*_dx_t <= 0)
{
global_MatrixTransformer.RotateRadAppend(_text_transform, -_alpha - Math.PI*1.5);
global_MatrixTransformer.TranslateAppend(_text_transform, _t_x_lb, _t_y_lb);
}
else
{
global_MatrixTransformer.RotateRadAppend(_text_transform, -Math.PI*0.5-_alpha);
global_MatrixTransformer.TranslateAppend(_text_transform, _t_x_rb, _t_y_rb);
}
}
}
if(isRealObject(this.spPr.geometry) && isRealObject(this.spPr.geometry.rect))
{
var rect = this.spPr.geometry.rect;
this.clipRect = {x: rect.l, y: rect.t, w: rect.r - rect.l, h: rect.b - rect.t};
}
else
{
this.clipRect = {x: 0, y: 0, w: this.absExtX, h: this.absExtY};
}
}
else
{
var _full_rotate = this.getFullRotate();
var _full_flip = this.getFullFlip();
var _hc = this.absExtX*0.5;
var _vc = this.absExtY*0.5;
var _transformed_shape_xc = this.transform.TransformPointX(_hc, _vc);
var _transformed_shape_yc = this.transform.TransformPointY(_hc, _vc);
var _content_width, content_height2;
if((_full_rotate >= 0 && _full_rotate < Math.PI*0.25)
|| (_full_rotate > 3*Math.PI*0.25 && _full_rotate < 5*Math.PI*0.25)
|| (_full_rotate > 7*Math.PI*0.25 && _full_rotate < 2*Math.PI))
{
if(!(_body_pr.vert === nVertTTvert || _body_pr.vert === nVertTTvert270))
{
_content_width = _r - _l;
content_height2 = _b - _t;
}
else
{
_content_width = _b - _t;
content_height2 = _r - _l;
}
}
else
{
if(!(_body_pr.vert === nVertTTvert || _body_pr.vert === nVertTTvert270))
{
_content_width = _b - _t;
content_height2 = _r - _l;
}
else
{
_content_width = _r - _l;
content_height2 = _b - _t;
}
}
if(_content_height < content_height2)
{
switch (_body_pr.anchor)
{
case 0 ://b
{ // (Text Anchor Enum ( Bottom ))
_vertical_shift = content_height2 - _content_height;
break;
}
case 1 : //ctr
{// (Text Anchor Enum ( Center ))
_vertical_shift = (content_height2 - _content_height)*0.5;
break;
}
case 2 : //dist
{// (Text Anchor Enum ( Distributed ))
_vertical_shift = (content_height2 - _content_height)*0.5;
break;
}
case 3 ://just
{// (Text Anchor Enum ( Justified ))
_vertical_shift = (content_height2 - _content_height)*0.5;
break;
}
case 4 ://t
{//Top
_vertical_shift = 0;
break;
}
}
}
else
{
_vertical_shift = 0;
/*if(_body_pr.anchor === 0)
{
_vertical_shift = content_height2 - _content_height;
}
else
{
_vertical_shift = 0;
} */
}
var _text_rect_xc = _l + (_r - _l)*0.5;
var _text_rect_yc = _t + (_b - _t)*0.5;
var _vx = _text_rect_xc - _hc;
var _vy = _text_rect_yc - _vc;
var _transformed_text_xc, _transformed_text_yc;
if(!_full_flip.flipH)
{
_transformed_text_xc = _transformed_shape_xc + _vx;
}
else
{
_transformed_text_xc = _transformed_shape_xc - _vx;
}
if(!_full_flip.flipV)
{
_transformed_text_yc = _transformed_shape_yc + _vy;
}
else
{
_transformed_text_yc = _transformed_shape_yc - _vy;
}
global_MatrixTransformer.TranslateAppend(_text_transform, 0, _vertical_shift);
if(_body_pr.vert === nVertTTvert)
{
global_MatrixTransformer.TranslateAppend(_text_transform, -_content_width*0.5, - content_height2*0.5);
global_MatrixTransformer.RotateRadAppend(_text_transform, -Math.PI*0.5);
global_MatrixTransformer.TranslateAppend(_text_transform, _content_width*0.5, content_height2*0.5);
}
if(_body_pr.vert === nVertTTvert270)
{
global_MatrixTransformer.TranslateAppend(_text_transform, -_content_width*0.5, - content_height2*0.5);
global_MatrixTransformer.RotateRadAppend(_text_transform, -Math.PI*1.5);
global_MatrixTransformer.TranslateAppend(_text_transform, _content_width*0.5, content_height2*0.5);
}
global_MatrixTransformer.TranslateAppend(_text_transform, _transformed_text_xc - _content_width*0.5, _transformed_text_yc - content_height2*0.5);
var body_pr = this.bodyPr;
var l_ins = typeof body_pr.lIns === "number" ? body_pr.lIns : 2.54;
var t_ins = typeof body_pr.tIns === "number" ? body_pr.tIns : 1.27;
var r_ins = typeof body_pr.rIns === "number" ? body_pr.rIns : 2.54;
var b_ins = typeof body_pr.bIns === "number" ? body_pr.bIns : 1.27;
this.clipRect = {
x: -l_ins,
y: -_vertical_shift - t_ins,
w: this.contentWidth + (r_ins + l_ins),
h: this.contentHeight + (b_ins + t_ins)
};
}
this.invertTextMatrix = global_MatrixTransformer.Invert(this.transformText);
},
addTextBody: function(textBody)
{
this.txBody = textBody;
},
select: function(drawingObjectsController)
{
this.selected = true;
......@@ -359,6 +738,19 @@ CShape.prototype =
shape_drawer.draw(this.spPr.geometry);
graphics.reset();
graphics.SetIntegerGrid(true);
if(this.txBody)
{
graphics.SetIntegerGrid(false);
graphics.transform3(this.transformText);
this.txBody.draw(graphics);
if (graphics.FreeFont !== undefined)
graphics.FreeFont();
graphics.SetIntegerGrid(true);
graphics.reset();
graphics.SetIntegerGrid(true);
}
},
check_bounds: function(checker)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -10,29 +10,146 @@ function CTxBody(shape)
this.shape = shape;
this.bodyPr = new CBodyPr();
this.bodyPr.setDefault();
this.lstStyle = null;
this.content = new CDocumentContent(this, editor.WordControl.m_oLogicDocument.DrawingDocument, 0, 0, 0, 20000, false, false);
this.content = new CDocumentContent(this, /*editor.WordControl.m_oLogicDocument.DrawingDocument*/undefined, 0, 0, 200, 20000, false, false);
this.contentWidth = 0;
this.contentHeight = 0;
}
CTxBody.prototype =
{
recalculate: function()
draw: function(graphics)
{
this.content.Draw(0, graphics);
},
Get_Styles: function(level)
{
return new CStyles();//this.shape.Get_Styles(level);
},
draw: function(graphics)
Get_Numbering: function()
{
this.content.Draw(graphics);
return new CNumbering();
},
Get_Styles: function(level)
Get_TableStyleForPara: function()
{
return this.shape.Get_Styles(level);
return null;
},
paragraphAdd: function(paraItem)
{
this.content.Paragraph_Add(paraItem);
this.content.Recalculate_Page(0, true );
if(this.bodyPr.anchor !== VERTICAL_ANCHOR_TYPE_TOP)
{
this.shape.calculateTransformTextMatrix();
}
},
recalculate: function()
{
},
getSummaryHeight: function()
{
return this.content.Get_SummaryHeight();
},
getBodyPr: function()
{
return this.bodyPr;
},
calculateContent: function()
{
var _l, _t, _r, _b;
var _body_pr = this.bodyPr;
var sp = this.shape;
if(isRealObject(sp.spPr.geometry) && isRealObject(sp.spPr.geometry.rect))
{
var _rect = sp.spPr.geometry.rect;
_l = _rect.l + _body_pr.lIns;
_t = _rect.t + _body_pr.tIns;
_r = _rect.r - _body_pr.rIns;
_b = _rect.b - _body_pr.bIns;
}
else
{
_l = _body_pr.lIns;
_t = _body_pr.tIns;
_r = sp.extX - _body_pr.rIns;
_b = sp.extY - _body_pr.bIns;
}
if(_body_pr.upright === false)
{
var _content_width;
if(!(_body_pr.vert === nVertTTvert || _body_pr.vert === nVertTTvert270))
{
_content_width = _r - _l;
this.contentWidth = _content_width;
this.contentHeight = _b - _t;
}
else
{
_content_width = _b - _t;
this.contentWidth = _content_width;
this.contentHeight = _r - _l;
}
}
else
{
var _full_rotate = sp.getFullRotate();
if((_full_rotate >= 0 && _full_rotate < Math.PI*0.25)
|| (_full_rotate > 3*Math.PI*0.25 && _full_rotate < 5*Math.PI*0.25)
|| (_full_rotate > 7*Math.PI*0.25 && _full_rotate < 2*Math.PI))
{
if(!(_body_pr.vert === nVertTTvert || _body_pr.vert === nVertTTvert270))
{
_content_width = _r - _l;
this.contentWidth = _content_width;
this.contentHeight = _b - _t;
}
else
{
_content_width = _b - _t;
this.contentWidth = _content_width;
this.contentHeight = _r - _l;
}
}
else
{
if(!(_body_pr.vert === nVertTTvert || _body_pr.vert === nVertTTvert270))
{
_content_width = _b - _t;
this.contentWidth = _content_width;
this.contentHeight = _r - _l;
}
else
{
_content_width = _r - _l;
this.contentWidth = _content_width;
this.contentHeight = _b - _t;
}
}
}
this.content.Reset(0, 0, _content_width, 20000);
this.content.Recalculate_Page(0, true );
},
OnEndRecalculate_Page: function()
{},
Is_Cell: function()
{
return false;
}
};
\ No newline at end of file
......@@ -38,6 +38,8 @@ var STATES_ID_POLY_LINE_ADD2 = 0x28;
var STATES_ID_ADD_PPOLY_LINE2 = 0x29;
var STATES_ID_ADD_PPOLY_LINE22 = 0x30;
var STATES_ID_ADD_PPOLY_LINE23 = 0x31;
var STATES_ID_TEXT_ADD = 0x32;
......@@ -200,16 +202,172 @@ function NullState(drawingObjectsController, drawingObjects)
{};
this.onKeyDown = function(e)
{
var b_prevent_default = false;
switch (e.keyCode)
{
case 8:
{
b_prevent_default = true;
}
}
if(b_prevent_default)
e.preventDefault();
};
this.onKeyPress = function(e)
{
var selected_objects = this.drawingObjectsController.selectedObjects;
if(selected_objects.length === 1 && selected_objects[0].isShape())
{
if(isRealNumber(e.charCode))
{
selected_objects[0].paragraphAdd(new ParaText(String.fromCharCode(e.charCode)));
//this.drawingObjects.showDrawingObjects(true);
}
}
};
this.drawSelection = function(drawingDocument)
{
DrawDefaultSelection(this.drawingObjectsController, drawingDocument);
};
this.isPointInDrawingObjects = function(x, y)
{
var selected_objects = this.drawingObjectsController.selectedObjects;
if(selected_objects.length === 1)
{
var hit_to_adj = selected_objects[0].hitToAdjustment(x, y);
if(hit_to_adj.hit)
{
if(selected_objects[0].canChangeAdjustments())
{
return {objectId: selected_objects[0].drawingBase.id, cursorType: "crosshair"};
}
}
}
for(var i = selected_objects.length - 1; i > -1; --i)
{
var hit_to_handles = selected_objects[i].hitToHandles(x, y);
if(hit_to_handles > -1)
{
if(hit_to_handles === 8)
{
if(!selected_objects[i].canRotate())
return null;
return {objectId: selected_objects[i].drawingBase.id, cursorType: "crosshair"};
}
else
{
if(!selected_objects[i].canResize())
return null;
this.drawingObjectsController.clearPreTrackObjects();
var card_direction = selected_objects[i].getCardDirectionByNum(hit_to_handles);
for(var j = 0; j < selected_objects.length; ++j)
{
if(selected_objects[j].canResize())
this.drawingObjectsController.addPreTrackObject(selected_objects[j].createResizeTrack(card_direction));
}
return {objectId: selected_objects[i].drawingBase.id, cursorType: CURSOR_TYPES_BY_CARD_DIRECTION[card_direction]};
}
}
}
for(i = selected_objects.length - 1; i > -1; --i)
{
if(selected_objects[i].hitInBoundingRect(x, y))
{
if(!selected_objects[i].canMove())
return null;
return {objectId: selected_objects[i].drawingBase.id, cursorType: "move"};
}
}
var arr_drawing_objects = this.drawingObjects.getDrawingObjects();
for(i = arr_drawing_objects.length-1; i > -1; --i)
{
var cur_drawing_base = arr_drawing_objects[i];
if(cur_drawing_base.isGraphicObject())
{
var cur_drawing = cur_drawing_base.graphicObject;
if(cur_drawing.isSimpleObject())
{
var hit_in_inner_area = cur_drawing.hitInInnerArea(x, y);
var hit_in_path = cur_drawing.hitInPath(x, y);
var hit_in_text_rect = cur_drawing.hitInTextRect(x, y);
if(hit_in_inner_area && !hit_in_text_rect || hit_in_path)
{
return {objectId: cur_drawing_base.id, cursorType: "move"};
}
else if(hit_in_text_rect)
{
//TODO
}
}
else
{
var grouped_objects = cur_drawing.getArrGraphicObjects();
for(var j = grouped_objects.length - 1; j > -1; --j)
{
var cur_grouped_object = grouped_objects[j];
var hit_in_inner_area = cur_grouped_object.hitInInnerArea(x, y);
var hit_in_path = cur_grouped_object.hitInPath(x, y);
var hit_in_text_rect = cur_grouped_object.hitInTextRect(x, y);
if(hit_in_inner_area && !hit_in_text_rect || hit_in_path)
{
return {objectId: cur_drawing_base.id, cursorType: "move"};
}
else if(hit_in_text_rect)
{
//TODO
}
}
}
}
}
return null;
};
}
function TextAddState(drawingObjectsController, drawingObjects, textObject)
{
this.id = STATES_ID_TEXT_ADD;
this.drawingObjectsController = drawingObjectsController;
this.drawingObjects = drawingObjects;
this.textObject = textObject;
this.onMouseDown = function(e, x, y)
{
};
this.onMouseMove = function(e, x, y)
{};
this.onMouseUp = function(e, x, y)
{};
this.onKeyDown = function(e)
{
var b_prevent_default = false;
switch (e.keyCode)
{
case 8:
{
b_prevent_default = true;
}
}
if(b_prevent_default)
e.preventDefault();
};
this.onKeyPress = function(e)
{
this.textObject.paragraphAdd(new ParaText(String.fromCharCode(e.charCode)));
//this.drawingObjects.showDrawingObjects(true);
};
this.drawSelection = function(drawingDocument)
......@@ -2485,6 +2643,7 @@ function AddPolyLine2State3(drawingObjectsController, drawingObjects, polyline)
this.onKeyPress = function(e)
{
};
this.isPointInDrawingObjects = function(x, y)
......
......@@ -167,6 +167,8 @@ function XYAdjustmentTrack(originalShape, adjIndex)
{
this.originalShape.setAdjustmentValue(this.refX, this.geometry.gdLst[this.adjastment.gdRefX], this.refY, this.geometry.gdLst[this.adjastment.gdRefY]);
this.originalShape.recalculateGeometry();
this.originalShape.calculateContent();
this.originalShape.calculateTransformTextMatrix();
};
}
......@@ -316,5 +318,8 @@ function PolarAdjustmentTrack(originalShape, adjIndex)
this.trackEnd = function()
{
this.originalShape.setAdjustmentValue(this.refR, this.geometry.gdLst[this.adjastment.gdRefR], this.refAng, this.geometry.gdLst[this.adjastment.gdRefAng]);
this.originalShape.recalculateGeometry();
this.originalShape.calculateContent();
this.originalShape.calculateTransformTextMatrix();
};
}
\ No newline at end of file
......@@ -47,6 +47,7 @@ function MoveShapeImageTrack(originalObject)
{
this.originalObject.setPosition(this.x, this.y);
this.originalObject.recalculateTransform();
this.originalObject.calculateTransformTextMatrix();
this.originalObject.updateDrawingBaseCoordinates();
};
}
......@@ -104,6 +105,7 @@ function MoveShapeImageTrackInGroup(originalObject)
var xfrm = this.originalObject.group.spPr.xfrm;
this.originalObject.setPosition(this.x/scale_scale_coefficients.cx + xfrm.chOffX, this.y/scale_scale_coefficients.cy + xfrm.chOffY);
this.originalObject.recalculateTransform();
this.originalObject.calculateTransformTextMatrix();
}
}
......
......@@ -1133,6 +1133,8 @@ function ResizeTrackShapeImageInGroup(originalObject, cardDirection)
this.originalObject.setExtents(this.resizedExtX/scale_scale_coefficients.cx, this.resizedExtY/scale_scale_coefficients.cy);
this.originalObject.setFlips(this.resizedflipH, this.resizedflipV);
this.originalObject.recalculateTransform();
this.originalObject.calculateContent();
this.originalObject.calculateTransformTextMatrix();
};
}
......
......@@ -123,6 +123,8 @@ function RotateTrackShapeImage(originalObject)
{
this.originalObject.setRotate(this.angle);
this.originalObject.recalculateTransform();
this.originalObject.calculateContent();
this.originalObject.calculateTransformTextMatrix();
}
}
......@@ -183,6 +185,8 @@ function RotateTrackShapeImageInGroup(originalObject)
{
this.originalObject.setRotate(this.angle);
this.originalObject.recalculateTransform();
this.originalObject.calculateContent();
this.originalObject.calculateTransformTextMatrix();
}
}
......
......@@ -94,6 +94,46 @@ var historyitem_AutoFilter_Empty = 3;
var historyitem_AutoFilter_ApplyDF = 4;
var historyitem_AutoFilter_ApplyMF = 5;
// Типы изменений в классе CDocumentContent
var historyitem_DocumentContent_AddItem = 1; // Добавляем элемент в документ
var historyitem_DocumentContent_RemoveItem = 2; // Удаляем элемент из документа
// Типы изменений в классе Paragraph
var historyitem_Paragraph_AddItem = 1; // Добавляем элемент в параграф
var historyitem_Paragraph_RemoveItem = 2; // Удаляем элемент из параграфа
var historyitem_Paragraph_Numbering = 3; // Добавляем/Убираем/Изменяем нумерацию у параграфа
var historyitem_Paragraph_Align = 4; // Изменяем прилегание параграфа
var historyitem_Paragraph_Ind_First = 5; // Изменяем отспут первой строки
var historyitem_Paragraph_Ind_Right = 6; // Изменяем правый отступ
var historyitem_Paragraph_Ind_Left = 7; // Изменяем левый отступ
var historyitem_Paragraph_ContextualSpacing = 8; // Изменяем свойство contextualSpacing
var historyitem_Paragraph_KeepLines = 9; // Изменяем свойство KeepLines
var historyitem_Paragraph_KeepNext = 10; // Изменяем свойство KeepNext
var historyitem_Paragraph_PageBreakBefore = 11; // Изменяем свойство PageBreakBefore
var historyitem_Paragraph_Spacing_Line = 12; // Изменяем свойство Spacing.Line
var historyitem_Paragraph_Spacing_LineRule = 13; // Изменяем свойство Spacing.LineRule
var historyitem_Paragraph_Spacing_Before = 14; // Изменяем свойство Spacing.Before
var historyitem_Paragraph_Spacing_After = 15; // Изменяем свойство Spacing.After
var historyitem_Paragraph_Spacing_AfterAutoSpacing = 16; // Изменяем свойство Spacing.AfterAutoSpacing
var historyitem_Paragraph_Spacing_BeforeAutoSpacing = 17; // Изменяем свойство Spacing.BeforeAutoSpacing
var historyitem_Paragraph_Shd_Value = 18; // Изменяем свойство Shd.Value
var historyitem_Paragraph_Shd_Color = 19; // Изменяем свойство Shd.Color
var historyitem_Paragraph_WidowControl = 20; // Изменяем свойство WidowControl
var historyitem_Paragraph_Tabs = 21; // Изменяем табы у параграфа
var historyitem_Paragraph_PStyle = 22; // Изменяем стиль параграфа
var historyitem_Paragraph_DocNext = 23; // Изменяем указатель на следующий объект
var historyitem_Paragraph_DocPrev = 24; // Изменяем указатель на предыдущий объект
var historyitem_Paragraph_Parent = 25; // Изменяем указатель на родительский объект
var historyitem_Paragraph_Borders_Between = 26; // Изменяем промежуточную границу
var historyitem_Paragraph_Borders_Bottom = 27; // Изменяем верхнюю границу
var historyitem_Paragraph_Borders_Left = 28; // Изменяем левую границу
var historyitem_Paragraph_Borders_Right = 29; // Изменяем правую границу
var historyitem_Paragraph_Borders_Top = 30; // Изменяем нижнюю границу
var historyitem_Paragraph_Pr = 31; // Изменяем свойства полностью
var historyitem_Paragraph_PresentationPr_Bullet = 32; // Изменяем свойства нумерации у параграфа в презентации
var historyitem_Paragraph_PresentationPr_Level = 33; // Изменяем уровень параграфа в презентациях
// Типы изменений в классе CTableId
var historyitem_TableId_Add = 1; // Добавили новую ссылку в глобальную таблицу
var historyitem_TableId_Reset = 2; // Изменили Id ссылки
......
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