Commit 35ffac09 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander.Trofimov

запись шейпов с контентом в run

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56334 954022d7-b5bf-4e40-9824-e11837661b57
parent bc2fa027
......@@ -1756,7 +1756,7 @@ function CBinaryFileWriter()
oThis.WriteUChar(g_nodeAttributeEnd);
oThis.WriteRecord1(1, rPr.unifill, oThis.WriteUniFill);
oThis.WriteRecord1(1, rPr.Unifill, oThis.WriteUniFill);
oThis.WriteRecord2(3, rPr.FontFamily, oThis.WriteTextFontTypeface);
if (hlinkObj != null && hlinkObj !== undefined)
......@@ -2271,13 +2271,10 @@ function CBinaryFileWriter()
this.WriteParagraph = function(paragraph, startPos, endPos)
{
var tPr = new CTextParagraphPr();
if(paragraph.bullet)
{
tPr.bullet = paragraph.bullet;
}
tPr.lvl = paragraph.PresentationPr.Level;
tPr.bullet = paragraph.Pr.Bullet;
tPr.lvl = paragraph.Pr.Lvl;
tPr.pPr = paragraph.Pr;
tPr.rPr = null; // TODO: !!!
tPr.rPr = paragraph.Pr.DefaultRunPr;
if (tPr.rPr == null)
tPr.rPr = new CTextPr();
......@@ -2291,9 +2288,6 @@ function CBinaryFileWriter()
var _par_content = paragraph.Content;
var start_pos = startPos != null ? startPos : 0;
var end_pos = endPos != undefined ? endPos : _par_content.length;
if(paragraph.f_id != undefined || paragraph.f_type != undefined || paragraph.f_text!= undefined)
{
oThis.StartRecord(0); // subtype
......@@ -2302,114 +2296,146 @@ function CBinaryFileWriter()
_count++;
}
var _content_index;
var _cur_run_text = "";
_content_index = start_pos;
var _cur_run_text_pr = null;
var hlinkObj = null;
while(_content_index < end_pos)
var _content_len = _par_content.length;
for (var i = 0; i < _content_len; i++)
{
var _elem = _par_content[i];
switch (_elem.Type)
{
case para_Run:
{
var _run_len = _elem.Content.length;
var _run_text = "";
for (var j = 0; j < _run_len; j++)
{
switch (_par_content[_content_index].Type)
switch (_elem.Content[j].Type)
{
case para_Text:
{
_cur_run_text += _par_content[_content_index].Value;
_run_text += _elem.Content[j].Value;
break;
}
case para_Space :
{
_cur_run_text += ' ';
_run_text += ' ';
break;
}
case para_Tab :
{
_cur_run_text += '\t';
break;
}
case para_TextPr :
{
if(("" != _cur_run_text) || (null != _cur_run_text_pr))
{
oThis.StartRecord(0); // subtype
oThis.WriteTextRun((null == _cur_run_text_pr) ? null : _cur_run_text_pr.Value, _cur_run_text, hlinkObj);
oThis.EndRecord();
_count++;
_cur_run_text = "";
_cur_run_text_pr = null;
}
_cur_run_text_pr = _par_content[_content_index];
_run_text += '\t';
break;
}
case para_NewLine :
{
if(("" != _cur_run_text) || (null != _cur_run_text_pr))
if("" != _run_text)
{
oThis.StartRecord(0); // subtype
oThis.WriteTextRun((null == _cur_run_text_pr) ? null : _cur_run_text_pr.Value, _cur_run_text, hlinkObj);
oThis.WriteTextRun(_elem.Pr, _run_text, null);
oThis.EndRecord();
_count++;
_cur_run_text = "";
_cur_run_text_pr = null;
_run_text = "";
}
oThis.StartRecord(0); // subtype
oThis.WriteLineBreak(_cur_run_text_pr, hlinkObj);
oThis.WriteLineBreak(_elem.Pr, null);
oThis.EndRecord();
_count++;
break;
}
case para_HyperlinkStart:
{
if("" != _cur_run_text)
}
}
if ("" != _run_text)
{
oThis.StartRecord(0); // subtype
oThis.WriteTextRun((null == _cur_run_text_pr) ? null : _cur_run_text_pr.Value, _cur_run_text, hlinkObj);
oThis.WriteTextRun(_elem.Pr, _run_text, null);
oThis.EndRecord();
_count++;
}
break;
}
case para_Hyperlink:
{
var _hObj = { Value : _elem.Value };
var _content_len_h = _elem.Content.length;
_cur_run_text = "";
// runPr оставляем таким же
for (var hi = 0; hi < _content_len_h; hi++)
{
var _elem_h = _elem.Content[i];
switch (_elem.Type)
{
case para_Run:
{
var _run_len = _elem.Content.length;
var _run_text = "";
for (var j = 0; j < _run_len; j++)
{
switch (_elem.Content[j].Type)
{
case para_Text:
{
_run_text += _elem.Content[j].Value;
break;
}
hlinkObj = _par_content[_content_index];
case para_Space :
{
_run_text += ' ';
break;
}
case para_HyperlinkEnd:
case para_Tab :
{
if("" != _cur_run_text)
_run_text += '\t';
break;
}
case para_NewLine :
{
if("" != _run_text)
{
oThis.StartRecord(0); // subtype
oThis.WriteTextRun((null == _cur_run_text_pr) ? null : _cur_run_text_pr.Value, _cur_run_text, hlinkObj);
oThis.WriteTextRun(_elem.Pr, _run_text, _hObj);
oThis.EndRecord();
_count++;
_cur_run_text = "";
// runPr оставляем таким же
_run_text = "";
}
oThis.StartRecord(0); // subtype
oThis.WriteLineBreak(_elem.Pr, _hObj);
oThis.EndRecord();
_count++;
hlinkObj = null;
break;
}
}
_content_index++;
}
if(_cur_run_text.length > 0)
if ("" != _run_text)
{
oThis.StartRecord(0); // subtype
oThis.WriteTextRun((null == _cur_run_text_pr) ? null : _cur_run_text_pr.Value, _cur_run_text, hlinkObj);
oThis.WriteTextRun(_elem.Pr, _run_text, _hObj);
oThis.EndRecord();
_count++;
}
break;
}
default:
break;
}
}
break;
}
default:
break;
}
}
var _new_pos = oThis.pos;
oThis.pos = _position;
......
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