Commit 3e693f1b authored by Sergey Luzyanin's avatar Sergey Luzyanin

fix bug 34558

parent 5766898f
...@@ -1063,6 +1063,10 @@ CDLbl.prototype = ...@@ -1063,6 +1063,10 @@ CDLbl.prototype =
return AscDFH.historyitem_type_DLbl; return AscDFH.historyitem_type_DLbl;
}, },
Check_AutoFit: function(){
return true;
},
createDuplicate: function() createDuplicate: function()
{ {
...@@ -12310,6 +12314,11 @@ CTitle.prototype = ...@@ -12310,6 +12314,11 @@ CTitle.prototype =
} }
return false; return false;
}, },
Check_AutoFit: function(){
return true;
},
getBodyPr: CDLbl.prototype.getBodyPr, getBodyPr: CDLbl.prototype.getBodyPr,
getCompiledStyle: CDLbl.prototype.getCompiledStyle, getCompiledStyle: CDLbl.prototype.getCompiledStyle,
......
...@@ -5113,157 +5113,159 @@ CShape.prototype.chekBodyPrTransform = function(oBodyPr) ...@@ -5113,157 +5113,159 @@ CShape.prototype.chekBodyPrTransform = function(oBodyPr)
CShape.prototype.checkTextWarp = function(oContent, oBodyPr, dWidth, dHeight, bNeedNoTransform, bNeedWarp) CShape.prototype.checkTextWarp = function(oContent, oBodyPr, dWidth, dHeight, bNeedNoTransform, bNeedWarp)
{ {
var oRet = {oTxWarpStruct: null, oTxWarpStructParamarks: null, oTxWarpStructNoTransform: null, oTxWarpStructParamarksNoTransform: null}; return AscFormat.ExecuteNoHistory(function(){
//return oRet; var oRet = {oTxWarpStruct: null, oTxWarpStructParamarks: null, oTxWarpStructNoTransform: null, oTxWarpStructParamarksNoTransform: null};
var bTransform = this.chekBodyPrTransform(oBodyPr) && bNeedWarp; //return oRet;
var warpGeometry = oBodyPr.prstTxWarp; var bTransform = this.chekBodyPrTransform(oBodyPr) && bNeedWarp;
warpGeometry && warpGeometry.Recalculate(dWidth, dHeight); var warpGeometry = oBodyPr.prstTxWarp;
this.recalcInfo.warpGeometry = warpGeometry; warpGeometry && warpGeometry.Recalculate(dWidth, dHeight);
var bCheckWordArtContent = this.checkContentWordArt(oContent); this.recalcInfo.warpGeometry = warpGeometry;
var bColumns = oContent.Get_ColumnsCount() > 1; var bCheckWordArtContent = this.checkContentWordArt(oContent);
var bContentRecalculated = false; var bColumns = oContent.Get_ColumnsCount() > 1;
if(bTransform || bCheckWordArtContent) var bContentRecalculated = false;
{ if(bTransform || bCheckWordArtContent)
var bNeedRecalc = this.checkNeedRecalcDocContentForTxWarp(oBodyPr), dOneLineWidth, dMinPolygonLength = 0, dKoeff = 1;
var oTheme = this.Get_Theme(), oColorMap = this.Get_ColorMap();
var oTextDrawer = new AscFormat.CTextDrawer(dWidth, dHeight, true, oTheme, bNeedRecalc);
oTextDrawer.bCheckLines = bTransform && bNeedWarp;
var oContentToDraw = oContent;
if(bNeedRecalc && bNeedWarp)
{ {
oContentToDraw = oContent.Copy(oContent.Parent, oContent.DrawingDocument); var bNeedRecalc = this.checkNeedRecalcDocContentForTxWarp(oBodyPr), dOneLineWidth, dMinPolygonLength = 0, dKoeff = 1;
var bNeedTurnOn = false; var oTheme = this.Get_Theme(), oColorMap = this.Get_ColorMap();
if(this.bWordShape && editor && editor.WordControl.m_oLogicDocument) var oTextDrawer = new AscFormat.CTextDrawer(dWidth, dHeight, true, oTheme, bNeedRecalc);
oTextDrawer.bCheckLines = bTransform && bNeedWarp;
var oContentToDraw = oContent;
if(bNeedRecalc && bNeedWarp)
{ {
if(!editor.WordControl.m_oLogicDocument.TurnOffRecalc) oContentToDraw = oContent.Copy(oContent.Parent, oContent.DrawingDocument);
var bNeedTurnOn = false;
if(this.bWordShape && editor && editor.WordControl.m_oLogicDocument)
{
if(!editor.WordControl.m_oLogicDocument.TurnOffRecalc)
{
bNeedTurnOn = true;
editor.WordControl.m_oLogicDocument.TurnOff_Recalculate();
}
}
oContentToDraw.Set_ApplyToAll(true);
oContentToDraw.Set_ParagraphSpacing({Before: 0, After: 0});
oContentToDraw.Set_ApplyToAll(false);
if(bNeedTurnOn)
{
editor.WordControl.m_oLogicDocument.TurnOn_Recalculate(false);
}
dMinPolygonLength = warpGeometry.getMinPathPolygonLength();
dOneLineWidth = AscFormat.GetRectContentWidth(oContentToDraw);
if(dOneLineWidth > dMinPolygonLength)
{
dKoeff = dMinPolygonLength/dOneLineWidth;
oContentToDraw.Reset(0, 0, dOneLineWidth, 20000);
}
else
{ {
bNeedTurnOn = true; oContentToDraw.Reset(0, 0, dMinPolygonLength, 20000);
editor.WordControl.m_oLogicDocument.TurnOff_Recalculate();
} }
oContentToDraw.Recalculate_Page(0, true);
} }
oContentToDraw.Set_ApplyToAll(true); else if(bTransform && bColumns){
oContentToDraw.Set_ParagraphSpacing({Before: 0, After: 0}); oContentToDraw = oContent.Copy(oContent.Parent, oContent.DrawingDocument);
oContentToDraw.Set_ApplyToAll(false); oContentToDraw.Reset(0, 0, oContent.XLimit, 20000);
if(bNeedTurnOn) oContentToDraw.Recalculate_Page(0, true);
{
editor.WordControl.m_oLogicDocument.TurnOn_Recalculate(false);
} }
dMinPolygonLength = warpGeometry.getMinPathPolygonLength(); var dContentHeight = oContentToDraw.Get_SummaryHeight();
dOneLineWidth = AscFormat.GetRectContentWidth(oContentToDraw); var OldShowParaMarks, width_ = dWidth*dKoeff, height_ = dHeight*dKoeff;
if(dOneLineWidth > dMinPolygonLength) if(isRealObject(editor))
{ {
dKoeff = dMinPolygonLength/dOneLineWidth; OldShowParaMarks = editor.ShowParaMarks;
oContentToDraw.Reset(0, 0, dOneLineWidth, 20000); editor.ShowParaMarks = true;
} }
else if(bNeedWarp)
{ {
oContentToDraw.Reset(0, 0, dMinPolygonLength, 20000); oContentToDraw.Draw(oContentToDraw.StartPage, oTextDrawer);
} oRet.oTxWarpStructParamarks = oTextDrawer.m_oDocContentStructure;
oContentToDraw.Recalculate_Page(0, true); oRet.oTxWarpStructParamarks.Recalculate(oTheme, oColorMap, width_, height_, this);
} if(bTransform)
else if(bTransform && bColumns){
oContentToDraw = oContent.Copy(oContent.Parent, oContent.DrawingDocument);
oContentToDraw.Reset(0, 0, oContent.XLimit, 20000);
oContentToDraw.Recalculate_Page(0, true);
}
var dContentHeight = oContentToDraw.Get_SummaryHeight();
var OldShowParaMarks, width_ = dWidth*dKoeff, height_ = dHeight*dKoeff;
if(isRealObject(editor))
{
OldShowParaMarks = editor.ShowParaMarks;
editor.ShowParaMarks = true;
}
if(bNeedWarp)
{
oContentToDraw.Draw(oContentToDraw.StartPage, oTextDrawer);
oRet.oTxWarpStructParamarks = oTextDrawer.m_oDocContentStructure;
oRet.oTxWarpStructParamarks.Recalculate(oTheme, oColorMap, width_, height_, this);
if(bTransform)
{
oRet.oTxWarpStructParamarks.checkByWarpStruct(warpGeometry, dWidth, dHeight, oTheme, oColorMap, this, dOneLineWidth, oContentToDraw.XLimit, dContentHeight, dKoeff);
if(bNeedNoTransform && bCheckWordArtContent)
{ {
if(oRet.oTxWarpStructParamarks.m_aComments.length > 0) oRet.oTxWarpStructParamarks.checkByWarpStruct(warpGeometry, dWidth, dHeight, oTheme, oColorMap, this, dOneLineWidth, oContentToDraw.XLimit, dContentHeight, dKoeff);
if(bNeedNoTransform && bCheckWordArtContent)
{ {
oContent.Recalculate_Page(0, true); if(oRet.oTxWarpStructParamarks.m_aComments.length > 0)
bContentRecalculated = true; {
oContent.Recalculate_Page(0, true);
bContentRecalculated = true;
}
oContent.Draw(oContent.StartPage, oTextDrawer);
oRet.oTxWarpStructParamarksNoTransform = oTextDrawer.m_oDocContentStructure;
oRet.oTxWarpStructParamarksNoTransform.Recalculate(oTheme, oColorMap, dWidth, dHeight, this);
oRet.oTxWarpStructParamarksNoTransform.checkUnionPaths();
}
}
else
{
oRet.oTxWarpStructParamarks.checkUnionPaths();
if(bNeedNoTransform && bCheckWordArtContent)
{
oRet.oTxWarpStructParamarksNoTransform = oRet.oTxWarpStructParamarks;
} }
oContent.Draw(oContent.StartPage, oTextDrawer);
oRet.oTxWarpStructParamarksNoTransform = oTextDrawer.m_oDocContentStructure;
oRet.oTxWarpStructParamarksNoTransform.Recalculate(oTheme, oColorMap, dWidth, dHeight, this);
oRet.oTxWarpStructParamarksNoTransform.checkUnionPaths();
} }
} }
else else
{ {
oRet.oTxWarpStructParamarks.checkUnionPaths();
if(bNeedNoTransform && bCheckWordArtContent) if(bNeedNoTransform && bCheckWordArtContent)
{ {
oRet.oTxWarpStructParamarksNoTransform = oRet.oTxWarpStructParamarks; oContent.Draw(oContent.StartPage, oTextDrawer);
oRet.oTxWarpStructParamarksNoTransform = oTextDrawer.m_oDocContentStructure;
oRet.oTxWarpStructParamarksNoTransform.Recalculate(oTheme, oColorMap, dWidth, dHeight, this);
oRet.oTxWarpStructParamarksNoTransform.checkUnionPaths();
} }
} }
}
else if(isRealObject(editor))
{
if(bNeedNoTransform && bCheckWordArtContent)
{ {
oContent.Draw(oContent.StartPage, oTextDrawer); editor.ShowParaMarks = false;
oRet.oTxWarpStructParamarksNoTransform = oTextDrawer.m_oDocContentStructure;
oRet.oTxWarpStructParamarksNoTransform.Recalculate(oTheme, oColorMap, dWidth, dHeight, this);
oRet.oTxWarpStructParamarksNoTransform.checkUnionPaths();
} }
} if(bNeedWarp)
if(isRealObject(editor))
{
editor.ShowParaMarks = false;
}
if(bNeedWarp)
{
oContentToDraw.Draw(oContentToDraw.StartPage, oTextDrawer);
oRet.oTxWarpStruct = oTextDrawer.m_oDocContentStructure;
oRet.oTxWarpStruct.Recalculate(oTheme, oColorMap, width_, height_, this);
if(bTransform)
{ {
oRet.oTxWarpStruct.checkByWarpStruct(warpGeometry, dWidth, dHeight, oTheme, oColorMap, this, dOneLineWidth, oContentToDraw.XLimit, dContentHeight, dKoeff); oContentToDraw.Draw(oContentToDraw.StartPage, oTextDrawer);
if(bNeedNoTransform && bCheckWordArtContent) oRet.oTxWarpStruct = oTextDrawer.m_oDocContentStructure;
oRet.oTxWarpStruct.Recalculate(oTheme, oColorMap, width_, height_, this);
if(bTransform)
{ {
if(oRet.oTxWarpStruct.m_aComments.length > 0 && !bContentRecalculated) oRet.oTxWarpStruct.checkByWarpStruct(warpGeometry, dWidth, dHeight, oTheme, oColorMap, this, dOneLineWidth, oContentToDraw.XLimit, dContentHeight, dKoeff);
if(bNeedNoTransform && bCheckWordArtContent)
{ {
oContent.Recalculate_Page(0, true); if(oRet.oTxWarpStruct.m_aComments.length > 0 && !bContentRecalculated)
{
oContent.Recalculate_Page(0, true);
}
oContent.Draw(oContent.StartPage, oTextDrawer);
oRet.oTxWarpStructNoTransform = oTextDrawer.m_oDocContentStructure;
oRet.oTxWarpStructNoTransform.Recalculate(oTheme, oColorMap, dWidth, dHeight, this);
oRet.oTxWarpStructNoTransform.checkUnionPaths();
}
}
else
{
oRet.oTxWarpStruct.checkUnionPaths();
if(bNeedNoTransform && bCheckWordArtContent)
{
oRet.oTxWarpStructNoTransform = oRet.oTxWarpStruct;
} }
oContent.Draw(oContent.StartPage, oTextDrawer);
oRet.oTxWarpStructNoTransform = oTextDrawer.m_oDocContentStructure;
oRet.oTxWarpStructNoTransform.Recalculate(oTheme, oColorMap, dWidth, dHeight, this);
oRet.oTxWarpStructNoTransform.checkUnionPaths();
} }
} }
else else
{ {
oRet.oTxWarpStruct.checkUnionPaths();
if(bNeedNoTransform && bCheckWordArtContent) if(bNeedNoTransform && bCheckWordArtContent)
{ {
oRet.oTxWarpStructNoTransform = oRet.oTxWarpStruct; oContent.Draw(oContent.StartPage, oTextDrawer);
oRet.oTxWarpStructNoTransform = oTextDrawer.m_oDocContentStructure;
oRet.oTxWarpStructNoTransform.Recalculate(oTheme, oColorMap, dWidth, dHeight, this);
oRet.oTxWarpStructNoTransform.checkUnionPaths();
} }
} }
}
else if(isRealObject(editor))
{
if(bNeedNoTransform && bCheckWordArtContent)
{ {
oContent.Draw(oContent.StartPage, oTextDrawer); editor.ShowParaMarks = OldShowParaMarks;
oRet.oTxWarpStructNoTransform = oTextDrawer.m_oDocContentStructure;
oRet.oTxWarpStructNoTransform.Recalculate(oTheme, oColorMap, dWidth, dHeight, this);
oRet.oTxWarpStructNoTransform.checkUnionPaths();
} }
} }
return oRet;
if(isRealObject(editor)) }, this, []);
{
editor.ShowParaMarks = OldShowParaMarks;
}
}
return oRet;
}; };
CShape.prototype.checkTypeCorrect = function(){ CShape.prototype.checkTypeCorrect = function(){
......
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