Fraction->double in reportdesign
Change-Id: I1dd785efeb267066921ddceb65e6af16370b194b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202740 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -45,9 +45,7 @@ OEndMarker::~OEndMarker()
|
||||
void OEndMarker::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/)
|
||||
{
|
||||
constexpr tools::Long CORNER_SPACE = 5;
|
||||
Fraction aCornerSpace(CORNER_SPACE);
|
||||
aCornerSpace *= rRenderContext.GetMapMode().GetScaleX();
|
||||
const tools::Long nCornerSpace = tools::Long(aCornerSpace);
|
||||
const tools::Long nCornerSpace = CORNER_SPACE * rRenderContext.GetMapMode().GetScaleX();
|
||||
|
||||
Size aSize = GetSizePixel();
|
||||
aSize.AdjustWidth(nCornerSpace );
|
||||
|
||||
@@ -135,9 +135,7 @@ void OReportWindow::showRuler(bool _bShow)
|
||||
|
||||
sal_Int32 OReportWindow::getMaxMarkerWidth() const
|
||||
{
|
||||
Fraction aStartWidth(tools::Long(REPORT_STARTMARKER_WIDTH));
|
||||
aStartWidth *= m_aViewsWindow->GetMapMode().GetScaleX();
|
||||
return sal_Int32(static_cast<tools::Long>(aStartWidth));
|
||||
return REPORT_STARTMARKER_WIDTH * m_aViewsWindow->GetMapMode().GetScaleX();
|
||||
}
|
||||
|
||||
sal_Int32 OReportWindow::GetTotalWidth() const
|
||||
@@ -145,13 +143,13 @@ sal_Int32 OReportWindow::GetTotalWidth() const
|
||||
sal_Int32 nWidth = 0;
|
||||
if ( !m_aViewsWindow->empty() )
|
||||
{
|
||||
Fraction aStartWidth(tools::Long(REPORT_ENDMARKER_WIDTH + REPORT_STARTMARKER_WIDTH ));
|
||||
const Fraction aZoom(m_pView->getController().getZoomValue(),100);
|
||||
aStartWidth *= aZoom;
|
||||
double fStartWidth = REPORT_ENDMARKER_WIDTH + REPORT_STARTMARKER_WIDTH;
|
||||
const double fZoom = m_pView->getController().getZoomValue() / 100.0;
|
||||
fStartWidth *= fZoom;
|
||||
sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(m_pView->getController().getReportDefinition(),PROPERTY_PAPERSIZE).Width;
|
||||
nPaperWidth = tools::Long(nPaperWidth * aZoom);
|
||||
nPaperWidth = tools::Long(nPaperWidth * fZoom);
|
||||
const Size aPageSize = LogicToPixel(Size(nPaperWidth,0));
|
||||
nWidth = aPageSize.Width() + tools::Long(aStartWidth);
|
||||
nWidth = aPageSize.Width() + tools::Long(fStartWidth);
|
||||
}
|
||||
return nWidth;
|
||||
}
|
||||
@@ -163,10 +161,10 @@ void OReportWindow::Resize()
|
||||
return;
|
||||
|
||||
const Size aTotalOutputSize = GetOutputSizePixel();
|
||||
Fraction aStartWidth(tools::Long(REPORT_STARTMARKER_WIDTH)*m_pView->getController().getZoomValue(),100);
|
||||
double fStartWidth = REPORT_STARTMARKER_WIDTH * m_pView->getController().getZoomValue() / 100.0;
|
||||
|
||||
const Point aOffset = LogicToPixel(Point(SECTION_OFFSET, 0), MapMode(MapUnit::MapAppFont));
|
||||
Point aStartPoint(static_cast<tools::Long>(aStartWidth) + aOffset.X(),0);
|
||||
Point aStartPoint(static_cast<tools::Long>(fStartWidth) + aOffset.X(),0);
|
||||
uno::Reference<report::XReportDefinition> xReportDefinition = getReportView()->getController().getReportDefinition();
|
||||
const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width;
|
||||
sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN);
|
||||
@@ -404,14 +402,14 @@ sal_uInt16 OReportWindow::getZoomFactor(SvxZoomType _eType) const
|
||||
break;
|
||||
case SvxZoomType::WHOLEPAGE:
|
||||
{
|
||||
nZoom = static_cast<sal_uInt16>(static_cast<tools::Long>(Fraction(aSize.Width()*100,impl_getRealPixelWidth())));
|
||||
nZoom = static_cast<sal_uInt16>(static_cast<tools::Long>(aSize.Width()*100.0 / impl_getRealPixelWidth()));
|
||||
MapMode aMap( MapUnit::Map100thMM );
|
||||
const Size aHeight = m_aViewsWindow->LogicToPixel(m_aViewsWindow->PixelToLogic(Size(0,GetTotalHeight() + m_aHRuler->GetSizePixel().Height())),aMap);
|
||||
nZoom = ::std::min(nZoom,static_cast<sal_uInt16>(static_cast<tools::Long>(Fraction(aSize.Height()*100,aHeight.Height()))));
|
||||
nZoom = ::std::min(nZoom,static_cast<sal_uInt16>(static_cast<tools::Long>(aSize.Height()*100.0 / aHeight.Height())));
|
||||
}
|
||||
break;
|
||||
case SvxZoomType::PAGEWIDTH:
|
||||
nZoom = static_cast<sal_uInt16>(static_cast<tools::Long>(Fraction(aSize.Width()*100,impl_getRealPixelWidth())));
|
||||
nZoom = static_cast<sal_uInt16>(static_cast<tools::Long>(double(aSize.Width()*100) / impl_getRealPixelWidth()));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -99,8 +99,8 @@ void OScrollWindowHelper::setTotalSize(sal_Int32 _nWidth ,sal_Int32 _nHeight)
|
||||
m_aTotalPixelSize.setHeight( _nHeight );
|
||||
|
||||
// now set the ranges without start marker
|
||||
Fraction aStartWidth(REPORT_STARTMARKER_WIDTH * m_pParent->getController().getZoomValue(),100);
|
||||
tools::Long nWidth = tools::Long(_nWidth - static_cast<double>(aStartWidth));
|
||||
double fStartWidth = (REPORT_STARTMARKER_WIDTH * m_pParent->getController().getZoomValue()) / 100.0;
|
||||
tools::Long nWidth = tools::Long(_nWidth - fStartWidth);
|
||||
m_aHScroll->SetRangeMax( nWidth );
|
||||
m_aVScroll->SetRangeMax( m_aTotalPixelSize.Height() );
|
||||
|
||||
@@ -152,9 +152,9 @@ Size OScrollWindowHelper::ResizeScrollBars()
|
||||
const Point aOffset = LogicToPixel(Point(SECTION_OFFSET, SECTION_OFFSET), MapMode(MapUnit::MapAppFont));
|
||||
// resize scrollbars and set their ranges
|
||||
{
|
||||
Fraction aStartWidth(tools::Long(REPORT_STARTMARKER_WIDTH*m_pParent->getController().getZoomValue()),100);
|
||||
const sal_Int32 nNewWidth = aOutPixSz.Width() - aOffset.X() - static_cast<tools::Long>(aStartWidth);
|
||||
lcl_setScrollBar(nNewWidth,Point( static_cast<tools::Long>(aStartWidth) + aOffset.X(), aOutPixSz.Height() ), Size( nNewWidth, nScrSize ), *m_aHScroll);
|
||||
double fStartWidth = (REPORT_STARTMARKER_WIDTH*m_pParent->getController().getZoomValue()) / 100.0;
|
||||
const sal_Int32 nNewWidth = aOutPixSz.Width() - aOffset.X() - static_cast<tools::Long>(fStartWidth);
|
||||
lcl_setScrollBar(nNewWidth,Point( static_cast<tools::Long>(fStartWidth) + aOffset.X(), aOutPixSz.Height() ), Size( nNewWidth, nScrSize ), *m_aHScroll);
|
||||
}
|
||||
{
|
||||
const sal_Int32 nNewHeight = aOutPixSz.Height() - m_aReportWindow->getRulerHeight();
|
||||
|
||||
@@ -92,9 +92,9 @@ void OStartMarker::dispose()
|
||||
|
||||
sal_Int32 OStartMarker::getMinHeight() const
|
||||
{
|
||||
Fraction aExtraWidth(tools::Long(2 * REPORT_EXTRA_SPACE));
|
||||
aExtraWidth *= GetMapMode().GetScaleX();
|
||||
return LogicToPixel(Size(0, GetTextHeight())).Height() + tools::Long(aExtraWidth);
|
||||
double fExtraWidth(tools::Long(2 * REPORT_EXTRA_SPACE));
|
||||
fExtraWidth *= GetMapMode().GetScaleX();
|
||||
return LogicToPixel(Size(0, GetTextHeight())).Height() + tools::Long(fExtraWidth);
|
||||
}
|
||||
|
||||
void OStartMarker::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/)
|
||||
|
||||
@@ -1627,11 +1627,11 @@ void OViewsWindow::zoom(double _fZoom)
|
||||
{
|
||||
const MapMode& aMapMode = GetMapMode();
|
||||
|
||||
Fraction aStartWidth(tools::Long(REPORT_STARTMARKER_WIDTH));
|
||||
double fStartWidth(REPORT_STARTMARKER_WIDTH);
|
||||
if ( _fZoom < aMapMode.GetScaleX() )
|
||||
aStartWidth *= aMapMode.GetScaleX();
|
||||
fStartWidth *= aMapMode.GetScaleX();
|
||||
else
|
||||
aStartWidth *= _fZoom;
|
||||
fStartWidth *= _fZoom;
|
||||
|
||||
setZoomFactor(_fZoom,*this);
|
||||
|
||||
@@ -1643,7 +1643,7 @@ void OViewsWindow::zoom(double _fZoom)
|
||||
Resize();
|
||||
|
||||
Size aOut = GetOutputSizePixel();
|
||||
aOut.setWidth( tools::Long(aStartWidth) );
|
||||
aOut.setWidth( tools::Long(fStartWidth) );
|
||||
aOut = PixelToLogic(aOut);
|
||||
|
||||
tools::Rectangle aRect(PixelToLogic(Point(0,0)),aOut);
|
||||
|
||||
@@ -69,10 +69,10 @@ void DlgEdFunc::ForceScroll( const Point& rPos )
|
||||
OScrollWindowHelper* pScrollWindow = pReportWindow->getScrollWindow();
|
||||
|
||||
Size aOut = pReportWindow->GetOutputSizePixel();
|
||||
Fraction aStartWidth(tools::Long(REPORT_STARTMARKER_WIDTH));
|
||||
aStartWidth *= m_pParent->GetMapMode().GetScaleX();
|
||||
double fStartWidth(REPORT_STARTMARKER_WIDTH);
|
||||
fStartWidth *= m_pParent->GetMapMode().GetScaleX();
|
||||
|
||||
aOut.AdjustWidth( -static_cast<tools::Long>(aStartWidth) );
|
||||
aOut.AdjustWidth( -static_cast<tools::Long>(fStartWidth) );
|
||||
aOut.setHeight( m_pParent->GetOutputSizePixel().Height() );
|
||||
|
||||
Point aPos = pScrollWindow->getThumbPos();
|
||||
@@ -81,7 +81,7 @@ void DlgEdFunc::ForceScroll( const Point& rPos )
|
||||
tools::Rectangle aOutRect( aPos, aOut );
|
||||
aOutRect = m_pParent->PixelToLogic( aOutRect );
|
||||
tools::Rectangle aWorkArea(Point(), pScrollWindow->getTotalSize());
|
||||
aWorkArea.AdjustRight( -static_cast<tools::Long>(aStartWidth) );
|
||||
aWorkArea.AdjustRight( -static_cast<tools::Long>(fStartWidth) );
|
||||
aWorkArea = pScrollWindow->PixelToLogic( aWorkArea );
|
||||
if( !aOutRect.Contains( rPos ) && aWorkArea.Contains( rPos ) )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user