Beispiel #1
0
        public void orderCollByLeft()
        {
            int            j    = 0;
            int            i    = 0;
            int            tmp  = 0;
            cReportControl ctl1 = null;
            cReportControl ctl2 = null;

            G.redim(ref m_collByLeft, this.Count);

            for (i = 0; i < m_collByLeft.Length; i++)
            {
                m_collByLeft[i] = i;
            }

            for (i = 0; i < this.Count - 1; i++)
            {
                for (j = i; j < this.Count - 1; j++)
                {
                    ctl1 = item(m_collByLeft[j]);
                    ctl2 = item(m_collByLeft[j + 1]);

                    if (ctl2.getLabel().getAspect().getLeft() < ctl1.getLabel().getAspect().getLeft())
                    {
                        tmp                 = m_collByLeft[j];
                        m_collByLeft[j]     = m_collByLeft[j + 1];
                        m_collByLeft[j + 1] = tmp;
                    }
                }
            }
        }
Beispiel #2
0
        public void setSectionLine(cReportSectionLine rhs)
        {
            m_sectionLine = rhs;

            cReportControl ctrl = null;

            for (int _i = 0; _i < this.Count; _i++)
            {
                ctrl = item(_i);
                ctrl.setSectionLine(rhs);
            }
        }
Beispiel #3
0
        internal bool save(CSXml.cXml xDoc, XmlNode nodeFather)
        {
            CSXml.cXmlProperty xProperty = null;
            XmlNode            nodeObj   = null;

            xProperty = new CSXml.cXmlProperty();

            xProperty.setName(m_key);
            nodeObj = xDoc.addNodeToNode(nodeFather, xProperty);

            xProperty.setName("Key");
            xProperty.setValue(eTypes.eText, m_key);
            xDoc.addPropertyToNode(nodeObj, xProperty);

            // TODO: fix me - this is Spanish - English bug we should use Index
            //
            xProperty.setName("Indice");
            xProperty.setValue(eTypes.eInteger, m_index);
            xDoc.addPropertyToNode(nodeObj, xProperty);

            xProperty.setName("IdField");
            xProperty.setValue(eTypes.eText, m_idField);
            xDoc.addPropertyToNode(nodeObj, xProperty);

            xProperty.setName("HasFormulaHide");
            xProperty.setValue(eTypes.eBoolean, m_hasFormulaHide);
            xDoc.addPropertyToNode(nodeObj, xProperty);

            if (!m_aspect.save(xDoc, nodeObj))
            {
                return(false);
            }
            if (!m_formulaHide.save(xDoc, nodeObj))
            {
                return(false);
            }

            xProperty.setName(C_NODERPTCONTROLS);
            nodeObj = xDoc.addNodeToNode(nodeObj, xProperty);

            cReportControl ctrl = null;

            for (int _i = 0; _i < m_controls.count(); _i++)
            {
                ctrl = m_controls.item(_i);
                ctrl.save(xDoc, nodeObj);
            }

            return(true);
        }
Beispiel #4
0
        internal bool load(CSXml.cXml xDoc, XmlNode nodeObj)
        {
            XmlNode nodeObjCtrls  = null;
            XmlNode nodeObjCtrl   = null;
            XmlNode nodeObjAspect = null;

            cReportControl ctrl = null;

            // TODO: fix me - this is Spanish - English bug we should use Index
            //
            m_index          = xDoc.getNodeProperty(nodeObj, "Indice").getValueInt(eTypes.eInteger);
            m_idField        = xDoc.getNodeProperty(nodeObj, "IdField").getValueString(eTypes.eText);
            m_hasFormulaHide = xDoc.getNodeProperty(nodeObj, "HasFormulaHide").getValueBool(eTypes.eBoolean);

            nodeObjAspect = nodeObj;

            XmlNode nodeObjAux = nodeObj;

            if (!m_formulaHide.load(xDoc, nodeObjAux))
            {
                return(false);
            }

            if (!m_aspect.load(xDoc, nodeObjAspect))
            {
                return(false);
            }

            nodeObjCtrls = xDoc.getNodeFromNode(nodeObj, C_NODERPTCONTROLS);

            if (xDoc.nodeHasChild(nodeObjCtrls))
            {
                nodeObjCtrl = xDoc.getNodeChild(nodeObjCtrls);

                while (nodeObjCtrl != null)
                {
                    String key = xDoc.getNodeProperty(nodeObjCtrl, "Key").getValueString(eTypes.eText);
                    ctrl = m_controls.add(null, key);
                    if (!ctrl.load(xDoc, nodeObjCtrl))
                    {
                        return(false);
                    }
                    nodeObjCtrl = xDoc.getNextNode(nodeObjCtrl);
                }
            }

            return(true);
        }
        internal cReportControl add2(cReportControl c, String key)
        {
            try
            {
                if (c == null)
                {
                    c = new cReportControl();
                }
                if (key == "")
                {
                    Add(getDummyKey(), c);
                }
                else
                {
                    Add(cReportGlobals.getKey(key), c);
                }

                return(c);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Beispiel #6
0
        public cReportControl add(cReportControl c, String key)
        {
            try
            {
                if (c == null)
                {
                    c = new cReportControl();
                }
                if (key == "")
                {
                    key = cReportGlobals.getNextKey().ToString();
                }
                else
                {
                    cReportGlobals.refreshNextKey(key);
                }

                key = cReportGlobals.getKey(key);
                Add(key, c);

                c.setKey(key);
                c.setTypeSection(m_typeSection);
                c.setSectionLine(m_sectionLine);

                if (m_copyColl != null)
                {
                    m_copyColl.add2(c, key);
                }

                return(c);
            }
            catch
            {
                return(null);
            }
        }
		private void pSetNewControlPosition(cReportControl ctrl, float left, float top) {
            cReportAspect aspect = ctrl.getLabel().getAspect();
            aspect.setLeft(left);
            aspect.setTop(top);

            cReportPaintObject paintObj = null;
			csRptPaintObjType paintType = csRptPaintObjType.CSRPTPAINTOBJBOX;

            if (ctrl.getControlType() == csRptControlType.CSRPTCTIMAGE 
                || ctrl.getControlType() == csRptControlType.CSRPTCTCHART) {
                paintType = CSReportPaint.csRptPaintObjType.CSRPTPAINTOBJIMAGE;
            }

            paintObj = m_paint.getNewObject(paintType);

            aspect = ctrl.getLabel().getAspect();

			pCopyAspectToPaint(aspect, paintObj.getAspect());

            aspect.setLeft(left);
            aspect.setTop(top);

            paintObj.setText(ctrl.getLabel().getText());

            paintObj.setRptType(csRptTypeSection.CONTROL);

            paintObj.setTag(ctrl.getKey());
            ctrl.setKeyPaint(paintObj.getKey());

            // position the control in the desired section line
            //
            moveControl(paintObj.getKey());

			m_paint.drawObject(paintObj.getKey(), m_graphic);
        }
        private void pSetNewControlProperties(cReportControl ctrl) { 
			cReportAspect aspect = null;

            ctrl.getLabel().getAspect().setAlign(CSReportGlobals.HorizontalAlignment.Left);

            switch (m_controlType) {
                case csRptEditCtrlType.CSRPTEDITFIELD:
                    ctrl.setControlType(csRptControlType.CSRPTCTFIELD);
                    ctrl.getLabel().setText(m_fieldName);
                    cReportField field = ctrl.getField();
                    field.setIndex(m_fieldIndex);
                    field.setName(m_fieldName);
                    field.setFieldType(m_fieldType);

                    if (cGlobals.isNumberField(m_fieldType)) {
                        aspect = ctrl.getLabel().getAspect();
					    aspect.setAlign(CSReportGlobals.HorizontalAlignment.Right);
                        aspect.setFormat("#0.00;-#0.00");
                    }
                    break;

                case csRptEditCtrlType.CSRPTEDITFORMULA:
                    ctrl.setControlType(csRptControlType.CSRPTCTLABEL);
                    ctrl.getFormulaValue().setText(m_formulaText + "(" + m_controlName + ")");
                    ctrl.setHasFormulaValue(true);
                    ctrl.getLabel().getAspect().setFormat("0.00;-0.00");
                    ctrl.getLabel().getAspect().getFont().setBold(true);
                    ctrl.getLabel().setText(ctrl.getFormulaValue().getText());
                    ctrl.getLabel().getAspect().setAlign(CSReportGlobals.HorizontalAlignment.Right);
                    break;

                case csRptEditCtrlType.CSRPTEDITLABEL:
                    ctrl.setControlType(csRptControlType.CSRPTCTLABEL);
                    ctrl.getLabel().setText(m_fieldName);
                    ctrl.getLabel().getAspect().getFont().setBold(true);

                    break;
                case csRptEditCtrlType.CSRPTEDITIMAGE:
                    ctrl.setControlType(csRptControlType.CSRPTCTIMAGE);
                    ctrl.getLabel().setText(m_fieldName);

                    break;
                case csRptEditCtrlType.CSRPTEDITCHART:
                    ctrl.setControlType(csRptControlType.CSRPTCTCHART);
                    ctrl.getLabel().setText(m_fieldName);
                    break;
            }

            const int ctrl_height = 285;
            const int ctrl_width = 2000;

			aspect = ctrl.getLabel().getAspect();
            aspect.setWidth(ctrl_width);
            aspect.setHeight(ctrl_height);
            aspect.setTransparent(true);
        }
        private void pCopyControl(cReportControl fromCtrl, cReportControl toCtrl) { 
            toCtrl.setControlType(fromCtrl.getControlType());

            cReportField field = toCtrl.getField();
            field.setFieldType(fromCtrl.getField().getFieldType());
            field.setIndex(fromCtrl.getField().getIndex());
            field.setName(fromCtrl.getField().getName());

            toCtrl.getFormulaHide().setName(fromCtrl.getFormulaHide().getName());
            toCtrl.getFormulaHide().setText(fromCtrl.getFormulaHide().getText());
            toCtrl.getFormulaValue().setName(fromCtrl.getFormulaValue().getName());
            toCtrl.getFormulaValue().setText(fromCtrl.getFormulaValue().getText());

            toCtrl.setHasFormulaHide(fromCtrl.getHasFormulaHide());
            toCtrl.setHasFormulaValue(fromCtrl.getHasFormulaValue());

            pCopyAspect(fromCtrl.getImage().getAspect(), toCtrl.getImage().getAspect());

            cReportLabel label = toCtrl.getLabel();
            pCopyAspect(fromCtrl.getLabel().getAspect(), label.getAspect());
            label.setCanGrow(fromCtrl.getLabel().getCanGrow());
            label.setText(fromCtrl.getLabel().getText());

            pCopyAspect(fromCtrl.getLine().getAspect(), toCtrl.getLine().getAspect());
            pCopyChart(fromCtrl.getChart(), toCtrl.getChart());
        }
Beispiel #10
0
		private void pAddControlEndAux(float left, float top, cReportControl baseControl) {
            cReportControl ctrl = null;

            // first we add a control in the main header
            // after the user complete the add operation
            // we would move the control to the desired
            // section line
            //
			ctrl = m_report.getHeaders().item(cGlobals.C_KEY_HEADER).getSectionLines().item(1).getControls().add();

            // later we will set the properties related to the type of the control
            //
            m_nextNameCtrl = m_nextNameCtrl + 1;
            ctrl.setName(cGlobals.C_CONTROL_NAME + m_nextNameCtrl);

            if (baseControl == null) {
                pSetNewControlProperties(ctrl);
            } 
            else {
                pCopyControl(baseControl, ctrl);
            }

            pSetNewControlPosition(ctrl, left, top);
        }
Beispiel #11
0
        private void pSetNewControlProperties(cReportControl ctrl) {
            const int CTRL_HEIGHT = 19;
            const int CTRL_WIDTH = 133;
            const int LINE_HEIGHT = 1;

            cReportLabel label = null;
            cReportAspect aspect = null;

            int ctrlHeigth = CTRL_HEIGHT;
            bool transparent = true;

            ctrl.getLabel().getAspect().setAlign(CSReportGlobals.HorizontalAlignment.Left);

            switch (m_controlType) {
                case csRptEditCtrlType.field:
                    ctrl.setControlType(csRptControlType.CSRPTCTFIELD);
                    ctrl.getLabel().setText(m_fieldName);
                    cReportField field = ctrl.getField();
                    field.setIndex(m_fieldIndex);
                    field.setName(m_fieldName);
                    field.setFieldType(m_fieldType);

                    if (cDatabaseGlobals.isNumberField(m_fieldType))
                    {
                        aspect = ctrl.getLabel().getAspect();
                        aspect.setAlign(CSReportGlobals.HorizontalAlignment.Right);
                        aspect.setFormat("#0.00;-#0.00");
                    }
                    break;

                case csRptEditCtrlType.formula:
                    ctrl.setControlType(csRptControlType.CSRPTCTLABEL);
                    ctrl.getFormulaValue().setText(m_formulaText + "(" + m_controlName + ")");
                    ctrl.setHasFormulaValue(true);
                    label = ctrl.getLabel();
                    aspect = label.getAspect();
                    aspect.setFormat("0.00;-0.00");
                    aspect.getFont().setBold(true);
                    label.setText(ctrl.getFormulaValue().getText());
                    aspect.setAlign(CSReportGlobals.HorizontalAlignment.Right);
                    break;

                case csRptEditCtrlType.label:
                    ctrl.setControlType(csRptControlType.CSRPTCTLABEL);
                    label = ctrl.getLabel();
                    label.setText(m_fieldName);
                    label.getAspect().getFont().setBold(true);
                    break;

                case csRptEditCtrlType.lineLabel:
                    ctrlHeigth = LINE_HEIGHT;
                    ctrl.setControlType(csRptControlType.CSRPTCTLABEL);
                    label = ctrl.getLabel();
                    label.setText(m_fieldName);
                    aspect = label.getAspect();
                    aspect.getFont().setBold(true);
                    aspect.setBackColor(Color.Gray.ToArgb());
                    transparent = false;
                    break;

                case csRptEditCtrlType.image:
                    ctrl.setControlType(csRptControlType.CSRPTCTIMAGE);
                    ctrl.getLabel().setText(m_fieldName);
                    break;

                case csRptEditCtrlType.chart:
                    ctrl.setControlType(csRptControlType.CSRPTCTCHART);
                    ctrl.getLabel().setText(m_fieldName);
                    break;
            }

            aspect = ctrl.getLabel().getAspect();
            aspect.setWidth(CTRL_WIDTH);
            aspect.setHeight(ctrlHeigth);
            aspect.setTransparent(transparent);
        }
Beispiel #12
0
 private Image pGetChartImage(int indexRows, int indexField, int indexRow, cReportControl ctrl)
 { // TODO: Use of ByRef founded Private Function pGetChartImage(ByVal IndexRows As Long, ByVal IndexField As Long, ByVal IndexRow As Long, ByRef ctrl As cReportControl) As Long
     if (ctrl.getChart().getChartCreated())
     {
         return ctrl.getChart().getImage();
     }
     else
     {
         if (ctrl.getChart().make(m_collRows[indexRows].Rows, ctrl.getLabel().getAspect().getFormat(), false, ""))
         {
             return ctrl.getChart().getImage();
         }
         else
         {
             return null;
         }
     }
 }
Beispiel #13
0
        private bool pInitCtrls(cReportControl ctrl, out int idx, List<object[]> recordsets, String fieldName)
        {
            bool found = false;
            int j = 0;
            bool bIsDBImage = false;

            string dataSource = pGetDataSource(fieldName);

            // index of the group which contains the control
            //
            int k = 0;

            for (int _i = 0; _i < recordsets.Count; _i++)
            {
                object[] varRs = recordsets[_i];                
                String rsDataSource = (String)varRs[1];
                if (rsDataSource.ToUpper() == dataSource.ToUpper() || dataSource == "")
                {
                    DataTable rs = (DataTable)varRs[0];

                    for (j = 0; j < rs.Columns.Count; j++)
                    {
                        if (rs.Columns[j].ColumnName.ToUpper() == cReportGlobals.getRealName(fieldName).ToUpper())
                        {
                            // TODO: we need to check what is the value of rs.Columns[j].DataType
                            //       when the column contains a binary field (tipicaly used for images)
                            //
                            System.TypeCode typeCode = System.Type.GetTypeCode(rs.Columns[j].DataType);
                            bIsDBImage = typeCode == System.TypeCode.Object;
                            found = true;
                            break;
                        }
                    }
                }
                if (found)
                {
                    break;
                }
                k = k + 1000;
            }

            if (found)
            {
                idx = j + k;
                if (bIsDBImage)
                {
                    ctrl.setControlType(csRptControlType.CSRPTCTDBIMAGE);
                }
            }
            else
            {
                throw new ReportException(csRptErrors.FIELD_NOT_FOUND,
                                            C_MODULE,
                                            cReportError.errGetDescript(csRptErrors.FIELD_NOT_FOUND, ctrl.getName(), fieldName)
                                            );
            }
            return true;
        }
Beispiel #14
0
        // indexRows     define the datasource
        // indexRow      define the row in the datasource
        //
        private void pGetIndexRows(out int indexRows, out int indexRow, out int indexField, cReportControl ctrl)
        {
            // the datasource index have an offset of 1000 between each other
            //
            indexRows = (int)(ctrl.getField().getIndex() / 1000);
            indexField = ctrl.getField().getIndex() - (indexRows * 1000);

            if (indexRows == 0)
            {
                indexRow = m_vRowsIndex[m_iRow2];
            }
            else
            {
                indexRow = m_vRowsIndexAux[indexRows];
            }
        }
        internal cReportControl add2(cReportControl c, String key)
        {
            try
            {
                if (c == null) 
                { 
                    c = new cReportControl(); 
                }
                if (key == "")
                {
                    Add(getDummyKey(), c);
                }
                else
                {
                    Add(cReportGlobals.getKey(key), c);
                }

                return c;
            }
            catch (Exception ex)
            {
                return null;
            }
        }
        public cReportControl add(cReportControl c, String key)
        {
            try
            {

                if (c == null) 
                { 
                    c = new cReportControl(); 
                }
                if (key == "")
                {
                    key = cReportGlobals.getNextKey().ToString();
                }
                else
                {
                    cReportGlobals.refreshNextKey(key);
                }

                key = cReportGlobals.getKey(key);
                Add(key, c);

                c.setKey(key);
                c.setTypeSection(m_typeSection);
                c.setSectionLine(m_sectionLine);

                if (m_copyColl != null) 
                { 
                    m_copyColl.add2(c, key); 
                }

                return c;
            }
            catch
            {
                return null;
            }
        }