summaryrefslogtreecommitdiff
path: root/reportdesign
diff options
context:
space:
mode:
authorJuan Picca <jumapico@gmail.com>2014-09-19 14:19:30 -0300
committerDavid Tardon <dtardon@redhat.com>2014-10-09 11:33:33 +0000
commit47a2d7642d249d70b5da0c330a73f3a0032e4bba (patch)
tree202b04810382ea87cf8015a7b4de29e931408948 /reportdesign
parentae77dc81c33ab0817264bcf5fc8bb71a55b78a73 (diff)
fdo#81356: convert Fraction to boost::rational<long> - wip
* Added rational util functions used by Fraction class not available in the boost::rational class. * Replaced usage of Fraction by boost::rational<long> * Removed code that relies on: 1. fraction.IsValid() -- rational only allow valid values, ie denominator() != 0 2. rational.denominator() == 0 -- always false 3. rational.denominator() < 0 -- always false but implementation detail: http://www.boost.org/doc/libs/release/libs/rational/rational.html#Internal%20representation * Simplified code that relies on: 1. rational.denominator() != 0 -- always true * BUGS EXIST because Fraction allows the creation of invalid values but boost::rational throws the exception boost::bad_rational Change-Id: I84970a4956afb3f91ac0c8f726547466319420f9 Reviewed-on: https://gerrit.libreoffice.org/11551 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'reportdesign')
-rw-r--r--reportdesign/inc/RptObject.hxx6
-rw-r--r--reportdesign/source/core/sdr/RptObject.cxx6
-rw-r--r--reportdesign/source/ui/inc/DesignView.hxx2
-rw-r--r--reportdesign/source/ui/inc/ReportWindow.hxx2
-rw-r--r--reportdesign/source/ui/inc/ScrollHelper.hxx2
-rw-r--r--reportdesign/source/ui/inc/SectionWindow.hxx2
-rw-r--r--reportdesign/source/ui/inc/StartMarker.hxx2
-rw-r--r--reportdesign/source/ui/inc/UITools.hxx2
-rw-r--r--reportdesign/source/ui/inc/ViewsWindow.hxx2
-rw-r--r--reportdesign/source/ui/misc/UITools.cxx2
-rw-r--r--reportdesign/source/ui/report/DesignView.cxx2
-rw-r--r--reportdesign/source/ui/report/EndMarker.cxx4
-rw-r--r--reportdesign/source/ui/report/ReportController.cxx2
-rw-r--r--reportdesign/source/ui/report/ReportSection.cxx4
-rw-r--r--reportdesign/source/ui/report/ReportWindow.cxx28
-rw-r--r--reportdesign/source/ui/report/ScrollHelper.cxx12
-rw-r--r--reportdesign/source/ui/report/SectionWindow.cxx20
-rw-r--r--reportdesign/source/ui/report/StartMarker.cxx20
-rw-r--r--reportdesign/source/ui/report/ViewsWindow.cxx14
-rw-r--r--reportdesign/source/ui/report/dlgedfunc.cxx6
20 files changed, 70 insertions, 70 deletions
diff --git a/reportdesign/inc/RptObject.hxx b/reportdesign/inc/RptObject.hxx
index 6f2cfca0da64..d91e271277bc 100644
--- a/reportdesign/inc/RptObject.hxx
+++ b/reportdesign/inc/RptObject.hxx
@@ -148,7 +148,7 @@ protected:
OCustomShape(const OUString& _sComponentName);
virtual void NbcMove( const Size& rSize ) SAL_OVERRIDE;
- virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) SAL_OVERRIDE;
virtual void NbcSetLogicRect(const Rectangle& rRect) SAL_OVERRIDE;
virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) SAL_OVERRIDE;
@@ -196,7 +196,7 @@ protected:
virtual void NbcMove( const Size& rSize ) SAL_OVERRIDE;
- virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) SAL_OVERRIDE;
virtual void NbcSetLogicRect(const Rectangle& rRect) SAL_OVERRIDE;
virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) SAL_OVERRIDE;
@@ -244,7 +244,7 @@ protected:
virtual ~OUnoObject();
virtual void NbcMove( const Size& rSize ) SAL_OVERRIDE;
- virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact) SAL_OVERRIDE;
virtual void NbcSetLogicRect(const Rectangle& rRect) SAL_OVERRIDE;
virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) SAL_OVERRIDE;
diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx
index 0d76ae25bf80..5c0d525dae60 100644
--- a/reportdesign/source/core/sdr/RptObject.cxx
+++ b/reportdesign/source/core/sdr/RptObject.cxx
@@ -538,7 +538,7 @@ void OCustomShape::NbcMove( const Size& rSize )
SdrObjCustomShape::NbcMove( rSize );
}
-void OCustomShape::NbcResize(const Point& rRef, const Fraction& xFract, const Fraction& yFract)
+void OCustomShape::NbcResize(const Point& rRef, const boost::rational<long>& xFract, const boost::rational<long>& yFract)
{
SdrObjCustomShape::NbcResize( rRef, xFract, yFract );
@@ -749,7 +749,7 @@ void OUnoObject::NbcMove( const Size& rSize )
-void OUnoObject::NbcResize(const Point& rRef, const Fraction& xFract, const Fraction& yFract)
+void OUnoObject::NbcResize(const Point& rRef, const boost::rational<long>& xFract, const boost::rational<long>& yFract)
{
SdrUnoObj::NbcResize( rRef, xFract, yFract );
@@ -1050,7 +1050,7 @@ void OOle2Obj::NbcMove( const Size& rSize )
-void OOle2Obj::NbcResize(const Point& rRef, const Fraction& xFract, const Fraction& yFract)
+void OOle2Obj::NbcResize(const Point& rRef, const boost::rational<long>& xFract, const boost::rational<long>& yFract)
{
SdrOle2Obj::NbcResize( rRef, xFract, yFract );
diff --git a/reportdesign/source/ui/inc/DesignView.hxx b/reportdesign/source/ui/inc/DesignView.hxx
index 2b219ea3ee63..4c36ab743abe 100644
--- a/reportdesign/source/ui/inc/DesignView.hxx
+++ b/reportdesign/source/ui/inc/DesignView.hxx
@@ -257,7 +257,7 @@ namespace rptui
/** zoom the ruler and view windows
*/
- void zoom(const Fraction& _aZoom);
+ void zoom(const boost::rational<long>& _aZoom);
/** fills the vector with all selected control models
/param _rSelection The vector will be filled and will not be cleared before.
diff --git a/reportdesign/source/ui/inc/ReportWindow.hxx b/reportdesign/source/ui/inc/ReportWindow.hxx
index 0af524b81b75..fec4e81de722 100644
--- a/reportdesign/source/ui/inc/ReportWindow.hxx
+++ b/reportdesign/source/ui/inc/ReportWindow.hxx
@@ -211,7 +211,7 @@ namespace rptui
/** zoom the ruler and view windows
*/
- void zoom(const Fraction& _aZoom);
+ void zoom(const boost::rational<long>& _aZoom);
/** fills the vector with all selected control models
/param _rSelection The vector will be filled and will not be cleared before.
diff --git a/reportdesign/source/ui/inc/ScrollHelper.hxx b/reportdesign/source/ui/inc/ScrollHelper.hxx
index e62233f84490..f00ceb8b8123 100644
--- a/reportdesign/source/ui/inc/ScrollHelper.hxx
+++ b/reportdesign/source/ui/inc/ScrollHelper.hxx
@@ -202,7 +202,7 @@ namespace rptui
/** zoom the ruler and view windows
*/
- void zoom(const Fraction& _aZoom);
+ void zoom(const boost::rational<long>& _aZoom);
/** fills the vector with all selected control models
/param _rSelection The vector will be filled and will not be cleared before.
diff --git a/reportdesign/source/ui/inc/SectionWindow.hxx b/reportdesign/source/ui/inc/SectionWindow.hxx
index ce8615862cee..e57769c3721d 100644
--- a/reportdesign/source/ui/inc/SectionWindow.hxx
+++ b/reportdesign/source/ui/inc/SectionWindow.hxx
@@ -120,7 +120,7 @@ namespace rptui
/** zoom the ruler and view windows
*/
- void zoom(const Fraction& _aZoom);
+ void zoom(const boost::rational<long>& _aZoom);
void scrollChildren(long _nThumbPosX);
};
diff --git a/reportdesign/source/ui/inc/StartMarker.hxx b/reportdesign/source/ui/inc/StartMarker.hxx
index 9f85af132872..83d4d7aee857 100644
--- a/reportdesign/source/ui/inc/StartMarker.hxx
+++ b/reportdesign/source/ui/inc/StartMarker.hxx
@@ -71,7 +71,7 @@ namespace rptui
/** zoom the ruler and view windows
*/
- void zoom(const Fraction& _aZoom);
+ void zoom(const boost::rational<long>& _aZoom);
};
}
#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_STARTMARKER_HXX
diff --git a/reportdesign/source/ui/inc/UITools.hxx b/reportdesign/source/ui/inc/UITools.hxx
index 1471152e99a1..facbd129a8c9 100644
--- a/reportdesign/source/ui/inc/UITools.hxx
+++ b/reportdesign/source/ui/inc/UITools.hxx
@@ -176,7 +176,7 @@ namespace rptui
@param _aZoom the zoom scale
@param _rWindow where to set the map mode
*/
- void setZoomFactor(const Fraction& _aZoom, ::vcl::Window& _rWindow);
+ void setZoomFactor(const boost::rational<long>& _aZoom, ::vcl::Window& _rWindow);
}
#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_UITOOLS_HXX
diff --git a/reportdesign/source/ui/inc/ViewsWindow.hxx b/reportdesign/source/ui/inc/ViewsWindow.hxx
index fb8fff7cb894..5fe5ab29fe98 100644
--- a/reportdesign/source/ui/inc/ViewsWindow.hxx
+++ b/reportdesign/source/ui/inc/ViewsWindow.hxx
@@ -331,7 +331,7 @@ namespace rptui
/** zoom the ruler and view windows
*/
- void zoom(const Fraction& _aZoom);
+ void zoom(const boost::rational<long>& _aZoom);
void scrollChildren(const Point& _aThumbPos);
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index 2a908306e23a..2ca816ddede2 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -991,7 +991,7 @@ void correctOverlapping(SdrObject* _pControl,OReportSection& _aReportSection,boo
rSectionView.InsertObjectAtView(_pControl,*rSectionView.GetSdrPageView(),SDRINSERT_ADDMARK);
}
-void setZoomFactor(const Fraction& _aZoom, vcl::Window& _rWindow)
+void setZoomFactor(const boost::rational<long>& _aZoom, vcl::Window& _rWindow)
{
MapMode aMapMode( _rWindow.GetMapMode() );
aMapMode.SetScaleX(_aZoom);
diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx
index b9df2babf467..853358ef6ccc 100644
--- a/reportdesign/source/ui/report/DesignView.cxx
+++ b/reportdesign/source/ui/report/DesignView.cxx
@@ -684,7 +684,7 @@ sal_uInt32 ODesignView::getMarkedObjectCount() const
return m_aScrollWindow.getMarkedObjectCount();
}
-void ODesignView::zoom(const Fraction& _aZoom)
+void ODesignView::zoom(const boost::rational<long>& _aZoom)
{
m_aScrollWindow.zoom(_aZoom);
}
diff --git a/reportdesign/source/ui/report/EndMarker.cxx b/reportdesign/source/ui/report/EndMarker.cxx
index d9dc4cf7c891..eacba6c64ffe 100644
--- a/reportdesign/source/ui/report/EndMarker.cxx
+++ b/reportdesign/source/ui/report/EndMarker.cxx
@@ -45,9 +45,9 @@ OEndMarker::~OEndMarker()
void OEndMarker::Paint( const Rectangle& /*rRect*/ )
{
- Fraction aCornerSpace(long(CORNER_SPACE));
+ boost::rational<long> aCornerSpace(long(CORNER_SPACE));
aCornerSpace *= GetMapMode().GetScaleX();
- const long nCornerSpace = aCornerSpace;
+ const long nCornerSpace = boost::rational_cast<long>(aCornerSpace);
Size aSize = GetSizePixel();
aSize.Width() += nCornerSpace;
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index 3259d777ee2b..f827456fbc2e 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -4110,7 +4110,7 @@ void OReportController::impl_fillState_nothrow(const OUString& _sProperty,dbaui:
void OReportController::impl_zoom_nothrow()
{
- Fraction aZoom(m_nZoomValue,100);
+ boost::rational<long> aZoom(m_nZoomValue,100);
setZoomFactor( aZoom,*getDesignView() );
getDesignView()->zoom(aZoom);
InvalidateFeature(SID_ATTR_ZOOM,Reference< XStatusListener >(), true);
diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx
index 8aca901f567b..519a0abb7e59 100644
--- a/reportdesign/source/ui/report/ReportSection.cxx
+++ b/reportdesign/source/ui/report/ReportSection.cxx
@@ -202,8 +202,8 @@ void OReportSection::fill()
m_pView->SetGridFine(aGridSizeFine);
// #i93595# set snap grid width to snap to all existing subdivisions
- const Fraction aX(aGridSizeFine.A());
- const Fraction aY(aGridSizeFine.B());
+ const boost::rational<long> aX(aGridSizeFine.A());
+ const boost::rational<long> aY(aGridSizeFine.B());
m_pView->SetSnapGridWidth(aX, aY);
m_pView->SetGridSnap( pDesignView->isGridSnap() );
diff --git a/reportdesign/source/ui/report/ReportWindow.cxx b/reportdesign/source/ui/report/ReportWindow.cxx
index 675f6ba6077e..57afd5c0dcba 100644
--- a/reportdesign/source/ui/report/ReportWindow.cxx
+++ b/reportdesign/source/ui/report/ReportWindow.cxx
@@ -141,11 +141,11 @@ void OReportWindow::showRuler(bool _bShow)
sal_Int32 OReportWindow::getMaxMarkerWidth(bool _bWithEnd) const
{
- Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
+ boost::rational<long> aStartWidth(long(REPORT_STARTMARKER_WIDTH));
aStartWidth *= m_aViewsWindow.GetMapMode().GetScaleX();
if ( _bWithEnd )
- aStartWidth += Fraction(long(REPORT_ENDMARKER_WIDTH));
- return sal_Int32((long)aStartWidth);
+ aStartWidth += boost::rational<long>(long(REPORT_ENDMARKER_WIDTH));
+ return sal_Int32(boost::rational_cast<long>(aStartWidth));
}
sal_Int32 OReportWindow::GetTotalWidth() const
@@ -153,14 +153,14 @@ sal_Int32 OReportWindow::GetTotalWidth() const
sal_Int32 nWidth = 0;
if ( !m_aViewsWindow.empty() )
{
- Fraction aStartWidth(long(REPORT_ENDMARKER_WIDTH + REPORT_STARTMARKER_WIDTH ));
- const Fraction aZoom(m_pView->getController().getZoomValue(),100);
+ boost::rational<long> aStartWidth(long(REPORT_ENDMARKER_WIDTH + REPORT_STARTMARKER_WIDTH ));
+ const boost::rational<long> 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);
+ boost::rational<long> aPaperWidth(nPaperWidth,1);
aPaperWidth *= aZoom;
- const Size aPageSize = LogicToPixel(Size(aPaperWidth,0));
- nWidth = aPageSize.Width() + long(aStartWidth);
+ const Size aPageSize = LogicToPixel(Size(boost::rational_cast<long>(aPaperWidth),0));
+ nWidth = aPageSize.Width() + boost::rational_cast<long>(aStartWidth);
}
return nWidth;
}
@@ -171,10 +171,10 @@ void OReportWindow::Resize()
if ( !m_aViewsWindow.empty() )
{
const Size aTotalOutputSize = GetOutputSizePixel();
- Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH)*m_pView->getController().getZoomValue(),100);
+ boost::rational<long> aStartWidth(long(REPORT_STARTMARKER_WIDTH)*m_pView->getController().getZoomValue(),100);
const Point aOffset = LogicToPixel( Point( SECTION_OFFSET, 0 ), MAP_APPFONT );
- Point aStartPoint((long)aStartWidth + aOffset.X(),0);
+ Point aStartPoint(boost::rational_cast<long>(aStartWidth) + 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);
@@ -372,7 +372,7 @@ sal_uInt32 OReportWindow::getMarkedObjectCount() const
return m_aViewsWindow.getMarkedObjectCount();
}
-void OReportWindow::zoom(const Fraction& _aZoom)
+void OReportWindow::zoom(const boost::rational<long>& _aZoom)
{
m_aHRuler.SetZoom(_aZoom);
m_aHRuler.Invalidate();
@@ -414,14 +414,14 @@ sal_uInt16 OReportWindow::getZoomFactor(SvxZoomType _eType) const
break;
case SVX_ZOOM_WHOLEPAGE:
{
- nZoom = (sal_uInt16)(long)Fraction(aSize.Width()*100,impl_getRealPixelWidth());
+ nZoom = (sal_uInt16) boost::rational_cast<long>( boost::rational<long>(aSize.Width() * 100, impl_getRealPixelWidth()) );
MapMode aMap( MAP_100TH_MM );
const Size aHeight = m_aViewsWindow.LogicToPixel(m_aViewsWindow.PixelToLogic(Size(0,GetTotalHeight() + m_aHRuler.GetSizePixel().Height())),aMap);
- nZoom = ::std::min(nZoom,(sal_uInt16)(long)Fraction(aSize.Height()*100,aHeight.Height()));
+ nZoom = ::std::min(nZoom, (sal_uInt16) boost::rational_cast<long>( boost::rational<long>(aSize.Height() * 100, aHeight.Height()) ));
}
break;
case SVX_ZOOM_PAGEWIDTH:
- nZoom = (sal_uInt16)(long)Fraction(aSize.Width()*100,impl_getRealPixelWidth());
+ nZoom = (sal_uInt16)boost::rational_cast<long>( boost::rational<long>(aSize.Width() * 100, this->impl_getRealPixelWidth()) );
break;
default:
break;
diff --git a/reportdesign/source/ui/report/ScrollHelper.cxx b/reportdesign/source/ui/report/ScrollHelper.cxx
index d225cee21363..59d1f6de1efd 100644
--- a/reportdesign/source/ui/report/ScrollHelper.cxx
+++ b/reportdesign/source/ui/report/ScrollHelper.cxx
@@ -101,8 +101,8 @@ void OScrollWindowHelper::setTotalSize(sal_Int32 _nWidth ,sal_Int32 _nHeight)
m_aTotalPixelSize.Height() = _nHeight;
// now set the ranges without start marker
- Fraction aStartWidth(REPORT_STARTMARKER_WIDTH * m_pParent->getController().getZoomValue(),100);
- long nWidth = long(_nWidth - (double)aStartWidth);
+ boost::rational<long> aStartWidth(REPORT_STARTMARKER_WIDTH * m_pParent->getController().getZoomValue(),100);
+ long nWidth = long(_nWidth - boost::rational_cast<double>(aStartWidth));
m_aHScroll.SetRangeMax( nWidth );
m_aVScroll.SetRangeMax( m_aTotalPixelSize.Height() );
@@ -163,9 +163,9 @@ Size OScrollWindowHelper::ResizeScrollBars()
const Point aOffset = LogicToPixel( Point( SECTION_OFFSET, SECTION_OFFSET ), MAP_APPFONT );
// resize scrollbars and set their ranges
{
- Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH*m_pParent->getController().getZoomValue()),100);
- const sal_Int32 nNewWidth = aOutPixSz.Width() - aOffset.X() - (long)aStartWidth;
- lcl_setScrollBar(nNewWidth,Point( (long)aStartWidth + aOffset.X(), aOutPixSz.Height() ),Size( nNewWidth, nScrSize ),m_aHScroll);
+ boost::rational<long> aStartWidth(long(REPORT_STARTMARKER_WIDTH*m_pParent->getController().getZoomValue()),100);
+ const sal_Int32 nNewWidth = aOutPixSz.Width() - aOffset.X() - boost::rational_cast<long>(aStartWidth);
+ lcl_setScrollBar(nNewWidth,Point( boost::rational_cast<long>(aStartWidth) + aOffset.X(), aOutPixSz.Height() ),Size( nNewWidth, nScrSize ),m_aHScroll);
}
{
const sal_Int32 nNewHeight = aOutPixSz.Height() - m_aReportWindow.getRulerHeight();
@@ -382,7 +382,7 @@ sal_uInt32 OScrollWindowHelper::getMarkedObjectCount() const
return m_aReportWindow.getMarkedObjectCount();
}
-void OScrollWindowHelper::zoom(const Fraction& _aZoom)
+void OScrollWindowHelper::zoom(const boost::rational<long>& _aZoom)
{
m_aReportWindow.zoom(_aZoom);
Resize();
diff --git a/reportdesign/source/ui/report/SectionWindow.cxx b/reportdesign/source/ui/report/SectionWindow.cxx
index ef15b49d9b30..1d82b716cd5e 100644
--- a/reportdesign/source/ui/report/SectionWindow.cxx
+++ b/reportdesign/source/ui/report/SectionWindow.cxx
@@ -220,7 +220,7 @@ void OSectionWindow::Resize()
Window::Resize();
Size aOutputSize = GetOutputSizePixel();
- Fraction aEndWidth(long(REPORT_ENDMARKER_WIDTH));
+ boost::rational<long> aEndWidth(long(REPORT_ENDMARKER_WIDTH));
aEndWidth *= GetMapMode().GetScaleX();
const Point aThumbPos = m_pParent->getView()->getThumbPos();
@@ -236,33 +236,33 @@ void OSectionWindow::Resize()
{
const bool bShowEndMarker = m_pParent->getView()->GetTotalWidth() <= (aThumbPos.X() + aOutputSize.Width() );
- Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
+ boost::rational<long> aStartWidth(long(REPORT_STARTMARKER_WIDTH));
aStartWidth *= GetMapMode().GetScaleX();
// set start marker
- m_aStartMarker.SetPosSizePixel(Point(0,0),Size(aStartWidth,aOutputSize.Height()));
+ m_aStartMarker.SetPosSizePixel(Point(0,0),Size(boost::rational_cast<long>(aStartWidth),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(boost::rational_cast<long>(aStartWidth),0);
+ aSectionSize.Width() = aOutputSize.Width() - boost::rational_cast<long>(aStartWidth);
if ( bShowEndMarker )
- aSectionSize.Width() -= (long)aEndWidth;
+ aSectionSize.Width() -= boost::rational_cast<long>(aEndWidth);
m_aReportSection.SetPosSizePixel(aReportPos,aSectionSize);
// set splitter
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( Rectangle(Point(aStartWidth,0),aSectionSize));
+ aSectionSize.Height() = (long)(1000 * boost::rational_cast<double>(this->GetMapMode().GetScaleY()));
+ m_aSplitter.SetDragRectPixel( Rectangle(Point(boost::rational_cast<long>(aStartWidth),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(boost::rational_cast<long>(aEndWidth),aOutputSize.Height()));
}
}
@@ -299,7 +299,7 @@ IMPL_LINK( OSectionWindow, Collapsed, OColorListener *, _pMarker )
return 0L;
}
-void OSectionWindow::zoom(const Fraction& _aZoom)
+void OSectionWindow::zoom(const boost::rational<long>& _aZoom)
{
setZoomFactor(_aZoom,*this);
m_aStartMarker.zoom(_aZoom);
diff --git a/reportdesign/source/ui/report/StartMarker.cxx b/reportdesign/source/ui/report/StartMarker.cxx
index a1a3f30944d2..bc7fc19a6efd 100644
--- a/reportdesign/source/ui/report/StartMarker.cxx
+++ b/reportdesign/source/ui/report/StartMarker.cxx
@@ -89,9 +89,9 @@ OStartMarker::~OStartMarker()
sal_Int32 OStartMarker::getMinHeight() const
{
- Fraction aExtraWidth(long(2*REPORT_EXTRA_SPACE));
+ boost::rational<long> aExtraWidth(long(2*REPORT_EXTRA_SPACE));
aExtraWidth *= GetMapMode().GetScaleX();
- return LogicToPixel(Size(0,m_aText.GetTextHeight())).Height() + (long)aExtraWidth;
+ return LogicToPixel(Size(0,m_aText.GetTextHeight())).Height() + boost::rational_cast<long>(aExtraWidth);
}
void OStartMarker::Paint( const Rectangle& rRect )
@@ -99,7 +99,7 @@ void OStartMarker::Paint( const Rectangle& rRect )
(void)rRect;
Size aSize = GetOutputSizePixel();
long nSize = aSize.Width();
- const long nCornerWidth = long(CORNER_SPACE * (double)GetMapMode().GetScaleX());
+ const long nCornerWidth = long(CORNER_SPACE * boost::rational_cast<double>(GetMapMode().GetScaleX()));
if ( isCollapsed() )
{
@@ -134,7 +134,7 @@ void OStartMarker::Paint( const Rectangle& rRect )
}
if ( m_bMarked )
{
- const long nCornerHeight = long(CORNER_SPACE * (double)GetMapMode().GetScaleY());
+ const long nCornerHeight = long(CORNER_SPACE * boost::rational_cast<double>(GetMapMode().GetScaleY()));
Rectangle aRect( Point(nCornerWidth,nCornerHeight),
Size(aSize.Width() - nCornerWidth - nCornerWidth,aSize.Height() - nCornerHeight - nCornerHeight));
ColorChanger aColors( this, COL_WHITE, COL_WHITE );
@@ -218,17 +218,17 @@ void OStartMarker::Resize()
Size aImageSize = m_aImage.GetImage().GetSizePixel();
const MapMode& rMapMode = GetMapMode();
- aImageSize.Width() = long(aImageSize.Width() * (double)rMapMode.GetScaleX());
- aImageSize.Height() = long(aImageSize.Height() * (double)rMapMode.GetScaleY());
+ aImageSize.Width() = long(aImageSize.Width() * boost::rational_cast<double>(rMapMode.GetScaleX()));
+ aImageSize.Height() = long(aImageSize.Height() * boost::rational_cast<double>(rMapMode.GetScaleY()));
- Fraction aExtraWidth(long(REPORT_EXTRA_SPACE));
+ boost::rational<long> aExtraWidth(long(REPORT_EXTRA_SPACE));
aExtraWidth *= rMapMode.GetScaleX();
- Point aPos(aImageSize.Width() + (long)(aExtraWidth + aExtraWidth), aExtraWidth);
+ Point aPos(aImageSize.Width() + boost::rational_cast<long>((aExtraWidth + aExtraWidth)), boost::rational_cast<long>(aExtraWidth));
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() = boost::rational_cast<long>(aExtraWidth);
aPos.Y() += static_cast<sal_Int32>((LogicToPixel(Size(0,m_aText.GetTextHeight())).Height() - aImageSize.Height()) * 0.5) ;
m_aImage.SetPosSizePixel(aPos,aImageSize);
}
@@ -281,7 +281,7 @@ void OStartMarker::setCollapsed(bool _bCollapsed)
changeImage();
}
-void OStartMarker::zoom(const Fraction& _aZoom)
+void OStartMarker::zoom(const boost::rational<long>& _aZoom)
{
setZoomFactor(_aZoom,*this);
m_aVRuler.SetZoom(_aZoom);
diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx
index 5fb908d71dee..8c0e49f4eb86 100644
--- a/reportdesign/source/ui/report/ViewsWindow.cxx
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -206,7 +206,7 @@ void OViewsWindow::impl_resizeSectionWindow(OSectionWindow& _rSectionWindow,Poin
aSectionSize.Height() = nMinHeight;
}
const StyleSettings& rSettings = GetSettings().GetStyleSettings();
- aSectionSize.Height() += (long)(rSettings.GetSplitSize() * (double)_rSectionWindow.GetMapMode().GetScaleY());
+ aSectionSize.Height() += (long)(rSettings.GetSplitSize() * boost::rational_cast<double>(_rSectionWindow.GetMapMode().GetScaleY()));
if ( _bSet )
_rSectionWindow.SetPosSizePixel(_rStartPoint,aSectionSize);
@@ -263,13 +263,13 @@ void OViewsWindow::Paint( const Rectangle& rRect )
Window::Paint( rRect );
Size aOut = GetOutputSizePixel();
- Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
+ boost::rational<long> aStartWidth(long(REPORT_STARTMARKER_WIDTH));
aStartWidth *= GetMapMode().GetScaleX();
- aOut.Width() -= (long)aStartWidth;
+ aOut.Width() -= boost::rational_cast<long>(aStartWidth);
aOut = PixelToLogic(aOut);
- Rectangle aRect(PixelToLogic(Point(aStartWidth,0)),aOut);
+ Rectangle aRect(PixelToLogic(Point(boost::rational_cast<long>(aStartWidth),0)),aOut);
Wallpaper aWall( m_aColorConfig.GetColorValue(::svtools::APPBACKGROUND).nColor );
DrawWallpaper(aRect,aWall);
}
@@ -1685,11 +1685,11 @@ void OViewsWindow::collapseSections(const uno::Sequence< beans::PropertyValue>&
}
}
-void OViewsWindow::zoom(const Fraction& _aZoom)
+void OViewsWindow::zoom(const boost::rational<long>& _aZoom)
{
const MapMode& aMapMode = GetMapMode();
- Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
+ boost::rational<long> aStartWidth(long(REPORT_STARTMARKER_WIDTH));
if ( _aZoom < aMapMode.GetScaleX() )
aStartWidth *= aMapMode.GetScaleX();
else
@@ -1707,7 +1707,7 @@ void OViewsWindow::zoom(const Fraction& _aZoom)
Resize();
Size aOut = GetOutputSizePixel();
- aOut.Width() = aStartWidth;
+ aOut.Width() = boost::rational_cast<long>(aStartWidth);
aOut = PixelToLogic(aOut);
Rectangle aRect(PixelToLogic(Point(0,0)),aOut);
diff --git a/reportdesign/source/ui/report/dlgedfunc.cxx b/reportdesign/source/ui/report/dlgedfunc.cxx
index 07067619fff9..33b12ae54a00 100644
--- a/reportdesign/source/ui/report/dlgedfunc.cxx
+++ b/reportdesign/source/ui/report/dlgedfunc.cxx
@@ -78,10 +78,10 @@ void DlgEdFunc::ForceScroll( const Point& rPos )
OScrollWindowHelper* pScrollWindow = pReportWindow->getScrollWindow();
Size aOut = pReportWindow->GetOutputSizePixel();
- Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
+ boost::rational<long> aStartWidth(long(REPORT_STARTMARKER_WIDTH));
aStartWidth *= m_pParent->GetMapMode().GetScaleX();
- aOut.Width() -= (long)aStartWidth;
+ aOut.Width() -= boost::rational_cast<long>(aStartWidth);
aOut.Height() = m_pParent->GetOutputSizePixel().Height();
Point aPos = pScrollWindow->getThumbPos();
@@ -90,7 +90,7 @@ void DlgEdFunc::ForceScroll( const Point& rPos )
Rectangle aOutRect( aPos, aOut );
aOutRect = m_pParent->PixelToLogic( aOutRect );
Rectangle aWorkArea(Point(), pScrollWindow->getTotalSize());
- aWorkArea.Right() -= (long)aStartWidth;
+ aWorkArea.Right() -= boost::rational_cast<long>(aStartWidth);
aWorkArea = pScrollWindow->PixelToLogic( aWorkArea );
if( !aOutRect.IsInside( rPos ) && aWorkArea.IsInside( rPos ) )
{