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