diff options
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/dialog/framelink.cxx | 97 | ||||
-rw-r--r-- | svx/source/dialog/framelinkarray.cxx | 126 | ||||
-rw-r--r-- | svx/source/dialog/frmsel.cxx | 23 | ||||
-rw-r--r-- | svx/source/table/viewcontactoftableobj.cxx | 132 |
4 files changed, 192 insertions, 186 deletions
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx index 1b858c0fbf0f..e5523fe5365e 100644 --- a/svx/source/dialog/framelink.cxx +++ b/svx/source/dialog/framelink.cxx @@ -44,12 +44,6 @@ namespace frame { namespace { -/** Rounds and casts a double value to a long value. */ -inline long lclD2L( double fValue ) -{ - return static_cast< long >( (fValue < 0.0) ? (fValue - 0.5) : (fValue + 0.5) ); -} - /** Converts a width in twips to a width in another map unit (specified by fScale). */ double lclScaleValue( double nValue, double fScale, sal_uInt16 nMaxWidth ) { @@ -236,18 +230,6 @@ bool operator<( const Style& rL, const Style& rR ) #undef SCALEVALUE - -// Various helper functions -double GetHorDiagAngle( long nWidth, long nHeight ) -{ - return atan2( static_cast< double >( std::abs( nHeight ) ), static_cast< double >( std::abs( nWidth ) ) ); -} - -long GetTLDiagOffset( long nVerOffs, long nDiagOffs, double fAngle ) -{ - return lclD2L( nVerOffs / tan( fAngle ) + nDiagOffs / sin( fAngle ) ); -} - bool CheckFrameBorderConnectable( const Style& rLBorder, const Style& rRBorder, const Style& rTFromTL, const Style& rTFromT, const Style& rTFromTR, const Style& rBFromBL, const Style& rBFromB, const Style& rBFromBR ) @@ -506,16 +488,16 @@ void CreateBorderPrimitives( const basegfx::B2DVector& rX, const basegfx::B2DVector& rY, const Style& rBorder, - const DiagStyle& /*rLFromTR*/, + const Style& /*rLFromTR*/, const Style& rLFromT, const Style& /*rLFromL*/, const Style& rLFromB, - const DiagStyle& /*rLFromBR*/, - const DiagStyle& /*rRFromTL*/, + const Style& /*rLFromBR*/, + const Style& /*rRFromTL*/, const Style& rRFromT, const Style& /*rRFromR*/, const Style& rRFromB, - const DiagStyle& /*rRFromBL*/, + const Style& /*rRFromBL*/, const Color* pForceColor) { if (rBorder.Prim()) @@ -572,8 +554,9 @@ void CreateBorderPrimitives( drawinglayer::primitive2d::BorderLine( rBorder.Prim(), (pForceColor ? *pForceColor : rBorder.GetColorPrim()).getBColor(), - mfExtendStart, - mfExtendEnd), + drawinglayer::primitive2d::BorderLineExtend( + mfExtendStart, + mfExtendEnd)), rBorder.Type(), rBorder.PatternScale()))); } @@ -605,6 +588,13 @@ void CreateBorderPrimitives( // cut exists. Else use upper and take maximum when cut exists mfExtendRightEnd = getComplexExtendedLineValues(rOrigin, rX, rY, aPerpendX, myOffsets[1], rRFromB, rRFromT, false, fLength); + // needs to be determined in detail later, for now use the max prolongation + // from left/right, but do not less than half (0.0). This works decently, + // but not perfect (see Writer, use three-color-style, look at upper/lower# + // connections) + const double fGapLeft(std::max(0.0, std::max(mfExtendLeftStart, mfExtendRightStart))); + const double fGapRight(std::max(0.0, std::max(mfExtendLeftEnd, mfExtendRightEnd))); + rTarget.append( drawinglayer::primitive2d::Primitive2DReference( new drawinglayer::primitive2d::BorderLinePrimitive2D( @@ -613,22 +603,21 @@ void CreateBorderPrimitives( drawinglayer::primitive2d::BorderLine( rBorder.Prim(), (pForceColor ? *pForceColor : rBorder.GetColorPrim()).getBColor(), - mfExtendLeftStart, - mfExtendLeftEnd), + drawinglayer::primitive2d::BorderLineExtend( + mfExtendLeftStart, + mfExtendLeftEnd)), drawinglayer::primitive2d::BorderLine( rBorder.Dist(), (pForceColor ? *pForceColor : rBorder.GetColorGap()).getBColor(), - // needs to be determined in detail later, for now use the max prolongation - // from left/right, butz do not less than half (0.0). This works decently, - // but not perfect (see Writer, use three-color-style, look at upper/lower# - // connections) - std::max(0.0, std::max(mfExtendLeftStart, mfExtendRightStart)), - std::max(0.0, std::max(mfExtendLeftEnd, mfExtendRightEnd))), + drawinglayer::primitive2d::BorderLineExtend( + fGapLeft, + fGapRight)), drawinglayer::primitive2d::BorderLine( rBorder.Secn(), (pForceColor ? *pForceColor : rBorder.GetColorSecn()).getBColor(), - mfExtendRightStart, - mfExtendRightEnd), + drawinglayer::primitive2d::BorderLineExtend( + mfExtendRightStart, + mfExtendRightEnd)), rBorder.UseGapColor(), rBorder.Type(), rBorder.PatternScale()))); @@ -658,16 +647,16 @@ void CreateBorderPrimitives( rX, rY, rBorder, - DiagStyle(), + Style(), rLFromT, rLFromL, rLFromB, - DiagStyle(), - DiagStyle(), + Style(), + Style(), rRFromT, rRFromR, rRFromB, - DiagStyle(), + Style(), pForceColor); } } @@ -701,7 +690,9 @@ void CreateDiagFrameBorderPrimitives( new drawinglayer::primitive2d::BorderLinePrimitive2D( rOrigin, rOrigin + rXAxis + rYAxis, - drawinglayer::primitive2d::BorderLine(rTLBR.Prim(), (pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()), + drawinglayer::primitive2d::BorderLine( + rTLBR.Prim(), + (pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()), rTLBR.Type(), rTLBR.PatternScale())); } @@ -711,9 +702,15 @@ void CreateDiagFrameBorderPrimitives( new drawinglayer::primitive2d::BorderLinePrimitive2D( rOrigin, rOrigin + rXAxis + rYAxis, - drawinglayer::primitive2d::BorderLine(rTLBR.Prim(), (pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()), - drawinglayer::primitive2d::BorderLine(rTLBR.Dist(), (pForceColor ? *pForceColor : rTLBR.GetColorGap()).getBColor()), - drawinglayer::primitive2d::BorderLine(rTLBR.Secn(), (pForceColor ? *pForceColor : rTLBR.GetColorSecn()).getBColor()), + drawinglayer::primitive2d::BorderLine( + rTLBR.Prim(), + (pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()), + drawinglayer::primitive2d::BorderLine( + rTLBR.Dist(), + (pForceColor ? *pForceColor : rTLBR.GetColorGap()).getBColor()), + drawinglayer::primitive2d::BorderLine( + rTLBR.Secn(), + (pForceColor ? *pForceColor : rTLBR.GetColorSecn()).getBColor()), rTLBR.UseGapColor(), rTLBR.Type(), rTLBR.PatternScale())); @@ -729,7 +726,9 @@ void CreateDiagFrameBorderPrimitives( new drawinglayer::primitive2d::BorderLinePrimitive2D( rOrigin + rYAxis, rOrigin + rXAxis, - drawinglayer::primitive2d::BorderLine(rTLBR.Prim(), (pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()), + drawinglayer::primitive2d::BorderLine( + rTLBR.Prim(), + (pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()), rBLTR.Type(), rBLTR.PatternScale())); } @@ -739,9 +738,15 @@ void CreateDiagFrameBorderPrimitives( new drawinglayer::primitive2d::BorderLinePrimitive2D( rOrigin + rYAxis, rOrigin + rXAxis, - drawinglayer::primitive2d::BorderLine(rTLBR.Prim(), (pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()), - drawinglayer::primitive2d::BorderLine(rTLBR.Dist(), (pForceColor ? *pForceColor : rTLBR.GetColorGap()).getBColor()), - drawinglayer::primitive2d::BorderLine(rTLBR.Secn(), (pForceColor ? *pForceColor : rTLBR.GetColorSecn()).getBColor()), + drawinglayer::primitive2d::BorderLine( + rTLBR.Prim(), + (pForceColor ? *pForceColor : rTLBR.GetColorPrim()).getBColor()), + drawinglayer::primitive2d::BorderLine( + rTLBR.Dist(), + (pForceColor ? *pForceColor : rTLBR.GetColorGap()).getBColor()), + drawinglayer::primitive2d::BorderLine( + rTLBR.Secn(), + (pForceColor ? *pForceColor : rTLBR.GetColorSecn()).getBColor()), rBLTR.UseGapColor(), rBLTR.Type(), rBLTR.PatternScale())); diff --git a/svx/source/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx index c5d0d9fe2676..ef6c410a7220 100644 --- a/svx/source/dialog/framelinkarray.cxx +++ b/svx/source/dialog/framelinkarray.cxx @@ -183,9 +183,6 @@ struct ArrayImpl long GetColWidth( size_t nFirstCol, size_t nLastCol ) const; long GetRowHeight( size_t nFirstRow, size_t nLastRow ) const; - double GetHorDiagAngle( size_t nCol, size_t nRow ) const; - double GetVerDiagAngle( size_t nCol, size_t nRow ) const; - bool HasCellRotation() const; }; @@ -319,35 +316,6 @@ long ArrayImpl::GetRowHeight( size_t nFirstRow, size_t nLastRow ) const return GetRowPosition( nLastRow + 1 ) - GetRowPosition( nFirstRow ); } -double ArrayImpl::GetHorDiagAngle( size_t nCol, size_t nRow ) const -{ - double fAngle = 0.0; - if( IsValidPos( nCol, nRow ) ) - { - if( !GetCell( nCol, nRow ).IsMerged() ) - { - fAngle = frame::GetHorDiagAngle( maWidths[ nCol ] + 1, maHeights[ nRow ] + 1 ); - } - else - { - // return correct angle for each cell in the merged range - size_t nFirstCol = GetMergedFirstCol( nCol, nRow ); - size_t nFirstRow = GetMergedFirstRow( nCol, nRow ); - const Cell& rCell = GetCell( nFirstCol, nFirstRow ); - long nWidth = GetColWidth( nFirstCol, GetMergedLastCol( nCol, nRow ) ) + rCell.mnAddLeft + rCell.mnAddRight; - long nHeight = GetRowHeight( nFirstRow, GetMergedLastRow( nCol, nRow ) ) + rCell.mnAddTop + rCell.mnAddBottom; - fAngle = frame::GetHorDiagAngle( nWidth + 1, nHeight + 1 ); - } - } - return fAngle; -} - -double ArrayImpl::GetVerDiagAngle( size_t nCol, size_t nRow ) const -{ - double fAngle = GetHorDiagAngle( nCol, nRow ); - return (fAngle > 0.0) ? (F_PI2 - fAngle) : 0.0; -} - bool ArrayImpl::HasCellRotation() const { // check cell array @@ -840,25 +808,15 @@ long Array::GetHeight() const return GetRowPosition( mxImpl->mnHeight ) - GetRowPosition( 0 ); } -Point Array::GetCellPosition( size_t nCol, size_t nRow ) const +basegfx::B2DRange Array::GetCellRange( size_t nCol, size_t nRow ) const { size_t nFirstCol = mxImpl->GetMergedFirstCol( nCol, nRow ); size_t nFirstRow = mxImpl->GetMergedFirstRow( nCol, nRow ); - return Point( GetColPosition( nFirstCol ), GetRowPosition( nFirstRow ) ); -} - -Size Array::GetCellSize( size_t nCol, size_t nRow ) const -{ - size_t nFirstCol = mxImpl->GetMergedFirstCol( nCol, nRow ); - size_t nFirstRow = mxImpl->GetMergedFirstRow( nCol, nRow ); size_t nLastCol = mxImpl->GetMergedLastCol( nCol, nRow ); size_t nLastRow = mxImpl->GetMergedLastRow( nCol, nRow ); - return Size( GetColWidth( nFirstCol, nLastCol ) + 1, GetRowHeight( nFirstRow, nLastRow ) + 1 ); -} - -tools::Rectangle Array::GetCellRect( size_t nCol, size_t nRow ) const -{ - tools::Rectangle aRect( GetCellPosition( nCol, nRow ), GetCellSize( 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 ); @@ -869,20 +827,7 @@ tools::Rectangle Array::GetCellRect( size_t nCol, size_t nRow ) const aRect.Top() -= rCell.mnAddTop; aRect.Bottom() += rCell.mnAddBottom; } - return aRect; -} - -// diagonal frame borders -double Array::GetHorDiagAngle( size_t nCol, size_t nRow ) const -{ - DBG_FRAME_CHECK_COLROW( nCol, nRow, "GetHorDiagAngle" ); - return mxImpl->GetHorDiagAngle( nCol, nRow ); -} - -double Array::GetVerDiagAngle( size_t nCol, size_t nRow ) const -{ - DBG_FRAME_CHECK_COLROW( nCol, nRow, "GetVerDiagAngle" ); - return mxImpl->GetVerDiagAngle( nCol, nRow ); + return basegfx::B2DRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()); } // mirroring @@ -983,9 +928,9 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor, if ((!bOverlapX && !bOverlapY) || (bFirstCol && bFirstRow) || (!bOverlapY && bFirstCol) || (!bOverlapX && bFirstRow)) { - const tools::Rectangle aRect(GetCellRect(nCol, nRow)); + const basegfx::B2DRange aRange(GetCellRange(nCol, nRow)); - if ((aRect.GetWidth() > 1) && (aRect.GetHeight() > 1)) + if (!aRange.isEmpty()) { size_t _nFirstCol = mxImpl->GetMergedFirstCol(nCol, nRow); size_t _nFirstRow = mxImpl->GetMergedFirstRow(nCol, nRow); @@ -997,7 +942,6 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor, if (rTLBR.GetWidth() || rBLTR.GetWidth()) { drawinglayer::primitive2d::Primitive2DContainer aSequence; - const basegfx::B2DRange aRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()); basegfx::B2DPoint aOrigin; basegfx::B2DVector aX; basegfx::B2DVector aY; @@ -1031,43 +975,37 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor, // *** horizontal frame borders *** for( nRow = nFirstRow; nRow <= nLastRow + 1; ++nRow ) { - double fAngle = mxImpl->GetHorDiagAngle( nFirstCol, nRow ); - double fTAngle = mxImpl->GetHorDiagAngle( nFirstCol, nRow - 1 ); - // *Start*** variables store the data of the left end of the cached frame border basegfx::B2DPoint aStartPos( mxImpl->GetColPosition( nFirstCol ), mxImpl->GetRowPosition( nRow ) ); const Style* pStart = &GetCellStyleTop( nFirstCol, nRow ); - DiagStyle aStartLFromTR( GetCellStyleBL( nFirstCol, nRow - 1 ), fTAngle ); + Style aStartLFromTR( GetCellStyleBL( nFirstCol, nRow - 1 )); const Style* pStartLFromT = &GetCellStyleLeft( nFirstCol, nRow - 1 ); const Style* pStartLFromL = &GetCellStyleTop( nFirstCol - 1, nRow ); const Style* pStartLFromB = &GetCellStyleLeft( nFirstCol, nRow ); - DiagStyle aStartLFromBR( GetCellStyleTL( nFirstCol, nRow ), fAngle ); + Style aStartLFromBR( GetCellStyleTL( nFirstCol, nRow )); // *End*** variables store the data of the right end of the cached frame border - DiagStyle aEndRFromTL( GetCellStyleBR( nFirstCol, nRow - 1 ), fTAngle ); + Style aEndRFromTL( GetCellStyleBR( nFirstCol, nRow - 1 )); const Style* pEndRFromT = &GetCellStyleRight( nFirstCol, nRow - 1 ); const Style* pEndRFromR = &GetCellStyleTop( nFirstCol + 1, nRow ); const Style* pEndRFromB = &GetCellStyleRight( nFirstCol, nRow ); - DiagStyle aEndRFromBL( GetCellStyleTR( nFirstCol, nRow ), fAngle ); + Style aEndRFromBL( GetCellStyleTR( nFirstCol, nRow )); for( nCol = nFirstCol + 1; nCol <= nLastCol; ++nCol ) { - fAngle = mxImpl->GetHorDiagAngle( nCol, nRow ); - fTAngle = mxImpl->GetHorDiagAngle( nCol, nRow - 1 ); - const Style& rCurr = *pEndRFromR; - DiagStyle aLFromTR( GetCellStyleBL( nCol, nRow - 1 ), fTAngle ); + Style aLFromTR( GetCellStyleBL( nCol, nRow - 1 )); const Style& rLFromT = *pEndRFromT; const Style& rLFromL = *pStart; const Style& rLFromB = *pEndRFromB; - DiagStyle aLFromBR( GetCellStyleTL( nCol, nRow ), fAngle ); + Style aLFromBR( GetCellStyleTL( nCol, nRow )); - DiagStyle aRFromTL( GetCellStyleBR( nCol, nRow - 1 ), fTAngle ); + Style aRFromTL( GetCellStyleBR( nCol, nRow - 1 )); const Style& rRFromT = GetCellStyleRight( nCol, nRow - 1 ); const Style& rRFromR = GetCellStyleTop( nCol + 1, nRow ); const Style& rRFromB = GetCellStyleRight( nCol, nRow ); - DiagStyle aRFromBL( GetCellStyleTR( nCol, nRow ), fAngle ); + Style aRFromBL( GetCellStyleTR( nCol, nRow )); // check if current frame border can be connected to cached frame border if( !CheckFrameBorderConnectable( *pStart, rCurr, aEndRFromTL, rLFromT, aLFromTR, aEndRFromBL, rLFromB, aLFromBR ) ) @@ -1090,8 +1028,7 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor, // we need to take care if the borderline is at top or bottom, so use pointer // compare here to find out const bool bUpper(&pCell->GetStyleTop() == pStart); - const tools::Rectangle aRect(GetCellRect(nCol - 1, bUpper ? nRow : nRow - 1)); - const basegfx::B2DRange aRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()); + const basegfx::B2DRange aRange(GetCellRange(nCol - 1, bUpper ? nRow : nRow - 1)); // adapt to cell coordinate system, including shear CreateCoordinateSystemForCell(aRange, *pCell, aOrigin, aX, aY); @@ -1161,8 +1098,7 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor, if (pCell && pCell->IsRotated()) { const bool bUpper(&pCell->GetStyleTop() == pStart); - const tools::Rectangle aRect(GetCellRect(nCol - 1, bUpper ? nRow : nRow - 1)); - const basegfx::B2DRange aRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()); + const basegfx::B2DRange aRange(GetCellRange(nCol - 1, bUpper ? nRow : nRow - 1)); CreateCoordinateSystemForCell(aRange, *pCell, aOrigin, aX, aY); @@ -1199,43 +1135,37 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor, // *** vertical frame borders *** for( nCol = nFirstCol; nCol <= nLastCol + 1; ++nCol ) { - double fAngle = mxImpl->GetVerDiagAngle( nCol, nFirstRow ); - double fLAngle = mxImpl->GetVerDiagAngle( nCol - 1, nFirstRow ); - // *Start*** variables store the data of the top end of the cached frame border basegfx::B2DPoint aStartPos( mxImpl->GetColPosition( nCol ), mxImpl->GetRowPosition( nFirstRow ) ); const Style* pStart = &GetCellStyleLeft( nCol, nFirstRow ); - DiagStyle aStartTFromBL( GetCellStyleTR( nCol - 1, nFirstRow ), fLAngle ); + Style aStartTFromBL( GetCellStyleTR( nCol - 1, nFirstRow )); const Style* pStartTFromL = &GetCellStyleTop( nCol - 1, nFirstRow ); const Style* pStartTFromT = &GetCellStyleLeft( nCol, nFirstRow - 1 ); const Style* pStartTFromR = &GetCellStyleTop( nCol, nFirstRow ); - DiagStyle aStartTFromBR( GetCellStyleTL( nCol, nFirstRow ), fAngle ); + Style aStartTFromBR( GetCellStyleTL( nCol, nFirstRow )); // *End*** variables store the data of the bottom end of the cached frame border - DiagStyle aEndBFromTL( GetCellStyleBR( nCol - 1, nFirstRow ), fLAngle ); + Style aEndBFromTL( GetCellStyleBR( nCol - 1, nFirstRow )); const Style* pEndBFromL = &GetCellStyleBottom( nCol - 1, nFirstRow ); const Style* pEndBFromB = &GetCellStyleLeft( nCol, nFirstRow + 1 ); const Style* pEndBFromR = &GetCellStyleBottom( nCol, nFirstRow ); - DiagStyle aEndBFromTR( GetCellStyleBL( nCol, nFirstRow ), fAngle ); + Style aEndBFromTR( GetCellStyleBL( nCol, nFirstRow )); for( nRow = nFirstRow + 1; nRow <= nLastRow; ++nRow ) { - fAngle = mxImpl->GetVerDiagAngle( nCol, nRow ); - fLAngle = mxImpl->GetVerDiagAngle( nCol - 1, nRow ); - const Style& rCurr = *pEndBFromB; - DiagStyle aTFromBL( GetCellStyleTR( nCol - 1, nRow ), fLAngle ); + Style aTFromBL( GetCellStyleTR( nCol - 1, nRow )); const Style& rTFromL = *pEndBFromL; const Style& rTFromT = *pStart; const Style& rTFromR = *pEndBFromR; - DiagStyle aTFromBR( GetCellStyleTL( nCol, nRow ), fAngle ); + Style aTFromBR( GetCellStyleTL( nCol, nRow )); - DiagStyle aBFromTL( GetCellStyleBR( nCol - 1, nRow ), fLAngle ); + Style aBFromTL( GetCellStyleBR( nCol - 1, nRow )); const Style& rBFromL = GetCellStyleBottom( nCol - 1, nRow ); const Style& rBFromB = GetCellStyleLeft( nCol, nRow + 1 ); const Style& rBFromR = GetCellStyleBottom( nCol, nRow ); - DiagStyle aBFromTR( GetCellStyleBL( nCol, nRow ), fAngle ); + Style aBFromTR( GetCellStyleBL( nCol, nRow )); // check if current frame border can be connected to cached frame border if( !CheckFrameBorderConnectable( *pStart, rCurr, @@ -1255,8 +1185,7 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor, if (pCell && pCell->IsRotated()) { const bool bLeft(&pCell->GetStyleLeft() == pStart); - const tools::Rectangle aRect(GetCellRect(bLeft ? nCol : nCol - 1, nRow - 1)); - const basegfx::B2DRange aRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()); + const basegfx::B2DRange aRange(GetCellRange(bLeft ? nCol : nCol - 1, nRow - 1)); CreateCoordinateSystemForCell(aRange, *pCell, aOrigin, aX, aY); @@ -1335,8 +1264,7 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor, if (pCell && pCell->IsRotated()) { const bool bLeft(&pCell->GetStyleLeft() == pStart); - const tools::Rectangle aRect(GetCellRect(bLeft ? nCol : nCol - 1, nRow - 1)); - const basegfx::B2DRange aRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()); + const basegfx::B2DRange aRange(GetCellRange(bLeft ? nCol : nCol - 1, nRow - 1)); CreateCoordinateSystemForCell(aRange, *pCell, aOrigin, aX, aY); 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 ) diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index 5ec9b6c6da99..0ee957466b83 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -293,8 +293,8 @@ namespace drawinglayer if(!aStart.equal(aEnd)) { - const double fExtendIS(getExtend(getTopLine(), maTopFromLLine)); - const double fExtendIE(getExtend(getBottomLine(), maBottomFromLLine)); + const double fExtendIS(getExtend(getTopLine(), maTopFromLLine) * fTwipsToMM); + const double fExtendIE(getExtend(getBottomLine(), maBottomFromLLine) * fTwipsToMM); if (basegfx::fTools::equalZero(getLeftLine().GetInWidth())) { @@ -302,21 +302,38 @@ namespace drawinglayer new BorderLinePrimitive2D( aStart, aEnd, - BorderLine(getChangedValue(getLeftLine().GetOutWidth(), true/*InTwips*/), getLeftLine().GetColorOut().getBColor(), fExtendIS * fTwipsToMM, fExtendIE * fTwipsToMM), + BorderLine( + getChangedValue(getLeftLine().GetOutWidth(), true/*InTwips*/), + getLeftLine().GetColorOut().getBColor(), + BorderLineExtend( + fExtendIS, + fExtendIE)), getLeftLine().GetBorderLineStyle())); } else { - const double fExtendOS(getExtend(maTopFromLLine, getTopLine())); - const double fExtendOE(getExtend(maBottomFromLLine, getBottomLine())); + const double fExtendOS(getExtend(maTopFromLLine, getTopLine()) * fTwipsToMM); + const double fExtendOE(getExtend(maBottomFromLLine, getBottomLine()) * fTwipsToMM); rContainer.push_back( new BorderLinePrimitive2D( aStart, aEnd, - BorderLine(getChangedValue(getLeftLine().GetOutWidth(), true/*InTwips*/), getLeftLine().GetColorOut().getBColor(), fExtendIS * fTwipsToMM, fExtendIE * fTwipsToMM), - BorderLine(getChangedValue(getLeftLine().GetDistance(), true/*InTwips*/), getLeftLine().GetColorGap().getBColor()), - BorderLine(getChangedValue(getLeftLine().GetInWidth(), true/*InTwips*/), getLeftLine().GetColorIn().getBColor(), fExtendOS * fTwipsToMM, fExtendOE * fTwipsToMM), + BorderLine( + getChangedValue(getLeftLine().GetOutWidth(), true/*InTwips*/), + getLeftLine().GetColorOut().getBColor(), + BorderLineExtend( + fExtendIS, + fExtendIE)), + BorderLine( + getChangedValue(getLeftLine().GetDistance(), true/*InTwips*/), + getLeftLine().GetColorGap().getBColor()), + BorderLine(getChangedValue( + getLeftLine().GetInWidth(), true/*InTwips*/), + getLeftLine().GetColorIn().getBColor(), + BorderLineExtend( + fExtendOS, + fExtendOE)), getLeftLine().HasGapColor(), getLeftLine().GetBorderLineStyle())); } @@ -331,8 +348,8 @@ namespace drawinglayer if(!aStart.equal(aEnd)) { - const double fExtendIS(getExtend(getLeftLine(), maLeftFromBLine )); - const double fExtendIE(getExtend(getRightLine(), maRightFromBLine)); + const double fExtendIS(getExtend(getLeftLine(), maLeftFromBLine) * fTwipsToMM); + const double fExtendIE(getExtend(getRightLine(), maRightFromBLine) * fTwipsToMM); if (basegfx::fTools::equalZero(getBottomLine().GetInWidth())) { @@ -340,21 +357,38 @@ namespace drawinglayer new BorderLinePrimitive2D( aStart, aEnd, - BorderLine(getChangedValue(getBottomLine().GetOutWidth(), true/*InTwips*/), getBottomLine().GetColorOut(false).getBColor(), fExtendIS * fTwipsToMM, fExtendIE * fTwipsToMM), + BorderLine( + getChangedValue(getBottomLine().GetOutWidth(), true/*InTwips*/), + getBottomLine().GetColorOut(false).getBColor(), + BorderLineExtend( + fExtendIS, + fExtendIE)), getBottomLine().GetBorderLineStyle())); } else { - const double fExtendOS(getExtend(maLeftFromBLine, getLeftLine())); - const double fExtendOE(getExtend(maRightFromBLine, getRightLine())); + const double fExtendOS(getExtend(maLeftFromBLine, getLeftLine()) * fTwipsToMM); + const double fExtendOE(getExtend(maRightFromBLine, getRightLine()) * fTwipsToMM); rContainer.push_back( new BorderLinePrimitive2D( aStart, aEnd, - BorderLine(getChangedValue(getBottomLine().GetOutWidth(), true/*InTwips*/), getBottomLine().GetColorOut(false).getBColor(), fExtendIS * fTwipsToMM, fExtendIE * fTwipsToMM), - BorderLine(getChangedValue(getBottomLine().GetDistance(), true/*InTwips*/), getBottomLine().GetColorGap().getBColor()), - BorderLine(getChangedValue(getBottomLine().GetInWidth(), true/*InTwips*/), getBottomLine().GetColorIn(false).getBColor(), fExtendOS * fTwipsToMM, fExtendOE * fTwipsToMM), + BorderLine( + getChangedValue(getBottomLine().GetOutWidth(), true/*InTwips*/), + getBottomLine().GetColorOut(false).getBColor(), + BorderLineExtend( + fExtendIS, + fExtendIE)), + BorderLine( + getChangedValue(getBottomLine().GetDistance(), true/*InTwips*/), + getBottomLine().GetColorGap().getBColor()), + BorderLine( + getChangedValue(getBottomLine().GetInWidth(), true/*InTwips*/), + getBottomLine().GetColorIn(false).getBColor(), + BorderLineExtend( + fExtendOS, + fExtendOE)), getBottomLine().HasGapColor(), getBottomLine().GetBorderLineStyle())); } @@ -369,8 +403,8 @@ namespace drawinglayer if(!aStart.equal(aEnd)) { - const double fExtendOS(getExtend(maTopFromRLine, getTopLine())); - const double fExtendOE(getExtend(maBottomFromRLine, getBottomLine())); + const double fExtendOS(getExtend(maTopFromRLine, getTopLine()) * fTwipsToMM); + const double fExtendOE(getExtend(maBottomFromRLine, getBottomLine()) * fTwipsToMM); if (basegfx::fTools::equalZero(getRightLine().GetInWidth())) { @@ -378,21 +412,38 @@ namespace drawinglayer new BorderLinePrimitive2D( aStart, aEnd, - BorderLine(getChangedValue(getRightLine().GetOutWidth(), true/*InTwips*/), getRightLine().GetColorOut().getBColor(), fExtendOS * fTwipsToMM, fExtendOE * fTwipsToMM), + BorderLine( + getChangedValue(getRightLine().GetOutWidth(), true/*InTwips*/), + getRightLine().GetColorOut().getBColor(), + BorderLineExtend( + fExtendOS, + fExtendOE)), getRightLine().GetBorderLineStyle())); } else { - const double fExtendIS(getExtend(getTopLine(), maTopFromRLine)); - const double fExtendIE(getExtend(getBottomLine(), maBottomFromRLine)); + const double fExtendIS(getExtend(getTopLine(), maTopFromRLine) * fTwipsToMM); + const double fExtendIE(getExtend(getBottomLine(), maBottomFromRLine) * fTwipsToMM); rContainer.push_back( new BorderLinePrimitive2D( aStart, aEnd, - BorderLine(getChangedValue(getRightLine().GetOutWidth(), true/*InTwips*/), getRightLine().GetColorOut().getBColor(), fExtendOS * fTwipsToMM, fExtendOE * fTwipsToMM), - BorderLine(getChangedValue(getRightLine().GetDistance(), true/*InTwips*/), getRightLine().GetColorGap().getBColor()), - BorderLine(getChangedValue(getRightLine().GetInWidth(), true/*InTwips*/), getRightLine().GetColorIn().getBColor(), fExtendIS * fTwipsToMM, fExtendIE * fTwipsToMM), + BorderLine( + getChangedValue(getRightLine().GetOutWidth(), true/*InTwips*/), + getRightLine().GetColorOut().getBColor(), + BorderLineExtend( + fExtendOS, + fExtendOE)), + BorderLine( + getChangedValue(getRightLine().GetDistance(), true/*InTwips*/), + getRightLine().GetColorGap().getBColor()), + BorderLine( + getChangedValue(getRightLine().GetInWidth(), true/*InTwips*/), + getRightLine().GetColorIn().getBColor(), + BorderLineExtend( + fExtendIS, + fExtendIE)), getRightLine().HasGapColor(), getRightLine().GetBorderLineStyle())); } @@ -412,8 +463,8 @@ namespace drawinglayer if(!aStart.equal(aEnd)) { - const double fExtendOS(getExtend(maLeftFromTLine, getLeftLine())); - const double fExtendOE(getExtend(maRightFromTLine, getRightLine())); + const double fExtendOS(getExtend(maLeftFromTLine, getLeftLine()) * fTwipsToMM); + const double fExtendOE(getExtend(maRightFromTLine, getRightLine()) * fTwipsToMM); if (basegfx::fTools::equalZero(getTopLine().GetInWidth())) { @@ -421,21 +472,38 @@ namespace drawinglayer new BorderLinePrimitive2D( aStart, aEnd, - BorderLine(getChangedValue(getTopLine().GetOutWidth(), true/*InTwips*/), getTopLine().GetColorOut(false).getBColor(), fExtendOS * fTwipsToMM, fExtendOE * fTwipsToMM), + BorderLine( + getChangedValue(getTopLine().GetOutWidth(), true/*InTwips*/), + getTopLine().GetColorOut(false).getBColor(), + BorderLineExtend( + fExtendOS, + fExtendOE)), getTopLine().GetBorderLineStyle())); } else { - const double fExtendIS(getExtend(getLeftLine(), maLeftFromTLine)); - const double fExtendIE(getExtend(getRightLine(), maRightFromTLine)); + const double fExtendIS(getExtend(getLeftLine(), maLeftFromTLine) * fTwipsToMM); + const double fExtendIE(getExtend(getRightLine(), maRightFromTLine) * fTwipsToMM); rContainer.push_back( new BorderLinePrimitive2D( aStart, aEnd, - BorderLine(getChangedValue(getTopLine().GetOutWidth(), true/*InTwips*/), getTopLine().GetColorOut(false).getBColor(), fExtendOS * fTwipsToMM, fExtendOE * fTwipsToMM), - BorderLine(getChangedValue(getTopLine().GetDistance(), true/*InTwips*/), getTopLine().GetColorGap().getBColor()), - BorderLine(getChangedValue(getTopLine().GetInWidth(), true/*InTwips*/), getTopLine().GetColorIn(false).getBColor(), fExtendIS * fTwipsToMM, fExtendIE * fTwipsToMM), + BorderLine( + getChangedValue(getTopLine().GetOutWidth(), true/*InTwips*/), + getTopLine().GetColorOut(false).getBColor(), + BorderLineExtend( + fExtendOS, + fExtendOE)), + BorderLine( + getChangedValue(getTopLine().GetDistance(), true/*InTwips*/), + getTopLine().GetColorGap().getBColor()), + BorderLine( + getChangedValue(getTopLine().GetInWidth(), true/*InTwips*/), + getTopLine().GetColorIn(false).getBColor(), + BorderLineExtend( + fExtendIS, + fExtendIE)), getTopLine().HasGapColor(), getTopLine().GetBorderLineStyle())); } |