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

картинки в колонтитулах

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55831 954022d7-b5bf-4e40-9824-e11837661b57
parent c28f1fd8
......@@ -1877,10 +1877,7 @@ CDocument.prototype =
if ( section_borders_ZOrderBack === SectPr.Get_Borders_ZOrder() )
this.Draw_Borders(pGraphics, SectPr);
this.DrawingObjects.drawBehindDocHdrFtr( nPageIndex, pGraphics );
this.DrawingObjects.drawWrappingObjectsHdrFtr( nPageIndex, pGraphics );
this.HdrFtr.Draw( nPageIndex, pGraphics );
this.DrawingObjects.drawBeforeObjectsHdrFtr( nPageIndex, pGraphics );
// Рисуем содержимое документа на данной странице
if ( docpostype_HdrFtr === this.CurPos.Type )
......
......@@ -562,17 +562,18 @@ CGraphicObjects.prototype =
addFloatTable: function(table)
{
if(!this.graphicPages[table.PageNum + table.PageController])
var hdr_ftr = table.Table.Parent.Is_HdrFtr(true);
if(!hdr_ftr)
{
this.graphicPages[table.PageNum + table.PageController] = new CGraphicPage(table.PageNum + table.PageController, this);
}
if(!table.Table.Parent.Is_HdrFtr())
{
this.graphicPages[table.PageNum + table.PageController].addFloatTable(table);
if(!this.graphicPages[table.PageNum + table.PageController])
{
this.graphicPages[table.PageNum + table.PageController] = new CGraphicPage(table.PageNum + table.PageController, this);
}
this.graphicPages[table.PageNum + table.PageController].hdrFtrPage.addFloatTable(table);
}
else
{
this.graphicPages[table.PageNum + table.PageController].hdrFtrPage.addFloatTable(table);
hdr_ftr.DrawingPage.addFloatTable(table);
}
},
......@@ -583,11 +584,17 @@ CGraphicObjects.prototype =
this.graphicPages[pageIndex] = new CGraphicPage(pageIndex, this);
}
var table = g_oTableId.Get_ById(id);
if(!table.Parent.Is_HdrFtr())
this.graphicPages[pageIndex].removeFloatTableById(id);
else
if(table)
{
this.graphicPages[pageIndex].hdrFtrPage.removeFloatTableById(id);
var hdr_ftr = table.Parent.Is_HdrFtr(true);
if(!hdr_ftr)
{
this.graphicPages[pageIndex].removeFloatTableById(id);
}
else
{
hdr_ftr.DrawingPage.removeFloatTableById(id);
}
}
},
......@@ -874,16 +881,30 @@ CGraphicObjects.prototype =
resetDrawingArrays : function(pageIndex, docContent)
{
if(isRealObject(this.graphicPages[pageIndex]))
var hdr_ftr = docContent.Is_HdrFtr(true);
if(!hdr_ftr)
{
if(!docContent || !docContent.Is_HdrFtr())
if(isRealObject(this.graphicPages[pageIndex]))
{
this.graphicPages[pageIndex].resetDrawingArrays(docContent);
else
this.graphicPages[pageIndex].hdrFtrPage.resetDrawingArrays(docContent);
}
}
else
{
hdr_ftr.DrawingPage.resetDrawingArrays(docContent);
}
},
mergeHdrFtrPages: function(page1, page2, pageIndex)
{
if(!isRealObject(this.graphicPages[pageIndex]))
this.graphicPages[pageIndex] = new CGraphicPage(pageIndex, this);
this.graphicPages[pageIndex].hdrFtrPage.clear();
this.graphicPages[pageIndex].hdrFtrPage.mergePages(page1, page2);
},
onEndRecalculateDocument: function(pagesCount)
{
for(var i = 0; i < pagesCount; ++i)
......@@ -1767,46 +1788,23 @@ CGraphicObjects.prototype =
addObjectOnPage: function(pageIndex, object)
{
if(!this.graphicPages[pageIndex])
var hdr_ftr = object.parent.DocumentContent.Is_HdrFtr(true);
if(!hdr_ftr)
{
this.graphicPages[pageIndex] = new CGraphicPage(pageIndex, this);
for(var z = 0; z < pageIndex; ++z)
if(!this.graphicPages[pageIndex])
{
if(!this.graphicPages[z])
this.graphicPages[z] = new CGraphicPage(z, this);
this.graphicPages[pageIndex] = new CGraphicPage(pageIndex, this);
for(var z = 0; z < pageIndex; ++z)
{
if(!this.graphicPages[z])
this.graphicPages[z] = new CGraphicPage(z, this);
}
}
this.graphicPages[pageIndex].addObject(object);
}
var page;
if(!object.parent.DocumentContent.Is_HdrFtr())
page = this.graphicPages[pageIndex];
else
page = this.graphicPages[pageIndex].hdrFtrPage;
var array_type = object.parent.getDrawingArrayType();
switch(array_type)
{
case DRAWING_ARRAY_TYPE_INLINE:
{
page.inlineObjects.push(object);
break;
}
case DRAWING_ARRAY_TYPE_BEHIND:
{
page.behindDocObjects.push(object);
page.behindDocObjects.sort(ComparisonByZIndexSimpleParent);
break;
}
case DRAWING_ARRAY_TYPE_BEFORE:
{
page.beforeTextObjects.push(object);
page.beforeTextObjects.sort(ComparisonByZIndexSimpleParent);
break;
}
case DRAWING_ARRAY_TYPE_WRAPPING:
{
page.wrappingObjects.push(object);
page.wrappingObjects.sort(ComparisonByZIndexSimpleParent);
break;
}
hdr_ftr.DrawingPage.addObject(object);
}
},
......@@ -2529,14 +2527,11 @@ CGraphicObjects.prototype =
if(isRealObject(object))
{
var hdr_ftr = object.DocumentContent.Is_HdrFtr(true);
//for(var i = 0; i < this.graphicPages.length; ++i)
var page = !hdr_ftr ? this.graphicPages[pageIndex] : hdr_ftr.DrawingPage;
if(isRealObject(page))
{
var page = !hdr_ftr ? this.graphicPages[pageIndex] : this.graphicPages[pageIndex] && this.graphicPages[pageIndex].hdrFtrPage;
if(isRealObject(page))
{
var array_type = object.getDrawingArrayType();
page.delObjectById(id, array_type);
}
var array_type = object.getDrawingArrayType();
page.delObjectById(id, array_type);
}
}
},
......
......@@ -46,6 +46,88 @@ CGraphicPage.prototype =
}
this.flowTables.push(table);
},
addObject: function(object)
{
var array_type = object.parent.getDrawingArrayType();
var drawing_array, need_sort = true;
switch(array_type)
{
case DRAWING_ARRAY_TYPE_INLINE:
{
drawing_array = this.inlineObjects;
need_sort = false;
break;
}
case DRAWING_ARRAY_TYPE_BEHIND:
{
drawing_array = this.behindDocObjects;
break;
}
case DRAWING_ARRAY_TYPE_BEFORE:
{
drawing_array = this.beforeTextObjects;
break;
}
case DRAWING_ARRAY_TYPE_WRAPPING:
{
drawing_array = this.wrappingObjects;
break;
}
}
if(Array.isArray(drawing_array))
{
for(var i = 0; i < drawing_array.length; ++i)
{
if(drawing_array[i] === object)
{
break;
}
}
if(i === drawing_array.length)
{
drawing_array.push(object);
if(need_sort)
{
drawing_array.sort(ComparisonByZIndexSimpleParent);
}
}
}
},
concatPage: function(page)
{
this.inlineObjects = this.inlineObjects.concat(page.inlineObjects);
this.behindDocObjects = this.behindDocObjects.concat(page.behindDocObjects);
this.wrappingObjects = this.wrappingObjects.concat(page.wrappingObjects);
this.beforeTextObjects = this.beforeTextObjects.concat(page.beforeTextObjects);
this.flowTables = this.flowTables.concat(page.flowTables);
},
mergePages: function(page1, page2)
{
if(page1)
{
this.concatPage(page1);
}
if(page2)
{
this.concatPage(page2);
}
this.behindDocObjects.sort(ComparisonByZIndexSimpleParent);
this.wrappingObjects.sort(ComparisonByZIndexSimpleParent);
this.beforeTextObjects.sort(ComparisonByZIndexSimpleParent);
},
clear: function()
{
this.inlineObjects = [];
this.behindDocObjects = [];
this.wrappingObjects = [];
this.beforeTextObjects = [];
this.flowTables = [];
},
CheckRange: function(X0, Y0, X1, Y1, Y0sp, Y1Ssp, LeftField, RightField, HdrFtrRanges, docContent)
{
return this.wrapManager.checkRanges(X0, Y0, X1, Y1, Y0sp, Y1Ssp, LeftField, RightField, HdrFtrRanges, docContent);
......@@ -249,14 +331,6 @@ CGraphicPage.prototype =
findInArrayAndRemove(drawingPage.beforeTextObjects, docContent, document);
findTableInArrayAndRemove(drawingPage.flowTables, docContent, document);
}
else if(Array.isArray(drawingPage.inlineArray))
{
findInArrayAndRemove(drawingPage.inlineArray, docContent, document);
findInArrayAndRemove(drawingPage.behindDocArray, docContent, document);
findInArrayAndRemove(drawingPage.wrappingArray, docContent, document);
findInArrayAndRemove(drawingPage.beforeTextArray, docContent, document);
findTableInArrayAndRemove(drawingPage.floatTables, docContent, document);
}
}
if(!isRealObject(docContent))
......@@ -265,6 +339,7 @@ CGraphicPage.prototype =
findInArrayAndRemoveFromDrawingPage(this, docContent, editor.WordControl.m_oLogicDocument);
},
draw: function(graphics)
{
for(var _object_index = 0; _object_index < this.inlineObjects.length; ++_object_index)
......
......@@ -47,6 +47,7 @@ function CHeaderFooter(Parent, LogicDocument, DrawingDocument, Type)
NeedRecalc : {}, // Объект с ключом - номером страницы, нужно ли пересчитывать данную страницу
SectPr : {} // Объект с ключом - номером страницы и полем - ссылкой на секцию
};
this.DrawingPage = new CGraphicPage(0, null);
// Добавляем данный класс в таблицу Id (обязательно в конце конструктора)
g_oTableId.Add( this, this.Id );
......@@ -145,7 +146,7 @@ CHeaderFooter.prototype =
// Если у нас до этого был какой-то пересчет, тогда сравним его с текущим.
// 1. Сравним границы: у верхнего колонтитула смотрим на изменение нижней границы, а нижнего - верхней
// 2. Сравним положение и размер Flow-объектов
if ( false === bChanges )
{
var NewBounds = this.Content.Get_PageBounds( 0 );
......@@ -215,7 +216,7 @@ CHeaderFooter.prototype =
var RecalcObj = this.RecalcInfo.RecalcObj[this.RecalcInfo.CurPage];
this.Content.Load_RecalculateObject( RecalcObj );
}
return bChanges;
},
......@@ -1234,6 +1235,8 @@ CHeaderFooterController.prototype =
return this.CurHdrFtr.RecalculateCurPos();
},
Recalculate : function(PageIndex)
{
// Определим четность страницы и является ли она первой в данной секции. Заметим, что четность страницы
......@@ -1253,10 +1256,6 @@ CHeaderFooterController.prototype =
this.Pages[PageIndex] = new CHdrFtrPage();
this.Pages[PageIndex].Header = Header;
this.Pages[PageIndex].Footer = Footer;
if(this.LogicDocument.DrawingObjects.graphicPages[PageIndex])
{
this.LogicDocument.DrawingObjects.graphicPages[PageIndex].hdrFtrPage.resetDrawingArrays(this.LogicDocument);
}
var X, XLimit;
var Orient = SectPr.Get_Orientation();
......@@ -1286,7 +1285,7 @@ CHeaderFooterController.prototype =
}
else
{
if ( -1 === Header.RecalcInfo.CurPage )
if ( -1 === Header.RecalcInfo.CurPage )
Header.Set_Page(PageIndex);
}
}
......@@ -1319,7 +1318,7 @@ CHeaderFooterController.prototype =
Footer.Set_Page(PageIndex);
}
}
if ( true === bRecalcHeader || true === bRecalcFooter )
return true;
......@@ -1331,12 +1330,19 @@ CHeaderFooterController.prototype =
{
var Header = this.Pages[nPageIndex].Header;
var Footer = this.Pages[nPageIndex].Footer;
this.LogicDocument.DrawingObjects.mergeHdrFtrPages(Header && Header.DrawingPage, Footer && Footer.DrawingPage, nPageIndex);
this.LogicDocument.DrawingObjects.drawBehindDocHdrFtr( nPageIndex, pGraphics );
this.LogicDocument.DrawingObjects.drawWrappingObjectsHdrFtr( nPageIndex, pGraphics );
if ( null !== Header )
Header.Draw( nPageIndex, pGraphics );
if ( null !== Footer )
Footer.Draw( nPageIndex, pGraphics );
this.LogicDocument.DrawingObjects.drawBeforeObjectsHdrFtr( nPageIndex, pGraphics );
},
CheckRange : function(X0, Y0, X1, Y1, _Y0, _Y1, X_lf, X_rf, PageIndex)
......
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