Commit 7232c148 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin

Выставление размера шрифта и спейсинга при открытии для тех автофигур у...

Выставление размера шрифта и спейсинга при открытии для тех автофигур у которых выставлена опция автоподбора.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@60064 954022d7-b5bf-4e40-9824-e11837661b57
parent 4599246e
......@@ -429,6 +429,84 @@ CTextBody.prototype =
}, this, []);
},
checkTextFit: function()
{
if(this.parent && this.parent.parent && this.parent.parent instanceof Slide)
{
if(isRealObject(this.bodyPr.textFit))
{
if(this.bodyPr.textFit.type === text_fit_NormAuto)
{
var text_fit = this.bodyPr.textFit;
var font_scale, spacing_scale;
if(isRealNumber(text_fit.fontScale))
font_scale = text_fit.fontScale/100000;
if(isRealNumber(text_fit.lnSpcReduction))
spacing_scale = text_fit.lnSpcReduction/100000;
if(isRealNumber(font_scale)|| isRealNumber(spacing_scale))
{
var pars = this.content.Content;
for(var index = 0; index < pars.length; ++index)
{
var parg = pars[index];
if(isRealNumber(spacing_scale))
{
var spacing2 = parg.Get_CompiledPr(false).ParaPr.Spacing;
var new_spacing = {};
var spc = spacing2.Line*spacing_scale;
new_spacing.LineRule = spacing2.LineRule;
if(isRealNumber(spc))
{
if(spacing2.LineRule === linerule_Auto)
{
new_spacing.Line = spacing2.Line - spacing_scale;
}
else
{
new_spacing.Line = spc;
}
}
spc = spacing2.Before*spacing_scale;
if(isRealNumber(spc))
new_spacing.Before = spc;
spc = spacing2.After*spacing_scale;
if(isRealNumber(spc))
new_spacing.After = spc;
parg.Set_Spacing(new_spacing);
}
if(isRealNumber(font_scale))
{
var par_font_size = parg.Get_CompiledPr(false).TextPr.FontSize;
for(var r = 0; r < parg.Content.length; ++r)
{
var item = parg.Content[r];
if(isRealNumber(item.Pr.FontSize))
{
item.Set_FontSize(Math.round(item.Pr.FontSize*font_scale));
}
else
{
if(r === 0)
{
item.Set_FontSize(Math.round(par_font_size*font_scale));
}
}
}
}
}
}
}
}
}
this.bodyPr.textFit = null;
},
Refresh_RecalcData: function()
{
if(this.parent && this.parent.recalcInfo)
......
......@@ -220,6 +220,8 @@ function BinaryPPTYLoader()
this.IsUseFullSrc = false;
this.RebuildImages = [];
this.textBodyTextFit = [];
this.Start_UseFullUrl = function()
{
this.IsUseFullUrl = true;
......@@ -235,6 +237,15 @@ function BinaryPPTYLoader()
return _result;
};
this.Check_TextFit = function()
{
for(var i = 0; i < this.textBodyTextFit.length; ++i)
{
this.textBodyTextFit[i].checkTextFit();
}
this.textBodyTextFit.length = 0;
};
this.Load = function(base64_ppty, presentation)
{
this.presentation = presentation;
......@@ -6814,6 +6825,10 @@ function BinaryPPTYLoader()
case 0:
{
txbody.setBodyPr(this.ReadBodyPr());
if(txbody.bodyPr && txbody.bodyPr.textFit)
{
this.textBodyTextFit.push(txbody);
}
break;
}
case 1:
......
......@@ -991,6 +991,8 @@ asc_docs_api.prototype.OpenDocument2 = function(url, gObject)
_loader.Api = this;
g_oIdCounter.Set_Load(true);
_loader.Load(gObject, this.WordControl.m_oLogicDocument);
_loader.Check_TextFit();
this.LoadedObject = 1;
g_oIdCounter.Set_Load(false);
......@@ -5199,10 +5201,12 @@ window["asc_docs_api"].prototype["asc_nativeOpenFile"] = function(base64File, ve
if (version === undefined)
{
_loader.Load(base64File, this.WordControl.m_oLogicDocument);
_loader.Check_TextFit();
}
else
{
_loader.Load2(base64File, this.WordControl.m_oLogicDocument);
_loader.Check_TextFit();
}
this.LoadedObject = 1;
......
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