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

increase & decrease font size in chart lables.

parent e8a2256b
...@@ -1019,7 +1019,7 @@ DrawingObjectsController.prototype = ...@@ -1019,7 +1019,7 @@ DrawingObjectsController.prototype =
} }
if(f === CDocumentContent.prototype.Paragraph_IncDecFontSize) if(f === CDocumentContent.prototype.Paragraph_IncDecFontSize)
{ {
arr[i].paragraphIncDecFontSize(args[0]);
} }
} }
else if(arr[i].getDocContent) else if(arr[i].getDocContent)
...@@ -1114,14 +1114,29 @@ DrawingObjectsController.prototype = ...@@ -1114,14 +1114,29 @@ DrawingObjectsController.prototype =
} }
else if(this.selection.groupSelection.selection.chartSelection) else if(this.selection.groupSelection.selection.chartSelection)
{ {
applyToChartSelection(this.selection.groupSelection.selection.chartSelection); if(f === CDocumentContent.prototype.Paragraph_IncDecFontSize)
{
this.selection.groupSelection.selection.chartSelection.paragraphIncDecFontSize(args[0]);
}
else
{
applyToChartSelection(this.selection.groupSelection.selection.chartSelection);
}
} }
else else
applyToArrayDrawings(this.selection.groupSelection.selectedObjects); applyToArrayDrawings(this.selection.groupSelection.selectedObjects);
} }
else if(this.selection.chartSelection) else if(this.selection.chartSelection)
{ {
applyToChartSelection(this.selection.chartSelection); if(f === CDocumentContent.prototype.Paragraph_IncDecFontSize)
{
this.selection.chartSelection.paragraphIncDecFontSize(args[0]);
}
else
{
applyToChartSelection(this.selection.chartSelection);
}
} }
else else
{ {
......
...@@ -375,7 +375,7 @@ function handleChart(drawing, drawingObjectsController, e, x, y, group, pageInde ...@@ -375,7 +375,7 @@ function handleChart(drawing, drawingObjectsController, e, x, y, group, pageInde
selector.resetSelection(); selector.resetSelection();
selector.selectObject(drawing, pageIndex); selector.selectObject(drawing, pageIndex);
selector.selection.chartSelection = drawing; selector.selection.chartSelection = drawing;
drawing.selection.axisLbls = oLabels; drawing.selection.axisLbls = oLabels.axis;
drawingObjectsController.updateSelectionState(); drawingObjectsController.updateSelectionState();
drawingObjectsController.updateOverlay(); drawingObjectsController.updateOverlay();
return true; return true;
......
...@@ -366,6 +366,31 @@ function CheckObjectTextPr(oElement, oTextPr, oDrawingDocument) ...@@ -366,6 +366,31 @@ function CheckObjectTextPr(oElement, oTextPr, oDrawingDocument)
} }
} }
function CheckIncDecFontSize(oElement, bIncrease, oDrawingDocument,nDefaultSize)
{
if(oElement)
{
if(!oElement.txPr)
{
oElement.setTxPr(CreateTextBodyFromString("", oDrawingDocument, oElement));
}
var oParaPr = oElement.txPr.content.Content[0].Pr.Copy();
oElement.txPr.content.Content[0].Set_DocumentIndex(0);
var oCopyTextPr;
if(oParaPr.DefaultRunPr)
{
oCopyTextPr = oParaPr.DefaultRunPr.Copy();
}
else
{
oCopyTextPr = new CTextPr();
}
oCopyTextPr.FontSize = FontSize_IncreaseDecreaseValue( bIncrease, isRealNumber(oCopyTextPr.FontSize) ? oCopyTextPr.FontSize : nDefaultSize);
oParaPr.DefaultRunPr = oCopyTextPr;
oElement.txPr.content.Content[0].Set_Pr(oParaPr);
}
}
function CChartSpace() function CChartSpace()
{ {
this.chart = null; this.chart = null;
...@@ -495,7 +520,8 @@ CChartSpace.prototype = ...@@ -495,7 +520,8 @@ CChartSpace.prototype =
} }
else if(this.selection.axisLbls) else if(this.selection.axisLbls)
{ {
drawingDocument.DrawTrack(TYPE_TRACK_SHAPE, this.transform, this.selection.axisLbls.x, this.selection.axisLbls.y, this.selection.axisLbls.extX, this.selection.axisLbls.extY, false, false); var oLabels = this.selection.axisLbls.labels
drawingDocument.DrawTrack(TYPE_TRACK_SHAPE, this.transform, oLabels.x, oLabels.y, oLabels.extX, oLabels.extY, false, false);
} }
} }
}, },
...@@ -706,13 +732,10 @@ CChartSpace.prototype = ...@@ -706,13 +732,10 @@ CChartSpace.prototype =
{ {
return this.selection.textSelection.txBody.content.Get_Paragraph_TextPr(); return this.selection.textSelection.txBody.content.Get_Paragraph_TextPr();
} }
else if(this.selection.axisLbls) else if(this.selection.axisLbls && this.selection.axisLbls.labels)
{ {
if(this.selection.axisLbls.axis) return GetTextPrFormArrObjects(this.selection.axisLbls.labels.arrLabels, true);
{
return GetTextPrFormArrObjects(this.selection.axisLbls.arrLabels, true);
} }
}
else if(isRealNumber(this.selection.dataLbls)) else if(isRealNumber(this.selection.dataLbls))
{ {
var ser = this.chart.plotArea.chart.series[this.selection.dataLbls]; var ser = this.chart.plotArea.chart.series[this.selection.dataLbls];
...@@ -740,33 +763,21 @@ CChartSpace.prototype = ...@@ -740,33 +763,21 @@ CChartSpace.prototype =
return new CTextPr(); return new CTextPr();
}, },
paragraphAdd: function(paraItem, bRecalculate)
applyLabelsFunction: function(fCallback, value)
{ {
var content; if(this.selection.title)
if(paraItem.Type === para_TextPr)
{ {
var _paraItem; fCallback(this.selection.title, value, this.getDrawingDocument(), 18);
if(paraItem.Value.Unifill && paraItem.Value.Unifill.checkWordMods())
{
_paraItem = paraItem.Copy();
_paraItem.Value.Unifill.convertToPPTXMods();
}
else
{
_paraItem = paraItem;
}
if(this.selection.title && !this.selection.textSelection)
{
CheckObjectTextPr(this.selection.title, _paraItem.Value, this.getDrawingDocument());
} }
else if(this.selection.legend) else if(this.selection.legend)
{ {
if(!isRealNumber(this.selection.legendEntry)) if(!isRealNumber(this.selection.legendEntry))
{ {
CheckObjectTextPr(this.selection.legend, paraItem.Value, this.getDrawingDocument()); fCallback(this.selection.legend, value, this.getDrawingDocument(), 10);
for(var i = 0; i < this.selection.legend.legendEntryes.length; ++i) for(var i = 0; i < this.selection.legend.legendEntryes.length; ++i)
{ {
CheckObjectTextPr(this.selection.legend.legendEntryes[i], paraItem.Value, this.getDrawingDocument()); fCallback(this.selection.legend.legendEntryes[i], value, this.getDrawingDocument(), 10);
} }
} }
else else
...@@ -780,22 +791,14 @@ CChartSpace.prototype = ...@@ -780,22 +791,14 @@ CChartSpace.prototype =
} }
if(entry) if(entry)
{ {
CheckObjectTextPr(entry, paraItem.Value, this.getDrawingDocument()); fCallback(entry, value, this.getDrawingDocument(), 10);
} }
} }
} }
else if(this.selection.textSelection)
{
this.selection.textSelection.checkDocContent();
this.selection.textSelection.paragraphAdd(_paraItem, bRecalculate);
}
else if(this.selection.axisLbls) else if(this.selection.axisLbls)
{ {
if(this.selection.axisLbls.axis) fCallback(this.selection.axisLbls, value, this.getDrawingDocument(), 10);
{
CheckObjectTextPr(this.selection.axisLbls.axis, paraItem.Value, this.getDrawingDocument());
} }
}
else if(isRealNumber(this.selection.dataLbls)) else if(isRealNumber(this.selection.dataLbls))
{ {
var ser = this.chart.plotArea.chart.series[this.selection.dataLbls]; var ser = this.chart.plotArea.chart.series[this.selection.dataLbls];
...@@ -817,14 +820,13 @@ CChartSpace.prototype = ...@@ -817,14 +820,13 @@ CChartSpace.prototype =
} }
if(!isRealNumber(this.selection.dataLbl)) if(!isRealNumber(this.selection.dataLbl))
{ {
fCallback(ser.dLbls, value, this.getDrawingDocument(), 10);
CheckObjectTextPr(ser.dLbls, paraItem.Value, this.getDrawingDocument());
for(var i = 0; i < pts.length; ++i) for(var i = 0; i < pts.length; ++i)
{ {
var dLbl = ser.dLbls.findDLblByIdx(pts[i].idx); var dLbl = ser.dLbls.findDLblByIdx(pts[i].idx);
if(dLbl) if(dLbl)
{ {
CheckObjectTextPr(dLbl, paraItem.Value, this.getDrawingDocument()); fCallback(dLbl, value, this.getDrawingDocument(), 10);
} }
} }
} }
...@@ -840,23 +842,39 @@ CChartSpace.prototype = ...@@ -840,23 +842,39 @@ CChartSpace.prototype =
dLbl.setIdx(pt.idx); dLbl.setIdx(pt.idx);
ser.dLbls.addDLbl(dLbl); ser.dLbls.addDLbl(dLbl);
} }
CheckObjectTextPr(dLbl, paraItem.Value, this.getDrawingDocument()); fCallback(dLbl, value, this.getDrawingDocument(), 10);
} }
} }
} }
} }
else },
paragraphIncDecFontSize: function(bIncrease)
{ {
//TODO: другие случаи будут обработаны в след. версиях this.applyLabelsFunction(CheckIncDecFontSize, bIncrease);
},
paragraphAdd: function(paraItem, bRecalculate)
{
if(paraItem.Type === para_TextPr)
{
var _paraItem;
if(paraItem.Value.Unifill && paraItem.Value.Unifill.checkWordMods())
{
_paraItem = paraItem.Copy();
_paraItem.Value.Unifill.convertToPPTXMods();
} }
}
else else
{ {
_paraItem = paraItem;
}
if(this.selection.textSelection) if(this.selection.textSelection)
{ {
this.selection.textSelection.checkDocContent(); this.selection.textSelection.checkDocContent();
this.selection.textSelection.paragraphAdd(paraItem, bRecalculate); this.selection.textSelection.paragraphAdd(paraItem, bRecalculate);
return;
} }
this.applyLabelsFunction(CheckObjectTextPr, _paraItem.Value);
} }
}, },
......
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