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

git-svn-id:...

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49579 954022d7-b5bf-4e40-9824-e11837661b57
parent eb8ec6ee
......@@ -1228,6 +1228,230 @@ function CDrawingDocument()
}
}
this.InitGuiCanvasTextProps = function(div_id)
{
var _div_elem = document.getElementById(div_id);
if (null != this.GuiCanvasTextProps)
{
var elem = _div_elem.getElementsByTagName('canvas');
if (elem.length == 0)
{
_div_elem.appendChild(this.GuiCanvasTextProps);
}
else
{
var _width = parseInt(_div_elem.offsetWidth);
var _height = parseInt(_div_elem.offsetHeight);
if (0 == _width)
_width = 300;
if (0 == _height)
_height = 80;
if (this.GuiCanvasTextProps.width != _width || this.GuiCanvasTextProps.height != _height)
{
this.GuiCanvasTextProps.width = _width;
this.GuiCanvasTextProps.height = _height;
}
}
}
else
{
this.GuiCanvasTextProps = document.createElement('canvas');
this.GuiCanvasTextProps.style = "position:absolute;left:0;top:0;";
this.GuiCanvasTextProps.id = this.GuiCanvasTextPropsId;
var _width = parseInt(_div_elem.offsetWidth);
var _height = parseInt(_div_elem.offsetHeight);
if (0 == _width)
_width = 300;
if (0 == _height)
_height = 80;
this.GuiCanvasTextProps.width = _width;
this.GuiCanvasTextProps.height = _height;
_div_elem.appendChild(this.GuiCanvasTextProps);
}
}
this.DrawGuiCanvasTextProps = function(props)
{
var bIsChange = false;
if (null == this.GuiLastTextProps)
{
bIsChange = true;
this.GuiLastTextProps = new CParagraphProp();
this.GuiLastTextProps.Subscript = props.Subscript;
this.GuiLastTextProps.Superscript = props.Superscript;
this.GuiLastTextProps.SmallCaps = props.SmallCaps;
this.GuiLastTextProps.AllCaps = props.AllCaps;
this.GuiLastTextProps.Strikeout = props.Strikeout;
this.GuiLastTextProps.DStrikeout = props.DStrikeout;
this.GuiLastTextProps.TextSpacing = props.TextSpacing;
this.GuiLastTextProps.Position = props.Position;
}
else
{
if (this.GuiLastTextProps.Subscript != props.Subscript)
{
this.GuiLastTextProps.Subscript = props.Subscript;
bIsChange = true;
}
if (this.GuiLastTextProps.Superscript != props.Superscript)
{
this.GuiLastTextProps.Superscript = props.Superscript;
bIsChange = true;
}
if (this.GuiLastTextProps.SmallCaps != props.SmallCaps)
{
this.GuiLastTextProps.SmallCaps = props.SmallCaps;
bIsChange = true;
}
if (this.GuiLastTextProps.AllCaps != props.AllCaps)
{
this.GuiLastTextProps.AllCaps = props.AllCaps;
bIsChange = true;
}
if (this.GuiLastTextProps.Strikeout != props.Strikeout)
{
this.GuiLastTextProps.Strikeout = props.Strikeout;
bIsChange = true;
}
if (this.GuiLastTextProps.DStrikeout != props.DStrikeout)
{
this.GuiLastTextProps.DStrikeout = props.DStrikeout;
bIsChange = true;
}
if (this.GuiLastTextProps.TextSpacing != props.TextSpacing)
{
this.GuiLastTextProps.TextSpacing = props.TextSpacing;
bIsChange = true;
}
if (this.GuiLastTextProps.Position != props.Position)
{
this.GuiLastTextProps.Position = props.Position;
bIsChange = true;
}
}
if (undefined !== this.GuiLastTextProps.Position && isNaN(this.GuiLastTextProps.Position))
this.GuiLastTextProps.Position = undefined;
if (undefined !== this.GuiLastTextProps.TextSpacing && isNaN(this.GuiLastTextProps.TextSpacing))
this.GuiLastTextProps.TextSpacing = undefined;
if (!bIsChange)
return;
History.TurnOff();
var _oldTurn = editor.isViewMode;
editor.isViewMode = true;
var par = new Paragraph(this, this.m_oWordControl.m_oLogicDocument, 0, 0, 0, 1000, 1000);
par.Cursor_MoveToStartPos();
var _paraPr = new CParaPr();
par.Pr = _paraPr;
var _textPr = new CTextPr();
_textPr.FontFamily = { Name : "Arial", Index : -1 };
_textPr.Strikeout = this.GuiLastTextProps.Strikeout;
if (true === this.GuiLastTextProps.Subscript)
_textPr.VertAlign = vertalign_SubScript;
else if (true === this.GuiLastTextProps.Superscript)
_textPr.VertAlign = vertalign_SuperScript;
else
_textPr.VertAlign = vertalign_Baseline;
_textPr.DStrikeout = this.GuiLastTextProps.DStrikeout;
_textPr.Caps = this.GuiLastTextProps.AllCaps;
_textPr.SmallCaps = this.GuiLastTextProps.SmallCaps;
_textPr.Spacing = this.GuiLastTextProps.TextSpacing;
_textPr.Position = this.GuiLastTextProps.Position;
par.Add(new ParaTextPr(_textPr));
par.Add(new ParaText("H"));
par.Add(new ParaText("e"));
par.Add(new ParaText("l"));
par.Add(new ParaText("l"));
par.Add(new ParaText("o"));
par.Add(new ParaSpace(1));
par.Add(new ParaText("W"));
par.Add(new ParaText("o"));
par.Add(new ParaText("r"));
par.Add(new ParaText("l"));
par.Add(new ParaText("d"));
par.Recalculate_Page(0);
var baseLineOffset = par.Lines[0].Y;
var _bounds = par.Get_PageBounds(0);
var ctx = this.GuiCanvasTextProps.getContext('2d');
var _wPx = this.GuiCanvasTextProps.width;
var _hPx = this.GuiCanvasTextProps.height;
var _wMm = _wPx * g_dKoef_pix_to_mm;
var _hMm = _hPx * g_dKoef_pix_to_mm;
ctx.fillStyle = "#FFFFFF";
ctx.fillRect(0, 0, _wPx, _hPx);
var _pxBoundsW = par.Lines[0].W * g_dKoef_mm_to_pix;//(_bounds.Right - _bounds.Left) * g_dKoef_mm_to_pix;
var _pxBoundsH = (_bounds.Bottom - _bounds.Top) * g_dKoef_mm_to_pix;
if (this.GuiLastTextProps.Position !== undefined && this.GuiLastTextProps.Position != null && this.GuiLastTextProps.Position != 0)
{
// TODO: нужна высота без учета Position
// _pxBoundsH -= (this.GuiLastTextProps.Position * g_dKoef_mm_to_pix);
}
if (_pxBoundsH < _hPx && _pxBoundsW < _wPx)
{
// рисуем линию
var _lineY = (((_hPx + _pxBoundsH) / 2) >> 0) + 0.5;
var _lineW = (((_wPx - _pxBoundsW) / 4) >> 0);
ctx.strokeStyle = "#000000";
ctx.lineWidth = 1;
ctx.beginPath();
ctx.moveTo(0, _lineY);
ctx.lineTo(_lineW, _lineY);
ctx.moveTo(_wPx - _lineW, _lineY);
ctx.lineTo(_wPx, _lineY);
ctx.stroke();
ctx.beginPath();
}
var _yOffset = (((_hPx + _pxBoundsH) / 2) - baseLineOffset * g_dKoef_mm_to_pix) >> 0;
var _xOffset = ((_wPx - _pxBoundsW) / 2) >> 0;
var graphics = new CGraphics();
graphics.init(ctx, _wPx, _hPx, _wMm, _hMm);
graphics.m_oFontManager = g_fontManager;
graphics.m_oCoordTransform.tx = _xOffset;
graphics.m_oCoordTransform.ty = _yOffset;
graphics.transform(1,0,0,1,0,0);
var old_marks = this.m_oWordControl.m_oApi.ShowParaMarks;
this.m_oWordControl.m_oApi.ShowParaMarks = false;
par.Draw(0, graphics);
this.m_oWordControl.m_oApi.ShowParaMarks = old_marks;
History.TurnOn();
editor.isViewMode = _oldTurn;
}
this.DrawSelection = function(overlay)
{
var xDst = this.SlideCurrectRect.left;
......
......@@ -1445,6 +1445,16 @@ function CompareShapeProperties(shapeProp1, shapeProp2)
{
_result_shape_prop.stroke = shapeProp1.stroke.compare(shapeProp2.stroke)
}
if(shapeProp1.verticalTextAlign === shapeProp2.verticalTextAlign)
{
_result_shape_prop.verticalTextAlign = shapeProp1.verticalTextAlign;
}
else
{
_result_shape_prop.verticalTextAlign = null;
}
if(shapeProp1.canChangeArrows !== true || shapeProp2.canChangeArrows !== true)
_result_shape_prop.canChangeArrows = false;
else
......@@ -3399,14 +3409,10 @@ function redrawSlide2(slide, presentation, arrInd, pos, arr_layouts, direction,
function recalculateSlideAfterChangeThemeColors(slide, presentation, direction, arr_slides)
{
var _history_is_on = History.Is_On();
if(_history_is_on)
{
History.TurnOff();
}
slide.calculateColors();
slide.Layout.calculateColors();
slide.Layout.Master.calculateColors();
slide.recalcAllColors();
slide.recalculate();
presentation.DrawingDocument.OnRecalculatePage(slide.num, slide);
if(presentation.CurPos.Type === docpostype_FlowObjects)
{
......@@ -3415,10 +3421,7 @@ function recalculateSlideAfterChangeThemeColors(slide, presentation, direction,
presentation.RecalculateCurPos();
}
}
if(_history_is_on)
{
History.TurnOn();
}
if(direction == 0)
{
if(slide.num > 0)
......
......@@ -649,6 +649,27 @@ function CCollaborativeEditing()
editor.sync_UnLockComment( this.m_aNeedUnlock[Index].Get_Id() );
else if ( this.m_aNeedUnlock[Index] instanceof CGraphicObjects )
editor.sync_UnLockDocumentSchema(); */
var Class = this.m_aNeedUnlock[Index];
if ( Class instanceof PropLocker )
{
var object = g_oTableId.Get_ById(Class.objectId);
if(object instanceof CPresentation)
{
if(Class === editor.WordControl.m_oLogicDocument.themeLock)
{
editor.asc_fireCallback("asc_onUnLockDocumentTheme");
}
else if(Class === editor.WordControl.m_oLogicDocument.schemeLock)
{
editor.asc_fireCallback("asc_onUnLockDocumentSchema");
}
else if(Class === editor.WordControl.m_oLogicDocument.slideSizeLock)
{
editor.asc_fireCallback("asc_onUnLockDocumentProps");
}
}
}
}
else if ( locktype_Other3 === CurLockType )
{
......@@ -1085,6 +1106,11 @@ var changestype_ColorScheme = 60; // Изменение свойств
var changestype_Text_Props = 61; // Изменение свойств фигуры
var changestype_RemoveSlide = 62; // Изменение свойств фигуры
var changestype_PresentationProps = 63; // Изменение темы, цветовой схемы, размера слайда;
var changestype_Theme = 64; // Изменение темы;
var changestype_ColorScheme = 65; // Изменение цветовой схемы;
var changestype_SlideSize = 66; // Изменение цветовой схемы;
......
......@@ -201,6 +201,27 @@ CDocumentContent.prototype =
return this.Parent.Get_Numbering();
},
recalcColors: function()
{
if(this.Parent instanceof CTextBody)
{
for(var i = 0; i < this.Content.length; ++i)
{
var p = this.Content[i];
if(p.CompiledPr.Pr.TextPr)
this.Parent.textPropsForRecalc.push({Value:p.CompiledPr.Pr.TextPr});
for(var j = 0; j < p.Content.length; ++j)
{
if(p.Content[j].Type === para_TextPr && p.Content[j].Value.unifill)
{
this.Parent.textPropsForRecalc.push(p.Content[j]);
}
}
}
}
},
Internal_GetNumInfo : function(ParaId, NumPr)
{
this.NumInfoCounter++;
......
......@@ -70,6 +70,24 @@ CGroupShape.prototype =
recalculateScaleCoefficients: true
};
},
recalcAllColors: function()
{
this.recalcInfo =
{
recalculateBrush: true,
recalculatePen: true,
recalculateTransform: true,
recalculateSpTree: true,
recalculateCursorTypes: true,
recalculateScaleCoefficients: true
};
for(var i = 0; i < this.spTree.length; ++i)
{
if(this.spTree[i].recalcAllColors)
this.spTree[i].recalcAllColors();
}
},
Get_Id: function()
{
return this.Id;
......
......@@ -62,6 +62,11 @@ CImageShape.prototype =
return true;
},
recalcAllColors: function()
{
},
normalize: function()
{
var new_off_x, new_off_y, new_ext_x, new_ext_y;
......
......@@ -146,6 +146,7 @@ Paragraph.prototype =
Use_Wrap : function()
{
return false;
if ( undefined != this.Get_FramePr() )
return false;
......@@ -9140,7 +9141,7 @@ Paragraph.prototype =
parents = this.Parent.Parent.shape.getParentObjects();
else if(this.Parent.Parent instanceof CTableCell)
parents = this.Parent.Parent.Row.Table.Parent.getParentObjects();
if(isRealObject(TextPr.unifill) && isRealObject(TextPr.unifill.fill) && TextPr.unifill.fill.type === FILL_TYPE_SOLID && isRealObject(TextPr.unifill.fill.color))
if(parents && isRealObject(TextPr.unifill) && isRealObject(TextPr.unifill.fill) && TextPr.unifill.fill.type === FILL_TYPE_SOLID && isRealObject(TextPr.unifill.fill.color))
{
TextPr.unifill.fill.color.Calculate(parents.theme, parents.slide, parents.layout, parents.master, {R:0, G:0, B:0, A:255});
TextPr.Color =
......@@ -9151,7 +9152,7 @@ Paragraph.prototype =
A:TextPr.unifill.fill.color.RGBA.A
};
}
if(isRealObject(TextPr.FontFamily) && typeof TextPr.FontFamily.Name === "string" && isThemeFont(TextPr.FontFamily.Name))
if(parents && isRealObject(TextPr.FontFamily) && typeof TextPr.FontFamily.Name === "string" && isThemeFont(TextPr.FontFamily.Name))
{
if(this.Parent.Parent.shape instanceof CShape)
{
......
......@@ -356,6 +356,10 @@ function CPresentation(DrawingDocument)
this.startChangeThemeTimeOutId = null;
// Добавляем данный класс в таблицу Id (обязательно в конце конструктора)
g_oTableId.Add( this, this.Id );
this.themeLock = new PropLocker(this.Id);
//this.schemeLock = new PropLocker(this.Id);
this.slideSizeLock = new PropLocker(this.Id);
}
var selected_None = -1;
......@@ -5917,6 +5921,9 @@ CPresentation.prototype =
{
return;
}
if(!(this.Document_Is_SelectionLocked(changestype_Theme) === false))
return;
if(this.startChangeThemeTimeOutId != null)
{
clearTimeout(this.startChangeThemeTimeOutId);
......@@ -5992,6 +5999,57 @@ CPresentation.prototype =
this.Document_UpdateUndoRedoState();
},
changeSlideSize: function()
{
},
changeColorScheme: function(colorScheme)
{
if(this.viewMode === true)
{
return;
}
if(!(this.Document_Is_SelectionLocked(changestype_Theme) === false))
return;
if(!(colorScheme instanceof ClrScheme))
{
return;
}
History.Create_NewPoint();
var _slides_array = [];
for(var _index = 0; _index < this.Slides.length; ++_index)
{
_slides_array.push(this.Slides[_index]);
}
var _slides = this.Slides;
var _slide_index;
var _slide_count = _slides.length;
var _cur_slide;
var _cur_theme;
var _old_color_scheme;
for(_slide_index = 0; _slide_index < _slide_count; ++_slide_index)
{
_cur_slide =_slides[_slide_index];
_cur_theme = _cur_slide.Layout.Master.Theme;
if(!_cur_theme.themeElements.clrScheme.isIdentical(colorScheme))
{
_old_color_scheme = _cur_theme.themeElements.clrScheme;
_cur_theme.themeElements.clrScheme = colorScheme.createDuplicate();
}
}
var _start_slide = this.Slides[this.CurPage];
var _presentation = this;
setTimeout(function(){recalculateSlideAfterChangeThemeColors(_start_slide, _presentation, 0, _slides_array)},30);
this.Document_UpdateUndoRedoState();
},
removeSlide: function(pos)
{
......@@ -6293,6 +6351,40 @@ CPresentation.prototype =
this.Slides[selected_slides[i]].deleteLock.Lock.Check(check_obj);
}
}
if(CheckType === changestype_Theme)
{
var check_obj =
{
"type": c_oAscLockTypeElemPresentation.Slide,
"val": this.themeLock.Get_Id(),
"guid": this.themeLock.Get_Id()
};
this.themeLock.Lock.Check(check_obj);
}
if(CheckType === changestype_ColorScheme)
{
var check_obj =
{
"type": c_oAscLockTypeElemPresentation.Slide,
"val": this.schemeLock.Get_Id(),
"guid": this.schemeLock.Get_Id()
};
this.schemeLock.Lock.Check(check_obj);
}
if(CheckType === changestype_SlideSize)
{
var check_obj =
{
"type": c_oAscLockTypeElemPresentation.Slide,
"val": this.slideSizeLock.Get_Id(),
"guid": this.slideSizeLock.Get_Id()
};
this.slideSizeLock.Lock.Check(check_obj);
}
var bResult = CollaborativeEditing.OnEnd_CheckLock();
if ( true === bResult )
......
......@@ -174,6 +174,24 @@ CShape.prototype =
recalculateTextStyles: [true, true, true, true, true, true, true, true, true]
};
},
recalcAllColors: function()
{
this.recalcInfo =
{
recalculateContent: true,
recalculateBrush: true,
recalculatePen: true,
recalculateStyle: true,
recalculateFill: true,
recalculateLine: true
};
if(this.txBody)
{
this.txBody.recalcColors();
}
},
Get_Id: function()
{
return this.Id;
......
......@@ -992,6 +992,19 @@ Slide.prototype =
}
},
recalcAllColors: function()
{
this.recalcInfo =
{
recalculateBackground: true,
recalculateSpTree: true
};
for(var i = 0; i < this.cSld.spTree.length; ++i)
{
this.cSld.spTree[i].recalcAllColors();
}
},
Get_Id: function()
{
return this.Id;
......@@ -1522,12 +1535,13 @@ Slide.prototype =
}
};
function PropLocker()
function PropLocker(objectId)
{
this.Lock = new CLock();
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
this.objectId = objectId;
}
......
......@@ -128,6 +128,11 @@ CTextBody.prototype =
},
recalcColors: function()
{
this.content.recalcColors();
},
recalculateBodyPr: function()
{
if(this.recalcInfo.recalculateBodyPr)
......
......@@ -711,6 +711,7 @@ CGraphicObjects.prototype = {
}
}
editor.sync_slidePropCallback(this.slide);
if(this.State.id === STATES_ID_TEXT_ADD || this.State.id === STATES_ID_TEXT_ADD_IN_GROUP)
{
......@@ -1110,14 +1111,14 @@ CGraphicObjects.prototype = {
if(this.State.id === STATES_ID_TEXT_ADD)
{
if(typeof this.State.textObject.setTextVerticalAlign === "function")
this.State.textObject.GraphicObj.setTextVerticalAlign(properties.verticalTextAlign);
if(typeof this.State.textObject.setVerticalAlign === "function")
this.State.textObject.setVerticalAlign(properties.verticalTextAlign);
}
if(this.State.id === STATES_ID_TEXT_ADD_IN_GROUP)
{
if(typeof this.State.setTextVerticalAlign === "function")
this.State.textObject.setTextVerticalAlign(properties.verticalTextAlign);
if(typeof this.State.setVerticalAlign === "function")
this.State.textObject.setVerticalAlign(properties.verticalTextAlign);
}
}
if(this.State.id !==STATES_ID_GROUP && this.State.id !==STATES_ID_TEXT_ADD_IN_GROUP && isRealNumber(properties.w) && isRealNumber(properties.h))
......@@ -1428,8 +1429,8 @@ CGraphicObjects.prototype = {
{
this.State.onMouseUp(e, x, y);
this.slide.presentation.Document_UpdateInterfaceState();
if(this.State.id === STATES_ID_NULL)
{
/* if(this.State.id === STATES_ID_NULL)
{ */
if(this.selectedObjects.length > 0)
{
var _data = new CContextMenuData();
......@@ -1438,7 +1439,7 @@ CGraphicObjects.prototype = {
_data.Y_abs = e.Y;
editor.sync_ContextMenuCallback(_data);
}
}
//}
},
updateCursorType: function(e, x, y)
......
......@@ -241,14 +241,25 @@ asc_docs_api.prototype._coAuthoringInit = function (docId, user) {
// Выставляем ID пользователя, залочившего данный элемент
Lock.Set_UserId( e["user"] );
/* if ( Class instanceof CHeaderFooterController )
editor.sync_LockHeaderFooters();
else if ( Class instanceof CDocument )
editor.sync_LockDocumentProps();
else if ( Class instanceof CComment )
editor.sync_LockComment(Class.Get_Id(), e["user"]);
else if ( Class instanceof CGraphicObjects )
editor.sync_LockDocumentSchema(); */
if ( Class instanceof PropLocker )
{
var object = g_oTableId.Get_ById(Class.objectId);
if(object instanceof CPresentation)
{
if(Class === editor.WordControl.m_oLogicDocument.themeLock)
{
editor.asc_fireCallback("asc_onLockDocumentTheme");
}
else if(Class === editor.WordControl.m_oLogicDocument.schemeLock)
{
editor.asc_fireCallback("asc_onLockDocumentSchema");
}
else if(Class === editor.WordControl.m_oLogicDocument.slideSizeLock)
{
editor.asc_fireCallback("asc_onLockDocumentProps");
}
}
}
// TODO: Здесь для ускорения надо сделать проверку, является ли текущим элемент с
// заданным Id. Если нет, тогда и не надо обновлять состояние.
......@@ -691,7 +702,7 @@ asc_docs_api.prototype.LoadDocument = function(c_DocInfo)
this.DocInfo.put_OfflineApp(true);
// For test create unique id
documentId = "qwerty123";
documentId = "safsfsdfsdfsdfsdf3";
this.OfflineAppDocumentStartLoad();
this.sync_zoomChangeCallback(this.WordControl.m_nZoomValue, this.WordControl.m_nZoomType);
......@@ -2054,6 +2065,12 @@ asc_docs_api.prototype.sync_PrPropCallback = function(prProp){
this.SelectedObjectsStack[this.SelectedObjectsStack.length] = new CSelectedObject( c_oAscTypeSelectElement.Paragraph, new CParagraphProp( prProp ) );
}
asc_docs_api.prototype.SetDrawImagePlaceParagraph = function(element_id, props)
{
this.WordControl.m_oDrawingDocument.InitGuiCanvasTextProps(element_id);
this.WordControl.m_oDrawingDocument.DrawGuiCanvasTextProps(props);
}
/*----------------------------------------------------------------*/
/*functions for working with page*/
asc_docs_api.prototype.change_PageOrient = function(isPortrait)
......
This diff is collapsed.
......@@ -1772,8 +1772,6 @@ $(document).ready(function(){
NewElement.style.backgroundColor = "red";
NewElement.style.zIndex = 100;
if ( Data.LockedObjectType === c_oAscMouseMoveLockedObjectType.Footer )
sTop = (Y - 20) + "px";
NewElement.style.top = sTop;
NewElement.style.left = sLeft;
......
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