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

Применение свойст текста к заголовкам диаграммы

parent d94a0e92
...@@ -23266,6 +23266,13 @@ CTitle.prototype = ...@@ -23266,6 +23266,13 @@ CTitle.prototype =
} }
this.tx.setRich(this.txBody.createDuplicate2()); this.tx.setRich(this.txBody.createDuplicate2());
this.tx.rich.setParent(this); this.tx.rich.setParent(this);
if(this.txPr && this.txPr.content && this.txPr.content.Content[0] && this.txPr.content.Content[0].Pr.DefaultRunPr)
{
for(var i = 0; i < this.tx.rich.content.Content.length; ++i)
{
AscFormat.CheckParagraphTextPr(this.tx.rich.content.Content[i], this.txPr.content.Content[0].Pr.DefaultRunPr);
}
}
var selection_state = this.txBody.content.Get_SelectionState(); var selection_state = this.txBody.content.Get_SelectionState();
this.txBody = this.tx.rich; this.txBody = this.tx.rich;
this.txBody.content.Set_SelectionState(selection_state, selection_state.length - 1); this.txBody.content.Set_SelectionState(selection_state, selection_state.length - 1);
......
...@@ -386,17 +386,10 @@ function checkPointInMap(map, worksheet, row, col) ...@@ -386,17 +386,10 @@ function checkPointInMap(map, worksheet, row, col)
}*/ }*/
function CheckObjectTextPr(oElement, oTextPr, oDrawingDocument)
{
if(oElement)
{
if(!oElement.txPr)
{
oElement.setTxPr(CreateTextBodyFromString("", oDrawingDocument, oElement));
}
var oParaPr = oElement.txPr.content.Content[0].Pr.Copy(); function CheckParagraphTextPr(oParagraph, oTextPr)
oElement.txPr.content.Content[0].Set_DocumentIndex(0); {
var oParaPr = oParagraph.Pr.Copy();
var oParaPr2 = new CParaPr(); var oParaPr2 = new CParaPr();
var oCopyTextPr = oTextPr.Copy(); var oCopyTextPr = oTextPr.Copy();
if(oCopyTextPr.FontFamily) if(oCopyTextPr.FontFamily)
...@@ -424,9 +417,31 @@ function CheckObjectTextPr(oElement, oTextPr, oDrawingDocument) ...@@ -424,9 +417,31 @@ function CheckObjectTextPr(oElement, oTextPr, oDrawingDocument)
} }
oParaPr2.DefaultRunPr = oCopyTextPr; oParaPr2.DefaultRunPr = oCopyTextPr;
oParaPr.Merge(oParaPr2); oParaPr.Merge(oParaPr2);
oElement.txPr.content.Content[0].Set_Pr(oParaPr); oParagraph.Set_Pr(oParaPr);
}
function CheckObjectTextPr(oElement, oTextPr, oDrawingDocument)
{
if(oElement)
{
if(!oElement.txPr)
{
oElement.setTxPr(AscFormat.CreateTextBodyFromString("", oDrawingDocument, oElement));
}
oElement.txPr.content.Content[0].Set_DocumentIndex(0);
CheckParagraphTextPr(oElement.txPr.content.Content[0], oTextPr);
if(oElement.tx && oElement.tx.rich)
{
var aContent = oElement.tx.rich.content.Content;
for(var i = 0; i < aContent.length; ++i)
{
CheckParagraphTextPr(aContent[i], oTextPr);
}
}
CheckParagraphTextPr(oElement.txPr.content.Content[0], oTextPr);
}
} }
}
function CheckIncDecFontSize(oElement, bIncrease, oDrawingDocument,nDefaultSize) function CheckIncDecFontSize(oElement, bIncrease, oDrawingDocument,nDefaultSize)
{ {
...@@ -808,8 +823,13 @@ CChartSpace.prototype.paragraphAdd = function(paraItem, bRecalculate) ...@@ -808,8 +823,13 @@ CChartSpace.prototype.paragraphAdd = function(paraItem, bRecalculate)
{ {
if(this.selection.title) if(this.selection.title)
{ {
fCallback(this.selection.title, value, this.getDrawingDocument(), 18); var DefaultFontSize = 18;
} if(this.selection.title !== this.chart.title)
{
DefaultFontSize = 10;
}
fCallback(this.selection.title, value, this.getDrawingDocument(), DefaultFontSize);
}
else if(this.selection.legend) else if(this.selection.legend)
{ {
if(!isRealNumber(this.selection.legendEntry)) if(!isRealNumber(this.selection.legendEntry))
...@@ -934,7 +954,7 @@ CChartSpace.prototype.paragraphAdd = function(paraItem, bRecalculate) ...@@ -934,7 +954,7 @@ CChartSpace.prototype.paragraphAdd = function(paraItem, bRecalculate)
this.selection.textSelection.paragraphAdd(paraItem, bRecalculate); this.selection.textSelection.paragraphAdd(paraItem, bRecalculate);
return; return;
} }
if(this.selection.title) /*if(this.selection.title)
{ {
this.selection.title.checkDocContent(); this.selection.title.checkDocContent();
CheckObjectTextPr(this.selection.title, _paraItem.Value, this.getDrawingDocument(), 18); CheckObjectTextPr(this.selection.title, _paraItem.Value, this.getDrawingDocument(), 18);
...@@ -943,6 +963,10 @@ CChartSpace.prototype.paragraphAdd = function(paraItem, bRecalculate) ...@@ -943,6 +963,10 @@ CChartSpace.prototype.paragraphAdd = function(paraItem, bRecalculate)
this.selection.title.tx.rich.content.Set_ApplyToAll(true); this.selection.title.tx.rich.content.Set_ApplyToAll(true);
this.selection.title.tx.rich.content.Paragraph_Add(_paraItem); this.selection.title.tx.rich.content.Paragraph_Add(_paraItem);
this.selection.title.tx.rich.content.Set_ApplyToAll(false); this.selection.title.tx.rich.content.Set_ApplyToAll(false);
}
return;
}*/
this.applyLabelsFunction(CheckObjectTextPr, _paraItem.Value);
} }
}; };
CChartSpace.prototype.applyTextFunction = function(docContentFunction, tableFunction, args) CChartSpace.prototype.applyTextFunction = function(docContentFunction, tableFunction, args)
...@@ -12577,4 +12601,5 @@ function checkBlipFillRasterImages(sp) ...@@ -12577,4 +12601,5 @@ function checkBlipFillRasterImages(sp)
window['AscFormat'].PAGE_SETUP_ORIENTATION_PORTRAIT = 2; window['AscFormat'].PAGE_SETUP_ORIENTATION_PORTRAIT = 2;
window['AscFormat'].initStyleManager = initStyleManager; window['AscFormat'].initStyleManager = initStyleManager;
window['AscFormat'].CheckParagraphTextPr = CheckParagraphTextPr;
})(window); })(window);
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