[Libreoffice-commits] core.git: Branch 'feature/borderline3' - drawinglayer/source include/drawinglayer include/svx sc/source svx/source sw/source
Armin Le Grand
Armin.Le.Grand at cib.de
Wed Aug 30 10:14:18 UTC 2017
drawinglayer/source/primitive2d/baseprimitive2d.cxx | 1
drawinglayer/source/processor2d/vclpixelprocessor2d.hxx | 1
include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx | 1
include/svx/framelinkarray.hxx | 14 ---
sc/source/ui/miscdlgs/autofmt.cxx | 19 +++--
svx/source/dialog/framelinkarray.cxx | 37 ++--------
svx/source/dialog/frmsel.cxx | 16 ++--
sw/source/ui/table/tautofmt.cxx | 11 ++
8 files changed, 45 insertions(+), 55 deletions(-)
New commits:
commit a3a53ebd2bb642a7a1235d33ca7fda0b8c5fc529
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date: Wed Aug 30 12:10:54 2017 +0200
borderline: CellRect->CellRange, cleanups
Change-Id: Ie03c7b2f446bd3cf353cc92905218276385599fc
diff --git a/drawinglayer/source/primitive2d/baseprimitive2d.cxx b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
index bdb96f96d423..581f0c421c75 100644
--- a/drawinglayer/source/primitive2d/baseprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
@@ -367,7 +367,6 @@ namespace drawinglayer
case PRIMITIVE2D_ID_PATTERNFILLPRIMITIVE2D: return OUString("PATTERNFILL");
case PRIMITIVE2D_ID_OBJECTINFOPRIMITIVE2D: return OUString("OBJECTINFO");
case PRIMITIVE2D_ID_POLYPOLYGONSELECTIONPRIMITIVE2D: return OUString("POLYPOLYGONSELECTION");
- case PRIMITIVE2D_ID_CLIPPEDBORDERLINEPRIMITIVE2D: return OUString("CLIPPEDBORDERLINE");
default: return OUString::number((nId >> 16) & 0xFF) + "|" + OUString::number(nId & 0xFF);
}
}
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx
index 19c0282ffc5a..fb7cc5280c64 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx
@@ -34,7 +34,6 @@ namespace drawinglayer { namespace primitive2d {
class PolyPolygonColorPrimitive2D;
class PolygonHairlinePrimitive2D;
class PolygonStrokePrimitive2D;
- class BorderLinePrimitive2D;
}}
diff --git a/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
index 9e78c8c3c0c5..7dcc2455effb 100644
--- a/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
+++ b/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
@@ -102,7 +102,6 @@
#define PRIMITIVE2D_ID_PATTERNFILLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 67)
#define PRIMITIVE2D_ID_OBJECTINFOPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 68)
#define PRIMITIVE2D_ID_POLYPOLYGONSELECTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 69)
-#define PRIMITIVE2D_ID_CLIPPEDBORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 70)
// When you add a new primitive, please update the drawinglayer::primitive2d::idToString() function
// in drawinglayer/source/primitive2d/baseprimitive2d.cxx.
diff --git a/include/svx/framelinkarray.hxx b/include/svx/framelinkarray.hxx
index 29e44994ff68..4801db277147 100644
--- a/include/svx/framelinkarray.hxx
+++ b/include/svx/framelinkarray.hxx
@@ -289,17 +289,9 @@ public:
/** Returns the output height of the entire array. */
long GetHeight() const;
- /** Returns the top-left output position of the cell (nCol,nRow).
- Returns output position of top-left corner of merged ranges. */
- Point GetCellPosition( size_t nCol, size_t nRow ) const;
-
- /** Returns the output size of the cell (nCol,nRow).
- Returns total output size of merged ranges. */
- Size GetCellSize( size_t nCol, size_t nRow ) const;
-
- /** Returns the output rectangle of the cell (nCol,nRow).
- Returns total output rectangle of merged ranges. */
- tools::Rectangle GetCellRect( size_t nCol, size_t nRow ) const;
+ /** Returns the output range of the cell (nCol,nRow).
+ Returns total output range of merged ranges. */
+ basegfx::B2DRange GetCellRange( size_t nCol, size_t nRow ) const;
// mirroring --------------------------------------------------------------
diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx
index 70bbc0b33b6e..9783431083eb 100644
--- a/sc/source/ui/miscdlgs/autofmt.cxx
+++ b/sc/source/ui/miscdlgs/autofmt.cxx
@@ -250,8 +250,8 @@ void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCo
Size aStrSize;
sal_uInt16 nFmtIndex = GetFormatIndex( nCol, nRow );
- tools::Rectangle cellRect = maArray.GetCellRect( nCol, nRow );
- Point aPos = cellRect.TopLeft();
+ const basegfx::B2DRange cellRange(maArray.GetCellRange( nCol, nRow ));
+ Point aPos = Point(basegfx::fround(cellRange.getMinX()), basegfx::fround(cellRange.getMinY()));
sal_uInt16 nRightX = 0;
bool bJustify = pCurData->GetIncludeJustify();
SvxCellHorJustify eJustification;
@@ -271,7 +271,7 @@ void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCo
MakeFonts( nFmtIndex, aFont, aCJKFont, aCTLFont );
- theMaxStrSize = cellRect.GetSize();
+ theMaxStrSize = Size(basegfx::fround(cellRange.getWidth()), basegfx::fround(cellRange.getHeight()));
theMaxStrSize.Width() -= FRAME_OFFSET;
theMaxStrSize.Height() -= FRAME_OFFSET;
@@ -304,7 +304,7 @@ void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCo
aStrSize = aScriptedText.GetTextSize();
}
- nRightX = sal_uInt16(cellRect.GetWidth() - aStrSize.Width() - FRAME_OFFSET);
+ nRightX = sal_uInt16(basegfx::fround(cellRange.getWidth()) - aStrSize.Width() - FRAME_OFFSET);
// vertical (always center):
@@ -314,7 +314,8 @@ void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCo
if (eJustification != SvxCellHorJustify::Standard)
{
- sal_uInt16 nHorPos = sal_uInt16((cellRect.GetWidth()-aStrSize.Width()) / 2);
+ sal_uInt16 nHorPos = sal_uInt16((basegfx::fround(cellRange.getWidth())-aStrSize.Width()) / 2);
+ //sal_uInt16 nHorPos = sal_uInt16((basegfx::fround(cellRange.getWidth())-aStrSize.Width()) / 2);
switch (eJustification)
{
@@ -372,7 +373,13 @@ void ScAutoFmtPreview::DrawBackground(vcl::RenderContext& rRenderContext)
rRenderContext.Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
rRenderContext.SetLineColor();
rRenderContext.SetFillColor( pItem->GetColor() );
- rRenderContext.DrawRect( maArray.GetCellRect( nCol, nRow ) );
+
+ const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow ));
+ rRenderContext.DrawRect(
+ tools::Rectangle(
+ basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
+ basegfx::fround(aCellRange.getMaxX()), basegfx::fround(aCellRange.getMaxY())));
+
rRenderContext.Pop();
}
}
diff --git a/svx/source/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx
index eaf8d01813a8..ef6c410a7220 100644
--- a/svx/source/dialog/framelinkarray.cxx
+++ b/svx/source/dialog/framelinkarray.cxx
@@ -808,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 );
@@ -837,7 +827,7 @@ tools::Rectangle Array::GetCellRect( size_t nCol, size_t nRow ) const
aRect.Top() -= rCell.mnAddTop;
aRect.Bottom() += rCell.mnAddBottom;
}
- return aRect;
+ return basegfx::B2DRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom());
}
// mirroring
@@ -938,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);
@@ -952,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;
@@ -1039,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);
@@ -1110,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);
@@ -1198,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);
@@ -1278,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 0bb928039b07..859afd787995 100644
--- a/svx/source/dialog/frmsel.cxx
+++ b/svx/source/dialog/frmsel.cxx
@@ -410,8 +410,11 @@ void FrameSelectorImpl::InitBorderGeometry()
{
for( nRow = 0, nRows = maArray.GetRowCount(); nRow < nRows; ++nRow )
{
- tools::Rectangle aRect( maArray.GetCellRect( nCol, nRow ) );
- const double fHorDiagAngle(atan2(static_cast< double >(std::abs(aRect.GetHeight())), static_cast< double >(std::abs(aRect.GetWidth()))));
+ 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)));
@@ -466,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/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index 0793190c75b3..ab2650d8587f 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -709,7 +709,10 @@ MAKENUMSTR:
SvtScriptedTextHelper aScriptedText(rRenderContext);
Size aStrSize;
sal_uInt8 nFormatIndex = GetFormatIndex( nCol, nRow );
- tools::Rectangle cellRect = maArray.GetCellRect( nCol, nRow );
+ const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow ));
+ const tools::Rectangle cellRect(
+ basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
+ basegfx::fround(aCellRange.getMaxX()), basegfx::fround(aCellRange.getMaxY()));
Point aPos = cellRect.TopLeft();
long nRightX = 0;
@@ -801,7 +804,11 @@ void AutoFormatPreview::DrawBackground(vcl::RenderContext& rRenderContext)
rRenderContext.Push(PushFlags::LINECOLOR | PushFlags::FILLCOLOR);
rRenderContext.SetLineColor();
rRenderContext.SetFillColor(aBrushItem.GetColor());
- rRenderContext.DrawRect(maArray.GetCellRect(nCol, nRow));
+ const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow ));
+ rRenderContext.DrawRect(
+ tools::Rectangle(
+ basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
+ basegfx::fround(aCellRange.getMaxX()), basegfx::fround(aCellRange.getMaxY())));
rRenderContext.Pop();
}
}
More information about the Libreoffice-commits
mailing list