Commit 116a2a06 authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander.Trofimov

Добавлены функции в апи для работы с настройками секции.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@68126 954022d7-b5bf-4e40-9824-e11837661b57
parent e0e6ebb0
......@@ -1592,6 +1592,7 @@ var historydescription_Presentation_ApplyTimingToAll = 0x012e;
var historydescription_Document_SetColumnsFromRuler = 0x012f;
var historydescription_Document_SetColumnsProps = 0x0130;
var historydescription_Document_AddColumnBreak = 0x0131;
var historydescription_Document_SetSectionProps = 0x0132;
......@@ -1908,6 +1909,7 @@ function Get_HistoryPointStringDescription(nDescription)
case historydescription_Document_SetColumnsFromRuler : sString = "Document_SetColumnsFromRuler "; break;
case historydescription_Document_SetColumnsProps : sString = "Document_SetColumnsProps "; break;
case historydescription_Document_AddColumnBreak : sString = "Document_AddColumnBreak "; break;
case historydescription_Document_SetSectionProps : sString = "Document_SetColumnsProps "; break;
}
return sString;
}
......@@ -13056,6 +13056,7 @@ CDocument.prototype =
var ColumnsPr = new CDocumentColumnsProps();
ColumnsPr.From_SectPr(SectPr);
this.Api.sync_ColumnsPropsCallback(ColumnsPr);
this.Api.sync_SectionPropsCallback(new CDocumentSectionProps(SectPr));
}
},
......@@ -13069,7 +13070,6 @@ CDocument.prototype =
if (SectPr)
{
ColumnsPr.From_SectPr(SectPr);
this.Api.sync_ColumnsPropsCallback(ColumnsPr);
}
return ColumnsPr;
......@@ -16231,6 +16231,64 @@ CDocument.prototype.private_RecalculateNumbering = function(Elements)
}
}
};
CDocument.prototype.Set_SectionProps = function(Props)
{
var CurPos = this.CurPos.ContentPos;
var SectPr = this.SectionsInfo.Get_SectPr(CurPos).SectPr;
if (SectPr && false === this.Document_Is_SelectionLocked(changestype_Document_SectPr))
{
this.Create_NewHistoryPoint(historydescription_Document_SetSectionProps);
if (undefined !== Props.get_W() || undefined !== Props.get_H())
{
var PageW = undefined !== Props.get_W() ? Props.get_W() : SectPr.Get_PageWidth();
var PageH = undefined !== Props.get_H() ? Props.get_H() : SectPr.Get_PageHeight();
SectPr.Set_PageSize(PageW, PageH);
}
if (undefined !== Props.get_Orientation())
{
var Orient = Props.get_Orientation() === c_oAscPageOrientation.Portrait ? orientation_Portrait : orientation_Landscape;
SectPr.Set_Orientation(Orient, false);
}
if (undefined !== Props.get_LeftMargin() || undefined !== Props.get_TopMargin() || undefined !== Props.get_RightMargin() || undefined !== Props.get_BottomMargin())
{
// Внутри функции идет разруливания, если какое то значение undefined
SectPr.Set_PageMargins(Props.get_LeftMargin(), Props.get_TopMargin(), Props.get_RightMargin(), Props.get_BottomMargin());
}
if (undefined !== Props.get_HeaderDistance())
{
SectPr.Set_PageMargins_Header(Props.get_HeaderDistance());
}
if (undefined !== Props.get_FooterDistance())
{
SectPr.Set_PageMargins_Footer(Props.get_FooterDistance());
}
if (true === this.History.Is_LastPointEmpty())
{
this.History.Remove_LastPoint();
}
else
{
this.Recalculate();
this.Document_UpdateSelectionState();
this.Document_UpdateInterfaceState();
this.Document_UpdateRulersState();
}
}
};
CDocument.prototype.Get_SectionProps = function()
{
var CurPos = this.CurPos.ContentPos;
var SectPr = this.SectionsInfo.Get_SectPr(CurPos).SectPr;
return new CDocumentSectionProps(SectPr);
};
//----------------------------------------------------------------------------------------------------------------------
// Settings
//----------------------------------------------------------------------------------------------------------------------
......
......@@ -3300,6 +3300,145 @@ asc_docs_api.prototype.get_DocumentHeight = function()
return Page_Height;
};
function CDocumentSectionProps(SectPr)
{
if (SectPr)
{
this.W = SectPr.Get_PageWidth();
this.H = SectPr.Get_PageHeight();
this.Orient = orientation_Portrait === SectPr.Get_Orientation() ? c_oAscPageOrientation.Portrait : c_oAscPageOrientation.Landscape;
this.Left = SectPr.Get_PageMargin_Left();
this.Top = SectPr.Get_PageMargin_Top();
this.Right = SectPr.Get_PageMargin_Right();
this.Bottom = SectPr.Get_PageMargin_Bottom();
this.Header = SectPr.Get_PageMargins_Header();
this.Footer = SectPr.Get_PageMargins_Footer();
}
else
{
this.W = undefined;
this.H = undefined;
this.Orient = undefined;
this.Left = undefined;
this.Top = undefined;
this.Right = undefined;
this.Bottom = undefined;
this.Header = undefined;
this.Footer = undefined;
}
}
CDocumentSectionProps.prototype.get_W = function()
{
return this.W;
};
CDocumentSectionProps.prototype.put_W = function(W)
{
this.W = W;
};
CDocumentSectionProps.prototype.get_H = function()
{
return this.H;
};
CDocumentSectionProps.prototype.put_H = function(H)
{
this.H = H;
};
CDocumentSectionProps.prototype.get_Orientation = function()
{
return this.Orient;
};
CDocumentSectionProps.prototype.put_Orientation = function(Orient)
{
this.Orient = Orient;
};
CDocumentSectionProps.prototype.get_LeftMargin = function()
{
return this.Left;
};
CDocumentSectionProps.prototype.put_LeftMargin = function(Left)
{
this.Left = Left;
};
CDocumentSectionProps.prototype.get_TopMargin = function()
{
return this.Top;
};
CDocumentSectionProps.prototype.put_TopMargin = function(Top)
{
this.Top = Top;
};
CDocumentSectionProps.prototype.get_RightMargin = function()
{
return this.Right;
};
CDocumentSectionProps.prototype.put_RightMargin = function(Right)
{
this.Right = Right;
};
CDocumentSectionProps.prototype.get_BottomMargin = function()
{
return this.Bottom;
};
CDocumentSectionProps.prototype.put_BottomMargin = function(Bottom)
{
this.Bottom = Bottom;
};
CDocumentSectionProps.prototype.get_HeaderDistance = function()
{
return this.Header;
};
CDocumentSectionProps.prototype.put_HeaderDistance = function(Header)
{
this.Header = Header;
};
CDocumentSectionProps.prototype.get_FooterDistance = function()
{
return this.Footer;
};
CDocumentSectionProps.prototype.put_FooterDistance = function(Footer)
{
this.Footer = Footer;
};
window["CDocumentSectionProps"] = CDocumentSectionProps;
CDocumentSectionProps.prototype["get_W"] = CDocumentSectionProps.prototype.get_W;
CDocumentSectionProps.prototype["put_W"] = CDocumentSectionProps.prototype.put_W;
CDocumentSectionProps.prototype["get_H"] = CDocumentSectionProps.prototype.get_H;
CDocumentSectionProps.prototype["put_H"] = CDocumentSectionProps.prototype.put_H;
CDocumentSectionProps.prototype["get_Orientation"] = CDocumentSectionProps.prototype.get_Orientation;
CDocumentSectionProps.prototype["put_Orientation"] = CDocumentSectionProps.prototype.put_Orientation;
CDocumentSectionProps.prototype["get_LeftMargin"] = CDocumentSectionProps.prototype.get_LeftMargin;
CDocumentSectionProps.prototype["put_LeftMargin"] = CDocumentSectionProps.prototype.put_LeftMargin;
CDocumentSectionProps.prototype["get_TopMargin"] = CDocumentSectionProps.prototype.get_TopMargin;
CDocumentSectionProps.prototype["put_TopMargin"] = CDocumentSectionProps.prototype.put_TopMargin;
CDocumentSectionProps.prototype["get_RightMargin"] = CDocumentSectionProps.prototype.get_RightMargin;
CDocumentSectionProps.prototype["put_RightMargin"] = CDocumentSectionProps.prototype.put_RightMargin;
CDocumentSectionProps.prototype["get_BottomMargin"] = CDocumentSectionProps.prototype.get_BottomMargin;
CDocumentSectionProps.prototype["put_BottomMargin"] = CDocumentSectionProps.prototype.put_BottomMargin;
CDocumentSectionProps.prototype["get_HeaderDistance"] = CDocumentSectionProps.prototype.get_HeaderDistance;
CDocumentSectionProps.prototype["put_HeaderDistance"] = CDocumentSectionProps.prototype.put_HeaderDistance;
CDocumentSectionProps.prototype["get_FooterDistance"] = CDocumentSectionProps.prototype.get_FooterDistance;
CDocumentSectionProps.prototype["put_FooterDistance"] = CDocumentSectionProps.prototype.put_FooterDistance;
asc_docs_api.prototype.asc_SetSectionProps = function(Props)
{
this.WordControl.m_oLogicDocument.Set_SectionProps(Props);
};
asc_docs_api.prototype.asc_GetSectionProps = function()
{
return this.WordControl.m_oLogicDocument.Get_SectionProps();
};
asc_docs_api.prototype.sync_SectionPropsCallback = function(Props)
{
this.asc_fireCallback("asc_onSectionProps", Props);
};
asc_docs_api.prototype["asc_SetSectionProps"] = asc_docs_api.prototype.asc_SetSectionProps;
asc_docs_api.prototype["asc_GetSectionProps"] = asc_docs_api.prototype.asc_GetSectionProps;
function CDocumentColumnProps()
{
this.W = 0;
......
......@@ -587,4 +587,9 @@ var c_oAscRevisionsObjectType =
MathEquation : 3
};
var c_oAscPageOrientation = {
Portrait : 0x00,
Landscape : 0x01
};
window["flat_desine"] = false;
\ No newline at end of file
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