wxRTC tables: improve collapsed border drawing by allowing cell borders at the edge if no overall border.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74984 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -9334,14 +9334,29 @@ bool wxRichTextCell::AdjustAttributes(wxRichTextAttr& attr, wxRichTextDrawingCon
|
|||||||
table->GetAttributes().GetTextBoxAttr().GetCollapseBorders() == wxTEXT_BOX_ATTR_COLLAPSE_FULL)
|
table->GetAttributes().GetTextBoxAttr().GetCollapseBorders() == wxTEXT_BOX_ATTR_COLLAPSE_FULL)
|
||||||
{
|
{
|
||||||
// Collapse borders:
|
// Collapse borders:
|
||||||
// (1) Reset left and top for all cells;
|
// (1) Reset left and top for all cells unless there is no table border there;
|
||||||
// (2) for bottom and right, ignore if at edge of table, otherwise
|
// (2) for bottom and right, reset if at edge of table and there are no table borders,
|
||||||
// use this cell's border if present, otherwise adjacent border if not.
|
// otherwise use this cell's border if present, otherwise adjacent border if not.
|
||||||
// Takes into account spanning by checking if adjacent cells are shown.
|
// Takes into account spanning by checking if adjacent cells are shown.
|
||||||
int row, col;
|
int row, col;
|
||||||
if (table->GetCellRowColumnPosition(GetRange().GetStart(), row, col))
|
if (table->GetCellRowColumnPosition(GetRange().GetStart(), row, col))
|
||||||
{
|
{
|
||||||
|
if (col == 0)
|
||||||
|
{
|
||||||
|
// Only remove the cell border on the left edge if we have a table border
|
||||||
|
if (table->GetAttributes().GetTextBoxAttr().GetBorder().GetLeft().IsValid())
|
||||||
attr.GetTextBoxAttr().GetBorder().GetLeft().Reset();
|
attr.GetTextBoxAttr().GetBorder().GetLeft().Reset();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
attr.GetTextBoxAttr().GetBorder().GetLeft().Reset();
|
||||||
|
|
||||||
|
if (row == 0)
|
||||||
|
{
|
||||||
|
// Only remove the cell border on the top edge if we have a table border
|
||||||
|
if (table->GetAttributes().GetTextBoxAttr().GetBorder().GetTop().IsValid())
|
||||||
|
attr.GetTextBoxAttr().GetBorder().GetTop().Reset();
|
||||||
|
}
|
||||||
|
else
|
||||||
attr.GetTextBoxAttr().GetBorder().GetTop().Reset();
|
attr.GetTextBoxAttr().GetBorder().GetTop().Reset();
|
||||||
|
|
||||||
// Compute right border
|
// Compute right border
|
||||||
@@ -9357,9 +9372,12 @@ bool wxRichTextCell::AdjustAttributes(wxRichTextAttr& attr, wxRichTextDrawingCon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If no adjacent cell (either because they were hidden or at the edge of the table)
|
// If no adjacent cell (either because they were hidden or at the edge of the table)
|
||||||
// then we must reset the border
|
// then we must reset the border, if there's a right table border.
|
||||||
if (!adjacentCellRight)
|
if (!adjacentCellRight)
|
||||||
|
{
|
||||||
|
if (table->GetAttributes().GetTextBoxAttr().GetBorder().GetRight().IsValid())
|
||||||
attr.GetTextBoxAttr().GetBorder().GetRight().Reset();
|
attr.GetTextBoxAttr().GetBorder().GetRight().Reset();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!attr.GetTextBoxAttr().GetBorder().GetRight().IsValid() ||
|
if (!attr.GetTextBoxAttr().GetBorder().GetRight().IsValid() ||
|
||||||
@@ -9381,9 +9399,12 @@ bool wxRichTextCell::AdjustAttributes(wxRichTextAttr& attr, wxRichTextDrawingCon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If no adjacent cell (either because they were hidden or at the edge of the table)
|
// If no adjacent cell (either because they were hidden or at the edge of the table)
|
||||||
// then we must reset the border
|
// then we must reset the border, if there's a bottom table border.
|
||||||
if (!adjacentCellBelow)
|
if (!adjacentCellBelow)
|
||||||
|
{
|
||||||
|
if (table->GetAttributes().GetTextBoxAttr().GetBorder().GetBottom().IsValid())
|
||||||
attr.GetTextBoxAttr().GetBorder().GetBottom().Reset();
|
attr.GetTextBoxAttr().GetBorder().GetBottom().Reset();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!attr.GetTextBoxAttr().GetBorder().GetBottom().IsValid() ||
|
if (!attr.GetTextBoxAttr().GetBorder().GetBottom().IsValid() ||
|
||||||
|
Reference in New Issue
Block a user