private String paintSection(cReportAspect aspect, String sKey, csRptTypeSection rptType, String text, bool isSectionLine) { CSReportPaint.cReportPaintObject paintObj = null; paintObj = m_paint.getNewSection(CSReportPaint.csRptPaintObjType.CSRPTPAINTOBJBOX); cReportAspect w_aspect = paintObj.getAspect(); // we only draw the bottom line of the sections // w_aspect.setLeft(0); w_aspect.setTop(aspect.getTop() + aspect.getHeight() - cGlobals.C_HEIGHT_BAR_SECTION); w_aspect.setWidth(aspect.getWidth()); w_aspect.setHeight(cGlobals.C_HEIGHT_BAR_SECTION); int innerColor = 0; innerColor = 0xAEAEAE; if (isSectionLine) { w_aspect.setBackColor(innerColor); w_aspect.setBorderColor(Color.Red.ToArgb()); } else { if (rptType == csRptTypeSection.GROUP_SECTION_FOOTER || rptType == csRptTypeSection.GROUP_SECTION_HEADER) { w_aspect.setBackColor(innerColor); w_aspect.setBorderColor(0xC0C000); } else { w_aspect.setBackColor(innerColor); w_aspect.setBorderColor(0x5A7FB); } } if (rptType == csRptTypeSection.CSRPTTPMAINSECTIONFOOTER || rptType == csRptTypeSection.CSRPTTPSCFOOTER) { w_aspect.setOffset(m_offSet); } paintObj.setIsSection(!isSectionLine); paintObj.setRptType(rptType); paintObj.setTag(sKey); paintObj.setText(text); return paintObj.getKey(); }
private void pAddPaintSetcionForSecLn( cReportSection sec, csRptTypeSection typeSecLn) { int i = 0; cReportPaintObject paintSec = null; if (sec.getSectionLines().count() > 1) { for (i = 1; i <= sec.getSectionLines().count() - 1; i++) { cReportSectionLine secLine = sec.getSectionLines().item(i); secLine.setKeyPaint( paintSection( secLine.getAspect(), secLine.getKey(), sec.getTypeSection(), C_SECTIONLINE + i.ToString(), true)); // we set the height of every section line // paintSec = m_paint.getPaintSections().item(secLine.getKeyPaint()); paintSec.setHeightSecLine(secLine.getAspect().getHeight()); paintSec.setRptType(typeSecLn); paintSec.setRptKeySec(sec.getKey()); } // if there is more than one section we use // textLine to show the name of the last line // CSReportPaint.cReportPaintObject po = m_paint.getPaintSections().item(sec.getKeyPaint()); po.setTextLine(C_SECTIONLINE + sec.getSectionLines().count().ToString()); } // we set the height of the last section line // paintSec = m_paint.getPaintSections().item(sec.getKeyPaint()); cReportSectionLines secLines = sec.getSectionLines(); paintSec.setHeightSecLine(secLines.item(secLines.count()).getAspect().getHeight()); }
public void addSection(csRptTypeSection typeSection) { if (!m_editor.Visible) return; cReportSection rptSection = null; cReportSection topSec = null; cReportAspect w_aspect = null; cReportAspect aspect = null; CSReportPaint.cReportPaintObject paintObj = null; int maxBottom = 0; int minBottom = 0; float y = 0; switch (typeSection) { case csRptTypeSection.CSRPTTPSCHEADER: 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(), csRptTypeSection.CSRPTTPSCHEADER, 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 csRptTypeSection.CSRPTTPSCDETAIL: break; case csRptTypeSection.CSRPTTPGROUPHEADER: cIReportGroupSections w_groupsHeaders = m_report.getGroupsHeaders(); rptSection = w_groupsHeaders.item(w_groupsHeaders.count()); rptSection.setName("GH_" + 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()); } else { topSec = w_groupsHeaders.item(w_groupsHeaders.count() - 1); } 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(), csRptTypeSection.GROUP_SECTION_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 csRptTypeSection.CSRPTTPGROUPFOOTER: cIReportGroupSections w_groupsFooters = m_report.getGroupsFooters(); rptSection = w_groupsFooters.item(1); rptSection.setName("GF_" + 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()); 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(), csRptTypeSection.GROUP_SECTION_FOOTER, rptSection.getName(), false)); paintObj = m_paint.getPaintObject(rptSection.getKeyPaint()); pMoveGroupFooter(rptSection.getKey(), minBottom, maxBottom, false); 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 csRptTypeSection.CSRPTTPSCFOOTER: cReportSections w_footers = m_report.getFooters(); // all footers are added to the beginning of the collection // rptSection = w_footers.add(null, "" , 1); rptSection.setName("F_" + rptSection.getIndex().ToString()); aspect = w_footers.item(2).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(), csRptTypeSection.CSRPTTPSCFOOTER, rptSection.getName(), false)); paintObj = m_paint.getPaintObject(rptSection.getKeyPaint()); pMoveFooter(rptSection.getKey(), minBottom, maxBottom, false); 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(); }