xsheet pdf export: tickmark breaks continuous line

This commit is contained in:
shun-iwasawa 2021-12-24 15:20:57 +09:00 committed by manongjohn
parent 7731c045dc
commit 795c8cae04

View file

@ -1347,6 +1347,10 @@ void XSheetPDFTemplate::drawXsheetTemplate(QPainter& painter, int framePage,
void XSheetPDFTemplate::drawXsheetContents(QPainter& painter, int framePage, void XSheetPDFTemplate::drawXsheetContents(QPainter& painter, int framePage,
int parallelPage, bool isPreview) { int parallelPage, bool isPreview) {
auto checkContinuous = [&](const TXshLevelColumn* column, int f, int r) { auto checkContinuous = [&](const TXshLevelColumn* column, int f, int r) {
if (m_info.continuousLineMode == Line_Always)
return true;
else if (m_info.continuousLineMode == Line_None)
return false;
TXshCell cell = column->getCell(f); TXshCell cell = column->getCell(f);
// check subsequent cells and see if more than 3 cells continue. // check subsequent cells and see if more than 3 cells continue.
int tmp_r = r + 1; int tmp_r = r + 1;
@ -1354,6 +1358,11 @@ void XSheetPDFTemplate::drawXsheetContents(QPainter& painter, int framePage,
if (tmp_f == m_duration) return false; if (tmp_f == m_duration) return false;
if (tmp_r % 72 == 0) return false; // step over to the next body if (tmp_r % 72 == 0) return false; // step over to the next body
if (column->getCell(tmp_f) != cell) return false; if (column->getCell(tmp_f) != cell) return false;
// tickmark breaks continuous line
int markId = column->getCellMark(tmp_f);
if (markId >= 0 &&
(m_info.tick1MarkId == markId || m_info.tick2MarkId == markId))
return false;
} }
return true; return true;
}; };
@ -1407,10 +1416,14 @@ void XSheetPDFTemplate::drawXsheetContents(QPainter& painter, int framePage,
// cotinuous line // cotinuous line
if (r != 0 && r != 72 && prevCell == cell) { if (r != 0 && r != 72 && prevCell == cell) {
// draw tick mark // draw tick mark
if (markId >= 0 && m_info.tick1MarkId == markId) if (markId >= 0 &&
drawTickMark(painter, m_cellRects[c][r], m_info.tick1MarkType); (m_info.tick1MarkId == markId || m_info.tick2MarkId == markId)) {
else if (markId >= 0 && m_info.tick2MarkId == markId) if (m_info.tick1MarkId == markId)
drawTickMark(painter, m_cellRects[c][r], m_info.tick2MarkType); drawTickMark(painter, m_cellRects[c][r], m_info.tick1MarkType);
else
drawTickMark(painter, m_cellRects[c][r], m_info.tick2MarkType);
drawCLFlag = checkContinuous(column, f, r);
}
else if (drawCLFlag) else if (drawCLFlag)
drawContinuousLine(painter, m_cellRects[c][r], cell.isEmpty()); drawContinuousLine(painter, m_cellRects[c][r], cell.isEmpty());
@ -1419,11 +1432,7 @@ void XSheetPDFTemplate::drawXsheetContents(QPainter& painter, int framePage,
else { else {
bool drawKeyMark = (markId >= 0 && m_info.keyMarkId == markId); bool drawKeyMark = (markId >= 0 && m_info.keyMarkId == markId);
drawCellNumber(painter, m_cellRects[c][r], cell, drawKeyMark); drawCellNumber(painter, m_cellRects[c][r], cell, drawKeyMark);
drawCLFlag = (m_info.continuousLineMode == Line_Always) drawCLFlag = checkContinuous(column, f, r);
? true
: (m_info.continuousLineMode == Line_None)
? false
: checkContinuous(column, f, r);
} }
prevCell = cell; prevCell = cell;