getHasFormulaHide() public method

public getHasFormulaHide ( ) : bool
return bool
コード例 #1
0
        private void getLineAux(cReportSection sec, cReportPageFields fields)
        {
            // for every control in every section line of sec
            // we need to create a new cPageField
            //
            cReportPageField field = null;
            cReportSectionLine secLn = null;
            cReportControl ctrl = null;
            bool isVisible = false;
            int indexCtrl = 0;

            // this indexes are used to
            //
            // indicate in which data source is this field
            //
            int indexRows = 0;
            //
            // in which row is this field
            //
            int indexRow = 0;
            //
            // in which column is this field
            //
            int indexField = 0;

            if (sec.getHasFormulaHide())
            {
                isVisible = cUtil.val(m_compiler.resultFunction(sec.getFormulaHide())) != 0;
            }
            else
            {
                isVisible = true;
            }

            if (isVisible)
            {
                // for every section line in sec
                //
                for (int _i = 0; _i < sec.getSectionLines().count(); _i++)
                {
                    secLn = sec.getSectionLines().item(_i);
                    m_lineIndex++;

                    if (secLn.getHasFormulaHide())
                    {
                        m_compiler.evalFunction(secLn.getFormulaHide());
                        isVisible = cUtil.val(m_compiler.resultFunction(secLn.getFormulaHide())) != 0;
                    }
                    else
                    {
                        isVisible = true;
                    }

                    if (isVisible)
                    {
                        // for every control in the section line
                        //
                        int[] collByLeft = secLn.getControls().getCollByLeft();
                        for (indexCtrl = 0; indexCtrl < collByLeft.Length; indexCtrl++)
                        {
                            ctrl = secLn.getControls().item(collByLeft[indexCtrl]);

                            // add a new field to the collection
                            //
                            field = fields.add(null, "");
                            field.setIndexLine(m_lineIndex);

                            if (ctrl.getHasFormulaValue())
                            {
                                field.setValue(
                                    cReportGlobals.format(
                                        m_compiler.resultFunction(ctrl.getFormulaValue()),
                                        ctrl.getLabel().getAspect().getFormat()));
                            }
                            else
                            {
                                cReportLabel w_label = null;
                                switch (ctrl.getControlType())
                                {
                                    case csRptControlType.CSRPTCTFIELD:

                                        pGetIndexRows(out indexRows, out indexRow, out indexField, ctrl);

                                        if (m_collRows[indexRows] != null)
                                        {
                                            // it looks ugly, dont think you?
                                            //
                                            // maybe this help a litle:
                                            //
                                            //    m_vCollRows(IndexRows)    a matrix with the data 
                                            //                              contained in the datasource
                                            //                              referd by this control
                                            //
                                            //    (IndexField, IndexRow)    a cell in this matrix
                                            //
                                            object value = m_collRows[indexRows].Rows[indexRow][indexField];
                                            field.setValue(
                                                cReportGlobals.format(
                                                    cReportGlobals.valVariant(value),
                                                    ctrl.getLabel().getAspect().getFormat()));
                                        }
                                        break;

                                    case csRptControlType.CSRPTCTLABEL:
                                        w_label = ctrl.getLabel();
                                        field.setValue(cReportGlobals.format(w_label.getText(), w_label.getAspect().getFormat()));
                                        break;

                                    case csRptControlType.CSRPTCTIMAGE:
                                        w_label = ctrl.getLabel();
                                        field.setValue(cReportGlobals.format(w_label.getText(), w_label.getAspect().getFormat()));
                                        field.setImage(ctrl.getImage().getImage());
                                        break;

                                    case csRptControlType.CSRPTCTDBIMAGE:
                                        pGetIndexRows(out indexRows, out indexRow, out indexField, ctrl);
                                        if (m_collRows[indexRows] != null)
                                        {
                                            field.setImage(pGetImage(indexRows, indexField, indexRow));
                                        }
                                        break;

                                    case csRptControlType.CSRPTCTCHART:
                                        pGetIndexRows(out indexRows, out indexRow, out indexField, ctrl);
                                        field.setImage(pGetChartImage(indexRows, indexField, indexRow, ctrl));
                                        break;
                                }
                            }

                            if (ctrl.getHasFormulaHide())
                            {
                                field.setVisible(cUtil.val(m_compiler.resultFunction(ctrl.getFormulaHide())) != 0);
                            }
                            else
                            {
                                field.setVisible(true);
                            }

                            // set a reference to the definition of this field
                            //
                            field.setInfo(m_pageSetting.item(ctrl.getKey()));
                        }
                    }
                }
            }
        }