public void addSection(csRptSectionType typeSection) {
if (!m_editor.Visible)
return;
cReportSection rptSection = null;
cReportSection topSec = null;
cReportAspect w_aspect = null;
cReportAspect aspect = null;
cReportPaintObject paintObj = null;
float maxBottom = 0;
float minBottom = 0;
float y = 0;
switch (typeSection) {
case csRptSectionType.HEADER:
cReportSections w_headers = m_report.getHeaders();
rptSection = w_headers.add();
rptSection.setName("H_" + rptSection.getIndex().ToString());
aspect = w_headers.item(w_headers.count() - 2).getAspect();
rptSection.getAspect().setWidth(aspect.getWidth());
rptSection.getAspect().setHeight(0);
rptSection.getAspect().setTop(aspect.getTop() + aspect.getHeight());
rptSection.setKeyPaint(paintSection(rptSection.getAspect(),
rptSection.getKey(),
csRptSectionType.HEADER,
rptSection.getName(),
false));
w_aspect = rptSection.getAspect();
moveSection(m_paint.getPaintObject(rptSection.getKeyPaint()),
0,
w_aspect.getTop(),
w_aspect.getTop() + cGlobals.C_HEIGHT_NEW_SECTION,
w_aspect.getTop() + rptSection.getAspect().getHeight(),
rptSection,
true);
break;
case csRptSectionType.DETAIL:
break;
case csRptSectionType.GROUP_HEADER:
cIReportGroupSections w_groupsHeaders = m_report.getGroupsHeaders();
rptSection = w_groupsHeaders.item(w_groupsHeaders.count() - 1);
rptSection.setName("G_" + rptSection.getIndex().ToString());
// the first group is next to the last header
//
if (w_groupsHeaders.count() == 1) {
topSec = m_report.getHeaders().item(m_report.getHeaders().count() - 1);
}
else {
topSec = w_groupsHeaders.item(w_groupsHeaders.count() - 2);
}
w_aspect = topSec.getAspect();
rptSection.getAspect().setWidth(w_aspect.getWidth());
rptSection.getAspect().setHeight(0);
rptSection.getAspect().setTop(w_aspect.getTop() + w_aspect.getHeight());
rptSection.setKeyPaint(paintSection(rptSection.getAspect(),
rptSection.getKey(),
csRptSectionType.GROUP_HEADER,
rptSection.getName(),
false));
w_aspect = rptSection.getAspect();
moveSection(m_paint.getPaintObject(rptSection.getKeyPaint()),
0,
w_aspect.getTop() + cGlobals.C_HEIGHT_NEW_SECTION,
w_aspect.getTop(),
w_aspect.getTop() + cGlobals.C_HEIGHT_NEW_SECTION,
rptSection,
true);
break;
case csRptSectionType.GROUP_FOOTER:
cIReportGroupSections w_groupsFooters = m_report.getGroupsFooters();
rptSection = w_groupsFooters.item(0);
rptSection.setName("G_" + rptSection.getIndex().ToString());
// all group footers are added to the top so at the
// beginning they are next to the detail section
//
topSec = m_report.getDetails().item(m_report.getDetails().count() - 1);
w_aspect = topSec.getAspect();
rptSection.getAspect().setWidth(w_aspect.getWidth());
rptSection.getAspect().setHeight(cGlobals.C_HEIGHT_NEW_SECTION);
rptSection.getAspect().setTop(w_aspect.getTop() + w_aspect.getHeight());
rptSection.setKeyPaint(paintSection(rptSection.getAspect(),
rptSection.getKey(),
csRptSectionType.GROUP_FOOTER,
rptSection.getName(),
false));
paintObj = m_paint.getPaintObject(rptSection.getKeyPaint());
pMoveGroupFooter(rptSection.getKey(), out minBottom, out maxBottom);
m_offY = 0;
w_aspect = rptSection.getAspect();
y = w_aspect.getHeight() + w_aspect.getTop() - cGlobals.C_HEIGHT_BAR_SECTION;
moveSection(paintObj, 0, y, minBottom, maxBottom, rptSection, true);
break;
case csRptSectionType.FOOTER:
cReportSections w_footers = m_report.getFooters();
// all footers are added to the beginning of the collection
//
rptSection = w_footers.add(null, "" , 0);
rptSection.setName("F_" + rptSection.getIndex().ToString());
aspect = w_footers.item(1).getAspect();
rptSection.getAspect().setWidth(aspect.getWidth());
rptSection.getAspect().setHeight(cGlobals.C_HEIGHT_NEW_SECTION);
rptSection.getAspect().setTop(aspect.getTop());
rptSection.setKeyPaint(paintSection(rptSection.getAspect(),
rptSection.getKey(),
csRptSectionType.FOOTER,
rptSection.getName(),
false));
paintObj = m_paint.getPaintObject(rptSection.getKeyPaint());
pMoveFooter(rptSection.getKey(), out minBottom, out maxBottom);
m_offY = 0;
w_aspect = rptSection.getAspect();
y = w_aspect.getHeight() + w_aspect.getTop() - m_offSet - cGlobals.C_HEIGHT_BAR_SECTION;
moveSection(paintObj, 0, y, minBottom, maxBottom, rptSection, true);
break;
}
// every section we add has a section line
// and we need to set his width
//
aspect = rptSection.getSectionLines().item(0).getAspect();
aspect.setWidth(rptSection.getAspect().getWidth());
refreshBody();
refreshRule();
}