Commit 67b11d9e authored by Oleg Korshul's avatar Oleg Korshul

paste on viewer

parent 7b080386
...@@ -33,7 +33,11 @@ ...@@ -33,7 +33,11 @@
(function (window, undefined){ (function (window, undefined){
/**
* CDrawingDocContent
* @constructor
* @extends {CDocumentContent}
*/
function CDrawingDocContent(Parent, DrawingDocument, X, Y, XLimit, YLimit) { function CDrawingDocContent(Parent, DrawingDocument, X, Y, XLimit, YLimit) {
CDrawingDocContent.superclass.constructor.call(this, Parent, DrawingDocument, X, Y, XLimit, YLimit, false, false, true); CDrawingDocContent.superclass.constructor.call(this, Parent, DrawingDocument, X, Y, XLimit, YLimit, false, false, true);
this.FullRecalc = new CDocumentRecalculateState(); this.FullRecalc = new CDocumentRecalculateState();
...@@ -558,12 +562,11 @@ ...@@ -558,12 +562,11 @@
CDrawingDocContent.prototype.private_GetElementPageIndexByXY = function(ElementPos, X, Y, PageIndex){ CDrawingDocContent.prototype.private_GetElementPageIndexByXY = function(ElementPos, X, Y, PageIndex){
if(this.Pages.length > 0){ if(this.Pages.length > 0){
if(this.Pages[0].Sections.length > 0){ if(this.Pages[0].Sections.length > 0){
return CDocument.prototype.private_GetElementPageIndexByXY.call(this, ElementPos, X, Y, PageIndex); return CDocument_prototype_private_GetElementPageIndexByXY.call(this, ElementPos, X, Y, PageIndex);
} }
} }
return CDocumentContent.prototype.private_GetElementPageIndexByXY.call(this, ElementPos, X, Y, PageIndex); return CDocumentContent.prototype.private_GetElementPageIndexByXY.call(this, ElementPos, X, Y, PageIndex);
}; };
CDrawingDocContent.prototype.Copy = function(Parent, DrawingDocument) CDrawingDocContent.prototype.Copy = function(Parent, DrawingDocument)
{ {
var DC = new CDrawingDocContent(Parent, DrawingDocument ? DrawingDocument : this.DrawingDocument, 0, 0, 0, 0, this.Split, this.TurnOffInnerWrap, this.bPresentation); var DC = new CDrawingDocContent(Parent, DrawingDocument ? DrawingDocument : this.DrawingDocument, 0, 0, 0, 0, this.Split, this.TurnOffInnerWrap, this.bPresentation);
...@@ -594,5 +597,65 @@ ...@@ -594,5 +597,65 @@
return DC; return DC;
}; };
// TODO: сделать по-нормальному!!!
function CDocument_prototype_private_GetElementPageIndexByXY(ElementPos, X, Y, PageIndex)
{
var Element = this.Content[ElementPos];
if (!Element)
return 0;
var Page = this.Pages[PageIndex];
if (!Page)
return 0;
var PageSection = null;
for (var SectionIndex = 0, SectionsCount = Page.Sections.length; SectionIndex < SectionsCount; ++SectionIndex)
{
if (Page.Sections[SectionIndex].Pos <= ElementPos && ElementPos <= Page.Sections[SectionIndex].EndPos)
{
PageSection = Page.Sections[SectionIndex];
break;
}
}
if (!PageSection)
return 0;
var ElementStartPage = Element.Get_StartPage_Relative();
var ElementStartColumn = Element.Get_StartColumn();
var ElementPagesCount = Element.Get_PagesCount();
var ColumnsCount = PageSection.Columns.length;
var StartColumn = 0;
var EndColumn = ColumnsCount - 1;
if (PageIndex === ElementStartPage)
{
StartColumn = Element.Get_StartColumn();
EndColumn = Math.min(ElementStartColumn + ElementPagesCount - 1, ColumnsCount - 1);
}
else
{
StartColumn = 0;
EndColumn = Math.min(ElementPagesCount - ElementStartColumn + (PageIndex - ElementStartPage) * ColumnsCount, ColumnsCount - 1);
}
// TODO: Разобраться с ситуацией, когда пустые колонки стоят не только в конце
while (true === PageSection.Columns[EndColumn].Empty && EndColumn > StartColumn)
EndColumn--;
var ResultColumn = EndColumn;
for (var ColumnIndex = StartColumn; ColumnIndex < EndColumn; ++ColumnIndex)
{
if (X < (PageSection.Columns[ColumnIndex].XLimit + PageSection.Columns[ColumnIndex + 1].X) / 2)
{
ResultColumn = ColumnIndex;
break;
}
}
return this.private_GetElementPageIndex(ElementPos, PageIndex, ResultColumn, ColumnsCount);
}
AscFormat.CDrawingDocContent = CDrawingDocContent; AscFormat.CDrawingDocContent = CDrawingDocContent;
})(window); })(window);
\ No newline at end of file
...@@ -1919,6 +1919,9 @@ background-repeat: no-repeat;\ ...@@ -1919,6 +1919,9 @@ background-repeat: no-repeat;\
asc_docs_api.prototype.asc_PasteData = function(_format, data1, data2) asc_docs_api.prototype.asc_PasteData = function(_format, data1, data2)
{ {
if (this.getViewMode())
return;
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_PasteHotKey); this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_PasteHotKey);
switch (_format) switch (_format)
{ {
......
...@@ -1952,7 +1952,7 @@ function CDrawingDocument() ...@@ -1952,7 +1952,7 @@ function CDrawingDocument()
{ {
// Пути указаны относительно html в меню, не надо их исправлять // Пути указаны относительно html в меню, не надо их исправлять
// и коммитить на пути относительно тестового меню // и коммитить на пути относительно тестового меню
this.cursorMarkerFormat = "url(../../../sdk/Common/Images/marker_format.cur), pointer"; this.cursorMarkerFormat = "url(../../../../sdkjs/common/Images/marker_format.cur), pointer";
} }
else if (window.opera) else if (window.opera)
{ {
......
...@@ -1970,6 +1970,9 @@ background-repeat: no-repeat;\ ...@@ -1970,6 +1970,9 @@ background-repeat: no-repeat;\
asc_docs_api.prototype.asc_PasteData = function(_format, data1, data2) asc_docs_api.prototype.asc_PasteData = function(_format, data1, data2)
{ {
if (AscCommon.CollaborativeEditing.m_bGlobalLock)
return;
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_PasteHotKey); this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_PasteHotKey);
switch (_format) switch (_format)
{ {
......
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