Changeset View
Changeset View
Standalone View
Standalone View
libs/textlayout/KoTextLayoutTableArea.cpp
Show First 20 Lines • Show All 429 Lines • ▼ Show 20 Line(s) | 424 | do { | |||
---|---|---|---|---|---|
430 | complete = layoutRow(cursor, topBorderWidth, bottomBorderWidth); | 430 | complete = layoutRow(cursor, topBorderWidth, bottomBorderWidth); | ||
431 | 431 | | |||
432 | setBottom(d->rowPositions[cursor->row + 1] + bottomBorderWidth); | 432 | setBottom(d->rowPositions[cursor->row + 1] + bottomBorderWidth); | ||
433 | topBorderWidth = bottomBorderWidth; | 433 | topBorderWidth = bottomBorderWidth; | ||
434 | bottomBorderWidth = nextBottomBorderWidth; | 434 | bottomBorderWidth = nextBottomBorderWidth; | ||
435 | 435 | | |||
436 | 436 | | |||
437 | if (complete) { | 437 | if (complete) { | ||
438 | if (cursor->row >= d->headerRows) { | ||||
438 | setVirginPage(false); | 439 | setVirginPage(false); | ||
440 | } | ||||
439 | cursor->row++; | 441 | cursor->row++; | ||
440 | } | 442 | } | ||
441 | } while (complete && cursor->row < d->table->rows()); | 443 | } while (complete && cursor->row < d->table->rows()); | ||
442 | 444 | | |||
443 | if (cursor->row == d->table->rows()) { | 445 | if (cursor->row == d->table->rows()) { | ||
444 | d->lastRowHasSomething = false; | 446 | d->lastRowHasSomething = false; | ||
445 | } | 447 | } | ||
446 | 448 | | |||
447 | 449 | | |||
448 | if (first) { // were we at the beginning of the table | 450 | if (first) { // were we at the beginning of the table | ||
449 | for (int row = 0; row < d->headerRows; ++row) { | 451 | for (int row = 0; row < d->headerRows; ++row) { | ||
450 | // Copy header rows | 452 | // Copy header rows | ||
451 | cursor->headerRowPositions[row] = d->rowPositions[row]; | 453 | cursor->headerRowPositions[row] = d->rowPositions[row]; | ||
452 | d->headerRowPositions[row] = d->rowPositions[row]; | 454 | d->headerRowPositions[row] = d->rowPositions[row]; | ||
453 | for (int col = 0; col < d->table->columns(); ++col) { | 455 | for (int col = 0; col < d->table->columns(); ++col) { | ||
454 | cursor->headerCellAreas[row][col] = d->cellAreas[row][col]; | 456 | cursor->headerCellAreas[row][col] = d->cellAreas[row][col]; | ||
455 | } | 457 | } | ||
456 | } | 458 | } | ||
457 | if (d->headerRows) { | 459 | if (d->headerRows) { | ||
458 | // Also set the position of the border below headers | 460 | // Also set the position of the border below headers | ||
459 | cursor->headerRowPositions[d->headerRows] = d->rowPositions[d->headerRows]; | 461 | cursor->headerRowPositions[d->headerRows] = d->rowPositions[d->headerRows]; | ||
460 | d->headerRowPositions[d->headerRows] = d->rowPositions[d->headerRows]; | 462 | d->headerRowPositions[d->headerRows] = d->rowPositions[d->headerRows]; | ||
461 | } | 463 | } | ||
462 | cursor->headerPositionX = d->columnPositions[0]; | 464 | cursor->headerPositionX = d->columnPositions[0]; | ||
boemann: nah this is too aggressive.
There are definitely cases where setting to 0 is the correct thing… | |||||
I should see how this would work, because if we reset it to 0 every time it takes same way to parse, as it can see cursor->row is force reset only here. anthonyfieroni: I should see how this would work, because if we reset it to 0 every time it takes same way to… | |||||
463 | 465 | | |||
464 | if (!virginPage() && d->totalMisFit) { | 466 | if (!virginPage() && d->totalMisFit) { | ||
465 | //if we couldn't fit the header rows plus some then don't even try | 467 | //if we couldn't fit the header rows plus some then don't even try | ||
466 | cursor->row = 0; | 468 | cursor->row = 0; | ||
467 | nukeRow(cursor); | 469 | nukeRow(cursor); | ||
468 | } | 470 | } | ||
469 | } | 471 | } | ||
470 | 472 | | |||
▲ Show 20 Lines • Show All 309 Lines • ▼ Show 20 Line(s) | 780 | for (col = 0; col < d->table->columns(); ++col) { | |||
780 | 782 | | |||
781 | if (row == cell.row() + cell.rowSpan() - 1) { | 783 | if (row == cell.row() + cell.rowSpan() - 1) { | ||
782 | delete cursor->frameIterators[col]; | 784 | delete cursor->frameIterators[col]; | ||
783 | cursor->frameIterators[col] = 0; | 785 | cursor->frameIterators[col] = 0; | ||
784 | } | 786 | } | ||
785 | } | 787 | } | ||
786 | } | 788 | } | ||
787 | 789 | | |||
788 | if (noCellsFitted && row <= d->headerRows) { | | |||
789 | d->totalMisFit = true; | | |||
790 | } | | |||
791 | | ||||
792 | if (anyCellTried && noCellsFitted && !rowHasExactHeight && !allCellsFullyDone) { | 790 | if (anyCellTried && noCellsFitted && !rowHasExactHeight && !allCellsFullyDone) { | ||
793 | d->rowPositions[row+1] = d->rowPositions[row]; | 791 | d->rowPositions[row+1] = d->rowPositions[row]; | ||
794 | nukeRow(cursor); | 792 | nukeRow(cursor); | ||
795 | if (cursor->row > d->startOfArea->row) { | 793 | if (cursor->row > d->startOfArea->row) { | ||
796 | cursor->row--; | 794 | cursor->row--; | ||
797 | layoutMergedCellsNotEnding(cursor, topBorderWidth, bottomBorderWidth, rowBottom); | 795 | layoutMergedCellsNotEnding(cursor, topBorderWidth, bottomBorderWidth, rowBottom); | ||
798 | cursor->row++; | 796 | cursor->row++; | ||
799 | } | 797 | } | ||
800 | return false; // we can't honour the anything inside so give up doing row | 798 | return false; // we can't honour the anything inside so give up doing row | ||
801 | } | 799 | } | ||
802 | 800 | | |||
801 | if (noCellsFitted && d->headerRows && row <= d->headerRows) { | ||||
802 | d->totalMisFit = true; | ||||
803 | } | ||||
804 | | ||||
803 | if (!allCellsFullyDone) { | 805 | if (!allCellsFullyDone) { | ||
804 | layoutMergedCellsNotEnding(cursor, topBorderWidth, bottomBorderWidth, rowBottom); | 806 | layoutMergedCellsNotEnding(cursor, topBorderWidth, bottomBorderWidth, rowBottom); | ||
805 | } else { | 807 | } else { | ||
806 | // Cells all ended naturally, so we can now do vertical alignment | 808 | // Cells all ended naturally, so we can now do vertical alignment | ||
807 | // Stop! Other odf implementors also only do it if all cells are fully done | 809 | // Stop! Other odf implementors also only do it if all cells are fully done | ||
808 | col = 0; | 810 | col = 0; | ||
809 | while (col < d->table->columns()) { | 811 | while (col < d->table->columns()) { | ||
810 | QTextTableCell cell = d->table->cellAt(row, col); | 812 | QTextTableCell cell = d->table->cellAt(row, col); | ||
▲ Show 20 Lines • Show All 367 Lines • Show Last 20 Lines |
nah this is too aggressive.
There are definitely cases where setting to 0 is the correct thing to do.
There might be some times we enter an infinite loop yes, but we need to catch this is some other way