Exemplo n.º 1
0
 /// <summary>
 /// Creates a debug string for spamming the display with too much information
 /// </summary>
 /// <returns>A formatted debug string</returns>
 public override string ToString()
 {
     return
         ("CurrentColumn: " + CurrentColumn.ToString() + "\n" +
          "CurrentRow:" + CurrentRow.ToString() + "\n" +
          "ApplicationCursorKeysMode:" + ApplicationCursorKeysMode.ToString() + "\n" +
          "Attribute:\n" + Attributes.ToString() + "\n" +
          "TabStops:" + string.Join(",", TabStops.Select(x => x.ToString()).ToList()) + "\n" +
          "WordWrap:" + WordWrap.ToString() + "\n" +
          "ReverseVideoMode:" + ReverseVideoMode.ToString() + "\n" +
          "OriginMode:" + OriginMode.ToString() + "\n" +
          "InsertMode:" + InsertMode.ToString() + "\n" +
          "ShowCursor:" + ShowCursor.ToString() + "\n" +
          "BlinkingCursor:" + BlinkingCursor.ToString() + "\n" +
          "CursorShape:" + CursorShape.ToString() + "\n" +
          "Utf8:" + Utf8.ToString() + "\n" +
          "CharacterSetMode:" + CharacterSetMode.ToString() + "\n" +
          "G0:" + G0.ToString() + "\n" +
          "G1:" + G1.ToString() + "\n" +
          "G2:" + G2.ToString() + "\n" +
          "G3:" + G3.ToString() + "\n" +
          "Vt300G1:" + Vt300G1.ToString() + "\n" +
          "Vt300G2:" + Vt300G2.ToString() + "\n" +
          "Vt300G3:" + Vt300G3.ToString() + "\n" +
          "Vt52AlternateKeypad: " + Vt52AlternateKeypad.ToString() + "\n" +
          "Vt52GraphicsMode: " + Vt52GraphicsMode.ToString() + "\n" +
          "AutomaticNewLine:" + AutomaticNewLine.ToString() + "\n" +
          "ConfiguredColumns:" + ConfiguredColumns.ToString() + "\n" +
          "National Character Replacement Mode:" + NationalCharacterReplacementMode.ToString() + "\n" +
          "Single shift character mode:" + SingleShiftSelectCharacterMode.ToString() + "\n"
         );
 }
Exemplo n.º 2
0
 public void showDebugCoord()
 {
     debugText(CurrentColumn.ToString() + ":" + CurrentRow.ToString());
 }
        private void StartVertRepeat(Bounds vertRepeatBounds, int repeatFrequency, RepeatMode repeatMode)
        {
            //Also if repeated rows have subRepeaters than add rowsinserted to top and bottom of such repeated defs.
            // All repeaters beneath the repeated zone must also have their top and bottom row increased by the number of rows being inserted.
            int rowsPerRepeat         = vertRepeatBounds.Bottom - vertRepeatBounds.Top + 1;
            int repeatFrequencyNumber = repeatFrequency;

            if (repeatFrequencyNumber == 0)
            {
                if (repeatMode == RepeatMode.insert)
                {
                    for (int i = vertRepeatBounds.Top; i <= vertRepeatBounds.Bottom; i++)
                    {
                        // If insert mode then remove the rows from the template
                        RowsToRemove.Add(i);
                        for (int j = vertRepeatBounds.Left; j <= vertRepeatBounds.Right; j++)
                        {
                            Document.SetCellValue(i, j, "");
                            Document.RemoveCellStyle(i, j);
                        }
                    }
                }
                if (repeatMode == RepeatMode.shift || repeatMode == RepeatMode.overwrite)
                {
                    //if the cells were to be just shifted or overwritten then just set the repeated zone to blank
                    for (int i = vertRepeatBounds.Top; i <= vertRepeatBounds.Bottom; i++)
                    {
                        for (int j = vertRepeatBounds.Left; j <= vertRepeatBounds.Right; j++)
                        {
                            Document.SetCellValue(i, j, "");
                            Document.RemoveCellStyle(i, j);
                        }
                    }
                }
                return;
            }
            //Repeated time is set to one as one sample has been created by the report designer, report engine will create the rest
            int repeatedTimes = 1;

            if (CurrentRow >= vertRepeatBounds.Top && CurrentRow <= vertRepeatBounds.Bottom)
            {
                throw new Exception(
                          "A repeater should be defined in the row before the area it is repeating. This row will be automatically deleted after repeating." +
                          "Current Row: " + CurrentRow.ToString() + " Repeater Bounds Top: " + vertRepeatBounds.Top.ToString() +
                          " Repeater Bounds Bottom: " + vertRepeatBounds.Bottom.ToString());
            }
            while (repeatedTimes < repeatFrequencyNumber)
            {
                int colBeingCopiedPos = vertRepeatBounds.Left;
                int RowBeingCopiedPos = vertRepeatBounds.Top;

                if (repeatMode == RepeatMode.insert)
                {
                    Document.InsertRow((rowsPerRepeat * repeatedTimes) + RowBeingCopiedPos, rowsPerRepeat);
                    //Increase report bounds to fit the repeated rows
                    CurrentReportBounds.Bottom += rowsPerRepeat;
                    IncreaseReapetersBeneathDefinitionRowBy(rowsPerRepeat,
                                                            ((rowsPerRepeat * repeatedTimes) + RowBeingCopiedPos));
                    IncreaseChartsBeneathDataRowBy(rowsPerRepeat, (rowsPerRepeat * repeatedTimes) + RowBeingCopiedPos);
                    //Previously parsed chart definition whose definition has been removed from template but are pointing to a range where row is inserted.
                    AdjustChartDataPostionOnRowInserted((rowsPerRepeat * repeatedTimes) + RowBeingCopiedPos, rowsPerRepeat);

                    this.RowsInserted.Add(new RowsInsertedItem((rowsPerRepeat * repeatedTimes) + RowBeingCopiedPos,
                                                               rowsPerRepeat));
                }
                else if (repeatMode == RepeatMode.shift)
                {
                    ShiftRowDown(vertRepeatBounds.Left, vertRepeatBounds.Right,
                                 (rowsPerRepeat * repeatedTimes) + RowBeingCopiedPos, rowsPerRepeat);
                    CurrentReportBounds.Bottom += rowsPerRepeat;
                    // Increase to and bottom bounds of all repeaters and sections defined below the inserted rows by the number of rows being inserted

                    IncreaseReapetersBeneathDefinitionRowBy(rowsPerRepeat,
                                                            ((rowsPerRepeat * repeatedTimes) + RowBeingCopiedPos));
                    IncreaseChartDataRowsBeneathShiftedRows(rowsPerRepeat, ((rowsPerRepeat * repeatedTimes) + RowBeingCopiedPos), vertRepeatBounds.Left, vertRepeatBounds.Right);
                    AdjustChartPositionOnRowShift(((rowsPerRepeat * repeatedTimes) + RowBeingCopiedPos), rowsPerRepeat, vertRepeatBounds.Left, vertRepeatBounds.Right);
                    this.RowsShifted.Add(new RowsShiftedItem((rowsPerRepeat * repeatedTimes) + RowBeingCopiedPos,
                                                             rowsPerRepeat, vertRepeatBounds.Left,
                                                             vertRepeatBounds.Right));
                }
                else
                {
                    CurrentReportBounds.Bottom += rowsPerRepeat;
                }

                while (RowBeingCopiedPos <= vertRepeatBounds.Bottom)
                {
                    while (colBeingCopiedPos <= vertRepeatBounds.Right)
                    {
                        Document.CopyCell(RowBeingCopiedPos, colBeingCopiedPos,
                                          (rowsPerRepeat * repeatedTimes) + RowBeingCopiedPos, colBeingCopiedPos,
                                          SLPasteTypeValues.Paste);
                        double sourceRowHeight = Document.GetRowHeight(RowBeingCopiedPos);
                        Document.SetRowHeight((rowsPerRepeat * repeatedTimes) + RowBeingCopiedPos, sourceRowHeight);
                        IncreaseChildReapeterRowBy((rowsPerRepeat * repeatedTimes),
                                                   (rowsPerRepeat * repeatedTimes) + RowBeingCopiedPos, colBeingCopiedPos,
                                                   vertRepeatBounds);
                        if (repeatMode == RepeatMode.insert)
                        {
                            IncreaseRepeatedChartsRowBy((rowsPerRepeat * repeatedTimes), RowBeingCopiedPos,
                                                        (rowsPerRepeat * repeatedTimes) + RowBeingCopiedPos,
                                                        colBeingCopiedPos);
                        }
                        else
                        {
                            IncreaseRepeatedChartsRowsIfDataInRepeatedZone((rowsPerRepeat * repeatedTimes),
                                                                           RowBeingCopiedPos,
                                                                           (rowsPerRepeat * repeatedTimes) +
                                                                           RowBeingCopiedPos,
                                                                           colBeingCopiedPos, vertRepeatBounds.Left, vertRepeatBounds.Right);
                        }
                        colBeingCopiedPos++;
                    }
                    colBeingCopiedPos = vertRepeatBounds.Left;
                    RowBeingCopiedPos++;
                }

                //copy cell merging
                foreach (var mergeCell in Document.GetWorksheetMergeCells())
                {
                    if (mergeCell.StartRowIndex >= vertRepeatBounds.Top &&
                        mergeCell.EndRowIndex <= vertRepeatBounds.Bottom &&
                        mergeCell.StartColumnIndex >= vertRepeatBounds.Left &&
                        mergeCell.EndColumnIndex <= vertRepeatBounds.Right)
                    {
                        Document.MergeWorksheetCells(mergeCell.StartRowIndex + (repeatedTimes * rowsPerRepeat),
                                                     mergeCell.StartColumnIndex,
                                                     mergeCell.EndRowIndex + (rowsPerRepeat * repeatedTimes),
                                                     mergeCell.EndColumnIndex);
                    }
                }
                CurrentReportBounds.Bottom = CurrentReportBounds.Bottom + rowsPerRepeat;
                repeatedTimes = repeatedTimes + 1;
            }
        }
Exemplo n.º 4
0
        /*====================================================*/

        protected virtual void OnViewNextPrev(Object aSrc, EventArgs e)
        {
            cPagingCtlEventArgs aArgs = (cPagingCtlEventArgs)e;

            /*
             * Page.Response.Write("Event: " + aArgs.mAction);
             * return;
             */
            int aNextRow;
            int aPrevRow;

            if (CurrentRow + mNumRowsToView >= mTotalRows)
            {
                aNextRow = CurrentRow + (mTotalRows - CurrentRow);
            }
            else
            {
                aNextRow = CurrentRow + mNumRowsToView;
            }

            if (CurrentRow - mNumRowsToView < 1)
            {
                aPrevRow = 1;
            }
            else
            {
                aPrevRow = CurrentRow - mNumRowsToView;
            }


            switch (aArgs.mAction)
            {
            case "First":
                if (mAnchorName == "")
                {
                    CorePage.Redirect(CurRowQueryString, "1");
                }
                else
                {
                    CorePage.Redirect(CurRowQueryString, "1", mAnchorName);
                }
                break;

            case "Next":
                if (mAnchorName == "")
                {
                    CorePage.Redirect(CurRowQueryString, aNextRow.ToString());
                }
                else
                {
                    CorePage.Redirect(CurRowQueryString, aNextRow.ToString(), mAnchorName);
                }
                break;

            case "Prev":
                if (mAnchorName == "")
                {
                    CorePage.Redirect(CurRowQueryString, aPrevRow.ToString());
                }
                else
                {
                    CorePage.Redirect(CurRowQueryString, aPrevRow.ToString(), mAnchorName);
                }
                break;

            case "Last":
                if (mAnchorName == "")
                {
                    CorePage.Redirect(CurRowQueryString, (mTotalRows - mNumRowsToView + 1).ToString());
                }
                else
                {
                    CorePage.Redirect(CurRowQueryString, (mTotalRows - mNumRowsToView + 1).ToString(), mAnchorName);
                }
                break;

            case "All":
                if (mAnchorName == "")
                {
                    CorePage.Redirect(CurRowQueryString, "ShowAll");
                }
                else
                {
                    CorePage.Redirect(CurRowQueryString, "ShowAll", mAnchorName);
                }
                break;

            case "Current":
                if (mAnchorName == "")
                {
                    CorePage.Redirect(CurRowQueryString, CurrentRow.ToString());
                }
                else
                {
                    CorePage.Redirect(CurRowQueryString, CurrentRow.ToString(), mAnchorName);
                }
                break;
            }
        }