summaryrefslogtreecommitdiff
path: root/reportdesign
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-13 10:20:59 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-13 15:46:47 +0200
commit1b1afc10f4d90e37c5e81961b8b8902133e65b00 (patch)
treefb6f68d743b334b8df4fc374afe68dc49fd6cbb8 /reportdesign
parentcc233992dfe0fa9732c24774852d037d161546ce (diff)
Fraction: make conversion operators and constructor explicit
and simplify some of the calculations that needed to be changed. Which resulted in one unit test needing to change by one pixel, let's hope not an indication of a real problem. Change-Id: Ie56434f35f4e58d21ee6f671392e93dc7542fca3 Reviewed-on: https://gerrit.libreoffice.org/42240 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'reportdesign')
-rw-r--r--reportdesign/source/ui/report/EndMarker.cxx2
-rw-r--r--reportdesign/source/ui/report/ReportWindow.cxx7
-rw-r--r--reportdesign/source/ui/report/SectionWindow.cxx18
-rw-r--r--reportdesign/source/ui/report/StartMarker.cxx7
-rw-r--r--reportdesign/source/ui/report/ViewsWindow.cxx9
5 files changed, 19 insertions, 24 deletions
diff --git a/reportdesign/source/ui/report/EndMarker.cxx b/reportdesign/source/ui/report/EndMarker.cxx
index 99580472a49f..57c48e312bb7 100644
--- a/reportdesign/source/ui/report/EndMarker.cxx
+++ b/reportdesign/source/ui/report/EndMarker.cxx
@@ -46,7 +46,7 @@ void OEndMarker::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangl
{
Fraction aCornerSpace(long(CORNER_SPACE));
aCornerSpace *= rRenderContext.GetMapMode().GetScaleX();
- const long nCornerSpace = aCornerSpace;
+ const long nCornerSpace = long(aCornerSpace);
Size aSize = GetSizePixel();
aSize.Width() += nCornerSpace;
diff --git a/reportdesign/source/ui/report/ReportWindow.cxx b/reportdesign/source/ui/report/ReportWindow.cxx
index 625e17543713..b28de3b9d9c5 100644
--- a/reportdesign/source/ui/report/ReportWindow.cxx
+++ b/reportdesign/source/ui/report/ReportWindow.cxx
@@ -156,10 +156,9 @@ sal_Int32 OReportWindow::GetTotalWidth() const
Fraction aStartWidth(long(REPORT_ENDMARKER_WIDTH + REPORT_STARTMARKER_WIDTH ));
const Fraction aZoom(m_pView->getController().getZoomValue(),100);
aStartWidth *= aZoom;
- const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(m_pView->getController().getReportDefinition(),PROPERTY_PAPERSIZE).Width;
- Fraction aPaperWidth(nPaperWidth,1);
- aPaperWidth *= aZoom;
- const Size aPageSize = LogicToPixel(Size(aPaperWidth,0));
+ sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(m_pView->getController().getReportDefinition(),PROPERTY_PAPERSIZE).Width;
+ nPaperWidth = long(nPaperWidth * aZoom);
+ const Size aPageSize = LogicToPixel(Size(nPaperWidth,0));
nWidth = aPageSize.Width() + long(aStartWidth);
}
return nWidth;
diff --git a/reportdesign/source/ui/report/SectionWindow.cxx b/reportdesign/source/ui/report/SectionWindow.cxx
index dcf30ca73fad..c342e995eb95 100644
--- a/reportdesign/source/ui/report/SectionWindow.cxx
+++ b/reportdesign/source/ui/report/SectionWindow.cxx
@@ -229,8 +229,7 @@ void OSectionWindow::Resize()
Window::Resize();
Size aOutputSize = GetOutputSizePixel();
- Fraction aEndWidth(long(REPORT_ENDMARKER_WIDTH));
- aEndWidth *= GetMapMode().GetScaleX();
+ long nEndWidth = long(REPORT_ENDMARKER_WIDTH * GetMapMode().GetScaleX());
const Point aThumbPos = m_pParent->getView()->getThumbPos();
aOutputSize.Width() -= aThumbPos.X();
@@ -245,19 +244,18 @@ void OSectionWindow::Resize()
{
const bool bShowEndMarker = m_pParent->getView()->GetTotalWidth() <= (aThumbPos.X() + aOutputSize.Width() );
- Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
- aStartWidth *= GetMapMode().GetScaleX();
+ long nStartWidth = long(REPORT_STARTMARKER_WIDTH * GetMapMode().GetScaleX());
// set start marker
- m_aStartMarker->SetPosSizePixel(Point(0,0),Size(aStartWidth,aOutputSize.Height()));
+ m_aStartMarker->SetPosSizePixel(Point(0,0),Size(nStartWidth,aOutputSize.Height()));
// set report section
const uno::Reference< report::XSection> xSection = m_aReportSection->getSection();
Size aSectionSize = LogicToPixel( Size( 0,xSection->getHeight() ) );
- Point aReportPos(aStartWidth,0);
- aSectionSize.Width() = aOutputSize.Width() - (long)aStartWidth;
+ Point aReportPos(nStartWidth,0);
+ aSectionSize.Width() = aOutputSize.Width() - nStartWidth;
if ( bShowEndMarker )
- aSectionSize.Width() -= (long)aEndWidth;
+ aSectionSize.Width() -= nEndWidth;
m_aReportSection->SetPosSizePixel(aReportPos,aSectionSize);
@@ -265,13 +263,13 @@ void OSectionWindow::Resize()
aReportPos.Y() += aSectionSize.Height();
m_aSplitter->SetPosSizePixel(aReportPos,Size(aSectionSize.Width(),m_aSplitter->GetSizePixel().Height()));
aSectionSize.Height() = (long)(1000 * (double)GetMapMode().GetScaleY());
- m_aSplitter->SetDragRectPixel( tools::Rectangle(Point(aStartWidth,0),aSectionSize));
+ m_aSplitter->SetDragRectPixel( tools::Rectangle(Point(nStartWidth,0),aSectionSize));
// set end marker
aReportPos.X() += aSectionSize.Width();
aReportPos.Y() = 0;
m_aEndMarker->Show(bShowEndMarker);
- m_aEndMarker->SetPosSizePixel(aReportPos,Size(aEndWidth,aOutputSize.Height()));
+ m_aEndMarker->SetPosSizePixel(aReportPos,Size(nEndWidth,aOutputSize.Height()));
}
}
diff --git a/reportdesign/source/ui/report/StartMarker.cxx b/reportdesign/source/ui/report/StartMarker.cxx
index 5e38e7a0b47e..dbd7e896411a 100644
--- a/reportdesign/source/ui/report/StartMarker.cxx
+++ b/reportdesign/source/ui/report/StartMarker.cxx
@@ -233,14 +233,13 @@ void OStartMarker::Resize()
aImageSize.Width() = long(aImageSize.Width() * (double)rMapMode.GetScaleX());
aImageSize.Height() = long(aImageSize.Height() * (double)rMapMode.GetScaleY());
- Fraction aExtraWidth(long(REPORT_EXTRA_SPACE));
- aExtraWidth *= rMapMode.GetScaleX();
+ long nExtraWidth = long(REPORT_EXTRA_SPACE * rMapMode.GetScaleX());
- Point aPos(aImageSize.Width() + (long)(aExtraWidth + aExtraWidth), aExtraWidth);
+ Point aPos(aImageSize.Width() + (nExtraWidth * 2), nExtraWidth);
const long nHeight = ::std::max<sal_Int32>(nOutputHeight - 2*aPos.Y(),LogicToPixel(Size(0,m_aText->GetTextHeight())).Height());
m_aText->SetPosSizePixel(aPos,Size(aRulerPos.X() - aPos.X(),nHeight));
- aPos.X() = aExtraWidth;
+ aPos.X() = nExtraWidth;
aPos.Y() += static_cast<sal_Int32>((LogicToPixel(Size(0,m_aText->GetTextHeight())).Height() - aImageSize.Height()) * 0.5) ;
m_aImage->SetPosSizePixel(aPos,aImageSize);
}
diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx
index af7c34346a4a..2ec17b1abc7e 100644
--- a/reportdesign/source/ui/report/ViewsWindow.cxx
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -260,13 +260,12 @@ void OViewsWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan
rRenderContext.SetTextFillColor(Application::GetSettings().GetStyleSettings().GetDialogColor());
Size aOut(GetOutputSizePixel());
- Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
- aStartWidth *= rRenderContext.GetMapMode().GetScaleX();
+ long nStartWidth = long(REPORT_STARTMARKER_WIDTH * rRenderContext.GetMapMode().GetScaleX());
- aOut.Width() -= long(aStartWidth);
+ aOut.Width() -= nStartWidth;
aOut = rRenderContext.PixelToLogic(aOut);
- tools::Rectangle aRect(rRenderContext.PixelToLogic(Point(aStartWidth,0)), aOut);
+ tools::Rectangle aRect(rRenderContext.PixelToLogic(Point(nStartWidth,0)), aOut);
Wallpaper aWall(m_aColorConfig.GetColorValue(::svtools::APPBACKGROUND).nColor);
rRenderContext.DrawWallpaper(aRect, aWall);
}
@@ -1709,7 +1708,7 @@ void OViewsWindow::zoom(const Fraction& _aZoom)
Resize();
Size aOut = GetOutputSizePixel();
- aOut.Width() = aStartWidth;
+ aOut.Width() = long(aStartWidth);
aOut = PixelToLogic(aOut);
tools::Rectangle aRect(PixelToLogic(Point(0,0)),aOut);