Commit 04086d88 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander.Trofimov

git-svn-id:...

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49092 954022d7-b5bf-4e40-9824-e11837661b57
parent 0550276b
......@@ -942,6 +942,7 @@ function CDrawingDocument()
this.m_oLogicDocument = null;
this.SlidesCount = 0;
this.IsEmptyPresentation = false;
this.SlideCurrent = -1;
this.SlideCurrectRect = new CDrawingPage();
......@@ -2757,6 +2758,8 @@ function CThumbnailsManager()
this.const_offsetX = 0;
this.const_border_w = 4;
this.bIsEmptyDrawed = false;
this.m_oCacheManager = new CCacheManager();
this.FocusObjType = FOCUS_OBJECT_MAIN;
......@@ -3680,9 +3683,27 @@ function CThumbnailsManager()
this.onCheckUpdate = function()
{
if (!this.m_bIsVisible || this.m_lDrawingFirst == -1 || this.m_lDrawingEnd == -1)
if (!this.m_bIsVisible)
return;
if (this.m_lDrawingFirst == -1 || this.m_lDrawingEnd == -1)
{
if (this.m_oWordControl.m_oDrawingDocument.IsEmptyPresentation)
{
if (!this.bIsEmptyDrawed)
{
this.bIsEmptyDrawed = true;
this.OnPaint();
}
return;
}
this.bIsEmptyDrawed = false;
return;
}
this.bIsEmptyDrawed = false;
if (!this.m_bIsUpdate)
{
// определяем, нужно ли пересчитать и закэшировать табнейл (хотя бы один)
......@@ -3903,13 +3924,21 @@ function CThumbnailsManager()
case 46:
{
var _delete_array = this.GetSelectedArray();
if (_delete_array.length == this.m_oWordControl.m_oDrawingDocument.SlidesCount)
_delete_array.splice(0, 1);
if (!this.m_oWordControl.m_oApi.IsSupportEmptyPresentation)
{
if (_delete_array.length == this.m_oWordControl.m_oDrawingDocument.SlidesCount)
_delete_array.splice(0, 1);
}
if (_delete_array.length != 0)
{
this.m_oWordControl.m_oLogicDocument.deleteSlides(_delete_array);
}
if (0 == this.m_oWordControl.m_oLogicDocument.Slides.length)
this.m_bIsUpdate = true;
break;
}
case 34: //PgDown
......@@ -4432,8 +4461,14 @@ function CSlideDrawer()
this.BoundsChecker = new CSlideBoundsChecker();
this.bIsEmptyPresentation = false;
this.CheckSlide = function(slideNum)
{
this.bIsEmptyPresentation = false;
if (-1 == slideNum)
this.bIsEmptyPresentation = true;
var dKoef = this.m_oWordControl.m_nZoomValue * g_dKoef_mm_to_pix / 100;
var w_mm = this.m_oWordControl.m_oLogicDocument.Width;
var h_mm = this.m_oWordControl.m_oLogicDocument.Height;
......@@ -4443,6 +4478,18 @@ function CSlideDrawer()
this.BoundsChecker.init(w_px, h_px, w_mm, h_mm);
this.BoundsChecker.transform(1,0,0,1,0,0);
if (this.bIsEmptyPresentation)
{
this.BoundsChecker._s();
this.BoundsChecker._m(0, 0);
this.BoundsChecker._l(w_mm, 0);
this.BoundsChecker._l(w_mm, h_mm);
this.BoundsChecker._l(0, h_mm);
this.BoundsChecker._z();
return;
}
this.m_oWordControl.m_oLogicDocument.DrawPage(slideNum, this.BoundsChecker);
// теперь смотрим, используем ли кэш для скролла
......@@ -4513,6 +4560,23 @@ function CSlideDrawer()
var _bounds = this.BoundsChecker.Bounds;
var _x = _rect.left + _bounds.min_x;
var _y = _rect.top + _bounds.min_y;
if (this.bIsEmptyPresentation)
{
var w_px = _bounds.max_x - _bounds.min_x + 1;
var h_px = _bounds.max_y - _bounds.min_y + 1;
outputCtx.lineWidth = 1;
outputCtx.strokeStyle = "#000000";
outputCtx.beginPath();
this.m_oWordControl.m_oDrawingDocument.AutoShapesTrack.AddRectDashClever(outputCtx, _x >> 0, _y >> 0, (_x + w_px) >> 0, (_y + h_px) >> 0, 2, 2);
outputCtx.stroke();
outputCtx.beginPath();
return;
}
if (this.IsCached)
{
var w_px = _bounds.max_x - _bounds.min_x + 1;
......
......@@ -677,7 +677,8 @@ function CEditorPage(api)
oWordControl.m_bIsRePaintOnScroll = true;
oWordControl.OnScroll();
oWordControl.m_oLogicDocument.Document_UpdateInterfaceState();
if (!oWordControl.m_oDrawingDocument.IsEmptyPresentation)
oWordControl.m_oLogicDocument.Document_UpdateInterfaceState();
}
this.zoom_Out = function()
......@@ -1308,6 +1309,12 @@ function CEditorPage(api)
{
global_mouseEvent.Button = 0;
oWordControl.m_bIsMouseLock = true;
if (oWordControl.m_oDrawingDocument.IsEmptyPresentation)
{
oWordControl.m_oLogicDocument.addNextSlide();
return;
}
}
if ((0 == global_mouseEvent.Button) || (undefined == global_mouseEvent.Button) || (2 == global_mouseEvent.Button))
......@@ -1351,6 +1358,9 @@ function CEditorPage(api)
if (oWordControl.DemonstrationManager.Mode)
return false;
if (oWordControl.m_oDrawingDocument.IsEmptyPresentation)
return;
check_MouseMoveEvent(e);
var pos = oWordControl.m_oDrawingDocument.ConvertCoordsFromCursor2(global_mouseEvent.X, global_mouseEvent.Y);
if (pos.Page == -1)
......@@ -1371,6 +1381,9 @@ function CEditorPage(api)
if (pos.Page == -1)
return;
if (oWordControl.m_oDrawingDocument.IsEmptyPresentation)
return;
oWordControl.m_oLogicDocument.OnMouseMove(global_mouseEvent, pos.X, pos.Y, pos.Page);
}
this.onMouseUp = function(e, bIsWindow)
......@@ -1392,6 +1405,10 @@ function CEditorPage(api)
}
check_MouseUpEvent(e);
if (oWordControl.m_oDrawingDocument.IsEmptyPresentation)
return;
var pos = oWordControl.m_oDrawingDocument.ConvertCoordsFromCursor2(global_mouseEvent.X, global_mouseEvent.Y);
if (pos.Page == -1)
return;
......@@ -1450,6 +1467,9 @@ function CEditorPage(api)
global_mouseEvent.IsPressed = false;
if (oWordControl.m_oDrawingDocument.IsEmptyPresentation)
return;
//---
var pos = oWordControl.m_oDrawingDocument.ConvertCoordsFromCursor2(global_mouseEvent.X, global_mouseEvent.Y);
if (pos.Page == -1)
......@@ -1677,36 +1697,44 @@ function CEditorPage(api)
if (0 != this.MainScrollsEnabledFlag)
return;
if (this.StartVerticalScroll)
if (!this.m_oDrawingDocument.IsEmptyPresentation)
{
this.VerticalScrollOnMouseUp.ScrollY = scrollPositionY;
this.VerticalScrollOnMouseUp.ScrollY_max = maxY;
if (this.StartVerticalScroll)
{
this.VerticalScrollOnMouseUp.ScrollY = scrollPositionY;
this.VerticalScrollOnMouseUp.ScrollY_max = maxY;
this.VerticalScrollOnMouseUp.SlideNum = (scrollPositionY * this.m_oDrawingDocument.SlidesCount / Math.max(1, maxY)) >> 0;
if (this.VerticalScrollOnMouseUp.SlideNum >= this.m_oDrawingDocument.SlidesCount)
this.VerticalScrollOnMouseUp.SlideNum = this.m_oDrawingDocument.SlidesCount - 1;
this.VerticalScrollOnMouseUp.SlideNum = (scrollPositionY * this.m_oDrawingDocument.SlidesCount / Math.max(1, maxY)) >> 0;
if (this.VerticalScrollOnMouseUp.SlideNum >= this.m_oDrawingDocument.SlidesCount)
this.VerticalScrollOnMouseUp.SlideNum = this.m_oDrawingDocument.SlidesCount - 1;
this.m_oApi.asc_fireCallback("asc_onPaintSlideNum", this.VerticalScrollOnMouseUp.SlideNum);
return;
}
this.m_oApi.asc_fireCallback("asc_onPaintSlideNum", this.VerticalScrollOnMouseUp.SlideNum);
return;
}
var lNumSlide = ((scrollPositionY / this.m_dDocumentPageHeight) + 0.1) >> 0; // 0.1 - ошибка округления!!
if (lNumSlide != this.m_oDrawingDocument.SlideCurrent)
{
if (this.IsGoToPageMAXPosition)
var lNumSlide = ((scrollPositionY / this.m_dDocumentPageHeight) + 0.1) >> 0; // 0.1 - ошибка округления!!
if (lNumSlide != this.m_oDrawingDocument.SlideCurrent)
{
if (lNumSlide >= this.m_oDrawingDocument.SlideCurrent)
this.IsGoToPageMAXPosition = false;
}
if (this.IsGoToPageMAXPosition)
{
if (lNumSlide >= this.m_oDrawingDocument.SlideCurrent)
this.IsGoToPageMAXPosition = false;
}
this.GoToPage(lNumSlide);
return;
this.GoToPage(lNumSlide);
return;
}
else if (this.SlideScrollMAX < scrollPositionY)
{
this.IsGoToPageMAXPosition = false;
this.GoToPage(this.m_oDrawingDocument.SlideCurrent + 1);
return;
}
}
else if (this.SlideScrollMAX < scrollPositionY)
else
{
this.IsGoToPageMAXPosition = false;
this.GoToPage(this.m_oDrawingDocument.SlideCurrent + 1);
return;
if (this.StartVerticalScroll)
return;
}
var oWordControl = oThis;
......@@ -1725,6 +1753,13 @@ function CEditorPage(api)
if (0 != this.MainScrollsEnabledFlag || !this.StartVerticalScroll)
return;
if (this.m_oDrawingDocument.IsEmptyPresentation)
{
this.StartVerticalScroll = false;
this.m_oScrollVerApi.scrollByY(0, false);
return;
}
if (this.VerticalScrollOnMouseUp.SlideNum != this.m_oDrawingDocument.SlideCurrent)
this.GoToPage(this.VerticalScrollOnMouseUp.SlideNum);
else
......@@ -2140,7 +2175,7 @@ function CEditorPage(api)
ctx.globalAlpha = 1.0;
ctx = null;
if (this.m_oLogicDocument != null)
if (this.m_oLogicDocument != null && drDoc.SlideCurrent >= 0)
{
this.m_oLogicDocument.Slides[drDoc.SlideCurrent].drawSelect();
......@@ -2311,6 +2346,9 @@ function CEditorPage(api)
this.m_dDocumentWidth = one_slide_width;
this.m_dDocumentHeight = (one_slide_height * this.m_oDrawingDocument.SlidesCount) >> 0;
if (0 == this.m_oDrawingDocument.SlidesCount)
this.m_dDocumentHeight = one_slide_height >> 0;
if (!bIsAttack && this.OldDocumentWidth == this.m_dDocumentWidth && this.OldDocumentHeight == this.m_dDocumentHeight)
{
/*
......@@ -2328,6 +2366,12 @@ function CEditorPage(api)
this.SlideScrollMIN = this.m_oDrawingDocument.SlideCurrent * one_slide_height;
this.SlideScrollMAX = this.SlideScrollMIN + one_slide_height - this.m_oEditor.HtmlElement.height;
if (0 == this.m_oDrawingDocument.SlidesCount)
{
this.SlideScrollMIN = 0;
this.SlideScrollMAX = this.SlideScrollMIN + one_slide_height - this.m_oEditor.HtmlElement.height;
}
// теперь проверим необходимость перезуммирования
if (1 == this.m_nZoomType)
{
......@@ -2604,7 +2648,14 @@ function CEditorPage(api)
this.GoToPage = function(lPageNum)
{
var drDoc = this.m_oDrawingDocument;
if (lPageNum < 0 || lPageNum >= drDoc.SlidesCount)
this.m_oDrawingDocument.IsEmptyPresentation = false;
if (-1 == lPageNum)
{
this.m_oDrawingDocument.IsEmptyPresentation = true;
}
if (lPageNum != -1 && (lPageNum < 0 || lPageNum >= drDoc.SlidesCount))
return;
this.Thumbnails.LockMainObjType = true;
......
......@@ -1202,7 +1202,7 @@ CGradFill.prototype =
function CPattFill()
{
this.type = FILL_TYPE_PATT;
this.ftype = "";
this.ftype = 0;
this.fgClr = new CUniColor();
this.bgClr = new CUniColor();
}
......
......@@ -7592,6 +7592,12 @@ CPresentation.prototype = {
Set_CurPage : function(PageNum)
{
if (-1 == PageNum)
{
this.CurPage = -1;
return;
}
var oldCurPage = this.CurPage;
this.CurPage = Math.min( this.Slides.length - 1, Math.max( 0, PageNum ) );
if(oldCurPage != this.CurPage && this.CurPage < this.Slides.length)
......
......@@ -44,6 +44,8 @@ function asc_docs_api(name)
this.DocumentUrl = "";
this.DocumentName = "";
this.DocInfo = null;
this.IsSupportEmptyPresentation = true;
this.ShowParaMarks = false;
this.isAddSpaceBetweenPrg = false;
......@@ -3298,8 +3300,12 @@ asc_docs_api.prototype.AddSlide = function(layoutIndex)
asc_docs_api.prototype.DeleteSlide = function()
{
var _delete_array = this.WordControl.Thumbnails.GetSelectedArray();
if (_delete_array.length == this.WordControl.m_oDrawingDocument.SlidesCount)
_delete_array.splice(0, 1);
if (!this.IsSupportEmptyPresentation)
{
if (_delete_array.length == this.WordControl.m_oDrawingDocument.SlidesCount)
_delete_array.splice(0, 1);
}
if (_delete_array.length != 0)
{
......
......@@ -394,9 +394,46 @@ function CAscFillSolid()
{
this.color = new CAscColor();
}
CAscFillSolid.prototype.get_color = function(){return this.color}
CAscFillSolid.prototype.get_color = function(){return this.color;}
CAscFillSolid.prototype.put_color = function(v){this.color = v;}
function CAscFillHatch()
{
this.PatternType = 0;
this.fgClr = new CAscColor();
this.bgClr = new CAscColor();
}
CAscFillHatch.prototype.get_pattern_type = function(){return this.PatternType;}
CAscFillHatch.prototype.put_pattern_type = function(v){this.PatternType = v;}
CAscFillHatch.prototype.get_color_fg = function(){return this.fgClr;}
CAscFillHatch.prototype.put_color_fg = function(v){this.fgClr = v;}
CAscFillHatch.prototype.get_color_bg = function(){return this.bgClr;}
CAscFillHatch.prototype.put_color_bg = function(v){this.bgClr = v;}
function CAscFillGrad()
{
this.Colors = new Array();
this.Positions = new Array();
this.GradType = 0;
this.LinearAngle = 0;
this.LinearScale = true;
this.PathType = 0;
}
CAscFillGrad.prototype.get_colors = function(){return this.Colors;}
CAscFillGrad.prototype.put_colors = function(v){this.Colors = v;}
CAscFillGrad.prototype.get_positions = function(){return this.Positions;}
CAscFillGrad.prototype.put_positions = function(v){this.Positions = v;}
CAscFillGrad.prototype.get_grad_type = function(){return this.GradType;}
CAscFillGrad.prototype.put_grad_type = function(v){this.GradType = v;}
CAscFillGrad.prototype.get_linear_angle = function(){return this.LinearAngle;}
CAscFillGrad.prototype.put_linear_angle = function(v){this.LinearAngle = v;}
CAscFillGrad.prototype.get_linear_scale = function(){return this.LinearScale;}
CAscFillGrad.prototype.put_linear_scale = function(v){this.LinearScale = v;}
CAscFillGrad.prototype.get_path_type = function(){return this.PathType;}
CAscFillGrad.prototype.put_path_type = function(v){this.PathType = v;}
function CAscFill()
{
this.type = null;
......@@ -430,18 +467,36 @@ function CreateAscFill(unifill)
}
case FILL_TYPE_PATT:
{
ret.type = c_oAscFill.FILL_TYPE_SOLID;
ret.fill = new CAscFillSolid();
ret.fill.color = CreateAscColor(_fill.fgClr);
ret.type = c_oAscFill.FILL_TYPE_PATT;
ret.fill = new CAscFillHatch();
ret.fill.PatternType = _fill.ftype;
ret.fill.fgClr = CreateAscColor(_fill.fgClr);
ret.fill.bgClr = CreateAscColor(_fill.bgClr);
break;
}
case FILL_TYPE_GRAD:
{
ret.type = c_oAscFill.FILL_TYPE_SOLID;
ret.fill = new CAscFillSolid();
ret.type = c_oAscFill.FILL_TYPE_GRAD;
ret.fill = new CAscFillGrad();
for (var i = 0; i < _fill.colors.length; i++)
{
ret.fill.Colors.push(CreateAscColor(_fill.colors[i].color));
ret.fill.Positions.push(_fill.colors[i].pos);
}
if (_fill.lin)
{
ret.fill.GradType = c_oAscFillGradType.GRAD_LINEAR;
ret.fill.LinearAngle = _fill.lin.angle;
ret.fill.LinearScale = _fill.lin.scale;
}
else
{
ret.fill.GradType = c_oAscFillGradType.GRAD_PATH;
ret.fill.PathType = 0;
}
if (_fill.colors.length > 0)
ret.fill.color = CreateAscColor(_fill.colors[0].color);
break;
}
case FILL_TYPE_BLIP:
......@@ -509,6 +564,76 @@ function CorrectUniFill(asc_fill, unifill)
break;
}
case c_oAscFill.FILL_TYPE_PATT:
{
if (ret.fill == null || ret.fill.type != FILL_TYPE_PATT)
{
ret.fill = new CPattFill();
}
if (undefined != _fill.PatternType)
{
ret.ftype = _fill.PatternType;
}
if (undefined != _fill.fgClr)
{
ret.fill.fgClr = CorrectUniColor(_fill.get_color_fg(), ret.fill.fgClr);
}
if (undefined != _fill.bgClr)
{
ret.fill.bgClr = CorrectUniColor(_fill.get_color_bg(), ret.fill.bgClr);
}
break;
}
case c_oAscFill.FILL_TYPE_GRAD:
{
if (ret.fill == null || ret.fill.type != FILL_TYPE_GRAD)
{
ret.fill = new CGradFill();
}
var _colors = _fill.get_colors();
var _positions = _fill.get_positions();
if (undefined != _colors && undefined != _positions)
{
if (_colors.length == _positions.length)
{
ret.fill.colors.splice(0, ret.fill.colors.length);
for (var i = 0; i < _colors.length; i++)
{
var _gs = new CGs();
_gs.color = CorrectUniColor(_colors[i], _gs.color);
_gs.pos = _positions[i];
ret.fill.colors.push(_gs);
}
}
}
var _grad_type = _fill.get_grad_type();
if (c_oAscFillGradType.GRAD_LINEAR == _grad_type)
{
var _angle = _fill.get_linear_angle();
var _scale = _fill.get_linear_scale();
if (!ret.fill.lin)
ret.fill.lin = new GradLin();
if (undefined != _angle)
ret.fill.lin.angle = _angle;
if (undefined != _scale)
ret.fill.lin.scale = _scale;
}
else if (c_oAscFillGradType.GRAD_PATH == _grad_type)
{
ret.fill.lin = null;
ret.fill.path = new GradPath();
}
break;
}
default:
{
if (ret.fill == null || ret.fill.type != FILL_TYPE_SOLID)
......
......@@ -202,7 +202,14 @@ var c_oAscColor = {
var c_oAscFill = {
FILL_TYPE_BLIP : 1,
FILL_TYPE_NOFILL : 2,
FILL_TYPE_SOLID : 3
FILL_TYPE_SOLID : 3,
FILL_TYPE_PATT : 4,
FILL_TYPE_GRAD : 5
};
var c_oAscFillGradType = {
GRAD_LINEAR : 1,
GRAD_PATH : 2
};
var c_oAscFillBlipType = {
......
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