summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2018-01-22 14:33:20 +0100
committerArmin Le Grand <Armin.Le.Grand@cib.de>2018-01-29 10:16:55 +0100
commitb28360c66bc856176ff84bc6c2516f710a7196ab (patch)
tree6e04f623517db4b0c227ae8e565efcdeb85a7cc7
parent8ed06d685bc99c61a36b8f1472883bf85e4b791a (diff)
BorderlineFix: Avoid BorderLines to be too prolonged
For MergedCells there was an effect that the BorderLines were painted too far in PrintPreview/Print/PDF visualization, found reason and changed. Checked (hopefully) all usages, looks good. Change-Id: I0acf8dcb20548a98533f3ab317ac72c0d0f0a947
-rw-r--r--include/svx/framelinkarray.hxx2
-rw-r--r--svx/source/dialog/framelinkarray.cxx58
2 files changed, 39 insertions, 21 deletions
diff --git a/include/svx/framelinkarray.hxx b/include/svx/framelinkarray.hxx
index e135e371319c..b73531b06e47 100644
--- a/include/svx/framelinkarray.hxx
+++ b/include/svx/framelinkarray.hxx
@@ -290,7 +290,7 @@ public:
long GetHeight() const;
/** Returns the output range of the cell (nCol,nRow).
- Returns total output range of merged ranges. */
+ Returns total output range of merged ranges, if bExpandMerged is true. */
basegfx::B2DRange GetCellRange( size_t nCol, size_t nRow, bool bExpandMerged ) const;
// mirroring --------------------------------------------------------------
diff --git a/svx/source/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx
index ac47053155ec..096216210585 100644
--- a/svx/source/dialog/framelinkarray.cxx
+++ b/svx/source/dialog/framelinkarray.cxx
@@ -840,24 +840,44 @@ long Array::GetHeight() const
basegfx::B2DRange Array::GetCellRange( size_t nCol, size_t nRow, bool bExpandMerged ) const
{
- size_t nFirstCol = bExpandMerged ? mxImpl->GetMergedFirstCol( nCol, nRow ) : nCol;
- size_t nFirstRow = bExpandMerged ? mxImpl->GetMergedFirstRow( nCol, nRow ) : nRow;
- size_t nLastCol = bExpandMerged ? mxImpl->GetMergedLastCol( nCol, nRow ) : nCol;
- size_t nLastRow = bExpandMerged ? mxImpl->GetMergedLastRow( nCol, nRow ) : nRow;
- const Point aPoint( GetColPosition( nFirstCol ), GetRowPosition( nFirstRow ) );
- const Size aSize( GetColWidth( nFirstCol, nLastCol ) + 1, GetRowHeight( nFirstRow, nLastRow ) + 1 );
- tools::Rectangle aRect(aPoint, aSize);
-
- // adjust rectangle for partly visible merged cells
- const Cell& rCell = CELL( nCol, nRow );
- if( rCell.IsMerged() )
+ if(bExpandMerged)
{
- aRect.Left() -= rCell.mnAddLeft;
- aRect.Right() += rCell.mnAddRight;
- aRect.Top() -= rCell.mnAddTop;
- aRect.Bottom() += rCell.mnAddBottom;
+ // get the Range of the fully expanded cell (if merged)
+ const size_t nFirstCol(mxImpl->GetMergedFirstCol( nCol, nRow ));
+ const size_t nFirstRow(mxImpl->GetMergedFirstRow( nCol, nRow ));
+ const size_t nLastCol(mxImpl->GetMergedLastCol( nCol, nRow ));
+ const size_t nLastRow(mxImpl->GetMergedLastRow( nCol, nRow ));
+ const Point aPoint( GetColPosition( nFirstCol ), GetRowPosition( nFirstRow ) );
+ const Size aSize( GetColWidth( nFirstCol, nLastCol ) + 1, GetRowHeight( nFirstRow, nLastRow ) + 1 );
+ tools::Rectangle aRect(aPoint, aSize);
+
+ // adjust rectangle for partly visible merged cells
+ const Cell& rCell = CELL( nCol, nRow );
+
+ if( rCell.IsMerged() )
+ {
+ // not *sure* what exactly this is good for,
+ // it is just a hard set extension at merged cells,
+ // probably *should* be included in the above extended
+ // GetColPosition/GetColWidth already. This might be
+ // added due to GetColPosition/GetColWidth not working
+ // correcly over PageChanges (if used), but not sure.
+ aRect.Left() -= rCell.mnAddLeft;
+ aRect.Right() += rCell.mnAddRight;
+ aRect.Top() -= rCell.mnAddTop;
+ aRect.Bottom() += rCell.mnAddBottom;
+ }
+
+ return basegfx::B2DRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom());
+ }
+ else
+ {
+ const Point aPoint( GetColPosition( nCol ), GetRowPosition( nRow ) );
+ const Size aSize( GetColWidth( nCol, nCol ) + 1, GetRowHeight( nRow, nRow ) + 1 );
+ const tools::Rectangle aRect(aPoint, aSize);
+
+ return basegfx::B2DRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom());
}
- return basegfx::B2DRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom());
}
// mirroring
@@ -1054,7 +1074,8 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
{
for (size_t nCol = nFirstCol; nCol <= nLastCol; ++nCol)
{
- // get Cell and CoordinateSystem (*only* for this Cell), check if used (not empty)
+ // get Cell and CoordinateSystem (*only* for this Cell, do *not* expand for
+ // merged cells (!)), check if used (non-empty vectors)
const Cell& rCell(CELL(nCol, nRow));
basegfx::B2DHomMatrix aCoordinateSystem(rCell.CreateCoordinateSystem(*this, nCol, nRow, false));
basegfx::B2DVector aX(basegfx::utils::getColumn(aCoordinateSystem, 0));
@@ -1153,9 +1174,6 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange(
if(bContinue)
{
- const size_t _nLastCol(mxImpl->GetMergedLastCol(nCol, nRow));
- const size_t _nLastRow(mxImpl->GetMergedLastRow(nCol, nRow));
-
if(rTLBR.IsUsed())
{
/// top-left and bottom-right Style Tables