1
////////////////////////////////////////////////////////////////////////////////
3
// This file is part of Toolkit for Conceptual Modeling (TCM).
4
// (c) copyright 1996, Vrije Universiteit Amsterdam
5
// Author: Frank Dehne (frank@cs.vu.nl).
7
// TCM is free software; you can redistribute it and/or modify
8
// it under the terms of the GNU General Public License as published by
9
// the Free Software Foundation; either version 2 of the License, or
10
// (at your option) any later version.
12
// TCM is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
17
// You should have received a copy of the GNU General Public License
18
// along with TCM; if not, write to the Free Software
19
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21
////////////////////////////////////////////////////////////////////////////////
26
#include "cellcolumn.h"
29
TDTable::TDTable(Config *c, TDWindow *t, TDViewer *v): Matrix(c, t, v) { }
31
bool TDTable::CheckTextString(Cell *c, const string *text) {
32
return (Matrix::CheckTextString(c, text));
35
void TDTable::CheckDocument() {
38
// Check missing entity type names.
39
unsigned n = CheckEmptyRowEntries(0);
41
chkbuf += "* Error: ";
43
chkbuf += " entity type";
46
chkbuf += " in column 0 ";
47
(n == 1) ? (chkbuf += "is"): (chkbuf += "are");
48
chkbuf += " still empty\n";
51
// Check missing transaction names.
52
n = CheckEmptyColumnEntries(0);
54
chkbuf += "* Error: ";
56
chkbuf += " transaction";
59
chkbuf += " in row 0 ";
60
(n == 1) ? (chkbuf += "is"): (chkbuf += "are");
61
chkbuf += " still empty\n";
64
// Check for transactions without entries (warning).
66
for (i=1; i<GetTableViewer()->GetNumberOfColumns(); i++) {
67
CellColumn *column = GetTableViewer()->GiveColumn(i);
68
if (column && *column->FirstCell()->GetText() != "") {
69
unsigned j = CheckEmptyRowEntries(i);
70
if (j == GetTableViewer()->GetNumberOfRows()-1) {
71
chkbuf+="* Warning: the transaction in column ";
73
chkbuf += " does not do anything\n";
74
GetTableViewer()->SelectCell(column->FirstCell());
79
// Check for entity types without entries(warning).
80
for (i=1; i<GetTableViewer()->GetNumberOfRows(); i++) {
81
CellRow *row = GetTableViewer()->GiveRow(i);
82
if (row && *row->FirstCell()->GetText() != "") {
83
unsigned j = CheckEmptyColumnEntries(i);
84
if (j == GetTableViewer()->GetNumberOfColumns()-1) {
85
chkbuf += "* Warning: the entity type in row ";
87
chkbuf += " does not take part in anything\n";
88
GetTableViewer()->SelectCell(row->FirstCell());
93
ReportCheck(total, &chkbuf);