Commit 1c1bb52a authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

(2.0.0.133): AVSOfficeDocxFile2

Убран отступ для правого таба, своство TableLayout и Lang на чтение и запись.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47728 954022d7-b5bf-4e40-9824-e11837661b57
parent 1cd61510
......@@ -400,8 +400,409 @@ var lcid_iuLatn = 0x7c5d; // Inuktitut, Latin
var lcid_tzmLatn = 0x7c5f; // Central Atlas Tamazight, Latin
var lcid_haLatn = 0x7c68; // Hausa, Latin
(function(document){
var g_aLcidNameIdArray = [
"ar", 0x0001 ,
"bg", 0x0002 ,
"ca", 0x0003 ,
"zh-Hans", 0x0004 ,
"cs", 0x0005 ,
"da", 0x0006 ,
"de", 0x0007 ,
"el", 0x0008 ,
"en", 0x0009 ,
"es", 0x000a ,
"fi", 0x000b ,
"fr", 0x000c ,
"he", 0x000d ,
"hu", 0x000e ,
"is", 0x000f ,
"it", 0x0010 ,
"ja", 0x0011 ,
"ko", 0x0012 ,
"nl", 0x0013 ,
"no", 0x0014 ,
"pl", 0x0015 ,
"pt", 0x0016 ,
"rm", 0x0017 ,
"ro", 0x0018 ,
"ru", 0x0019 ,
"hr", 0x001a ,
"sk", 0x001b ,
"sq", 0x001c ,
"sv", 0x001d ,
"th", 0x001e ,
"tr", 0x001f ,
"ur", 0x0020 ,
"id", 0x0021 ,
"uk", 0x0022 ,
"be", 0x0023 ,
"sl", 0x0024 ,
"et", 0x0025 ,
"lv", 0x0026 ,
"lt", 0x0027 ,
"tg", 0x0028 ,
"fa", 0x0029 ,
"vi", 0x002a ,
"hy", 0x002b ,
"az", 0x002c ,
"eu", 0x002d ,
"hsb", 0x002e ,
"mk", 0x002f ,
"tn", 0x0032 ,
"xh", 0x0034 ,
"zu", 0x0035 ,
"af", 0x0036 ,
"ka", 0x0037 ,
"fo", 0x0038 ,
"hi", 0x0039 ,
"mt", 0x003a ,
"se", 0x003b ,
"ga", 0x003c ,
"ms", 0x003e ,
"kk", 0x003f ,
"ky", 0x0040 ,
"sw", 0x0041 ,
"tk", 0x0042 ,
"uz", 0x0043 ,
"tt", 0x0044 ,
"bn", 0x0045 ,
"pa", 0x0046 ,
"gu", 0x0047 ,
"or", 0x0048 ,
"ta", 0x0049 ,
"te", 0x004a ,
"kn", 0x004b ,
"ml", 0x004c ,
"as", 0x004d ,
"mr", 0x004e ,
"sa", 0x004f ,
"mn", 0x0050 ,
"bo", 0x0051 ,
"cy", 0x0052 ,
"km", 0x0053 ,
"lo", 0x0054 ,
"gl", 0x0056 ,
"kok", 0x0057 ,
"syr", 0x005a ,
"si", 0x005b ,
"iu", 0x005d ,
"am", 0x005e ,
"tzm", 0x005f ,
"ne", 0x0061 ,
"fy", 0x0062 ,
"ps", 0x0063 ,
"fil", 0x0064 ,
"dv", 0x0065 ,
"ha", 0x0068 ,
"yo", 0x006a ,
"quz", 0x006b ,
"nso", 0x006c ,
"ba", 0x006d ,
"lb", 0x006e ,
"kl", 0x006f ,
"ig", 0x0070 ,
"ii", 0x0078 ,
"arn", 0x007a ,
"moh", 0x007c ,
"br", 0x007e ,
"ug", 0x0080 ,
"mi", 0x0081 ,
"oc", 0x0082 ,
"co", 0x0083 ,
"gsw", 0x0084 ,
"sah", 0x0085 ,
"qut", 0x0086 ,
"rw", 0x0087 ,
"wo", 0x0088 ,
"prs", 0x008c ,
"gd", 0x0091 ,
"ar-SA", 0x0401 ,
"bg-BG", 0x0402 ,
"ca-ES", 0x0403 ,
"zh-TW", 0x0404 ,
"cs-CZ", 0x0405 ,
"da-DK", 0x0406 ,
"de-DE", 0x0407 ,
"el-GR", 0x0408 ,
"en-US", 0x0409 ,
"es-ES_tradnl", 0x040a ,
"fi-FI", 0x040b ,
"fr-FR", 0x040c ,
"he-IL", 0x040d ,
"hu-HU", 0x040e ,
"is-IS", 0x040f ,
"it-IT", 0x0410 ,
"ja-JP", 0x0411 ,
"ko-KR", 0x0412 ,
"nl-NL", 0x0413 ,
"nb-NO", 0x0414 ,
"pl-PL", 0x0415 ,
"pt-BR", 0x0416 ,
"rm-CH", 0x0417 ,
"ro-RO", 0x0418 ,
"ru-RU", 0x0419 ,
"hr-HR", 0x041a ,
"sk-SK", 0x041b ,
"sq-AL", 0x041c ,
"sv-SE", 0x041d ,
"th-TH", 0x041e ,
"tr-TR", 0x041f ,
"ur-PK", 0x0420 ,
"id-ID", 0x0421 ,
"uk-UA", 0x0422 ,
"be-BY", 0x0423 ,
"sl-SI", 0x0424 ,
"et-EE", 0x0425 ,
"lv-LV", 0x0426 ,
"lt-LT", 0x0427 ,
"tg-Cyrl-TJ", 0x0428 ,
"fa-IR", 0x0429 ,
"vi-VN", 0x042a ,
"hy-AM", 0x042b ,
"az-Latn-AZ", 0x042c ,
"eu-ES", 0x042d ,
"wen-DE", 0x042e ,
"mk-MK", 0x042f ,
"st-ZA", 0x0430 ,
"ts-ZA", 0x0431 ,
"tn-ZA", 0x0432 ,
"ven-ZA", 0x0433 ,
"xh-ZA", 0x0434 ,
"zu-ZA", 0x0435 ,
"af-ZA", 0x0436 ,
"ka-GE", 0x0437 ,
"fo-FO", 0x0438 ,
"hi-IN", 0x0439 ,
"mt-MT", 0x043a ,
"se-NO", 0x043b ,
"ms-MY", 0x043e ,
"kk-KZ", 0x043f ,
"ky-KG", 0x0440 ,
"sw-KE", 0x0441 ,
"tk-TM", 0x0442 ,
"uz-Latn-UZ", 0x0443 ,
"tt-RU", 0x0444 ,
"bn-IN", 0x0445 ,
"pa-IN", 0x0446 ,
"gu-IN", 0x0447 ,
"or-IN", 0x0448 ,
"ta-IN", 0x0449 ,
"te-IN", 0x044a ,
"kn-IN", 0x044b ,
"ml-IN", 0x044c ,
"as-IN", 0x044d ,
"mr-IN", 0x044e ,
"sa-IN", 0x044f ,
"mn-MN", 0x0450 ,
"bo-CN", 0x0451 ,
"cy-GB", 0x0452 ,
"km-KH", 0x0453 ,
"lo-LA", 0x0454 ,
"my-MM", 0x0455 ,
"gl-ES", 0x0456 ,
"kok-IN", 0x0457 ,
"mni", 0x0458 ,
"sd-IN", 0x0459 ,
"syr-SY", 0x045a ,
"si-LK", 0x045b ,
"chr-US", 0x045c ,
"iu-Cans-CA", 0x045d ,
"am-ET", 0x045e ,
"tmz", 0x045f ,
"ne-NP", 0x0461 ,
"fy-NL", 0x0462 ,
"ps-AF", 0x0463 ,
"fil-PH", 0x0464 ,
"dv-MV", 0x0465 ,
"bin-NG", 0x0466 ,
"fuv-NG", 0x0467 ,
"ha-Latn-NG", 0x0468 ,
"ibb-NG", 0x0469 ,
"yo-NG", 0x046a ,
"quz-BO", 0x046b ,
"nso-ZA", 0x046c ,
"ba-RU", 0x046d ,
"lb-LU", 0x046e ,
"kl-GL", 0x046f ,
"ig-NG", 0x0470 ,
"kr-NG", 0x0471 ,
"gaz-ET", 0x0472 ,
"ti-ER", 0x0473 ,
"gn-PY", 0x0474 ,
"haw-US", 0x0475 ,
"so-SO", 0x0477 ,
"ii-CN", 0x0478 ,
"pap-AN", 0x0479 ,
"arn-CL", 0x047a ,
"moh-CA", 0x047c ,
"br-FR", 0x047e ,
"ug-CN", 0x0480 ,
"mi-NZ", 0x0481 ,
"oc-FR", 0x0482 ,
"co-FR", 0x0483 ,
"gsw-FR", 0x0484 ,
"sah-RU", 0x0485 ,
"qut-GT", 0x0486 ,
"rw-RW", 0x0487 ,
"wo-SN", 0x0488 ,
"prs-AF", 0x048c ,
"plt-MG", 0x048d ,
"gd-GB", 0x0491 ,
"ar-IQ", 0x0801 ,
"zh-CN", 0x0804 ,
"de-CH", 0x0807 ,
"en-GB", 0x0809 ,
"es-MX", 0x080a ,
"fr-BE", 0x080c ,
"it-CH", 0x0810 ,
"nl-BE", 0x0813 ,
"nn-NO", 0x0814 ,
"pt-PT", 0x0816 ,
"ro-MO", 0x0818 ,
"ru-MO", 0x0819 ,
"sr-Latn-CS", 0x081a ,
"sv-FI", 0x081d ,
"ur-IN", 0x0820 ,
"az-Cyrl-AZ", 0x082c ,
"dsb-DE", 0x082e ,
"se-SE", 0x083b ,
"ga-IE", 0x083c ,
"ms-BN", 0x083e ,
"uz-Cyrl-UZ", 0x0843 ,
"bn-BD", 0x0845 ,
"pa-PK", 0x0846 ,
"mn-Mong-CN", 0x0850 ,
"bo-BT", 0x0851 ,
"sd-PK", 0x0859 ,
"iu-Latn-CA", 0x085d ,
"tzm-Latn-DZ", 0x085f ,
"ne-IN", 0x0861 ,
"quz-EC", 0x086b ,
"ti-ET", 0x0873 ,
"ar-EG", 0x0c01 ,
"zh-HK", 0x0c04 ,
"de-AT", 0x0c07 ,
"en-AU", 0x0c09 ,
"es-ES", 0x0c0a ,
"fr-CA", 0x0c0c ,
"sr-Cyrl-CS", 0x0c1a ,
"se-FI", 0x0c3b ,
"tmz-MA", 0x0c5f ,
"quz-PE", 0x0c6b ,
"ar-LY", 0x1001 ,
"zh-SG", 0x1004 ,
"de-LU", 0x1007 ,
"en-CA", 0x1009 ,
"es-GT", 0x100a ,
"fr-CH", 0x100c ,
"hr-BA", 0x101a ,
"smj-NO", 0x103b ,
"ar-DZ", 0x1401 ,
"zh-MO", 0x1404 ,
"de-LI", 0x1407 ,
"en-NZ", 0x1409 ,
"es-CR", 0x140a ,
"fr-LU", 0x140c ,
"bs-Latn-BA", 0x141a ,
"smj-SE", 0x143b ,
"ar-MA", 0x1801 ,
"en-IE", 0x1809 ,
"es-PA", 0x180a ,
"fr-MC", 0x180c ,
"sr-Latn-BA", 0x181a ,
"sma-NO", 0x183b ,
"ar-TN", 0x1c01 ,
"en-ZA", 0x1c09 ,
"es-DO", 0x1c0a ,
"fr-West", 0x1c0c ,
"sr-Cyrl-BA", 0x1c1a ,
"sma-SE", 0x1c3b ,
"ar-OM", 0x2001 ,
"en-JM", 0x2009 ,
"es-VE", 0x200a ,
"fr-RE", 0x200c ,
"bs-Cyrl-BA", 0x201a ,
"sms-FI", 0x203b ,
"ar-YE", 0x2401 ,
"en-CB", 0x2409 ,
"es-CO", 0x240a ,
"fr-CG", 0x240c ,
"sr-Latn-RS", 0x241a ,
"smn-FI", 0x243b ,
"ar-SY", 0x2801 ,
"en-BZ", 0x2809 ,
"es-PE", 0x280a ,
"fr-SN", 0x280c ,
"sr-Cyrl-RS", 0x281a ,
"ar-JO", 0x2c01 ,
"en-TT", 0x2c09 ,
"es-AR", 0x2c0a ,
"fr-CM", 0x2c0c ,
"sr-Latn-ME", 0x2c1a ,
"ar-LB", 0x3001 ,
"en-ZW", 0x3009 ,
"es-EC", 0x300a ,
"fr-CI", 0x300c ,
"sr-Cyrl-ME", 0x301a ,
"ar-KW", 0x3401 ,
"en-PH", 0x3409 ,
"es-CL", 0x340a ,
"fr-ML", 0x340c ,
"ar-AE", 0x3801 ,
"en-ID", 0x3809 ,
"es-UY", 0x380a ,
"fr-MA", 0x380c ,
"ar-BH", 0x3c01 ,
"en-HK", 0x3c09 ,
"es-PY", 0x3c0a ,
"fr-HT", 0x3c0c ,
"ar-QA", 0x4001 ,
"en-IN", 0x4009 ,
"es-BO", 0x400a ,
"en-MY", 0x4409 ,
"es-SV", 0x440a ,
"en-SG", 0x4809 ,
"es-HN", 0x480a ,
"es-NI", 0x4c0a ,
"es-PR", 0x500a ,
"es-US", 0x540a ,
"bs-Cyrl", 0x641a ,
"bs-Latn", 0x681a ,
"sr-Cyrl", 0x6c1a ,
"sr-Latn", 0x701a ,
"smn", 0x703b ,
"az-Cyrl", 0x742c ,
"sms", 0x743b ,
"zh", 0x7804 ,
"nn", 0x7814 ,
"bs", 0x781a ,
"az-Latn", 0x782c ,
"sma", 0x783b ,
"uz-Cyrl", 0x7843 ,
"mn-Cyrl", 0x7850 ,
"iu-Cans", 0x785d ,
"zh-Hant", 0x7c04 ,
"nb", 0x7c14 ,
"sr", 0x7c1a ,
"tg-Cyrl", 0x7c28 ,
"dsb", 0x7c2e ,
"smj", 0x7c3b ,
"uz-Latn", 0x7c43 ,
"mn-Mong", 0x7c50 ,
"iu-Latn", 0x7c5d ,
"tzm-Latn", 0x7c5f ,
"ha-Latn", 0x7c68 ];
var g_oLcidNameToIdMap = new Object();
var g_oLcidIdToNameMap = new Object();
(function(document){
for(var i = 0, length = g_aLcidNameIdArray.length; i + 1< length; i+=2)
{
var name = g_aLcidNameIdArray[i];
var id = g_aLcidNameIdArray[i + 1];
g_oLcidNameToIdMap[name] = id;
g_oLcidIdToNameMap[id] = name;
}
function CDetectFontUse()
{
this.DetectData = null;
......
var c_oSerFormat = {
Version:3, //1.0.0.2
Version:4, //1.0.0.2
Signature: "DOCY"
};
var g_nCurFileVersion = c_oSerFormat.Version;
//dif:
//Version:2 добавлены свойства стилей qFormat, uiPriority, hidden, semiHidden, unhideWhenUsed, для более ранних бинарников считаем qFormat = true
//Version:3 все рисованные обьекты открываются через презентации
//Version:4 добавилось свойство CTablePr.TableLayout(проблема в том что если оно отсутствует, то это tbllayout_AutoFit, а у нас в любом случае считалось tbllayout_Fixed)
var c_oSerTableTypes = {
Signature:0,
Info:1,
......@@ -118,7 +119,8 @@ var c_oSerProp_tblPrType = {
tblpPr:8,
Look: 9,
Style: 10,
tblpPr2: 11
tblpPr2: 11,
Layout: 12
};
var c_oSer_tblpPrType = {
Page:0,
......@@ -190,7 +192,10 @@ var c_oSerProp_rPrType = {
ItalicCs: 21,
FontSizeCs: 22,
Cs: 23,
Rtl: 24
Rtl: 24,
Lang: 25,
LangBidi: 26,
LangEA: 27
};
var c_oSerProp_rowPrType = {
CantSplit:0,
......@@ -387,7 +392,8 @@ var c_oSerBordersType = {
};
var c_oSerWidthType = {
Type:0,
W:1
W:1,
WDocx: 2
};
var c_oSer_pgSzType = {
W:0,
......@@ -477,6 +483,10 @@ var EHint = {
hintDefault: 1,
hintEastAsia: 2
};
var ETblLayoutType = {
tbllayouttypeAutofit: 1,
tbllayouttypeFixed: 2
};
var g_nodeAttributeStart = 0xFA;
var g_nodeAttributeEnd = 0xFB;
......@@ -1174,6 +1184,28 @@ function Binary_rPrWriter(memory)
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(rPr.RTL);
}
//Lang
if(null != rPr.Lang)
{
if(null != rPr.Lang.Val)
{
this.memory.WriteByte(c_oSerProp_rPrType.Lang);
this.memory.WriteByte(c_oSerPropLenType.Variable);
this.memory.WriteString2(g_oLcidIdToNameMap[rPr.Lang.Val]);
}
if(null != rPr.Lang.Bidi)
{
this.memory.WriteByte(c_oSerProp_rPrType.LangBidi);
this.memory.WriteByte(c_oSerPropLenType.Variable);
this.memory.WriteString2(g_oLcidIdToNameMap[rPr.Lang.Bidi]);
}
if(null != rPr.Lang.EastAsia)
{
this.memory.WriteByte(c_oSerProp_rPrType.LangEA);
this.memory.WriteByte(c_oSerPropLenType.Variable);
this.memory.WriteString2(g_oLcidIdToNameMap[rPr.Lang.EastAsia]);
}
}
};
};
function Binary_tblPrWriter(memory, oNumIdMap)
......@@ -1239,7 +1271,7 @@ Binary_tblPrWriter.prototype =
this.bs.WriteItem(c_oSerProp_tblPrType.TableInd, function(){oThis.memory.WriteDouble(tblPr.TableInd);});
}
//TableW
if(null != tblPr.TableW && tblwidth_Auto != tblPr.TableW.Type)
if(null != tblPr.TableW)
{
this.bs.WriteItem(c_oSerProp_tblPrType.TableW, function(){oThis.WriteW(tblPr.TableW);});
}
......@@ -1258,6 +1290,16 @@ Binary_tblPrWriter.prototype =
{
this.bs.WriteItem(c_oSerProp_tblPrType.Shd, function(){oThis.bs.WriteShd(tblPr.Shd);});
}
if(null != tblPr.TableLayout)
{
var nLayout = ETblLayoutType.tbllayouttypeAutofit;
switch(tblPr.TableLayout)
{
case tbllayout_AutoFit: nLayout = ETblLayoutType.tbllayouttypeAutofit;break;
case tbllayout_Fixed: nLayout = ETblLayoutType.tbllayouttypeFixed;break;
}
this.bs.WriteItem(c_oSerProp_tblPrType.Layout, function(){oThis.memory.WriteByte(nLayout);});
}
//tblpPr
if(null != table && false == table.Inline)
{
......@@ -1268,22 +1310,22 @@ Binary_tblPrWriter.prototype =
{
var oThis = this;
//Left
if(null != cellMar.Left && tblwidth_Auto != cellMar.Left.Type)
if(null != cellMar.Left)
{
this.bs.WriteItem(c_oSerMarginsType.left, function(){oThis.WriteW(cellMar.Left);});
}
//Top
if(null != cellMar.Top && tblwidth_Auto != cellMar.Top.Type)
if(null != cellMar.Top)
{
this.bs.WriteItem(c_oSerMarginsType.top, function(){oThis.WriteW(cellMar.Top);});
}
//Right
if(null != cellMar.Right && tblwidth_Auto != cellMar.Right.Type)
if(null != cellMar.Right)
{
this.bs.WriteItem(c_oSerMarginsType.right, function(){oThis.WriteW(cellMar.Right);});
}
//Bottom
if(null != cellMar.Bottom && tblwidth_Auto != cellMar.Bottom.Type)
if(null != cellMar.Bottom)
{
this.bs.WriteItem(c_oSerMarginsType.bottom, function(){oThis.WriteW(cellMar.Bottom);});
}
......@@ -1353,14 +1395,14 @@ Binary_tblPrWriter.prototype =
this.memory.WriteBool(rowPr.CantSplit);
}
//After
if(null != rowPr.GridAfter || (null != rowPr.WAfter && tblwidth_Auto != rowPr.WAfter.Type))
if(null != rowPr.GridAfter || null != rowPr.WAfter)
{
this.memory.WriteByte(c_oSerProp_rowPrType.After);
this.memory.WriteByte(c_oSerPropLenType.Variable);
this.bs.WriteItemWithLength(function(){oThis.WriteAfter(rowPr);});
}
//Before
if(null != rowPr.GridBefore || (null != rowPr.WBefore && tblwidth_Auto != rowPr.WBefore.Type))
if(null != rowPr.GridBefore || null != rowPr.WBefore)
{
this.memory.WriteByte(c_oSerProp_rowPrType.Before);
this.memory.WriteByte(c_oSerPropLenType.Variable);
......@@ -1406,7 +1448,7 @@ Binary_tblPrWriter.prototype =
this.memory.WriteLong(After.GridAfter);
}
//WAfter
if(null != After.WAfter && tblwidth_Auto != After.WAfter.Type)
if(null != After.WAfter)
{
this.memory.WriteByte(c_oSerProp_rowPrType.WAfter);
this.memory.WriteByte(c_oSerPropLenType.Variable);
......@@ -1424,7 +1466,7 @@ Binary_tblPrWriter.prototype =
this.memory.WriteLong(Before.GridBefore);
}
//WBefore
if(null != Before.WBefore && tblwidth_Auto != Before.WBefore.Type)
if(null != Before.WBefore)
{
this.memory.WriteByte(c_oSerProp_rowPrType.WBefore);
this.memory.WriteByte(c_oSerPropLenType.Variable);
......@@ -1460,9 +1502,12 @@ Binary_tblPrWriter.prototype =
//W
if(null != WAfter.W)
{
this.memory.WriteByte(c_oSerWidthType.W);
this.memory.WriteByte(c_oSerPropLenType.Double);
this.memory.WriteDouble(WAfter.W);
var nVal = WAfter.W;
if(tblwidth_Mm == WAfter.Type)
nVal = Math.round(g_dKoef_mm_to_twips * WAfter.W);
this.memory.WriteByte(c_oSerWidthType.WDocx);
this.memory.WriteByte(c_oSerPropLenType.Long);
this.memory.WriteLong(nVal);
}
},
WriteCellPr: function(cellPr, vMerge)
......@@ -1497,7 +1542,7 @@ Binary_tblPrWriter.prototype =
this.bs.WriteItemWithLength(function(){oThis.WriteCellMar(cellPr.TableCellMar);});
}
//TableCellW
if(null != cellPr.TableCellW && tblwidth_Auto != cellPr.TableCellW.Type)
if(null != cellPr.TableCellW)
{
this.memory.WriteByte(c_oSerProp_cellPrType.TableCellW);
this.memory.WriteByte(c_oSerPropLenType.Variable);
......@@ -3762,6 +3807,30 @@ function Binary_rPrReader(doc, stream)
break;
case c_oSerProp_rPrType.Rtl:
rPr.RTL = this.stream.GetBool();
break;
case c_oSerProp_rPrType.Lang:
if(null == rPr.Lang)
rPr.Lang = new CLang();
var sLang = this.stream.GetString2LE(length);
var nLcid = g_oLcidNameToIdMap[sLang];
if(null != nLcid)
rPr.Lang.Val = nLcid;
break;
case c_oSerProp_rPrType.LangBidi:
if(null == rPr.Lang)
rPr.Lang = new CLang();
var sLang = this.stream.GetString2LE(length);
var nLcid = g_oLcidNameToIdMap[sLang];
if(null != nLcid)
rPr.Lang.Bidi = nLcid;
break;
case c_oSerProp_rPrType.LangEA:
if(null == rPr.Lang)
rPr.Lang = new CLang();
var sLang = this.stream.GetString2LE(length);
var nLcid = g_oLcidNameToIdMap[sLang];
if(null != nLcid)
rPr.Lang.EastAsia = nLcid;
break;
default:
res = c_oSerConstants.ReadUnknown;
......@@ -3793,11 +3862,13 @@ Binary_tblPrReader.prototype =
}
else if( c_oSerProp_tblPrType.TableW === type )
{
if(null == Pr.TableW)
Pr.TableW = new CTableMeasurement(tblwidth_Auto, 0);
var oW = {Type: null, W: null, WDocx: null};
res = this.bcr.Read2(length, function(t, l){
return oThis.ReadW(t, l, Pr.TableW);
return oThis.ReadW(t, l, oW);
});
if(null == Pr.TableW)
Pr.TableW = new CTableMeasurement(tblwidth_Auto, 0);
this.ParseW(oW, Pr.TableW);
}
else if( c_oSerProp_tblPrType.TableCellMar === type )
{
......@@ -3830,6 +3901,15 @@ Binary_tblPrReader.prototype =
res = this.bcr.Read2(length, function(t, l){
return oThis.bcr.ReadShd(t, l, Pr.Shd);
});
}
else if( c_oSerProp_tblPrType.Layout === type )
{
var nLayout = this.stream.GetUChar();
switch(nLayout)
{
case ETblLayoutType.tbllayouttypeAutofit: Pr.TableLayout = tbllayout_AutoFit;break;
case ETblLayoutType.tbllayouttypeFixed: Pr.TableLayout = tbllayout_Fixed;break;
}
}
else if(null != table)
{
......@@ -3909,46 +3989,72 @@ Binary_tblPrReader.prototype =
else if( c_oSerWidthType.W === type )
{
Width.W = this.bcr.ReadDouble();
}
else if( c_oSerWidthType.WDocx === type )
{
Width.WDocx = this.stream.GetULongLE();
}
else
res = c_oSerConstants.ReadUnknown;
return res;
},
ParseW: function(input, output)
{
if(input.Type)
output.Type = input.Type;
if(input.W)
output.W = input.W;
if(input.WDocx)
{
if(tblwidth_Mm == input.Type)
output.W = g_dKoef_twips_to_mm * input.WDocx;
else
output.W = input.WDocx;
}
},
ReadCellMargins: function(type, length, Margins)
{
var res = c_oSerConstants.ReadOk;
var oThis = this;
if( c_oSerMarginsType.left === type )
{
if(null == Margins.Left)
Margins.Left = new CTableMeasurement(tblwidth_Auto, 0);
var oW = {Type: null, W: null, WDocx: null};
res = this.bcr.Read2(length, function(t, l){
return oThis.ReadW(t, l, Margins.Left);
return oThis.ReadW(t, l, oW);
});
if(null == Margins.Left)
Margins.Left = new CTableMeasurement(tblwidth_Auto, 0);
this.ParseW(oW, Margins.Left);
}
else if( c_oSerMarginsType.top === type )
{
if(null == Margins.Top)
Margins.Top = new CTableMeasurement(tblwidth_Auto, 0);
var oW = {Type: null, W: null, WDocx: null};
res = this.bcr.Read2(length, function(t, l){
return oThis.ReadW(t, l, Margins.Top);
return oThis.ReadW(t, l, oW);
});
if(null == Margins.Top)
Margins.Top = new CTableMeasurement(tblwidth_Auto, 0);
this.ParseW(oW, Margins.Top);
}
else if( c_oSerMarginsType.right === type )
{
if(null == Margins.Right)
Margins.Right = new CTableMeasurement(tblwidth_Auto, 0);
var oW = {Type: null, W: null, WDocx: null};
res = this.bcr.Read2(length, function(t, l){
return oThis.ReadW(t, l, Margins.Right);
return oThis.ReadW(t, l, oW);
});
if(null == Margins.Right)
Margins.Right = new CTableMeasurement(tblwidth_Auto, 0);
this.ParseW(oW, Margins.Right);
}
else if( c_oSerMarginsType.bottom === type )
{
if(null == Margins.Bottom)
Margins.Bottom = new CTableMeasurement(tblwidth_Auto, 0);
var oW = {Type: null, W: null, WDocx: null};
res = this.bcr.Read2(length, function(t, l){
return oThis.ReadW(t, l, Margins.Bottom);
return oThis.ReadW(t, l, oW);
});
if(null == Margins.Bottom)
Margins.Bottom = new CTableMeasurement(tblwidth_Auto, 0);
this.ParseW(oW, Margins.Bottom);
}
else
res = c_oSerConstants.ReadUnknown;
......@@ -4068,11 +4174,13 @@ Binary_tblPrReader.prototype =
}
else if( c_oSerProp_rowPrType.WAfter === type )
{
if(null == After.WAfter)
After.WAfter = new CTableMeasurement(tblwidth_Auto, 0);
var oW = {Type: null, W: null, WDocx: null};
res = this.bcr.Read2(length, function(t, l){
return oThis.ReadW(t, l, After.WAfter);
return oThis.ReadW(t, l, oW);
});
if(null == After.WAfter)
After.WAfter = new CTableMeasurement(tblwidth_Auto, 0);
this.ParseW(oW, After.WAfter);
}
else
res = c_oSerConstants.ReadUnknown;
......@@ -4088,11 +4196,13 @@ Binary_tblPrReader.prototype =
}
else if( c_oSerProp_rowPrType.WBefore === type )
{
if(null == Before.WBefore)
Before.WBefore = new CTableMeasurement(tblwidth_Auto, 0);
var oW = {Type: null, W: null, WDocx: null};
res = this.bcr.Read2(length, function(t, l){
return oThis.ReadW(t, l, Before.WBefore);
return oThis.ReadW(t, l, oW);
});
if(null == Before.WBefore)
Before.WBefore = new CTableMeasurement(tblwidth_Auto, 0);
this.ParseW(oW, Before.WBefore);
}
else
res = c_oSerConstants.ReadUnknown;
......@@ -4145,19 +4255,23 @@ Binary_tblPrReader.prototype =
}
else if( c_oSerProp_cellPrType.CellMar === type )
{
if(null == Pr.TableCellMar)
Pr.TableCellMar = this.GetNewMargin();
res = this.bcr.Read1(length, function(t, l){
return oThis.ReadCellMargins(t, l, Pr.TableCellMar);
var oW = {Type: null, W: null, WDocx: null};
res = this.bcr.Read2(length, function(t, l){
return oThis.ReadW(t, l, oW);
});
if(null == Pr.TableCellMar)
Pr.TableCellMar = new CTableMeasurement(tblwidth_Auto, 0);
this.ParseW(oW, Pr.TableCellMar);
}
else if( c_oSerProp_cellPrType.TableCellW === type )
{
if(null == Pr.TableCellW)
Pr.TableCellW = new CTableMeasurement(tblwidth_Auto, 0);
var oW = {Type: null, W: null, WDocx: null};
res = this.bcr.Read2(length, function(t, l){
return oThis.ReadW(t, l, Pr.TableCellW);
return oThis.ReadW(t, l, oW);
});
if(null == Pr.TableCellW)
Pr.TableCellW = new CTableMeasurement(tblwidth_Auto, 0);
this.ParseW(oW, Pr.TableCellW);
}
else if( c_oSerProp_cellPrType.VAlign === type )
{
......
......@@ -31,7 +31,9 @@ var smallcaps_Koef = 0.8; // Коэффициент изменения разм
var g_dKoef_pt_to_mm = 25.4 / 72;
var g_dKoef_pc_to_mm = g_dKoef_pt_to_mm / 12;
var g_dKoef_in_to_mm = 25.4;
var g_dKoef_twips_to_mm = g_dKoef_pt_to_mm / 20;
var g_dKoef_mm_to_pt = 1 / g_dKoef_pt_to_mm;
var g_dKoef_mm_to_twips = 1 / g_dKoef_twips_to_mm;
var tblwidth_Auto = 0x00;
var tblwidth_Mm = 0x01;
......
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