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

правка бага 18115 - Поддержка флага "подгонять размер текста по размеру автофигуры"

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@50769 954022d7-b5bf-4e40-9824-e11837661b57
parent 221a88ac
......@@ -5816,9 +5816,13 @@ CPresentation.prototype =
{
if(layout.cSld.spTree[i].isPlaceholder())
{
var sp = new CShape(new_slide);
layout.cSld.spTree[i].copy2(sp);
new_slide.addToSpTreeToPos(new_slide.cSld.spTree.length, sp);
var _ph_type = layout.cSld.spTree[i].getPhType();
if(_ph_type != phType_dt && _ph_type != phType_ftr && _ph_type != phType_hdr && _ph_type != phType_sldNum)
{
var sp = new CShape(new_slide);
layout.cSld.spTree[i].copy2(sp);
new_slide.addToSpTreeToPos(new_slide.cSld.spTree.length, sp);
}
}
}
new_slide.setSlideNum(this.CurPage + 1);
......@@ -5961,12 +5965,17 @@ CPresentation.prototype =
{
if(layout.cSld.spTree[j].isPlaceholder())
{
var matching_shape = slide.getMatchingShape(layout.cSld.spTree[j].getPlaceholderType(), layout.cSld.spTree[j].getPlaceholderIndex());
if(matching_shape == null && layout.cSld.spTree[j].copy2)
var _ph_type = layout.cSld.spTree[j].getPhType();
if(_ph_type != phType_dt && _ph_type != phType_ftr && _ph_type != phType_hdr && _ph_type != phType_sldNum)
{
var sp = new CShape(slide);
layout.cSld.spTree[j].copy2(sp);
slide.addToSpTreeToPos(slide.cSld.spTree.length, sp)
var matching_shape = slide.getMatchingShape(layout.cSld.spTree[j].getPlaceholderType(), layout.cSld.spTree[j].getPlaceholderIndex());
if(matching_shape == null && layout.cSld.spTree[j].copy2)
{
var sp = new CShape(slide);
layout.cSld.spTree[j].copy2(sp);
slide.addToSpTreeToPos(slide.cSld.spTree.length, sp)
}
}
}
}
......
......@@ -223,6 +223,9 @@ CTextBody.prototype =
calculateContent: function()
{
var parent_object = this.shape.getParentObjects();
for(var i = 0; i < this.textPropsForRecalc.length; ++i)
{
......@@ -252,7 +255,102 @@ CTextBody.prototype =
this.content.RecalculateNumbering();
this.bRecalculateNumbering = false;
}
this.content.Set_StartPage(/*isRealNumber(this.shape.parent.num) ? this.shape.parent.num : */0);
if(this.bodyPr.textFit !== null && typeof this.bodyPr.textFit === "object")
{
if(this.bodyPr.textFit.type === text_fit_NormAuto)
{
var text_fit = this.bodyPr.textFit;
var font_scale, spacing_scale;
if(!isNaN(text_fit.fontScale) && typeof text_fit.fontScale === "number")
font_scale = text_fit.fontScale/100000;
if(!isNaN(text_fit.lnSpcReduction) && typeof text_fit.lnSpcReduction === "number")
spacing_scale = text_fit.lnSpcReduction/100000;
if(!isNaN(font_scale) && typeof font_scale === "number"
|| !isNaN(spacing_scale) && typeof spacing_scale === "number")
{
var pars = this.content.Content;
for(var index = 0; index < pars.length; ++index)
{
var parg = pars[index];
if(!isNaN(spacing_scale) && typeof spacing_scale === "number")
{
var spacing = parg.Pr.Spacing;
var spacing2 = parg.Get_CompiledPr(false).ParaPr;
parg.Recalc_CompiledPr();
var spc = (spacing2.Line*spacing_scale);
if(!isNaN(spc) && typeof spc === "number")
spacing.Line = spc;
spc = (spacing2.Before*spacing_scale);
if(!isNaN(spc) && typeof spc === "number")
spacing.Before = spc;
spc = (spacing2.After*spacing_scale);
if(!isNaN(spc) && typeof spc === "number")
spacing.After = spc;
}
if(!isNaN(font_scale) && typeof font_scale === "number")
{
var par_font_size = parg.Get_CompiledPr(false).TextPr.FontSize;
parg.Recalc_CompiledPr();
for(var r = 0; r < parg.Content.length; ++r)
{
var item = parg.Content[r];
if(item.Type === para_TextPr)
{
var value = item.Value;
if(!isNaN(value.FontSize) && typeof value.FontSize === "number")
{
value.FontSize = (value.FontSize*font_scale) >> 0;
}
}
}
var result_par_text_pr_font_size = (par_font_size*font_scale) >> 0;
if(!isNaN(result_par_text_pr_font_size) && typeof result_par_text_pr_font_size === "number")
{
var b_insert_text_pr = false, pos = -1;
for(var p = 0; p < parg.Content.length; ++p)
{
if(parg.Content[p].Type === para_TextPr)
{
if(!(!isNaN(parg.Content[p].Value.FontSize) && typeof parg.Content[p].Value.FontSize === "number"))
parg.Content[p].Value.FontSize = result_par_text_pr_font_size;
break;
}
if(parg.Content[p].Type === para_Text)
{
b_insert_text_pr = true;
pos = p;
break;
}
}
if(b_insert_text_pr)
{
var history_is_on = History.Is_On();
if(history_is_on)
History.TurnOff();
parg.Internal_Content_Add(p, new ParaTextPr({FontSize: result_par_text_pr_font_size}));
if(history_is_on)
History.TurnOn();
}
}
}
}
}
}
this.bodyPr.textFit = null;
this.calculateContent();
return;
}
this.bodyPr.normAutofit = false;
var _l, _t, _r, _b;
var _body_pr = this.getBodyPr();
......@@ -330,6 +428,9 @@ CTextBody.prototype =
this.content.Recalculate_Page(0, true);
this.contentHeight = this.getSummaryHeight();
if(this.recalcInfo.recalculateContent2)
{
......@@ -431,6 +532,8 @@ CTextBody.prototype =
}
this.recalcInfo.recalculateContent2 = false;
}
},
copy: function(txBody)
......
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