private void releaseReferences() { if (m_sectionLines != null) { if (m_sectionLines.getCopyColl() != null) { m_sectionLines.getCopyColl().clear(); m_sectionLines.setCopyColl(null); } m_sectionLines = null; } m_aspect = null; m_formulaHide = null; }
private void releaseReferences() { setCopyColl(null); if (m_controls != null) { if (m_controls.getCopyColl() != null) { m_controls.getCopyColl().clear(); m_controls.setCopyColl(null); } m_controls.clear(); m_controls = null; } m_aspect = null; m_formulaHide = null; }
public void setAspect(cReportAspect rhs) { m_aspect = rhs; }
public cReportImage() { m_aspect = new cReportAspect(); }
public cReportPageInfo() { m_aspect = new cReportAspect(); }
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 pDrawObjBox( Graphics graph, cReportAspect aspect, float x1, float y1, float x2, float y2, bool filled, int colorIn, int colorOut) { // m_notBorder is used by preview and printing to indicate the controls must be print a border only // when BorderType != NONE // if ((m_notBorder == false || filled) || (aspect.getBorderType() != csReportBorderType.CSRPTBSNONE)) { if (aspect.getBorderType() == csReportBorderType.CSRPTBS3D) { printLine(graph, filled, x1, y1, x2, y2, colorIn, 0, false, (int)csColors.C_COLOR_WHITE, false); // top // printLine(graph, false, x1, y1, x2, y1, (int)csColors.C_COLOR_WHITE, 1, false, aspect.getBorderColor3d(), false); // down // printLine(graph, false, x1, y2 - 1, x2, y2 - 1, (int)csColors.C_COLOR_WHITE, 1, false, aspect.getBorderColor3dShadow(), false); // left // printLine(graph, false, x1 + 1, y1, x1 + 1, y2, (int)csColors.C_COLOR_WHITE, 1, false, aspect.getBorderColor3d(), false); // right // printLine(graph, false, x2 - 1, y1, x2 - 1, y2, (int)csColors.C_COLOR_WHITE, 1, false, aspect.getBorderColor3dShadow(), false); } else if (aspect.getBorderRounded()) { printLine(graph, filled, x1, y1, x2, y2, colorIn, (int)aspect.getBorderWidth(), false, colorOut, true); } else { // // we are in the editor window // // TODO: this is a bug. Then only way to get a border is setting BorderType to CSRPTBS3D or // BorderRounded == TRUE // // when BorderType == CSRPTBSFIXED the border is not drawn // // we need to fix it but the fix will break all reports so first we need to update // those reports to set the BorderType to CSRPTBSNONE // bool dash = false; const int borderWidth = 1; if (m_notBorder == false && ( ( aspect.getBorderType() == csReportBorderType.CSRPTBSFIXED && !aspect.getBorderRounded() && aspect.getBorderWidth() == 0 ) || aspect.getBorderType() == csReportBorderType.CSRPTBSNONE ) ) { colorOut = Color.Gray.ToArgb(); // 0xff9966; //Color.LightGray.ToArgb(); dash = true; } // TODO: clean this. we have many issues with this code. the value 16777215 is white // it is used in cairo reports. when a control has a background (colorIn) == white // we must not call printLine // if (!m_notBorder || (filled && colorIn != 16777215) // this is the value of white controls in cairo reports. || (aspect.getBorderType() == csReportBorderType.CSRPTBSFIXED && aspect.getBorderWidth() > 0)) { printLine(graph, filled, x1, y1, x2, y2, colorIn, borderWidth, dash, colorOut, false); } } } }
private void printText(Graphics graph, String sText, cReportAspect aspect, Image image) { // TODO: Use of ByRef founded Private Sub PrintText(ByVal hDC As Long, ByVal sText As String, ByRef Aspect As cReportAspect, ByVal hImage As Long) /* // Para separarlo del borde Const(c_Margen_Y As Integer == 20); Const(c_Margen_X As Integer == 80); Const(c_Margen_Bottom As Integer == 80); StdFont oFont = null; oFont = new StdFont(); RECT tR = null; int oldBkColor = 0; int oldBkMode = 0; int oldFontColor = 0; int flags = 0; cReportFont w_font = aspect.getFont(); oFont.Name = w_font.getName(); oFont.Bold = w_font.getBold(); oFont.Italic = w_font.getItalic(); oFont.UnderLine = w_font.getUnderLine(); oFont.Size = (w_font.getSize() > 0) ? w_font.getSize() : 3); // {end with: w_font} int stringWidth = 0; int stringHeight = 0; int nWidth = 0; int hFntOld = 0; hFntOld = SelectObject(hDC, m_hFnt[mAux.addFontIfRequired(oFont, hDC, m_fontCount, m_fnt, m_hFnt)]); // With aspect; oldFontColor = SetTextColor(hDC, mAux.translateColor(aspect.getFont().getForeColor())); oldBkColor = SetBkColor(hDC, mAux.translateColor(aspect.getBackColor())); oldBkMode = SetBkMode(hDC, aspect.getTransparent() ? C_TRANSPARENT : C_OPAQUE)); if (aspect.getWordWrap()) { flags = ECGTextAlignFlags.DT_WORDBREAK || ECGTextAlignFlags.DT_WORD_ELLIPSIS || ECGTextAlignFlags.DT_LEFT || ECGTextAlignFlags.DT_NOPREFIX || ECGTextAlignFlags.DT_EDITCONTROL; } else { flags = ECGTextAlignFlags.DT_SINGLELINE || ECGTextAlignFlags.DT_WORD_ELLIPSIS || ECGTextAlignFlags.DT_LEFT || ECGTextAlignFlags.DT_NOPREFIX; } // {end with: aspect} stringWidth = getPlEvaluateTextWidth(sText, hDC, m_scaleX); stringHeight = getPlEvaluateTextHeight(sText, hDC, aspect.getWidth(), flags, m_scaleY, m_scaleX); // Esto es por seguridad, ya que // cuando imprimo en la impresora (en pantalla esto no pasa) // por pequeñas diferencias en la // proceso de escalar hasta la resolucion // de la impresora en algunos casos // pierdo parte del texto si el // rectangulo que pido es demasiado pequeño // stringHeight = stringHeight + 400; int margenX = 0; int margenY = 0; int width = 0; int height = 0; margenX = c_Margen_X; margenY = c_Margen_Y; if (hImage != 0) { mAux.getBitmapSize(hImage, width, height); margenX = margenX + width; margenY = height - stringHeight - c_Margen_Bottom; // With aspect; if (margenY + stringHeight > aspect.getHeight()) { margenY = aspect.getHeight() - stringHeight - c_Margen_Bottom; } // {end with: aspect} if (margenY < c_Margen_Y) { margenY = c_Margen_Y; } } nWidth = aspect.getWidth() - margenX * 2; if (stringWidth > nWidth) { stringWidth = nWidth; } int x = 0; int y = 0; switch (aspect.setAlign()) { case AlignmentConstants.vbRightJustify: x = aspect.getLeft() + aspect.getWidth() - stringWidth - margenX; break; case AlignmentConstants.vbCenter: x = aspect.getLeft() + (aspect.getWidth() - stringWidth) * 0.5; break; case AlignmentConstants.vbLeftJustify: x = aspect.getLeft() + margenX; break; } y = aspect.getTop() - aspect.setOffset() + margenY; // With aspect; //'.Height) tR = cGlobals.newRectangle(x, y, x + aspect.getWidth() - margenX, y + stringHeight); mAux.rectTwipsToPixel(tR, m_scaleX, m_scaleY); // If .WordWrap Then // Flags = DT_WORDBREAK Or DT_WORD_ELLIPSIS Or DT_LEFT Or DT_NOPREFIX Or DT_EDITCONTROL // Else // Flags = DT_SINGLELINE Or DT_WORD_ELLIPSIS Or DT_LEFT Or DT_NOPREFIX // End If DrawText(hDC, sText+ vbNullChar, -1, tR, flags); // {end with: aspect} SetBkColor(hDC, oldBkColor); SetTextColor(hDC, oldFontColor); SetBkMode(hDC, oldBkMode); SelectObject(hDC, hFntOld); */ // padding const int c_Margen_Y = 1; // 20 twips; const int c_Margen_X = 4; // 80 twips; const int c_Margen_Bottom = 4; // 80 twips; int idx = cGlobals.addFontIfRequired(aspect.getFont(), ref m_fnt); Font font = m_fnt[idx]; StringFormat format = new StringFormat(); format.Trimming = StringTrimming.EllipsisWord; format.Alignment = StringAlignment.Near; if (!aspect.getWordWrap()) { format.FormatFlags = StringFormatFlags.NoWrap; } int stringWidth = getPlEvaluateTextWidth(sText, font, m_scaleX); int stringHeight = getPlEvaluateTextHeight(sText, font, aspect.getWidth(), format, m_scaleY, m_scaleX); // TODO: translate this to English if it is really needed // // Esto es por seguridad, ya que // cuando imprimo en la impresora (en pantalla esto no pasa) // por pequeñas diferencias en la // proceso de escalar hasta la resolucion // de la impresora en algunos casos // pierdo parte del texto si el // rectangulo que pido es demasiado pequeño // stringHeight += 25; //+ 400 the original code was in twips; int margenX = c_Margen_X; int margenY = c_Margen_Y; if (image != null) { margenX += image.Size.Width; margenY = image.Size.Height - stringHeight - c_Margen_Bottom; if (margenY + stringHeight > aspect.getHeight()) { margenY = Convert.ToInt32(aspect.getHeight() - stringHeight - c_Margen_Bottom); } if (margenY < c_Margen_Y) { margenY = c_Margen_Y; } } int nWidth = Convert.ToInt32(aspect.getWidth() - margenX * 2); if (stringWidth > nWidth) { stringWidth = nWidth; } int x = 0; int y = 0; switch (aspect.getAlign()) { case HorizontalAlignment.Right: x = Convert.ToInt32(aspect.getLeft() + aspect.getWidth() - stringWidth - margenX); break; case HorizontalAlignment.Center: x = Convert.ToInt32(aspect.getLeft() + (aspect.getWidth() - stringWidth) * 0.5); break; case HorizontalAlignment.Left: x = Convert.ToInt32(aspect.getLeft() + margenX); break; } y = Convert.ToInt32(aspect.getTop() - aspect.getOffset() + margenY); RectangleF rect = cGlobals.newRectangleF(x, y, Convert.ToInt32(x + aspect.getWidth() - margenX), y + stringHeight); SolidBrush brush = new SolidBrush(cColor.colorFromRGB(aspect.getFont().getForeColor())); graph.DrawString(sText, font, brush, rect, format); brush.Dispose(); }
public cReportLabel() { m_aspect = new cReportAspect(); }
private String paintSection(cReportAspect aspect, String sKey, csRptSectionType rptType, String text, bool isSecLn) { cReportPaintObject paintObj = null; paintObj = m_paint.getNewSection(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); w_aspect.setBorderType(csReportBorderType.CSRPTBSFIXED); w_aspect.setBorderWidth(1); if (isSecLn) { w_aspect.setBackColor(0xffcc99); w_aspect.setBorderColor(Color.Red.ToArgb()); } else { const int innerColor = 0x99ccff; if (rptType == csRptSectionType.GROUP_FOOTER || rptType == csRptSectionType.GROUP_HEADER) { w_aspect.setBackColor(innerColor); w_aspect.setBorderColor(0xC0C000); } else { w_aspect.setBackColor(innerColor); w_aspect.setBorderColor(0x0066cc); } } if (rptType == csRptSectionType.MAIN_FOOTER || rptType == csRptSectionType.FOOTER) { w_aspect.setOffset(m_offSet); } paintObj.setIsSection(!isSecLn); paintObj.setRptType(rptType); paintObj.setTag(sKey); paintObj.setText(text); return paintObj.getKey(); }
// TODO: this function shouldn't be needed // private void pCopyAspectToPaint(cReportAspect fromAspect, cReportAspect toAspect) { toAspect.setAlign(fromAspect.getAlign()); toAspect.setBackColor(fromAspect.getBackColor()); toAspect.setBorderColor(fromAspect.getBorderColor()); toAspect.setBorderColor3d(fromAspect.getBorderColor3d()); toAspect.setBorderColor3dShadow(fromAspect.getBorderColor3dShadow()); toAspect.setBorderType(fromAspect.getBorderType()); toAspect.setBorderWidth(fromAspect.getBorderWidth()); toAspect.setCanGrow(fromAspect.getCanGrow()); toAspect.setFormat(fromAspect.getFormat()); toAspect.setHeight(fromAspect.getHeight()); toAspect.setIsAccounting(fromAspect.getIsAccounting()); toAspect.setLeft(fromAspect.getLeft()); toAspect.setNZOrder(fromAspect.getNZOrder()); toAspect.setSelectColor(fromAspect.getSelectColor()); toAspect.setSymbol(fromAspect.getSymbol()); toAspect.setTop(fromAspect.getTop()); toAspect.setTransparent(fromAspect.getTransparent()); toAspect.setWidth(fromAspect.getWidth()); toAspect.setWordWrap(fromAspect.getWordWrap()); pCopyFontPaint(fromAspect.getFont(), toAspect.getFont()); }
public bool drawRule(String key, Graphics graph) { const int LINE_COLOR = 0xcc6600; int top = 0; float heightSec = 0; cReportAspect aspect = null; aspect = new cReportAspect(); cReportPaintObject w_item = m_paintSections.item(key); heightSec = w_item.getHeightSecLine() * 0.5f; cReportAspect w_aspect = w_item.getAspect(); aspect.setTop(w_aspect.getTop() + 3 - heightSec); aspect.setOffset(w_aspect.getOffset()); aspect.setTransparent(true); aspect.setLeft(0); aspect.setHeight(20); aspect.setAlign(HorizontalAlignment.Right); aspect.setWidth(graph.ClipBounds.Width - 1); if (w_item.getTextLine() != "") { top = - Convert.ToInt32(w_item.getHeightSec()); w_aspect = w_item.getAspect(); top += Convert.ToInt32(w_aspect.getTop() - w_aspect.getOffset() - 6 + w_aspect.getHeight() * 2); printLine(graph, true, 0, top, aspect.getWidth(), top, LINE_COLOR, 1, true, LINE_COLOR, false); // last section line // printText(graph, w_item.getTextLine(), aspect, w_item.getImage()); heightSec = w_item.getHeightSec() * 0.5f; // print section's name // w_aspect = m_paintSections.item(key).getAspect(); aspect.setTop(w_aspect.getTop() - heightSec); aspect.setAlign(HorizontalAlignment.Left); printText(graph, w_item.getText(), aspect, w_item.getImage()); } else { top = Convert.ToInt32(aspect.getTop() - aspect.getOffset() - heightSec + w_item.getAspect().getHeight()); if (w_item.getIsSection()) { printLine(graph, true, 0, top, aspect.getWidth(), top, LINE_COLOR, 1, true, LINE_COLOR, false); } // every section line except the last one // printText(graph, w_item.getText(), aspect, w_item.getImage()); } if (w_item == m_paintSections.item(m_paintSections.count() - 1)) { top = Convert.ToInt32(aspect.getTop() + w_item.getHeightSecLine() - heightSec - aspect.getOffset() + 6); if (w_item.getIsSection()) { printLine(graph, true, 0, top, aspect.getWidth(), top, LINE_COLOR, 1, true, LINE_COLOR, false); } } return true; }
private void pMoveControl(cReportAspect aspect, bool bSizing) { const int C_MIN_WIDTH = 10; const int C_MIN_HEIGHT = 10; cReportAspect rptCtrlAspect = null; if (m_paint.getPaintObject(m_keySizing).getRptType() == csRptTypeSection.CONTROL) { rptCtrlAspect = m_report.getControls().item(m_paint.getPaintObject(m_keySizing).getTag()).getLabel().getAspect(); rptCtrlAspect.setLeft(aspect.getLeft()); if (!bSizing) { rptCtrlAspect.setTop(aspect.getTop() + aspect.getOffset()); } else { rptCtrlAspect.setTop(aspect.getTop()); } rptCtrlAspect.setWidth(aspect.getWidth()); rptCtrlAspect.setHeight(aspect.getHeight()); } switch (m_moveType) { case csRptEditorMoveType.CSRPTEDMOVDOWN: m_paint.alingObjBottomToGrid(m_keySizing); break; case csRptEditorMoveType.CSRPTEDMOVLEFT: m_paint.alingObjLeftToGrid(m_keySizing); break; case csRptEditorMoveType.CSRPTEDMOVRIGHT: m_paint.alingObjRightToGrid(m_keySizing); break; case csRptEditorMoveType.CSRPTEDMOVUP: m_paint.alingObjTopToGrid(m_keySizing); break; case csRptEditorMoveType.CSRPTEDMOVLEFTDOWN: m_paint.alingObjLeftBottomToGrid(m_keySizing); break; case csRptEditorMoveType.CSRPTEDMOVLEFTUP: m_paint.alingObjLeftTopToGrid(m_keySizing); break; case csRptEditorMoveType.CSRPTEDMOVRIGHTDOWN: m_paint.alingObjRightBottomToGrid(m_keySizing); break; case csRptEditorMoveType.CSRPTEDMOVRIGHTUP: m_paint.alingObjRightTopToGrid(m_keySizing); break; } // Validations // Width can't be lower than C_MIN_WIDTH // if (aspect.getWidth() < C_MIN_WIDTH) { aspect.setWidth(C_MIN_WIDTH); } // Height can't be lower than C_MIN_HEIGHT // if (aspect.getHeight() < C_MIN_HEIGHT) { aspect.setHeight(C_MIN_HEIGHT); } }