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

ParaDrawing'и в WordArt'ах

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@62992 954022d7-b5bf-4e40-9824-e11837661b57
parent f8714fb9
...@@ -4744,6 +4744,7 @@ DrawingObjectsController.prototype = ...@@ -4744,6 +4744,7 @@ DrawingObjectsController.prototype =
if(this.bNoCheckChartTextSelection === true) if(this.bNoCheckChartTextSelection === true)
return; return;
var chart_selection; var chart_selection;
var nPageNum1, nPageNum2;
if(this.selection.chartSelection) if(this.selection.chartSelection)
{ {
chart_selection = this.selection.chartSelection; chart_selection = this.selection.chartSelection;
...@@ -4773,101 +4774,134 @@ DrawingObjectsController.prototype = ...@@ -4773,101 +4774,134 @@ DrawingObjectsController.prototype =
if(this.document) if(this.document)
{ {
chart_selection.recalculate(); chart_selection.recalculate();
this.document.DrawingDocument.OnRecalculatePage( chart_selection.selectStartPage, this.document.Pages[chart_selection.selectStartPage] ); nPageNum1 = chart_selection.selectStartPage;
this.document.DrawingDocument.OnEndRecalculate( false, true );
} }
else if(this.drawingObjects.cSld) else if(this.drawingObjects.cSld)
{ {
chart_selection.recalculate(); chart_selection.recalculate();
if(!(bNoRedraw === true)) if(!(bNoRedraw === true))
{ {
editor.WordControl.m_oDrawingDocument.OnRecalculatePage( this.drawingObjects.num, this.drawingObjects ); nPageNum1 = this.drawingObjects.num;
editor.WordControl.m_oDrawingDocument.OnEndRecalculate( false, true );
} }
} }
else else
{ {
chart_selection.addToRecalculate(); chart_selection.addToRecalculate();
this.startRecalculate();
} }
chart_selection.recalcInfo.bRecalculatedTitle = false; chart_selection.recalcInfo.bRecalculatedTitle = false;
} }
} }
else { var oTargetTextObject = getTargetTextObject(this);
var oTargetTextObject = getTargetTextObject(this); var nSelectStartPage = 0, bNoNeedRecalc = false;
var nSelectStartPage = 0, bNoNeedRecalc = false; if(oTargetTextObject)
if(oTargetTextObject) {
{ nSelectStartPage = oTargetTextObject.selectStartPage;
nSelectStartPage = oTargetTextObject.selectStartPage; }
} if((!(oTargetTextObject instanceof CShape)) && this.document)
if(!oTargetTextObject && this.document) {
if(this.selectedObjects.length === 1 && this.selectedObjects[0].parent)
{ {
if(this.selectedObjects.length === 1 && this.selectedObjects[0].parent) var oShape = this.selectedObjects[0].parent.isShapeChild(true);
if(oShape)
{ {
var oShape = this.selectedObjects[0].parent.isShapeChild(true); oTargetTextObject = oShape;
if(oShape) nSelectStartPage = this.selectedObjects[0].selectStartPage;
{ bNoNeedRecalc = true;
oTargetTextObject = oShape;
nSelectStartPage = this.selectedObjects[0].selectStartPage;
bNoNeedRecalc = true;
}
} }
} }
if (oTargetTextObject) { }
if (oTargetTextObject) {
var oBodyPr = oTargetTextObject.getBodyPr && oTargetTextObject.getBodyPr(); var oBodyPr = oTargetTextObject.getBodyPr && oTargetTextObject.getBodyPr();
if((oBodyPr && oBodyPr.prstTxWarp && oBodyPr.prstTxWarp.preset !== "textNoShape") || oTargetTextObject.checkContentWordArt && oTargetTextObject.checkContentWordArt(oTargetTextObject.getDocContent())) if((oBodyPr && oBodyPr.prstTxWarp && oBodyPr.prstTxWarp.preset !== "textNoShape") || oTargetTextObject.checkContentWordArt && oTargetTextObject.checkContentWordArt(oTargetTextObject.getDocContent()))
{
if (oTargetTextObject.recalcInfo.bRecalculatedTitle)
{ {
if (oTargetTextObject.recalcInfo.bRecalculatedTitle) oTargetTextObject.recalcInfo.recalcTitle = null;
oTargetTextObject.recalcInfo.bRecalculatedTitle = false;
ExecuteNoHistory(function()
{ {
oTargetTextObject.recalcInfo.recalcTitle = null; if(oTargetTextObject.bWordShape)
oTargetTextObject.recalcInfo.bRecalculatedTitle = false;
ExecuteNoHistory(function()
{ {
if(oTargetTextObject.bWordShape) if(!bNoNeedRecalc)
{ {
if(!bNoNeedRecalc) oTargetTextObject.recalcInfo.oContentMetrics = oTargetTextObject.recalculateTxBoxContent();
oTargetTextObject.recalcInfo.recalculateTxBoxContent = false;
oTargetTextObject.recalcInfo.AllDrawings = [];
var oContent = oTargetTextObject.getDocContent();
if(oContent)
{ {
oTargetTextObject.recalcInfo.oContentMetrics = oTargetTextObject.recalculateTxBoxContent(); oContent.Get_AllDrawingObjects(oTargetTextObject.recalcInfo.AllDrawings);
oTargetTextObject.recalcInfo.recalculateTxBoxContent = false;
oTargetTextObject.recalcInfo.AllDrawings = [];
var oContent = oTargetTextObject.getDocContent();
if(oContent)
{
oContent.Get_AllDrawingObjects(oTargetTextObject.recalcInfo.AllDrawings);
}
} }
} }
else }
{ else
oTargetTextObject.recalcInfo.oContentMetrics = oTargetTextObject.recalculateContent();
oTargetTextObject.recalcInfo.recalculateContent = false;
}
}, this, []);
}
if (this.document)
{
this.document.DrawingDocument.OnRecalculatePage(nSelectStartPage, this.document.Pages[nSelectStartPage]);
this.document.DrawingDocument.OnEndRecalculate(false, true);
}
else if (this.drawingObjects.cSld)
{
if (!(bNoRedraw === true))
{ {
editor.WordControl.m_oDrawingDocument.OnRecalculatePage(this.drawingObjects.num, this.drawingObjects); oTargetTextObject.recalcInfo.oContentMetrics = oTargetTextObject.recalculateContent();
editor.WordControl.m_oDrawingDocument.OnEndRecalculate(false, true); oTargetTextObject.recalcInfo.recalculateContent = false;
} }
} }, this, []);
else
}
if (this.document)
{
nPageNum2 = nSelectStartPage;
}
else if (this.drawingObjects.cSld)
{
if (!(bNoRedraw === true))
{ {
oTargetTextObject.addToRecalculate(); nPageNum2 = this.drawingObjects.num;
this.startRecalculate();
} }
} }
else
{
oTargetTextObject.addToRecalculate();
}
}
}
if(isRealNumber(nPageNum1))
{
if(this.document)
{
this.document.DrawingDocument.OnRecalculatePage( nPageNum1, this.document.Pages[nPageNum1] );
this.document.DrawingDocument.OnEndRecalculate( false, true );
} }
else if(this.drawingObjects.cSld)
{
if(!(bNoRedraw === true))
{
editor.WordControl.m_oDrawingDocument.OnRecalculatePage( nPageNum1, this.drawingObjects );
editor.WordControl.m_oDrawingDocument.OnEndRecalculate( false, true );
}
}
else
{
this.startRecalculate();
}
}
if(isRealNumber(nPageNum2) && nPageNum2 !== nPageNum1)
{
if(this.document)
{
this.document.DrawingDocument.OnRecalculatePage( nPageNum2, this.document.Pages[nPageNum2] );
this.document.DrawingDocument.OnEndRecalculate( false, true );
}
else if(this.drawingObjects.cSld)
{
if(!(bNoRedraw === true))
{
editor.WordControl.m_oDrawingDocument.OnRecalculatePage( nPageNum2, this.drawingObjects );
editor.WordControl.m_oDrawingDocument.OnEndRecalculate( false, true );
}
}
else
{
this.startRecalculate();
}
} }
}, },
......
...@@ -142,7 +142,7 @@ function handleShapeImage(drawing, drawingObjectsController, e, x, y, group, pag ...@@ -142,7 +142,7 @@ function handleShapeImage(drawing, drawingObjectsController, e, x, y, group, pag
} }
else if(hit_in_text_rect) else if(hit_in_text_rect)
{ {
if(bWord && (!drawing.txWarpStruct || drawingObjectsController.curState.startTargetTextObject === drawing || drawing.haveSelectedDrawingInContent && drawing.haveSelectedDrawingInContent())) if(bWord/* && (!drawing.txWarpStruct || drawingObjectsController.curState.startTargetTextObject === drawing || drawing.haveSelectedDrawingInContent && drawing.haveSelectedDrawingInContent())*/)
{ {
var all_drawings = drawing.getDocContent().Get_AllDrawingObjects(); var all_drawings = drawing.getDocContent().Get_AllDrawingObjects();
var drawings2 = []; var drawings2 = [];
...@@ -172,8 +172,8 @@ function handleShapeImageInGroup(drawingObjectsController, drawing, shape, e, x, ...@@ -172,8 +172,8 @@ function handleShapeImageInGroup(drawingObjectsController, drawing, shape, e, x,
} }
else if(hit_in_text_rect) else if(hit_in_text_rect)
{ {
if(bWord && if(bWord/* &&
(!shape.txWarpStruct || drawingObjectsController.curState.startTargetTextObject === shape || shape.haveSelectedDrawingInContent && shape.haveSelectedDrawingInContent())) { (!shape.txWarpStruct || drawingObjectsController.curState.startTargetTextObject === shape || shape.haveSelectedDrawingInContent && shape.haveSelectedDrawingInContent())*/) {
var all_drawings = shape.getDocContent().Get_AllDrawingObjects(); var all_drawings = shape.getDocContent().Get_AllDrawingObjects();
var drawings2 = []; var drawings2 = [];
for (var i = 0; i < all_drawings.length; ++i) { for (var i = 0; i < all_drawings.length; ++i) {
...@@ -371,15 +371,18 @@ function handleInlineShapeImage(drawing, drawingObjectsController, e, x, y, page ...@@ -371,15 +371,18 @@ function handleInlineShapeImage(drawing, drawingObjectsController, e, x, y, page
} }
else if(b_hit_to_text) else if(b_hit_to_text)
{ {
var all_drawings = drawing.getDocContent().Get_AllDrawingObjects(); if(drawing.bWordShape /*&& (!drawing.txWarpStruct || drawingObjectsController.curState.startTargetTextObject === drawing || drawing.haveSelectedDrawingInContent && drawing.haveSelectedDrawingInContent())*/)
var drawings2 = [];
for(var i = 0; i < all_drawings.length; ++i)
{ {
drawings2.push(all_drawings[i].GraphicObj); var all_drawings = drawing.getDocContent().Get_AllDrawingObjects();
var drawings2 = [];
for(var i = 0; i < all_drawings.length; ++i)
{
drawings2.push(all_drawings[i].GraphicObj);
}
var ret = handleInlineObjects(drawingObjectsController, drawings2, e, x, y, pageIndex, true);
if(ret)
return ret;
} }
var ret = handleInlineObjects(drawingObjectsController, drawings2, e, x, y, pageIndex, true);
if(ret)
return ret;
return drawingObjectsController.handleTextHit(drawing, e, x, y, null, pageIndex, true); return drawingObjectsController.handleTextHit(drawing, e, x, y, null, pageIndex, true);
} }
} }
......
...@@ -3429,7 +3429,7 @@ CShape.prototype = ...@@ -3429,7 +3429,7 @@ CShape.prototype =
} }
var oController = this.getDrawingObjectsController && this.getDrawingObjectsController(); var oController = this.getDrawingObjectsController && this.getDrawingObjectsController();
if(!this.txWarpStruct || oController && (getTargetTextObject(oController) === this) || this.haveSelectedDrawingInContent()) if(!this.txWarpStruct || oController && (getTargetTextObject(oController) === this) /*|| this.haveSelectedDrawingInContent()*/)
{ {
if (this.txBody) if (this.txBody)
{ {
...@@ -3534,6 +3534,28 @@ CShape.prototype = ...@@ -3534,6 +3534,28 @@ CShape.prototype =
} }
else else
{ {
var bNeedRestoreState = false;
if(this.bWordShape && this.clipRect)
{
bNeedRestoreState = true;
var clip_rect = this.clipRect;
if(!this.bodyPr.upright)
{
graphics.SaveGrState();
graphics.SetIntegerGrid(false);
graphics.transform3(this.transform);
graphics.AddClipRect(clip_rect.x, clip_rect.y, clip_rect.w, clip_rect.h);
}
else
{
graphics.SaveGrState();
graphics.SetIntegerGrid(false);
graphics.transform3(this.transformText, true);
graphics.AddClipRect(clip_rect.x, clip_rect.y, clip_rect.w, clip_rect.h);
}
}
var oTransform = this.transformTextWordArt; var oTransform = this.transformTextWordArt;
if(editor && editor.ShowParaMarks) if(editor && editor.ShowParaMarks)
{ {
...@@ -3543,6 +3565,10 @@ CShape.prototype = ...@@ -3543,6 +3565,10 @@ CShape.prototype =
{ {
this.txWarpStruct.draw(graphics, oTransform); this.txWarpStruct.draw(graphics, oTransform);
} }
if(bNeedRestoreState)
{
graphics.RestoreGrState();
}
} }
} }
if(!this.group) if(!this.group)
......
var PATH_DIV_EPSILON = 0.1; var PATH_DIV_EPSILON = 0.1;
function ParaDrawingStruct(nPageIndex, pDrawing)
{
this.oDrawing = pDrawing;
this.nPageeIndex = nPageIndex;
}
ParaDrawingStruct.prototype.Draw = function(pGraphics)
{
if(this.oDrawing)
{
this.oDrawing.Draw( 0, 0, pGraphics, this.nPageeIndex, 0)
}
};
function CDocContentStructure() function CDocContentStructure()
{ {
this.m_nType = DRAW_COMMAND_CONTENT; this.m_nType = DRAW_COMMAND_CONTENT;
this.m_aContent = []; this.m_aContent = [];
this.m_aByLines = null; this.m_aByLines = null;
this.m_aDrawingsStruct = [];
} }
CDocContentStructure.prototype.Recalculate = function(oTheme, oColorMap, dWidth, dHeight, oShape) CDocContentStructure.prototype.Recalculate = function(oTheme, oColorMap, dWidth, dHeight, oShape)
...@@ -16,7 +32,12 @@ CDocContentStructure.prototype.Recalculate = function(oTheme, oColorMap, dWidth, ...@@ -16,7 +32,12 @@ CDocContentStructure.prototype.Recalculate = function(oTheme, oColorMap, dWidth,
}; };
CDocContentStructure.prototype.draw = function(graphics, transform) CDocContentStructure.prototype.draw = function(graphics, transform)
{ {
for(var i = 0; i < this.m_aContent.length; ++i) var i;
for(i = 0; i < this.m_aDrawingsStruct.length; ++i)
{
this.m_aDrawingsStruct[i].Draw(graphics);
}
for(i = 0; i < this.m_aContent.length; ++i)
{ {
this.m_aContent[i].draw(graphics, transform); this.m_aContent[i].draw(graphics, transform);
} }
...@@ -368,6 +389,7 @@ function CTextDrawer(dWidth, dHeight, bDivByLInes) ...@@ -368,6 +389,7 @@ function CTextDrawer(dWidth, dHeight, bDivByLInes)
this.m_aStack = []; this.m_aStack = [];
this.m_oDocContentStructure = null; this.m_oDocContentStructure = null;
this.m_aCommands = []; this.m_aCommands = [];
this.m_aDrawings = [];
// RFonts // RFonts
this.m_oTextPr = null; this.m_oTextPr = null;
this.m_oGrFonts = new CGrRFonts(); this.m_oGrFonts = new CGrRFonts();
...@@ -606,8 +628,10 @@ CTextDrawer.prototype = ...@@ -606,8 +628,10 @@ CTextDrawer.prototype =
this.m_oDocContentStructure = oDocContentStructure; this.m_oDocContentStructure = oDocContentStructure;
this.m_oDocContentStructure.m_aByLines = this.m_aByLines; this.m_oDocContentStructure.m_aByLines = this.m_aByLines;
this.m_oDocContentStructure.m_aByParagraphs = this.m_aByParagraphs; this.m_oDocContentStructure.m_aByParagraphs = this.m_aByParagraphs;
this.m_oDocContentStructure.m_aDrawingsStruct = this.m_aDrawings;
this.m_aByLines = []; this.m_aByLines = [];
this.m_aByParagraphs = []; this.m_aByParagraphs = [];
this.m_aDrawings = [];
} }
if(this.m_bDivByLines) if(this.m_bDivByLines)
{ {
...@@ -1360,12 +1384,16 @@ CTextDrawer.prototype = ...@@ -1360,12 +1384,16 @@ CTextDrawer.prototype =
SetTextPr : function(textPr, theme) SetTextPr : function(textPr, theme)
{ {
var bNeedGetPath = false;
if(!this.CheckCompareFillBrush(textPr, this.m_oTextPr)) if(!this.CheckCompareFillBrush(textPr, this.m_oTextPr))
{ {
this.Get_PathToDraw(false, true); bNeedGetPath = true;
} }
this.m_oTextPr = textPr; this.m_oTextPr = textPr;
if(bNeedGetPath)
{
this.Get_PathToDraw(false, true);
}
if (theme) if (theme)
this.m_oGrFonts.checkFromTheme(theme.themeElements.fontScheme, this.m_oTextPr.RFonts); this.m_oGrFonts.checkFromTheme(theme.themeElements.fontScheme, this.m_oTextPr.RFonts);
else else
...@@ -1374,6 +1402,8 @@ CTextDrawer.prototype = ...@@ -1374,6 +1402,8 @@ CTextDrawer.prototype =
CheckCompareFillBrush: function(oTextPr1, oTextPr2) CheckCompareFillBrush: function(oTextPr1, oTextPr2)
{ {
if(!oTextPr1 && oTextPr2 || oTextPr1 && !oTextPr2)
return false;
if(oTextPr1 && oTextPr2) if(oTextPr1 && oTextPr2)
{ {
var oFill1 = this.GetFillFromTextPr(oTextPr1); var oFill1 = this.GetFillFromTextPr(oTextPr1);
......
...@@ -4398,8 +4398,8 @@ ParaDrawing.prototype = ...@@ -4398,8 +4398,8 @@ ParaDrawing.prototype =
{ {
if(pGraphics.Start_Command) if(pGraphics.Start_Command)
{ {
pGraphics.m_aDrawings.push(new ParaDrawingStruct(pageIndex, this));
return; return;
pGraphics.Start_Command(DRAW_COMMAND_DRAWING);
} }
if ( drawing_Inline === this.DrawingType ) if ( drawing_Inline === this.DrawingType )
{ {
......
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