public bool exportEx(CSReportDll.cReport report, object caller, String outputFile, bool showPDFWindow)
 {
     return false;
 }
        private CSReportDll.cReportPageFields pGetLineAux(int indexLine, CSReportDll.cReportPageFields fields)
        {
            CSReportDll.cReportPageFields flds = new CSReportDll.cReportPageFields();

            for (int _i = 0; _i < fields.count(); _i++)
            {
                CSReportDll.cReportPageField fld = fields.item(_i);
                if (fld.getIndexLine() == indexLine)
                {
                    flds.add(fld);
                }
            }
            return flds;
        }
Example #3
0
        public static void fillColumns(
            string dataSource, CSReportDll.cColumnsInfo columns, ListView lv_columns,
            string C_INDEX, string C_FIELDTYPE, bool add)
        {
            if (!add) lv_columns.Items.Clear();

            foreach (CSReportDll.cColumnInfo column in columns)
            {
                var item = lv_columns.Items.Add(String.Format("{{{0}}}.{1}", dataSource, column.getName()));
                item.ImageIndex = 0;
                string info = cUtil.setInfoString("", C_INDEX, column.getPosition().ToString());
                info = cUtil.setInfoString(info, C_FIELDTYPE, column.getColumnType().ToString());
                item.Tag = info;
            }
        }
        public bool isInThisLine(
            String ctrlName,
            int indexField,
            CSReportDll.cReportPageField testFld)
        {
            CSReportDll.cReportPageFields fields = null;
            CSReportDll.cReportPageField fld = null;

            if (indexField == 0)
            {
                return true;
            }
            fields = getLine(indexField);

            for (int _i = 0; _i < fields.count(); _i++)
            {
                fld = fields.item(_i);
                if (fld.getInfo().getName() == ctrlName)
                {
                    if (testFld == fld)
                    {
                        return true;
                    }
                }
            }
            return false;
        }
        private cReportPaintObject pGetPaintObjByCtrlName(
            String ctrlName,
            CSReportDll.cReportPageFields fields,
            int offset)
        {
            CSReportDll.cReportPageField fld = getFieldByCtrlName(ctrlName, fields);

            for (int _i = 0; _i < m_paint.getPaintObjects().count(); _i++)
            {
                cReportPaintObject rtn = m_paint.getPaintObjects().item(_i);
                if (fields.item(rtn.getIndexField() - offset) == fld)
                {
                    return rtn;
                }
            }
            return null;
        }
 public CSReportDll.cReportPageField getFieldByCtrlName(
     String ctrlName,
     CSReportDll.cReportPageFields fields)
 {
     return getFieldByCtrlName(ctrlName, fields, 0);
 }
        public CSReportDll.cReportPageField getFieldByCtrlName(
            String ctrlName,
            CSReportDll.cReportPageFields fields,
            int indexField)
        {
            CSReportDll.cReportPageField fld = null;

            for (int _i = 0; _i < fields.count(); _i++)
            {
                fld = fields.item(_i);
                if (fld.getInfo().getName() == ctrlName)
                {
                    if (isInThisLine(ctrlName, indexField, fld))
                    {
                        return fld;
                    }
                }
            }
            return null;
        }
 private bool pGetFieldFromIndexAux(CSReportDll.cReportPageFields fields, int index, ref CSReportDll.cReportPageField rtn)
 {
     try
     {
         rtn = fields.item(index);
         return true;
     }
     catch
     {
         return false;
     }
 }
 private void setReport(CSReportDll.cReport rhs)
 {
     m_report = rhs;
 }
        private void createPaintObjects(CSReportDll.cReportPageFields fields, int offset)
        {
            CSReportDll.cReportPageField field = null;

            CSReportDll.cReportAspect rptAspect = null;
            CSReportDll.cReportFont rptFont = null;

            int index = 0;

            for (int _i = 0; _i < fields.count(); _i++)
            {
                field = fields.item(_i);
                index = index + 1;

                if (field.getVisible())
                {

                    rptAspect = field.getInfo().getAspect();

                    cReportPaintObject w_add = m_paint.getPaintObjects().add(null, "");
                    CSReportDll.cReportAspect w_aspect = w_add.getAspect();
                    if (field.getTop() > 0)
                    {
                        w_aspect.setTop(field.getTop());
                    }
                    else
                    {
                        w_aspect.setTop(rptAspect.getTop());
                    }
                    if (field.getHeight() > 0)
                    {
                        w_aspect.setHeight(field.getHeight());
                    }
                    else
                    {
                        w_aspect.setHeight(rptAspect.getHeight());
                    }
                    if (field.getWidth() > 0)
                    {
                        w_aspect.setWidth(field.getWidth());
                    }
                    else
                    {
                        w_aspect.setWidth(rptAspect.getWidth());
                    }
                    w_aspect.setLeft(rptAspect.getLeft());
                    w_aspect.setBackColor(rptAspect.getBackColor());
                    w_aspect.setTransparent(rptAspect.getTransparent());
                    w_aspect.setAlign(rptAspect.getAlign());
                    w_aspect.setWordWrap(rptAspect.getWordWrap());

                    w_aspect.setBorderColor(rptAspect.getBorderColor());
                    w_aspect.setBorderColor3d(rptAspect.getBorderColor3d());
                    w_aspect.setBorderColor3dShadow(rptAspect.getBorderColor3dShadow());
                    w_aspect.setBorderRounded(rptAspect.getBorderRounded());
                    w_aspect.setBorderType(rptAspect.getBorderType());
                    w_aspect.setBorderWidth(rptAspect.getBorderWidth());

                    rptFont = rptAspect.getFont();
                    CSReportDll.cReportFont w_font = w_aspect.getFont();
                    w_font.setBold(rptFont.getBold());
                    w_font.setForeColor(rptFont.getForeColor());
                    w_font.setItalic(rptFont.getItalic());
                    w_font.setName(rptFont.getName());
                    w_font.setSize(rptFont.getSize() * m_scaleFont);
                    w_font.setStrike(rptFont.getStrike());
					w_font.setUnderline(rptFont.getUnderline());

                    w_add.setText(field.getValue());
                    w_add.setImage(field.getImage());

                    if (w_add.getImage() != null)
                    {
                        w_add.setPaintType(csRptPaintObjType.CSRPTPAINTOBJIMAGE);
                    }
                    w_add.setIndexField(index + offset);
                    if (field.getObjectID() != null)
                    {
                        w_add.setTag(field.getObjectID().getValue());
                    }
                }
            }
        }
        // returns the bigger control's height and set the height of every control
        //
        private float getLineHeight(CSReportDll.cReportPageFields fields, ref float[] offsetTop)
        {
            CSReportDll.cReportPageField field = null;
            float offBottom = 0;
            float aspectHeight = 0;
            float aspectWidth = 0;

            CSReportDll.cReportAspect aspect = null;
            CSReportDll.cReportAspect aspectLn = null;

            // used to get the offset to top
            //
            float lnHeight = 0;

            // used to increase the height of the line
            //
            float lnHeight2 = 0;
            float newLnHeight = 0;

            Font font = null;

            float topSection = 0;
            int indexSection = -1;
            float heightSection = 0;

            offsetTop = new float[1];

            if (fields.count() > 0)
            {

                // search for the highest control
                //
                for (int _i = 0; _i < fields.count(); _i++)
                {
                    field = fields.item(_i);

                    // if it can grow we need to get its height to be
                    // able to print it
                    //
                    aspect = field.getInfo().getAspect();
                    aspectLn = field.getInfo().getSectionLine().getAspect();

                    // TODO: remove me
                    // System.Console.WriteLine(field.getInfo().getSectionLine().getRealIndex());

                    // if the line has changed we need to get the height of the line
                    // and add it to heightSection
                    //
                    if (indexSection != field.getInfo().getSectionLine().getIndex())
                    {

                        // save a reference to this section
                        //
                        indexSection = field.getInfo().getSectionLine().getIndex();

                        if (indexSection > offsetTop.Length -1)
                        {
                            G.redimPreserve(ref offsetTop, indexSection + 1);
                        }

                        // save this offset to add it to every control holded in the
                        // section lines which are under the current section line
                        //
                        offsetTop[indexSection] = offsetTop[indexSection] + newLnHeight - lnHeight;

                        // we get the top of the current line which includes only
                        // the height of visible lines
                        //
                        topSection = topSection + (aspectLn.getTop() - (topSection + heightSection));

                        // add to heightSection the height of this line
                        //
                        heightSection = heightSection + aspectLn.getHeight();

                        // save the height of the line to know if it has changed for canGrow
                        //
                        lnHeight = aspectLn.getHeight();

                        // the height of the original section line
                        //
                        lnHeight2 = lnHeight;

                        // save the height of the line to analize canGrow
                        //
                        newLnHeight = lnHeight;
                    }

                    // add to every control the offset produced by controls which
                    // can grow
                    //
                    if (aspect.getCanGrow())
                    {

                        aspectHeight = aspect.getHeight();
                        aspectWidth = aspect.getWidth();

                        // if there is an image we need to get its height
                        //
                        if (field.getImage() != null)
                        {

                            int imgWidth = 0;
                            int imgHeight = 0;

                            cGlobals.getBitmapSize(field.getImage(), out imgWidth, out imgHeight, true);

                            field.setHeight(imgHeight);
                            field.setWidth(imgWidth);

                            if (field.getHeight() < aspectHeight) { field.setHeight(aspectHeight); }
                            if (field.getWidth() < aspectWidth) { field.setWidth(aspectWidth); }
                        }
                        else
                        {
                            if (field.getValue() != "")
                            {
                                int flags = 0;

                                // TODO: flags to get height of text to be drawn
                                if (aspect.getWordWrap())
                                {
                                    flags = 0/*ECGTextAlignFlags.DT_WORDBREAK
                                            || ECGTextAlignFlags.DT_WORD_ELLIPSIS
                                            || ECGTextAlignFlags.DT_LEFT
                                            || ECGTextAlignFlags.DT_NOPREFIX
                                            || ECGTextAlignFlags.DT_EDITCONTROL*/;
                                }
                                else
                                {
                                    flags = 0/*ECGTextAlignFlags.DT_SINGLELINE
                                            || ECGTextAlignFlags.DT_WORD_ELLIPSIS
                                            || ECGTextAlignFlags.DT_LEFT
                                            || ECGTextAlignFlags.DT_NOPREFIX*/;
                                }
                                
                                int idx = cGlobals.addFontIfRequired(aspect.getFont(), ref m_fnt);
                                
                                font = m_fnt[idx];

                                field.setHeight(
                                    evaluateTextHeight(
                                        field.getValue(), 
                                        font, 
                                        aspect.getWidth(), 
                                        flags, 
                                        m_scaleY, 
                                        m_scaleX));
                                if (field.getHeight() < aspectHeight) { field.setHeight(aspectHeight); }
                            }
                        }

                        // if it doesn't fit in the line because is too high
                        //
                        if (field.getHeight() + aspect.getTop() > topSection + newLnHeight)
                        {
                            offBottom = (topSection + newLnHeight) - (aspect.getTop() + aspectHeight);

                            // to separete a little
                            //
                            if (offBottom < 0) { offBottom = offBottom + 5; }

                            // new line's height 
                            //
                            newLnHeight = aspect.getTop() - topSection + field.getHeight() + offBottom;
                        }

                        // if the height of the previous line has changed because 
                        // some control has set to canGrow = true and its value
                        // makes the control's height to change, we need to add
                        // this height to heightSection
                        //
                        if (newLnHeight > lnHeight2)
                        {
                            //                                substract the original height
                            //                                |         add the hieght for canGrow
                            //                                |             |
                            heightSection = heightSection - lnHeight2 + newLnHeight;
                            lnHeight2 = newLnHeight;
                        }
                    }
                    else
                    {
                        field.setHeight(aspect.getHeight());
                    }
                }
            }

            // return the height of the section
            //
            return heightSection;
        }
 // returns details' height of this page
 //
 private float getDetailHeight(CSReportDll.cReportPage page, ref float top)
 {
     top = page.getHeaderBottom();
     return page.getFooterTop() - top;
 }