Commit 6f793057 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@55766 954022d7-b5bf-4e40-9824-e11837661b57
parent b12ce00c
...@@ -36,11 +36,6 @@ function CGraphicObjects(document, drawingDocument, api, documentContent) ...@@ -36,11 +36,6 @@ function CGraphicObjects(document, drawingDocument, api, documentContent)
this.drawingObjects = []; this.drawingObjects = [];
this.objectsMap = {}; this.objectsMap = {};
////header footer graphicObjects
this.firstPage = null;
this.evenPage = null;
this.oddPage = null;
this.urlMap = []; this.urlMap = [];
this.recalcMap = {}; this.recalcMap = {};
...@@ -60,46 +55,6 @@ function CGraphicObjects(document, drawingDocument, api, documentContent) ...@@ -60,46 +55,6 @@ function CGraphicObjects(document, drawingDocument, api, documentContent)
this.selectedObjects = []; this.selectedObjects = [];
this.headerFooter =
{
header:{
first: null,
even : null,
odd : null
},
footer: {
first: null,
even : null,
odd : null
},
commonFirst:
{
inlineObjects: [],
behindDocObjects: [],
wrappingObjects: [],
beforeTextObjects: [],
flowTables: []
},
commonEven:
{
inlineObjects: [],
behindDocObjects: [],
wrappingObjects: [],
beforeTextObjects: [],
flowTables: []
},
commonOdd:
{
inlineObjects: [],
behindDocObjects: [],
wrappingObjects: [],
beforeTextObjects: [],
flowTables: []
}
};
this.handleEventMode = HANDLE_EVENT_MODE_HANDLE; this.handleEventMode = HANDLE_EVENT_MODE_HANDLE;
...@@ -834,149 +789,32 @@ CGraphicObjects.prototype = ...@@ -834,149 +789,32 @@ CGraphicObjects.prototype =
addFloatTable: function(table) addFloatTable: function(table)
{ {
if(!this.graphicPages[table.PageNum + table.PageController])
{
this.graphicPages[table.PageNum + table.PageController] = new CGraphicPage(table.PageNum + table.PageController, this);
}
if(!table.Table.Parent.Is_HdrFtr()) if(!table.Table.Parent.Is_HdrFtr())
{ {
this.graphicPages[table.PageNum + table.PageController].addFloatTable(table); this.graphicPages[table.PageNum + table.PageController].addFloatTable(table);
} }
else else
{ {
var hdr_or_ftr = table.Table.Parent.Is_HdrFtr(true); this.graphicPages[table.PageNum + table.PageController].hdrFtrPage.addFloatTable(table);
return;
var hdr_ftr_controller_content = this.document.HdrFtr.Content[0];
var headers, footers;
headers = hdr_ftr_controller_content.Header;
footers = hdr_ftr_controller_content.Footer;
var hdr_footer_objects, common_hdr_footer_objects = [];
if(headers.First === hdr_or_ftr)
{
hdr_footer_objects = this.headerFooter.header.first;
common_hdr_footer_objects.push(this.headerFooter.commonFirst);
if(this.headerFooter.header.first === this.headerFooter.header.even)
common_hdr_footer_objects.push(this.headerFooter.commonEven);
if(this.headerFooter.header.first === this.headerFooter.header.odd)
common_hdr_footer_objects.push(this.headerFooter.commonOdd);
}
else if(footers.First === hdr_or_ftr)
{
hdr_footer_objects = this.headerFooter.footer.first;
common_hdr_footer_objects.push(this.headerFooter.commonFirst);
if(this.headerFooter.header.first === this.headerFooter.header.even)
common_hdr_footer_objects.push(this.headerFooter.commonEven);
if(this.headerFooter.header.first === this.headerFooter.header.odd)
common_hdr_footer_objects.push(this.headerFooter.commonOdd);
}
else if(headers.Even === hdr_or_ftr)
{
hdr_footer_objects = this.headerFooter.header.even;
common_hdr_footer_objects.push(this.headerFooter.commonEven);
if(this.headerFooter.header.even === this.headerFooter.header.first)
common_hdr_footer_objects.push(this.headerFooter.commonFirst);
if(this.headerFooter.header.even === this.headerFooter.header.odd)
common_hdr_footer_objects.push(this.headerFooter.commonOdd);
}
else if(footers.Even === hdr_or_ftr)
{
hdr_footer_objects = this.headerFooter.footer.even;
common_hdr_footer_objects.push(this.headerFooter.commonEven);
if(this.headerFooter.header.even === this.headerFooter.header.first)
common_hdr_footer_objects.push(this.headerFooter.commonFirst);
if(this.headerFooter.header.even === this.headerFooter.header.odd)
common_hdr_footer_objects.push(this.headerFooter.commonOdd);
}
else if(headers.Odd === hdr_or_ftr)
{
hdr_footer_objects = this.headerFooter.header.odd;
common_hdr_footer_objects.push(this.headerFooter.commonOdd);
if(this.headerFooter.header.odd === this.headerFooter.header.first)
common_hdr_footer_objects.push(this.headerFooter.commonFirst);
if(this.headerFooter.header.odd === this.headerFooter.header.even)
common_hdr_footer_objects.push(this.headerFooter.commonEven);
}
else if(footers.Odd === hdr_or_ftr)
{
hdr_footer_objects = this.headerFooter.footer.odd;
common_hdr_footer_objects.push(this.headerFooter.commonOdd);
if(this.headerFooter.header.odd === this.headerFooter.header.first)
common_hdr_footer_objects.push(this.headerFooter.commonFirst);
if(this.headerFooter.header.odd === this.headerFooter.header.even)
common_hdr_footer_objects.push(this.headerFooter.commonEven);
}
var i;
if(hdr_footer_objects != null)
{
hdr_footer_objects.floatTables.push(table);
for(i = 0; i < common_hdr_footer_objects.length; ++i)
common_hdr_footer_objects[i].flowTables.push(table);
}
} }
}, },
removeFloatTableById: function(pageIndex, id) removeFloatTableById: function(pageIndex, id)
{ {
if(!this.graphicPages[pageIndex])
{
this.graphicPages[pageIndex] = new CGraphicPage(pageIndex, this);
}
var table = g_oTableId.Get_ById(id); var table = g_oTableId.Get_ById(id);
if(!table.Parent.Is_HdrFtr()) if(!table.Parent.Is_HdrFtr())
this.graphicPages[pageIndex].removeFloatTableById(id); this.graphicPages[pageIndex].removeFloatTableById(id);
else else
{ {
var check_hdr_ftr_arrays = []; this.graphicPages[pageIndex].hdrFtrPage.removeFloatTableById(id);
if(pageIndex === 0)
{
check_hdr_ftr_arrays.push(this.headerFooter.header.first);
check_hdr_ftr_arrays.push(this.headerFooter.footer.first);
}
else
{
if(pageIndex % 2 === 1)
{
check_hdr_ftr_arrays.push(this.headerFooter.header.even);
check_hdr_ftr_arrays.push(this.headerFooter.footer.even);
}
else
{
check_hdr_ftr_arrays.push(this.headerFooter.header.odd);
check_hdr_ftr_arrays.push(this.headerFooter.footer.odd);
}
}
check_hdr_ftr_arrays.push(this.headerFooter.commonFirst);
check_hdr_ftr_arrays.push(this.headerFooter.commonEven);
check_hdr_ftr_arrays.push(this.headerFooter.commonOdd);
function findTableInArrayAndRemove(drawingArray, Id)
{
for(var i = drawingArray.length-1; i >-1; --i)
{
if(drawingArray[i].Table.Get_Id() === Id)
drawingArray.splice(i, 1);
}
}
function findInArrayAndRemoveFromDrawingPage(drawingPage, Id)
{
if(!drawingPage)
return;
if(Array.isArray(drawingPage.flowTables))
{
findTableInArrayAndRemove(drawingPage.flowTables, Id);
}
else if(Array.isArray(drawingPage.floatTables))
{
findTableInArrayAndRemove(drawingPage.floatTables, Id);
}
}
for(var i = 0; i < check_hdr_ftr_arrays.length; ++i)
{
findInArrayAndRemoveFromDrawingPage(check_hdr_ftr_arrays[i], id);
}
} }
}, },
...@@ -991,56 +829,14 @@ CGraphicObjects.prototype = ...@@ -991,56 +829,14 @@ CGraphicObjects.prototype =
getTableByXY: function(x, y, pageIndex, documentContent) getTableByXY: function(x, y, pageIndex, documentContent)
{ {
if(!documentContent.Is_HdrFtr()) if(!this.graphicPages[pageIndex])
return this.graphicPages[pageIndex].getTableByXY(x, y, documentContent);
var check_hdr_ftr_arrays = [];
if(pageIndex === 0)
{ {
check_hdr_ftr_arrays.push(this.headerFooter.header.first); this.graphicPages[pageIndex] = new CGraphicPage(pageIndex, this);
check_hdr_ftr_arrays.push(this.headerFooter.footer.first);
} }
if(!documentContent.Is_HdrFtr())
return this.graphicPages[pageIndex].getTableByXY(x, y, documentContent);
else else
{ return this.graphicPages[pageIndex].hdrFtrPage.getTableByXY(x, y, documentContent);
if(pageIndex % 2 === 1)
{
check_hdr_ftr_arrays.push(this.headerFooter.header.even);
check_hdr_ftr_arrays.push(this.headerFooter.footer.even);
}
else
{
check_hdr_ftr_arrays.push(this.headerFooter.header.odd);
check_hdr_ftr_arrays.push(this.headerFooter.footer.odd);
}
}
function findTableInArrayAndRemove(drawingArray, documentContent, x, y)
{
for(var i = drawingArray.length-1; i >-1; --i)
{
if(drawingArray[i].IsPointIn(x, y) && drawingArray[i].Table.Parent === documentContent)
return drawingArray[i];
}
return null;
}
function findInArrayAndRemoveFromDrawingPage(drawingPage, documentContent, x, y)
{
if(!drawingPage)
return null;
else if(Array.isArray(drawingPage.floatTables))
{
return findTableInArrayAndRemove(drawingPage.floatTables, documentContent, x, y);
}
}
var ret;
for(var i = 0; i < check_hdr_ftr_arrays.length; ++i)
{
ret = findInArrayAndRemoveFromDrawingPage(check_hdr_ftr_arrays[i], documentContent, x, y);
if(ret)
return ret;
}
return null; return null;
}, },
...@@ -1310,6 +1106,8 @@ CGraphicObjects.prototype = ...@@ -1310,6 +1106,8 @@ CGraphicObjects.prototype =
getAllFloatObjectsOnPage: function(pageIndex, docContent) getAllFloatObjectsOnPage: function(pageIndex, docContent)
{ {
if(!this.graphicPages[pageIndex])
this.graphicPages[pageIndex] = new CGraphicPage(pageIndex, this);
var arr, page, i, ret = []; var arr, page, i, ret = [];
if(!docContent.Is_HdrFtr()) if(!docContent.Is_HdrFtr())
{ {
...@@ -1318,22 +1116,7 @@ CGraphicObjects.prototype = ...@@ -1318,22 +1116,7 @@ CGraphicObjects.prototype =
} }
else else
{ {
if(pageIndex === 0) page = this.graphicPages[pageIndex].hdrFtrPage;
{
page = this.headerFooter.commonFirst;
}
else
{
if(pageIndex % 2 === 1)
{
page = this.headerFooter.commonEven;
}
else
{
page = this.headerFooter.commonOdd;
}
}
} }
arr = page.wrappingObjects.concat(page.behindDocObjects.concat(page.beforeTextObjects)); arr = page.wrappingObjects.concat(page.behindDocObjects.concat(page.beforeTextObjects));
for(i = 0; i < arr.length; ++i) for(i = 0; i < arr.length; ++i)
...@@ -1348,34 +1131,22 @@ CGraphicObjects.prototype = ...@@ -1348,34 +1131,22 @@ CGraphicObjects.prototype =
getAllFloatTablesOnPage: function(pageIndex, docContent) getAllFloatTablesOnPage: function(pageIndex, docContent)
{ {
if(!this.graphicPages[pageIndex])
this.graphicPages[pageIndex] = new CGraphicPage(pageIndex, this);
if(!docContent) if(!docContent)
{ {
docContent = this.document; docContent = this.document;
} }
var tables, page; var tables, page;
if(!docContent.Is_HdrFtr(false)) if(!docContent.Is_HdrFtr())
{ {
page = this.graphicPages[pageIndex]; page = this.graphicPages[pageIndex];
} }
else else
{ {
if(pageIndex === 0) page = this.graphicPages[pageIndex].hdrFtrPage;
{
page = this.headerFooter.commonFirst;
}
else
{
if(pageIndex % 2 === 1)
{
page = this.headerFooter.commonEven;
}
else
{
page = this.headerFooter.commonOdd;
}
}
} }
tables = page.flowTables; tables = page.flowTables;
var ret = []; var ret = [];
......
...@@ -39,6 +39,11 @@ CGraphicPage.prototype = ...@@ -39,6 +39,11 @@ CGraphicPage.prototype =
{ {
addFloatTable: function(table) addFloatTable: function(table)
{ {
for(var i = 0; i < this.flowTables.length; ++i)
{
if(this.flowTables[i] === table)
return;
}
this.flowTables.push(table); this.flowTables.push(table);
}, },
CheckRange: function(X0, Y0, X1, Y1, Y0sp, Y1Ssp, LeftField, RightField, HdrFtrRanges, docContent) CheckRange: function(X0, Y0, X1, Y1, Y0sp, Y1Ssp, LeftField, RightField, HdrFtrRanges, docContent)
......
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