Commit deb7375c authored by Ilya Kirillov's avatar Ilya Kirillov

Сделаны функции получения всех автофигур и URL всех картинок в документе.

parent a85a3c89
......@@ -323,8 +323,11 @@ CSelectedContent.prototype =
this.DrawingObjects = [];
this.Comments = [];
this.Maths = [];
this.HaveShape = false;
this.MoveDrawing = false; // Только для переноса автофигур
this.HaveMath = false;
},
Add : function(Element)
......@@ -16929,6 +16932,32 @@ CDocumentSectionsInfo.prototype =
}
},
Get_AllDrawingObjects : function(arrDrawings)
{
for (var nIndex = 0, nCount = this.Elements.length; nIndex < nCount; ++nIndex)
{
var SectPr = this.Elements[nIndex].SectPr;
if (null != SectPr.HeaderFirst)
SectPr.HeaderFirst.Get_AllDrawingObjects(arrDrawings);
if (null != SectPr.HeaderDefault)
SectPr.HeaderDefault.Get_AllDrawingObjects(arrDrawings);
if (null != SectPr.HeaderEven)
SectPr.HeaderEven.Get_AllDrawingObjects(arrDrawings);
if (null != SectPr.FooterFirst)
SectPr.FooterFirst.Get_AllDrawingObjects(arrDrawings);
if (null != SectPr.FooterDefault)
SectPr.FooterDefault.Get_AllDrawingObjects(arrDrawings);
if (null != SectPr.FooterEven)
SectPr.FooterEven.Get_AllDrawingObjects(arrDrawings);
}
},
Document_CreateFontMap : function(FontMap)
{
var Count = this.Elements.length;
......
......@@ -1204,21 +1204,6 @@ CDocumentContent.prototype.Draw = function(nPageIndex,
pGraphics.End_Command();
}
};
// Составляем полный массив всех ParaDrawing используемых в данном классе (с учетом всех вложенных DocumentContent)
CDocumentContent.prototype.Get_AllDrawingObjects = function(DrawingObjs)
{
if (undefined === DrawingObjs)
DrawingObjs = [];
var Count = this.Content.length;
for (var Pos = 0; Pos < Count; Pos++)
{
var Item = this.Content[Pos];
Item.Get_AllDrawingObjects(DrawingObjs);
}
return DrawingObjs;
};
CDocumentContent.prototype.Get_AllComments = function(AllComments)
{
if (undefined === AllComments)
......
......@@ -34,6 +34,49 @@ CDocumentContentBase.prototype.Update_ContentIndexing = function()
this.ReindexStartPos = -1;
}
};
/**
* Получаем массив всех автофигур.
* @param {Array} arrDrawings - Если задан массив, тогда мы дополняем данный массив и возвращаем его.
* @returns {Array}
*/
CDocumentContentBase.prototype.Get_AllDrawingObjects = function(arrDrawings)
{
if (undefined === arrDrawings || null === arrDrawings)
arrDrawings = [];
if (this instanceof CDocument)
{
this.SectionsInfo.Get_AllDrawingObjects(arrDrawings);
}
for (var nPos = 0, nCount = this.Content.length; nPos < nCount; ++nPos)
{
this.Content[nPos].Get_AllDrawingObjects(arrDrawings);
}
return arrDrawings;
};
/**
* Получаем массив URL всех картинок в документе.
* @param {Array} arrUrls - Если задан массив, тогда мы дополняем данный массив и возвращаем его.
* @returns {Array}
*/
CDocumentContentBase.prototype.Get_AllImageUrls = function(arrUrls)
{
if (undefined === arrDrawings || null === arrDrawings)
arrUrls = [];
var arrDrawings = this.Get_AllDrawingObjects();
for (var nIndex = 0, nCount = arrDrawings.length; nIndex < nCount; ++nIndex)
{
var oParaDrawing = arrDrawings[nIndex];
oParaDrawing.GraphicObj.getAllRasterImages(arrUrls);
}
return arrUrls;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Private area
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -876,6 +876,11 @@ CHeaderFooter.prototype =
return this.Content.Get_AllParagraphs(Props, ParaArray);
},
Get_AllDrawingObjects : function(arrDrawings)
{
return this.Content.Get_AllDrawingObjects(arrDrawings);
},
Get_PrevElementEndInfo : function(CurElement)
{
return null;
......
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