Пример #1
0
        internal cReportPaintObject add(cReportPaintObject c, String key)
        {
            try
            {
                if (c == null)
                {
                    c = new cReportPaintObject();
                }
                if (key == "")
                {
                    key = cGlobals.getNextKey().ToString();
                }

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

                c.setKey(key);
                G.redimPreserve(ref m_zorder, this.count());
                m_zorder[this.count() - 1] = key;

                return(c);
            }
            catch
            {
                return(null);
            }
        }
Пример #2
0
        private void pChangeSecLnHeight(
           cReportPaintObject paintObj,
            float y,
            float minBottom,
            float maxBottom,
            cReportSectionLine secLn)
        {
            cReportAspect w_aspect = paintObj.getAspect();

            // if Y is contained between the range allowed everything is ok
            //
            if (y >= minBottom && y <= maxBottom) {
                w_aspect.setTop(y - m_offY);
            }
            else {
                // if it have been moved upward
                //
                if (y < minBottom) {
                    w_aspect.setTop(minBottom);

                }
                // if it have been moved downward
                //
                else {
                    w_aspect.setTop(maxBottom);
                }
            }

            // because the top has been setted to the real dimensions
            // of the screen now we need to move it the offset
            // of its section
            //
            w_aspect.setTop(w_aspect.getTop() + w_aspect.getOffset());

            // TODO: remove after more testing - aligning the sections has an undesired result: the last section line is shrinked after five resize actions
            //
            // m_paint.alingToGrid(paintObj.getKey());

            // the section line height has been changed
            //
            secLn.getAspect().setHeight(w_aspect.getTop()
                                        + cGlobals.C_HEIGHT_BAR_SECTION
                                        - secLn.getAspect().getTop());
        }
Пример #3
0
        private void moveSection(cReportPaintObject paintObj,
                                    float x,
                                    float y,
                                    float minBottom,
                                    float maxBottom,
                                    cReportSection secToMove,
                                    bool isNew)
        {
            float oldHeight = 0;

            m_dataHasChanged = true;

            cReportAspect w_aspect = paintObj.getAspect();

            // if Y is contained by the allowed range everything is ok
            //
            if (y >= minBottom && y <= maxBottom) {
                w_aspect.setTop(y - m_offY);

                // because the top has been set to real dimensions
                // of the screen we must move to the offset
                // of its section
                //
                w_aspect.setTop(w_aspect.getTop() + w_aspect.getOffset());
            }
            else {
                // if we have moved to top
                //
                if (y < minBottom) {
                    w_aspect.setTop(minBottom);

                    // because the top has been set to real dimensions
                    // of the screen we must move to the offset
                    // of his section
                    //
                    w_aspect.setTop(w_aspect.getTop() + w_aspect.getOffset());
                }
                else {
                    w_aspect.setTop(maxBottom);
                }
            }

            // TODO: remove after more testing - aligning the sections has an undesired result: the last section line is shrinked after five resize actions
            //
            // m_paint.alingToGrid(paintObj.getKey());

            if (isNew) {
                oldHeight = 0;
            }
            else {
                oldHeight = secToMove.getAspect().getHeight();
            }

            // for the detail section and every other section which is over the detail
            // we only change the height, for all sections bellow the detail we need to
            // change the height and top becasuse wen we strech a section it needs to move
            // to the bottom of the report
            //
            secToMove.getAspect().setHeight(w_aspect.getTop()
                                            + cGlobals.C_HEIGHT_BAR_SECTION
                                            - secToMove.getAspect().getTop());

            // every section bellow this section needs to update its top
            //
            float offsetTop = 0;

            w_aspect = secToMove.getAspect();

            offsetTop = oldHeight - (w_aspect.getHeight() + m_newSecLineOffSet);

            switch (secToMove.getTypeSection()) {

                    // if the section is a footer we move to bottom
                    // (OJO: footer sections, no group footers)
                    //
                case  csRptSectionType.FOOTER:
                case csRptSectionType.MAIN_FOOTER:

                    w_aspect.setTop(w_aspect.getTop() + offsetTop);

                    // OJO: this has to be after we have changed the top of the section
                    //      to allow the paint object to reflect the change
                    //
                    // we move the controls of this section
                    //
                    pChangeHeightSection(secToMove, oldHeight);

                    // move the section
                    //
                    pChangeBottomSections(secToMove, offsetTop);

                    // for headers, group headers, group footers and the detail section we move to top
                    //
                    break;
                default:

                    // move all controls in this section
                    //
                    pChangeHeightSection(secToMove, oldHeight);

                    offsetTop = offsetTop * -1;

                    pChangeTopSections(secToMove, offsetTop);
                    break;
            }

            // finaly we need to update the offset of every section,
            // apply it to every object paint in m_Paint
            //
            float pageHeight = 0;
            cReportPaperInfo w_paperInfo = m_report.getPaperInfo();
            pGetOffSet(CSReportPaint.cGlobals.getRectFromPaperSize(
                                                        m_report.getPaperInfo(),
                                                        w_paperInfo.getPaperSize(),
                                                        w_paperInfo.getOrientation()).Height,
                                                        out pageHeight);
            pRefreshOffSetInPaintObjs();
            m_paint.setGridHeight(pageHeight);
        }
Пример #4
0
        private bool pointIsInThisObjectAux(
            cReportPaintObject paintObj,
            float x,
            float y,
            ref String sKey,
            ref csRptPaintRegionType regionType)
        { /* ByRef PaintObj As cReportPaintObject, 
           * ByVal x As Single, 
           * ByVal y As Single, 
           * ByRef sKey As String, 
           * Optional ByRef RegionType As csRptPaintRegionType */

            const int C_WIDTH_REGION = 3;

            float yY = 0;
            float xX = 0;

            float top = 0;
            float height = 0;
            float width = 0;
            float left = 0;

            if (paintObj == null)
            {
                return false;
            }
            else
            {
                cReportAspect w_aspect = paintObj.getAspect();
                left = w_aspect.getLeft();
                width = w_aspect.getWidth();
                top = w_aspect.getTop() - w_aspect.getOffset();
                height = w_aspect.getHeight();

                if (pointIsInRegion(left - C_WIDTH_REGION,
                                    top - C_WIDTH_REGION,
                                    left + width + C_WIDTH_REGION,
                                    top + height + C_WIDTH_REGION,
                                    x, y))
                {
                    sKey = paintObj.getKey();

                    yY = top + height / 2;
                    yY = yY - C_WIDTH_REGION;

                    xX = left + width / 2;
                    xX = xX - C_WIDTH_REGION;

                    // we need to know in which region it is
                    //

                    // body
                    //
                    if (pointIsInRegion(left + C_WIDTH_REGION,
                                        top + C_WIDTH_REGION,
                                        left + width - C_WIDTH_REGION,
                                        top + height - C_WIDTH_REGION,
                                        x, y))
                    {
                        regionType = csRptPaintRegionType.CRPTPNTRGNTYPEBODY;
                    }
                    // Left
                    else if (pointIsInRegion(left - C_WIDTH_REGION * 2,
                                                yY,
                                                left + C_WIDTH_REGION * 2,
                                                yY + C_WIDTH_REGION * 2,
                                                x, y))
                    {
                        regionType = csRptPaintRegionType.CRPTPNTRGNTYPELEFT;
                    }
                    // Rigth
                    else if (pointIsInRegion(left + width - C_WIDTH_REGION * 2,
                                                yY,
                                                left + width + C_WIDTH_REGION * 2,
                                                yY + C_WIDTH_REGION * 2,
                                                x, y))
                    {
                        regionType = csRptPaintRegionType.CRPTPNTRGNTYPERIGHT;
                    }
                    // Up
                    else if (pointIsInRegion(xX,
                                                top - C_WIDTH_REGION * 2,
                                                xX + C_WIDTH_REGION * 2,
                                                top + C_WIDTH_REGION * 2,
                                                x, y))
                    {
                        regionType = csRptPaintRegionType.CRPTPNTRGNTYPEUP;
                    }
                    // Down
                    else if (pointIsInRegion(xX,
                                                top + height - C_WIDTH_REGION * 2,
                                                xX + C_WIDTH_REGION * 2,
                                                top + height + C_WIDTH_REGION * 2,
                                                x, y))
                    {
                        regionType = csRptPaintRegionType.CRPTPNTRGNTYPEDOWN;
                    }
                    // LeftUp
                    else if (pointIsInRegion(left - C_WIDTH_REGION,
                                                top - C_WIDTH_REGION,
                                                left + C_WIDTH_REGION,
                                                top + C_WIDTH_REGION,
                                                x, y))
                    {
                        regionType = csRptPaintRegionType.CRPTPNTRGNTYPELEFTUP;
                    }
                    // LeftDown
                    else if (pointIsInRegion(left - C_WIDTH_REGION,
                                                top + height - C_WIDTH_REGION,
                                                left + C_WIDTH_REGION,
                                                top + height + C_WIDTH_REGION,
                                                x, y))
                    {
                        regionType = csRptPaintRegionType.CRPTPNTRGNTYPELEFTDOWN;
                    }
                    // RigthUp
                    else if (pointIsInRegion(left + width - C_WIDTH_REGION,
                                                top - C_WIDTH_REGION,
                                                left + width + C_WIDTH_REGION,
                                                top + C_WIDTH_REGION,
                                                x, y))
                    {
                        regionType = csRptPaintRegionType.CRPTPNTRGNTYPERIGHTUP;
                    }
                    // RitgthDown
                    else if (pointIsInRegion(left + width - C_WIDTH_REGION,
                                                top + height - C_WIDTH_REGION,
                                                left + width + C_WIDTH_REGION,
                                                top + height + C_WIDTH_REGION,
                                                x, y))
                    {
                        regionType = csRptPaintRegionType.CRPTPNTRGNTYPERIGHTDOWN;
                    }

                    return true;
                }
                else
                {
                    return false;
                }
            }
        }
        internal cReportPaintObject add(cReportPaintObject c, String key)
        {
            try
            {
                if (c == null) 
                { 
                    c = new cReportPaintObject(); 
                }
                if (key == "")
                {
                    key = cGlobals.getNextKey().ToString();
                }

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

                c.setKey(key);
                G.redimPreserve(ref m_zorder, this.count());
                m_zorder[this.count()-1] = key;

                return c;
            }
            catch
            {
                return null;
            }
        }