Commit 0a5a0ece authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

Изменены классы для открытия и сохранения, так чтобы их можно было использовать в copy/paste.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48743 954022d7-b5bf-4e40-9824-e11837661b57
parent 1a0f2d55
......@@ -30,13 +30,30 @@ function BinaryCommonWriter(memory)
this.memory.WriteByte(type);
this.WriteItemWithLength(fWrite);
};
this.WriteItemStart = function(type)
{
this.memory.WriteByte(type);
return this.WriteItemWithLengthStart(fWrite);
};
this.WriteItemEnd = function(nStart)
{
this.WriteItemWithLengthEnd(nStart);
};
this.WriteItemWithLength = function(fWrite)
{
var nStart = this.WriteItemWithLengthStart();
fWrite();
this.WriteItemWithLengthEnd(nStart);
};
this.WriteItemWithLengthStart = function()
{
//Запоминаем позицию чтобы в конце записать туда длину
var nStart = this.memory.GetCurPosition();
this.memory.Skip(4);
//pPr
fWrite();
return nStart;
};
this.WriteItemWithLengthEnd = function(nStart)
{
//Length
var nEnd = this.memory.GetCurPosition();
this.memory.Seek(nStart);
......
......@@ -299,6 +299,7 @@ function CopyProcessor(api, ElemToSelect)
{
this.api = api;
this.oDocument = api.WordControl.m_oLogicDocument;
this.oBinaryFileWriter = new BinaryFileWriter(this.oDocument);
this.fontsArray = api.FontLoader.fontInfos;
this.ElemToSelect = ElemToSelect;
this.Ul = document.createElement( "ul" );
......@@ -1438,16 +1439,25 @@ CopyProcessor.prototype =
elem.before = elem.gridStart - nMinGrid;
elem.after = nMaxGrid - elem.gridEnd;
}
this.oBinaryFileWriter.CopyTable(Item, oRowElems);
this.oBinaryFileWriter.copyParams.bLockCopyPar = true;
this.CopyTable(oDomTarget, Item, oRowElems);
this.oBinaryFileWriter.copyParams.bLockCopyPar = null;
}
}
}
else
{
this.oBinaryFileWriter.CopyTable(Item, null);
this.oBinaryFileWriter.copyParams.bLockCopyPar = true;
this.CopyTable(oDomTarget, Item, null);
this.oBinaryFileWriter.copyParams.bLockCopyPar = null;
}
}
else if ( type_Paragraph === Item.GetType() )
{
//todo ����� ������ ��� �������� ������ ���� Index == End
this.oBinaryFileWriter.CopyParagraph(Item, bUseSelection);
this.CopyParagraph(oDomTarget, Item, Index == End, bUseSelection, oDocument.Content, Index);
}
}
......@@ -1455,6 +1465,7 @@ CopyProcessor.prototype =
},
Start : function(node)
{
this.oBinaryFileWriter.CopyStart();
var oDocument = this.oDocument;
if(g_bIsDocumentCopyPaste)
{
......@@ -1598,6 +1609,12 @@ CopyProcessor.prototype =
}
}
}
this.oBinaryFileWriter.CopyEnd();
if(this.oBinaryFileWriter.copyParams.itemCount > 0)
{
var sBase64 = this.oBinaryFileWriter.GetResult();
//this.ElemToSelect.innerHTML = sBase64;
}
}
};
......@@ -2279,8 +2296,62 @@ PasteProcessor.prototype =
}
},
Start : function(node)
ReadFromBinary : function(sBase64)
{
var openParams = {checkFileSize: false, charCount: 0, parCount: 0};
var oBinaryFileReader = new BinaryFileReader(this.oDocument, openParams);
oBinaryFileReader.stream = oBinaryFileReader.getbase64DecodedData(sBase64);
oBinaryFileReader.ReadMainTable();
var oReadResult = oBinaryFileReader.oReadResult;
//обрабатываем списки
for(var i in oReadResult.numToNumClass)
{
var oNumClass = oReadResult.numToNumClass[i];
this.oDocument.Numbering.Add_AbstractNum(oNumClass);
}
for(var i = 0, length = oReadResult.paraNumPrs.length; i < length; ++i)
{
var numPr = oReadResult.paraNumPrs[i];
var oNumClass = oReadResult.numToNumClass[numPr.NumId];
if(null != oNumClass)
numPr.NumId = oNumClass.Get_Id();
else
numPr.NumId = 0;
}
//обрабатываем стили
for(var i = 0, length = oReadResult.paraStyles.length; i < length; ++i)
{
var elem = oReadResult.paraStyles[i];
var stylePaste = oReadResult.styles[elem.style];
if(null != stylePaste && null != stylePaste.style)
{
for(var j in this.oDocument.Styles.Style)
{
var styleDoc = this.oDocument.Styles.Style[j];
if(styleDoc.Name == stylePaste.style.Name)
elem.pPr.PStyle = j;
}
}
}
var aContent = oBinaryFileReader.oReadResult.DocumentContent;
if(aContent.length > 0)
{
//todo в зависимости от наличия символа конца параграфа
this.bInBlock = true;
}
return aContent
},
Start : function(node)
{
// this.aContent = this.ReadFromBinary(node.innerText);
// if(false == this.bNested)
// {
// this.InsertInDocument();
// node.blur();
// node.style.display = ELEMENT_DISPAY_STYLE;
// }
// return;
this.oRootNode = node;
var oThis = this;
this._Prepeare(node,
......
......@@ -1667,6 +1667,14 @@ CNumbering.prototype =
return Id;
},
Add_AbstractNum : function(AbstractNum)
{
var Id = AbstractNum.Get_Id();
this.AbstractNum[Id] = AbstractNum;
return Id;
},
Get_AbstractNum : function(Id)
{
......
This diff is collapsed.
......@@ -196,7 +196,7 @@ function CPPTXContentLoader()
oThis.stream.pos = s.pos;
oThis.stream.cur = s.cur;
var oBinary_DocumentTableReader = new Binary_DocumentTableReader(shape.textBoxContent, null, oThis.ImageMap, oThis.stream, false, oThis.m_oDocxNum, oThis.oComments);
var oBinary_DocumentTableReader = new Binary_DocumentTableReader(shape.textBoxContent, oThis.oReadResult, null, oThis.stream, false, oThis.oComments);
var nDocLength = oThis.stream.GetULongLE();
oThis.bcr.Read1(nDocLength, function(t,l){
return oBinary_DocumentTableReader.ReadDocumentContent(t,l, shape.textBoxContent.Content);
......
......@@ -1073,7 +1073,7 @@ asc_docs_api.prototype.OpenDocument2 = function(url, gObject)
//this.asyncServerIdStartLoaded();
this.FontLoader.LoadEmbeddedFonts(this.DocumentUrl, this.WordControl.m_oLogicDocument.EmbeddedFonts);
//this.FontLoader.LoadEmbeddedFonts(this.DocumentUrl, this.WordControl.m_oLogicDocument.EmbeddedFonts);
this.FontLoader.LoadDocumentFonts(this.WordControl.m_oLogicDocument.Fonts, false);
}
else
......
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