diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-08-11 18:32:33 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-09-15 12:58:03 +0200 |
commit | fe14ddf25003c0f79f9f8a249bc22d45f57a0068 (patch) | |
tree | f0470ccd992a439bf52b83688d818c776bcd733e /sc/source/ui/miscdlgs/autofmt.cxx | |
parent | 596efaad51735a130e7b7bd27dbc34dc07f32f68 (diff) |
borderline: Abstraction of BorderLinePrimitive
As preparation for more detailed definition of BorderLine
primitives I have adapted the BorderLine definition to
work with motre possibilities to define the LineStartEnd
definitions in a BorderLineExtend class. That one is
flexible to hold all kinds of definitions - from none to
all four possible extends (Start/End, Left/Right of vector)
Cleanup of DiagStyle and others: DiagStyle is not needed
anymore due to no longer using angles calculated, but
being based on vectors defining the geometry. Also cleaned
up quite a bit of no longer needed calculation stuff for
the control.
Diffstat (limited to 'sc/source/ui/miscdlgs/autofmt.cxx')
-rw-r--r-- | sc/source/ui/miscdlgs/autofmt.cxx | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx index 01d71d232062..40b8da73cb7d 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(); } } |