diff options
Diffstat (limited to 'svx/source/dialog/frmsel.cxx')
-rw-r--r-- | svx/source/dialog/frmsel.cxx | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx index f89b160f949c..c3b58e00d5b5 100644 --- a/svx/source/dialog/frmsel.cxx +++ b/svx/source/dialog/frmsel.cxx @@ -360,8 +360,9 @@ void FrameSelectorImpl::InitGlobalGeometry() /* nBetwBordersSize contains the size between an outer and inner frame border (made odd). */ long nBetwBordersSize = (((nMinSize - nFixedSize) / 2) - 1) | 1; - /* The final size of the usable area. */ + /* The final size of the usable area. At least do not get negative */ mnCtrlSize = 2 * nBetwBordersSize + nFixedSize; + mnCtrlSize = std::max(mnCtrlSize, static_cast<long>(0)); mpVirDev->SetOutputSizePixel( Size( mnCtrlSize, mnCtrlSize ) ); /* Center the virtual device in the control. */ @@ -409,9 +410,14 @@ void FrameSelectorImpl::InitBorderGeometry() { for( nRow = 0, nRows = maArray.GetRowCount(); nRow < nRows; ++nRow ) { - tools::Rectangle aRect( maArray.GetCellRect( nCol, nRow ) ); - long nDiagFocusOffsX = frame::GetTLDiagOffset( -mnFocusOffs, mnFocusOffs, maArray.GetHorDiagAngle( nCol, nRow ) ); - long nDiagFocusOffsY = frame::GetTLDiagOffset( -mnFocusOffs, mnFocusOffs, maArray.GetVerDiagAngle( nCol, nRow ) ); + const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow )); + const tools::Rectangle aRect( + basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()), + basegfx::fround(aCellRange.getMaxX()), basegfx::fround(aCellRange.getMaxY())); + const double fHorDiagAngle(atan2(fabs(aCellRange.getHeight()), fabs(aCellRange.getWidth()))); + const double fVerDiagAngle(fHorDiagAngle > 0.0 ? F_PI2 - fHorDiagAngle : 0.0); + const long nDiagFocusOffsX(basegfx::fround(-mnFocusOffs / tan(fHorDiagAngle) + mnFocusOffs / sin(fHorDiagAngle))); + const long nDiagFocusOffsY(basegfx::fround(-mnFocusOffs / tan(fVerDiagAngle) + mnFocusOffs / sin(fVerDiagAngle))); std::vector< Point > aFocusVec; aFocusVec.emplace_back( aRect.Left() - mnFocusOffs, aRect.Top() + nDiagFocusOffsY ); @@ -463,11 +469,10 @@ void FrameSelectorImpl::InitBorderGeometry() for( nRow = 0, nRows = maArray.GetRowCount(); nRow < nRows; ++nRow ) { // the usable area between horizonal/vertical frame borders of current quadrant - tools::Rectangle aRect( maArray.GetCellRect( nCol, nRow ) ); - aRect.Left() += nClV + 1; - aRect.Right() -= nClV + 1; - aRect.Top() += nClH + 1; - aRect.Bottom() -= nClH + 1; + const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow )); + const tools::Rectangle aRect( + basegfx::fround(aCellRange.getMinX()) + nClV + 1, basegfx::fround(aCellRange.getMinY()) + nClH + 1, + basegfx::fround(aCellRange.getMaxX()) - nClV + 1, basegfx::fround(aCellRange.getMaxY()) - nClH + 1); /* Both diagonal frame borders enabled. */ if( mbTLBR && mbBLTR ) |