protected override void InvalidateLayout() { base.InvalidateLayout(); // Discard all layout information for children added or removed. currentLayoutTable = null; }
protected override void OnChildMeasureInvalidated() { base.OnChildMeasureInvalidated(); // Discard all layout information for child size changed. currentLayoutTable = null; }
public TableViewModel(LayoutTable table, bool adding) { if (table == null) { throw new ArgumentNullException("table"); } Table = table; Adding = adding; }
/// <summary> /// Рисует строку подведения итогов. Это может быть как строка с общими итогами, так и с промежуточными /// </summary> /// <remarks>Переопределяем стандартный метод</remarks> protected override void WriteTotalRow(tablelayoutClass LayoutProfile, Croc.XmlFramework.ReportService.Layouts.ReportLayoutData LayoutData, Croc.XmlFramework.ReportService.Layouts.TableLayout.LayoutColumns Columns, int CurrentRowNum, int CurrentColumnNum, bool SubTotals, DataTable oTable, int[] ColumnsRowspan, int nGroupedCellsCount, DataRow PreviousRow) { // вызываем базовый метод, но передаем ему столбцы для накопления итогов // только по помеченным строкам base.WriteTotalRow(LayoutProfile, LayoutData, TotalColumns, CurrentRowNum, CurrentColumnNum, SubTotals, oTable, ColumnsRowspan, nGroupedCellsCount, PreviousRow); // если выводим общие итоги, то больше ничего делать не надо if (!SubTotals) { return; } // получаем объект, с которым работают форматтеры и эвалуаторы ReportFormatterData FormatterData = new ReportFormatterData(LayoutData, ((int)PreviousRow["Expected"] - (int)PreviousRow["TotalSpent"]).ToString(), null, PreviousRow, -1, -1); durationevaluatorClass FormatterNode = new durationevaluatorClass(); FormatterNode.workdayDuration = "{#WorkdayDuration}"; FormatterNode.format = "{@TimeMeasureUnits}"; // просим объект у фабрики IReportFormatter Formatter = (IReportFormatter)ReportObjectFactory.GetInstance(FormatterNode.GetAssembly(), FormatterNode.GetClass()); // делаем что-то Formatter.Execute(FormatterNode, FormatterData); // далее добавляем строку для вывода дисбаланса по сотруднику LayoutTable.AddRow(); LayoutTable.CurrentRow.AddCell("<fo:block text-align='right'>Дисбаланс по сотруднику:</fo:block>", "string", 1, 3, "SUBTOTAL"); LayoutTable.CurrentRow.CurrentCell.StartsColumnspanedCells = true; LayoutTable.CurrentRow.CurrentCell.IsAggregated = true; LayoutTable.CurrentRow.AddCell(null, null, 1, 1); LayoutTable.CurrentRow.CurrentCell.IsFakeCell = true; LayoutTable.CurrentRow.CurrentCell.IsAggregated = true; LayoutTable.CurrentRow.AddCell(null, null, 1, 1); LayoutTable.CurrentRow.CurrentCell.IsFakeCell = true; LayoutTable.CurrentRow.CurrentCell.IsAggregated = true; LayoutTable.CurrentRow.AddCell(FormatterData.CurrentValue, "string", 1, 2, "SUBTOTAL"); LayoutTable.CurrentRow.CurrentCell.StartsColumnspanedCells = true; LayoutTable.CurrentRow.CurrentCell.IsAggregated = true; LayoutTable.CurrentRow.AddCell(null, null, 1, 1); LayoutTable.CurrentRow.CurrentCell.IsFakeCell = true; LayoutTable.CurrentRow.CurrentCell.IsAggregated = true; }
protected override SizeRequest OnMeasure(double widthConstraint, double heightConstraint) { LayoutTable layoutData = GetLayoutData(widthConstraint, heightConstraint); if (layoutData == null || layoutData.Rows == 0) { return(new SizeRequest()); } return(new SizeRequest(layoutData.CalcTotalSize())); }
/// <summary> /// Edits the table. /// </summary> private bool EditTable(LayoutTable table, bool newTable) { var model2 = new TableViewModel(table, newTable); if (_context.Container.Run <TablePresenter, TableViewModel>(model2)) { table.UpdateWidth(GdiPlusHelper.TempGraphics, false); return(true); } return(false); }
/// <summary> /// Initializes a table added by user. /// </summary> private bool OpenTableDialog(LayoutTable table) { var model = new CreateTableModel(); if (_context.Container.Run <CreateTablePresenter, CreateTableModel>(model)) { table.Data.Initialize(model.RowCount, model.ColumnCount); return(EditTable(table, true)); } return(false); }
private LayoutTable GetLayoutData(double width, double height) { Size size = new Size(width, height); // Check if cached information is available. if (currentLayoutTable != null && currentLayoutTable.Size == size) { return(currentLayoutTable); } int columns = 0; Size maxChildSize = new Size(CellMinWidth, CellMinHeight); // Calculate the number of rows and columns. if (Double.IsPositiveInfinity(width)) { columns = Children.Count(c => c.IsVisible); } else { columns = (int)((width + ColumnSpacing) / (maxChildSize.Width + ColumnSpacing)); columns = Math.Max(1, columns); } // Now maximize the cell size based on the layout size. Size cellSize = new Size(); cellSize.Width = Double.IsPositiveInfinity(width) ? maxChildSize.Width : (width - ColumnSpacing * (columns - 1)) / columns; cellSize.Height = maxChildSize.Height; var layoutTable = new LayoutTable(new Size(width, height), columns, cellSize, ColumnSpacing, RowSpacing); foreach (VisualElement el in Children) { if (el.IsVisible) { layoutTable.LayoutItem(el); } } currentLayoutTable = layoutTable; return(currentLayoutTable); }
// get information about a current table cell public static string GetInformationAboutCurrentTableCell(Document currentDocument, LayoutTableCell tableCell) { string returnedInformation = "!A TABLE CELL IS SELECTED!\r\n"; string cellText = currentDocument.GetText(currentDocument.CreateRange(tableCell.Range.Start, tableCell.Range.Length - 1)); returnedInformation += String.Format("Cell's content: {0}\r\n", cellText); LayoutTableRow currentRow = tableCell.Parent as LayoutTableRow; if (currentRow == null) { return(returnedInformation); } LayoutTable currentTable = currentRow.Parent as LayoutTable; if (currentTable == null) { return(returnedInformation); } returnedInformation += String.Format("Row index: {0}\r\n", currentTable.TableRows.ToList().IndexOf(currentRow) + 1); for (int i = 0; i < currentRow.TableCells.Count; i++) { if (currentRow.TableCells[i] == tableCell) { returnedInformation += String.Format("Column index: {0}\r\n", i + 1); break; } } returnedInformation += String.Format("\r\n!Table information:\r\n"); returnedInformation += String.Format("Row count: {0}\r\n", currentTable.TableRows.Count); int maxCellsCount = 0; for (int i = 0; i < currentTable.TableRows.Count; i++) { if (currentTable.TableRows[i].TableCells.Count > maxCellsCount) { maxCellsCount = currentTable.TableRows[i].TableCells.Count; } } returnedInformation += String.Format("Column count: {0}\r\n", maxCellsCount); return(returnedInformation); }
private void btnCheckLayout_Click(object sender, EventArgs e) { #region #CheckLayout DevExpress.XtraRichEdit.API.Native.Table table = richEditControl1.Document.Tables.First; if (table != null) { // Obtain the layout element related to the table. LayoutTable ltable = richEditControl1.DocumentLayout.GetElement <LayoutTable>(table.Range.Start); // Obtain zero-based page index of the page containing the layout element. int pageIndex = this.richEditControl1.DocumentLayout.GetPageIndex(ltable); // Check whether the layout element is located at the second page. string s = "Layout verified."; if (pageIndex != 1) { s = "The first table is not on the page 2. Review pagination."; } MessageBox.Show(s, "Check Layout", MessageBoxButtons.OK, MessageBoxIcon.Information); } #endregion #CheckLayout }
protected override void VisitTable(LayoutTable table) { TryAddElementToCollection(table, ContentDisplayAction.Select, true); base.VisitTable(table); }
public override void DrawTable(LayoutTable table) { base.DrawTable(table); HighlightElement(table); }
protected override void VisitTable(LayoutTable table) { AddTreeNode(table, ContentDisplayAction.Select); base.VisitTable(table); }
public virtual string layoutToXML(LayoutTable paramLayoutTable) { return(this.o_xStream.toXML(paramLayoutTable)); }
protected override void VisitTable(LayoutTable table) { TablesCount++; base.VisitTable(table); }
private void AddTable() { var tbl = new LayoutTable(); _layoutControl.AddElementWithMouse(tbl); }