summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/access/accmap.cxx10
-rw-r--r--sw/source/core/doc/tblrwcl.cxx10
-rw-r--r--sw/source/core/docnode/ndnotxt.cxx4
-rw-r--r--sw/source/core/draw/dcontact.cxx6
-rw-r--r--sw/source/core/draw/dflyobj.cxx4
-rw-r--r--sw/source/core/frmedt/fecopy.cxx4
-rw-r--r--sw/source/core/graphic/ndgrf.cxx8
-rw-r--r--sw/source/core/inc/dflyobj.hxx8
-rw-r--r--sw/source/core/inc/viewimp.hxx4
-rw-r--r--sw/source/core/layout/anchoreddrawobject.cxx7
-rw-r--r--sw/source/core/layout/fly.cxx8
-rw-r--r--sw/source/core/layout/paintfrm.cxx19
-rw-r--r--sw/source/core/text/porlay.hxx2
-rw-r--r--sw/source/core/txtnode/fntcache.cxx10
-rw-r--r--sw/source/core/view/pagepreviewlayout.cxx14
-rw-r--r--sw/source/core/view/viewimp.cxx6
-rw-r--r--sw/source/core/view/viewpg.cxx10
-rw-r--r--sw/source/core/view/viewsh.cxx10
-rw-r--r--sw/source/core/view/vnew.cxx2
-rw-r--r--sw/source/filter/html/htmlflywriter.cxx8
-rw-r--r--sw/source/filter/writer/wrtswtbl.cxx8
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx2
-rw-r--r--sw/source/filter/ww8/rtfexport.cxx2
-rw-r--r--sw/source/filter/ww8/writerhelper.cxx18
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx8
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx18
-rw-r--r--sw/source/filter/ww8/ww8par4.cxx8
-rw-r--r--sw/source/ui/misc/pgfnote.cxx6
-rw-r--r--sw/source/uibase/docvw/PostItMgr.cxx20
-rw-r--r--sw/source/uibase/docvw/SidebarWin.cxx38
-rw-r--r--sw/source/uibase/frmdlg/colex.cxx2
-rw-r--r--sw/source/uibase/inc/pview.hxx2
-rw-r--r--sw/source/uibase/inc/view.hxx2
-rw-r--r--sw/source/uibase/uiview/pview.cxx2
-rw-r--r--sw/source/uibase/uiview/swcli.cxx8
-rw-r--r--sw/source/uibase/uiview/view.cxx2
-rw-r--r--sw/source/uibase/uiview/viewmdi.cxx2
-rw-r--r--sw/source/uibase/uiview/viewport.cxx18
-rw-r--r--sw/source/uibase/utlui/uiitems.cxx6
-rw-r--r--sw/source/uibase/wrtsh/wrtsh1.cxx12
40 files changed, 172 insertions, 166 deletions
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 63661e303225..64a70c94a67e 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -602,7 +602,7 @@ class SwAccPreviewData
Rectangles maLogicRects;
SwRect maVisArea;
- boost::rational<long> maScale;
+ Fraction maScale;
const SwPageFrm *mpSelPage;
@@ -630,7 +630,7 @@ public:
void Update( const SwAccessibleMap& rAccMap,
const std::vector<PreviewPage*>& _rPreviewPages,
- const boost::rational<long>& _rScale,
+ const Fraction& _rScale,
const SwPageFrm* _pSelectedPageFrm,
const Size& _rPreviewWinSize );
@@ -661,7 +661,7 @@ SwAccPreviewData::~SwAccPreviewData()
void SwAccPreviewData::Update( const SwAccessibleMap& rAccMap,
const std::vector<PreviewPage*>& _rPreviewPages,
- const boost::rational<long>& _rScale,
+ const Fraction& _rScale,
const SwPageFrm* _pSelectedPageFrm,
const Size& _rPreviewWinSize )
{
@@ -1801,7 +1801,7 @@ uno::Reference< XAccessible > SwAccessibleMap::GetDocumentView( )
uno::Reference<XAccessible> SwAccessibleMap::GetDocumentPreview(
const std::vector<PreviewPage*>& _rPreviewPages,
- const boost::rational<long>& _rScale,
+ const Fraction& _rScale,
const SwPageFrm* _pSelectedPageFrm,
const Size& _rPreviewWinSize )
{
@@ -2964,7 +2964,7 @@ sal_Int32 SwAccessibleMap::GetChildIndex( const SwFrm& rParentFrm,
}
void SwAccessibleMap::UpdatePreview( const std::vector<PreviewPage*>& _rPreviewPages,
- const boost::rational<long>& _rScale,
+ const Fraction& _rScale,
const SwPageFrm* _pSelectedPageFrm,
const Size& _rPreviewWinSize )
{
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index f7987da558e6..1ce8a372c978 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -25,7 +25,7 @@
#include <editeng/lrspitem.hxx>
#include <editeng/protitem.hxx>
#include <editeng/boxitem.hxx>
-#include <tools/rational.hxx>
+#include <tools/fract.hxx>
#include <fmtfsize.hxx>
#include <fmtornt.hxx>
#include <doc.hxx>
@@ -3986,10 +3986,10 @@ void SetLineHeight( SwTableLine& rLine, SwTwips nOldHeight, SwTwips nNewHeight,
else
{
// Calculate as exactly as possible
- boost::rational<long> aTmp( nMyOldH );
- aTmp *= boost::rational<long>( nNewHeight, nOldHeight );
- aTmp += boost::rational<long>( 1, 2 ); // round up if needed
- nMyNewH = boost::rational_cast<long>(aTmp);
+ Fraction aTmp( nMyOldH );
+ aTmp *= Fraction( nNewHeight, nOldHeight );
+ aTmp += Fraction( 1, 2 ); // round up if needed
+ nMyNewH = aTmp;
}
SwFrmSize eSize = ATT_MIN_SIZE;
diff --git a/sw/source/core/docnode/ndnotxt.cxx b/sw/source/core/docnode/ndnotxt.cxx
index 6360b359e319..7a325c93cc94 100644
--- a/sw/source/core/docnode/ndnotxt.cxx
+++ b/sw/source/core/docnode/ndnotxt.cxx
@@ -125,8 +125,8 @@ const tools::PolyPolygon *SwNoTxtNode::HasContour() const
const Size aGrfPrefMapModeSize( GetGraphic().GetPrefSize() );
if ( aGrfMap.GetMapUnit() == MAP_INCH )
{
- nGrfDPIx = aGrfPixelSize.Width() / ( boost::rational_cast<double>(aGrfMap.GetScaleX()) * aGrfPrefMapModeSize.Width() );
- nGrfDPIy = aGrfPixelSize.Height() / ( boost::rational_cast<double>(aGrfMap.GetScaleY()) * aGrfPrefMapModeSize.Height() );
+ nGrfDPIx = aGrfPixelSize.Width() / ( (double)aGrfMap.GetScaleX() * aGrfPrefMapModeSize.Width() );
+ nGrfDPIy = aGrfPixelSize.Height() / ( (double)aGrfMap.GetScaleY() * aGrfPrefMapModeSize.Height() );
}
else
{
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index b9f1318f648e..d9c9af706e65 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -2372,7 +2372,7 @@ void SwDrawVirtObj::NbcMove(const Size& rSiz)
SdrObject::NbcMove( rSiz );
}
-void SwDrawVirtObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact)
+void SwDrawVirtObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
{
rRefObj.NbcResize(rRef - GetOffset(), xFact, yFact);
SetRectsDirty();
@@ -2401,9 +2401,9 @@ void SwDrawVirtObj::Move(const Size& rSiz)
SdrObject::Move( rSiz );
}
-void SwDrawVirtObj::Resize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bUnsetRelative)
+void SwDrawVirtObj::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative)
{
- if(xFact.numerator() != xFact.denominator() || yFact.numerator() != yFact.denominator())
+ if(xFact.GetNumerator() != xFact.GetDenominator() || yFact.GetNumerator() != yFact.GetDenominator())
{
Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetLastBoundRect();
rRefObj.Resize(rRef - GetOffset(), xFact, yFact, bUnsetRelative);
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx
index ad56718a900c..700a6296b872 100644
--- a/sw/source/core/draw/dflyobj.cxx
+++ b/sw/source/core/draw/dflyobj.cxx
@@ -731,7 +731,7 @@ void SwVirtFlyDrawObj::NbcMove(const Size& rSiz)
}
void SwVirtFlyDrawObj::NbcResize(const Point& rRef,
- const boost::rational<long>& xFact, const boost::rational<long>& yFact)
+ const Fraction& xFact, const Fraction& yFact)
{
ResizeRect( aOutRect, rRef, xFact, yFact );
@@ -843,7 +843,7 @@ void SwVirtFlyDrawObj::Move(const Size& rSiz)
}
void SwVirtFlyDrawObj::Resize(const Point& rRef,
- const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool /*bUnsetRelative*/)
+ const Fraction& xFact, const Fraction& yFact, bool /*bUnsetRelative*/)
{
NbcResize( rRef, xFact, yFact );
SetChanged();
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 0cbcb5e97636..3669a5902734 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -1389,8 +1389,8 @@ void SwFEShell::Paste( SvStream& rStrm, sal_uInt16 nAction, const Point* pPt )
Rectangle aNewRect( pNewObj->GetCurrentBoundRect() );
Size aNewSize( aNewRect.GetSize() );
- boost::rational<long> aScaleWidth( aOldObjSize.Width(), aNewSize.Width() );
- boost::rational<long> aScaleHeight( aOldObjSize.Height(), aNewSize.Height());
+ Fraction aScaleWidth( aOldObjSize.Width(), aNewSize.Width() );
+ Fraction aScaleHeight( aOldObjSize.Height(), aNewSize.Height());
pNewObj->NbcResize( aNewRect.TopLeft(), aScaleWidth, aScaleHeight);
Point aVec = aOldObjRect.TopLeft() - aNewRect.TopLeft();
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index d4cc181943f6..280c6d45b7e1 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -812,8 +812,8 @@ void SwGrfNode::ScaleImageMap()
return;
bool bScale = false;
- boost::rational<long> aScaleX( 1, 1 );
- boost::rational<long> aScaleY( 1, 1 );
+ Fraction aScaleX( 1, 1 );
+ Fraction aScaleY( 1, 1 );
const SwFmtFrmSize& rFrmSize = pFmt->GetFrmSize();
const SvxBoxItem& rBox = pFmt->GetBox();
@@ -829,7 +829,7 @@ void SwGrfNode::ScaleImageMap()
if( nGrfSize.Width() != nWidth )
{
- aScaleX = boost::rational<long>( nGrfSize.Width(), nWidth );
+ aScaleX = Fraction( nGrfSize.Width(), nWidth );
bScale = true;
}
}
@@ -844,7 +844,7 @@ void SwGrfNode::ScaleImageMap()
if( nGrfSize.Height() != nHeight )
{
- aScaleY = boost::rational<long>( nGrfSize.Height(), nHeight );
+ aScaleY = Fraction( nGrfSize.Height(), nHeight );
bScale = true;
}
}
diff --git a/sw/source/core/inc/dflyobj.hxx b/sw/source/core/inc/dflyobj.hxx
index 79e9f37471d7..058e64c13d8e 100644
--- a/sw/source/core/inc/dflyobj.hxx
+++ b/sw/source/core/inc/dflyobj.hxx
@@ -99,11 +99,11 @@ public:
virtual void NbcSetLogicRect(const Rectangle& rRect) SAL_OVERRIDE;
virtual ::basegfx::B2DPolyPolygon TakeXorPoly() const SAL_OVERRIDE;
virtual void NbcMove (const Size& rSiz) SAL_OVERRIDE;
- virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact,
- const boost::rational<long>& yFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact,
+ const Fraction& yFact) SAL_OVERRIDE;
virtual void Move (const Size& rSiz) SAL_OVERRIDE;
- virtual void Resize(const Point& rRef, const boost::rational<long>& xFact,
- const boost::rational<long>& yFact, bool bUnsetRelative = true) SAL_OVERRIDE;
+ virtual void Resize(const Point& rRef, const Fraction& xFact,
+ const Fraction& yFact, bool bUnsetRelative = true) SAL_OVERRIDE;
const SwFrmFmt *GetFmt() const;
SwFrmFmt *GetFmt();
diff --git a/sw/source/core/inc/viewimp.hxx b/sw/source/core/inc/viewimp.hxx
index ae86642f8d73..66a652510944 100644
--- a/sw/source/core/inc/viewimp.hxx
+++ b/sw/source/core/inc/viewimp.hxx
@@ -40,7 +40,7 @@ class SwPageFrm;
class SwRegionRects;
class SwAccessibleMap;
class SdrObject;
-namespace boost { template<typename T> class rational; }
+class Fraction;
class SwPrintData;
class SwPagePreviewLayout;
struct PreviewPage;
@@ -262,7 +262,7 @@ public:
/// update data for accessible preview
/// change method signature due to new page preview functionality
void UpdateAccessiblePreview( const std::vector<PreviewPage*>& _rPreviewPages,
- const boost::rational<long>& _rScale,
+ const Fraction& _rScale,
const SwPageFrm* _pSelectedPageFrm,
const Size& _rPreviewWinSize );
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx
index 58fa20cac362..628ed1356d5b 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -655,14 +655,13 @@ const SwRect SwAnchoredDrawObject::GetObjBoundRect() const
nTargetHeight = aPageRect.GetHeight( ) * GetDrawObj( )->GetRelativeHeight( ).get( );
}
- if ( (nTargetWidth != aCurrObjRect.GetWidth( ) || nTargetHeight != aCurrObjRect.GetHeight( ))
- && aCurrObjRect.GetWidth() != 0 && aCurrObjRect.GetHeight() != 0 )
+ if ( nTargetWidth != aCurrObjRect.GetWidth( ) || nTargetHeight != aCurrObjRect.GetHeight( ) )
{
SwDoc* pDoc = const_cast<SwDoc*>(GetPageFrm()->GetFmt()->GetDoc());
bool bModified = pDoc->getIDocumentState().IsModified();
const_cast< SdrObject* >( GetDrawObj() )->Resize( aCurrObjRect.TopLeft(),
- boost::rational<long>( nTargetWidth, aCurrObjRect.GetWidth() ),
- boost::rational<long>( nTargetHeight, aCurrObjRect.GetHeight() ), false );
+ Fraction( nTargetWidth, aCurrObjRect.GetWidth() ),
+ Fraction( nTargetHeight, aCurrObjRect.GetHeight() ), false );
if (!bModified)
pDoc->getIDocumentState().ResetModified();
}
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index d0b8975ebda4..c8f6deeffb95 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -875,8 +875,8 @@ void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
if ( rOld.GetWidth() && rOld.GetHeight() )
{
- boost::rational<long> aScaleX( rOld.GetWidth(), rNew.GetWidth() );
- boost::rational<long> aScaleY( rOld.GetHeight(), rOld.GetHeight() );
+ Fraction aScaleX( rOld.GetWidth(), rNew.GetWidth() );
+ Fraction aScaleY( rOld.GetHeight(), rOld.GetHeight() );
aURL.GetMap()->Scale( aScaleX, aScaleY );
SwFrmFmt *pFmt = GetFmt();
pFmt->LockModify();
@@ -1002,8 +1002,8 @@ void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
rSz.GetWidth() != Frm().Width() )
{
SwFmtURL aURL( GetFmt()->GetURL() );
- boost::rational<long> aScaleX( Frm().Width(), rSz.GetWidth() );
- boost::rational<long> aScaleY( Frm().Height(), rSz.GetHeight() );
+ Fraction aScaleX( Frm().Width(), rSz.GetWidth() );
+ Fraction aScaleY( Frm().Height(), rSz.GetHeight() );
aURL.GetMap()->Scale( aScaleX, aScaleY );
SwFrmFmt *pFmt = GetFmt();
pFmt->LockModify();
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index bbb2cda42a65..57cbeb7753ac 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -355,8 +355,8 @@ void SwCalcPixStatics( OutputDevice *pOut )
nMinDistPixelH = nPixelSzH * 2 + 1;
const MapMode &rMap = pOut->GetMapMode();
- aScaleX = boost::rational_cast<double>(rMap.GetScaleX());
- aScaleY = boost::rational_cast<double>(rMap.GetScaleY());
+ aScaleX = rMap.GetScaleX();
+ aScaleY = rMap.GetScaleY();
}
/**
@@ -2960,17 +2960,17 @@ void SwTabFrmPainter::Insert( const SwFrm& rFrm, const SvxBoxItem& rBoxItem )
SwViewShell* pViewShell = mrTabFrm.getRootFrm()->GetCurrShell();
OutputDevice* pOutDev = pViewShell->GetOut();
const MapMode& rMapMode = pOutDev->GetMapMode();
- const boost::rational<long>& rFracX = rMapMode.GetScaleX();
- const boost::rational<long>& rFracY = rMapMode.GetScaleY();
+ const Fraction& rFracX = rMapMode.GetScaleX();
+ const Fraction& rFracY = rMapMode.GetScaleY();
svx::frame::Style aL(rBoxItem.GetLeft());
- aL.SetPatternScale(boost::rational_cast<double>(rFracY));
+ aL.SetPatternScale(rFracY);
svx::frame::Style aR(rBoxItem.GetRight());
- aR.SetPatternScale(boost::rational_cast<double>(rFracY));
+ aR.SetPatternScale(rFracY);
svx::frame::Style aT(rBoxItem.GetTop());
- aT.SetPatternScale(boost::rational_cast<double>(rFracX));
+ aT.SetPatternScale(rFracX);
svx::frame::Style aB(rBoxItem.GetBottom());
- aB.SetPatternScale(boost::rational_cast<double>(rFracX));
+ aB.SetPatternScale(rFracX);
aR.MirrorSelf();
aB.MirrorSelf();
@@ -5576,7 +5576,8 @@ void SwFtnContFrm::PaintLine( const SwRect& rRect,
SWRECTFN( this )
SwTwips nPrtWidth = (Prt().*fnRect->fnGetWidth)();
- const SwTwips nWidth = boost::rational_cast<long>(long(nPrtWidth) * rInf.GetWidth());
+ Fraction aFract( nPrtWidth, 1 );
+ const SwTwips nWidth = (long)(aFract *= rInf.GetWidth());
SwTwips nX = (this->*fnRect->fnGetPrtLeft)();
switch ( rInf.GetAdj() )
diff --git a/sw/source/core/text/porlay.hxx b/sw/source/core/text/porlay.hxx
index 1213a06b0f23..3784cdaad445 100644
--- a/sw/source/core/text/porlay.hxx
+++ b/sw/source/core/text/porlay.hxx
@@ -19,7 +19,7 @@
#ifndef INCLUDED_SW_SOURCE_CORE_TEXT_PORLAY_HXX
#define INCLUDED_SW_SOURCE_CORE_TEXT_PORLAY_HXX
-#include <tools/rational.hxx>
+#include <tools/fract.hxx>
#include <scriptinfo.hxx>
#include "swrect.hxx"
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index c7216d1e190c..76d35001c166 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -467,10 +467,12 @@ void SwFntObj::CreateScrFont( const SwViewShell& rSh, const OutputDevice& rOut )
// one in the ViewOptions, this Font must not be cached,
// hence set zoom factor to an invalid value
long nTmp;
- if( pOut->GetMapMode().GetScaleX() == pOut->GetMapMode().GetScaleY() )
+ if( pOut->GetMapMode().GetScaleX().IsValid() &&
+ pOut->GetMapMode().GetScaleY().IsValid() &&
+ pOut->GetMapMode().GetScaleX() == pOut->GetMapMode().GetScaleY() )
{
- nTmp = ( 100 * pOut->GetMapMode().GetScaleX().numerator() ) /
- pOut->GetMapMode().GetScaleX().denominator();
+ nTmp = ( 100 * pOut->GetMapMode().GetScaleX().GetNumerator() ) /
+ pOut->GetMapMode().GetScaleX().GetDenominator();
}
else
nTmp = 0;
@@ -1131,7 +1133,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
if ( bDirectPrint )
{
- const boost::rational<long> aTmp( 1, 1 );
+ const Fraction aTmp( 1, 1 );
bool bStretch = rInf.GetWidth() && ( rInf.GetLen() > 1 ) && bPrt
&& ( aTmp != rInf.GetOut().GetMapMode().GetScaleX() );
diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx
index 4f2307c6e4c7..3e8004ab1776 100644
--- a/sw/source/core/view/pagepreviewlayout.cxx
+++ b/sw/source/core/view/pagepreviewlayout.cxx
@@ -215,17 +215,17 @@ bool SwPagePreviewLayout::Init( const sal_uInt16 _nCols,
// calculate scaling
MapMode aMapMode( MAP_TWIP );
Size aWinSize = mrParentViewShell.GetOut()->PixelToLogic( _rPxWinSize, aMapMode );
- boost::rational<long> aXScale( aWinSize.Width(), mnPreviewLayoutWidth );
- boost::rational<long> aYScale( aWinSize.Height(), mnPreviewLayoutHeight );
+ Fraction aXScale( aWinSize.Width(), mnPreviewLayoutWidth );
+ Fraction aYScale( aWinSize.Height(), mnPreviewLayoutHeight );
if( aXScale < aYScale )
aYScale = aXScale;
{
// adjust scaling for Drawing layer.
- aYScale *= boost::rational<long>( 1000, 1 );
- long nNewNuminator = boost::rational_cast<long>(aYScale);
+ aYScale *= Fraction( 1000, 1 );
+ long nNewNuminator = aYScale.operator long();
if( nNewNuminator < 1 )
nNewNuminator = 1;
- aYScale = boost::rational<long>( nNewNuminator, 1000 );
+ aYScale = Fraction( nNewNuminator, 1000 );
// propagate scaling as zoom percentage to view options for font cache
_ApplyNewZoomAtViewShell( static_cast<sal_uInt8>(nNewNuminator/10) );
}
@@ -740,8 +740,8 @@ bool SwPagePreviewLayout::SetBookPreviewMode( const bool _bEnableBookPreview,
OD 12.12.2002 #103492#
*/
Point SwPagePreviewLayout::GetPreviewStartPosForNewScale(
- const boost::rational<long>& _aNewScale,
- const boost::rational<long>& _aOldScale,
+ const Fraction& _aNewScale,
+ const Fraction& _aOldScale,
const Size& _aNewWinSize ) const
{
Point aNewPaintStartPos = maPaintedPreviewDocRect.TopLeft();
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index 68725dbbda18..ed381b74d6a9 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -70,8 +70,8 @@ void SwViewImp::Init( const SwViewOption *pNewOpt )
( rSz.Width() ? rSz.Width() /std::max(short(1),pNewOpt->GetDivisionX()):0,
rSz.Height()? rSz.Height()/std::max(short(1),pNewOpt->GetDivisionY()):0);
pDrawView->SetGridFine( aFSize );
- boost::rational<long> aSnGrWdtX(rSz.Width(), pNewOpt->GetDivisionX() + 1);
- boost::rational<long> aSnGrWdtY(rSz.Height(), pNewOpt->GetDivisionY() + 1);
+ Fraction aSnGrWdtX(rSz.Width(), pNewOpt->GetDivisionX() + 1);
+ Fraction aSnGrWdtY(rSz.Height(), pNewOpt->GetDivisionY() + 1);
pDrawView->SetSnapGridWidth( aSnGrWdtX, aSnGrWdtY );
if ( pRoot->Frm().HasArea() )
@@ -432,7 +432,7 @@ void SwViewImp::_InvalidateAccessibleParaAttrs( const SwTxtFrm& rTxtFrm )
// OD 15.01.2003 #103492# - method signature change due to new page preview functionality
void SwViewImp::UpdateAccessiblePreview( const std::vector<PreviewPage*>& _rPreviewPages,
- const boost::rational<long>& _rScale,
+ const Fraction& _rScale,
const SwPageFrm* _pSelectedPageFrm,
const Size& _rPreviewWinSize )
{
diff --git a/sw/source/core/view/viewpg.cxx b/sw/source/core/view/viewpg.cxx
index 2e086c4ede71..601c710b54c1 100644
--- a/sw/source/core/view/viewpg.cxx
+++ b/sw/source/core/view/viewpg.cxx
@@ -175,20 +175,20 @@ void SwViewShell::PrintProspect(
// set the MapMode
aMapMode.SetOrigin( Point() );
{
- boost::rational<long> aScX( aPrtSize.Width(), nMaxColSz );
- boost::rational<long> aScY( aPrtSize.Height(), nMaxRowSz );
+ Fraction aScX( aPrtSize.Width(), nMaxColSz );
+ Fraction aScY( aPrtSize.Height(), nMaxRowSz );
if( aScX < aScY )
aScY = aScX;
{
// Round percentages for Drawings so that these can paint their objects properly
- aScY *= boost::rational<long>( 1000, 1 );
- long nTmp = boost::rational_cast<long>(aScY);
+ aScY *= Fraction( 1000, 1 );
+ long nTmp = (long)aScY;
if( 1 < nTmp )
--nTmp;
else
nTmp = 1;
- aScY = boost::rational<long>( nTmp, 1000 );
+ aScY = Fraction( nTmp, 1000 );
}
aMapMode.SetScaleY( aScY );
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 561bcd9027c9..53bf408b040c 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1775,8 +1775,8 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex
// Scaling. Must convert from pixels to twips. We know
// that VirtualDevises use a DPI of 96.
- boost::rational<long> scaleX = boost::rational<long>(contextWidth, 96) * boost::rational<long>(1440L) / boost::rational<long>(tileWidth);
- boost::rational<long> scaleY = boost::rational<long>(contextHeight, 96) * boost::rational<long>(1440L) / boost::rational<long>(tileHeight);
+ Fraction scaleX = Fraction(contextWidth, 96) * Fraction(1440L) / Fraction(tileWidth);
+ Fraction scaleY = Fraction(contextHeight, 96) * Fraction(1440L) / Fraction(tileHeight);
aMapMode.SetScaleX(scaleX);
aMapMode.SetScaleY(scaleY);
rDevice.SetMapMode(aMapMode);
@@ -2131,7 +2131,7 @@ void SwViewShell::ImplApplyViewOptions( const SwViewOption &rOpt )
if( mpOpt->GetZoom() != rOpt.GetZoom() && !IsPreview() )
{
MapMode aMode( pMyWin->GetMapMode() );
- boost::rational<long> aNewFactor( rOpt.GetZoom(), 100 );
+ Fraction aNewFactor( rOpt.GetZoom(), 100 );
aMode.SetScaleX( aNewFactor );
aMode.SetScaleY( aNewFactor );
pMyWin->SetMapMode( aMode );
@@ -2172,8 +2172,8 @@ void SwViewShell::ImplApplyViewOptions( const SwViewOption &rOpt )
( rSz.Width() ? rSz.Width() / (rOpt.GetDivisionX()+1) : 0,
rSz.Height()? rSz.Height()/ (rOpt.GetDivisionY()+1) : 0);
pDView->SetGridFine( aFSize );
- boost::rational<long> aSnGrWdtX(rSz.Width(), rOpt.GetDivisionX() + 1);
- boost::rational<long> aSnGrWdtY(rSz.Height(), rOpt.GetDivisionY() + 1);
+ Fraction aSnGrWdtX(rSz.Width(), rOpt.GetDivisionX() + 1);
+ Fraction aSnGrWdtY(rSz.Height(), rOpt.GetDivisionY() + 1);
pDView->SetSnapGridWidth( aSnGrWdtX, aSnGrWdtY );
// set handle size to 9 pixels, always
diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx
index 4b38f181d0b8..231abcdcb7ec 100644
--- a/sw/source/core/view/vnew.cxx
+++ b/sw/source/core/view/vnew.cxx
@@ -65,7 +65,7 @@ void SwViewShell::Init( const SwViewOption *pNewOpt )
if( GetWin() && 100 != mpOpt->GetZoom() )
{
MapMode aMode( mpWin->GetMapMode() );
- const boost::rational<long> aNewFactor( mpOpt->GetZoom(), 100 );
+ const Fraction aNewFactor( mpOpt->GetZoom(), 100 );
aMode.SetScaleX( aNewFactor );
aMode.SetScaleY( aNewFactor );
mpWin->SetMapMode( aMode );
diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx
index 17e207eed8b5..6a0d313b6316 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -1120,8 +1120,8 @@ OUString lclWriteOutImap(SwHTMLWriter& rHTMLWrt, const SfxItemSet& rItemSet, con
} while (bFound);
bool bScale = false;
- boost::rational<long> aScaleX(1, 1);
- boost::rational<long> aScaleY(1, 1);
+ Fraction aScaleX(1, 1);
+ Fraction aScaleY(1, 1);
const SwFmtFrmSize& rFrmSize = rFrmFmt.GetFrmSize();
const SvxBoxItem& rBox = rFrmFmt.GetBox();
@@ -1137,7 +1137,7 @@ OUString lclWriteOutImap(SwHTMLWriter& rHTMLWrt, const SfxItemSet& rItemSet, con
if (rRealSize.Width() != nWidth)
{
- aScaleX = boost::rational<long>(nWidth, rRealSize.Width());
+ aScaleX = Fraction(nWidth, rRealSize.Width());
bScale = true;
}
}
@@ -1154,7 +1154,7 @@ OUString lclWriteOutImap(SwHTMLWriter& rHTMLWrt, const SfxItemSet& rItemSet, con
if (rRealSize.Height() != nHeight)
{
- aScaleY = boost::rational<long>(nHeight, rRealSize.Height());
+ aScaleY = Fraction(nHeight, rRealSize.Height());
bScale = true;
}
}
diff --git a/sw/source/filter/writer/wrtswtbl.cxx b/sw/source/filter/writer/wrtswtbl.cxx
index 3285e1379636..cfa1781afff8 100644
--- a/sw/source/filter/writer/wrtswtbl.cxx
+++ b/sw/source/filter/writer/wrtswtbl.cxx
@@ -20,7 +20,7 @@
#include <hintids.hxx>
#include <editeng/boxitem.hxx>
#include <editeng/brushitem.hxx>
-#include <tools/rational.hxx>
+#include <tools/fract.hxx>
#include <wrtswtbl.hxx>
#include <swtable.hxx>
#include <frmfmt.hxx>
@@ -344,7 +344,8 @@ sal_uInt16 SwWriteTable::GetRelWidth( sal_uInt16 nCol, sal_uInt16 nColSpan ) con
{
long nWidth = GetRawWidth( nCol, nColSpan );
- return (sal_uInt16) boost::rational_cast<long>(boost::rational<long>(nWidth * 256 + GetBaseWidth() / 2, GetBaseWidth()));
+ return (sal_uInt16)(long)Fraction( nWidth*256 + GetBaseWidth()/2,
+ GetBaseWidth() );
}
sal_uInt16 SwWriteTable::GetPrcWidth( sal_uInt16 nCol, sal_uInt16 nColSpan ) const
@@ -353,7 +354,8 @@ sal_uInt16 SwWriteTable::GetPrcWidth( sal_uInt16 nCol, sal_uInt16 nColSpan ) con
// Looks funny, but is nothing more than
// [(100 * nWidth) + .5] without rounding errors
- return (sal_uInt16) boost::rational_cast<long>(boost::rational<long>(nWidth * 100 + GetBaseWidth() / 2, GetBaseWidth()));
+ return (sal_uInt16)(long)Fraction( nWidth*100 + GetBaseWidth()/2,
+ GetBaseWidth() );
}
long SwWriteTable::GetAbsHeight(long nRawHeight, size_t const nRow,
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 9b0a164a7e69..be93040e6e95 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6723,7 +6723,7 @@ void DocxAttributeOutput::FootnotesEndnotes( bool bFootnotes )
{
const SwPageFtnInfo& rFtnInfo = m_rExport.pDoc->GetPageDesc(0).GetFtnInfo();
// Request a separator only in case the width is larger than zero.
- bSeparator = boost::rational_cast<double>(rFtnInfo.GetWidth()) > 0;
+ bSeparator = double(rFtnInfo.GetWidth()) > 0;
}
if (bSeparator)
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index c776688fdce7..e0bebb95255f 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -396,7 +396,7 @@ void RtfExport::WriteFootnoteSettings()
{
const SwPageFtnInfo& rFtnInfo = pDoc->GetPageDesc(0).GetFtnInfo();
// Request a separator only in case the width is larger than zero.
- bool bSeparator = boost::rational_cast<double>(rFtnInfo.GetWidth()) > 0;
+ bool bSeparator = double(rFtnInfo.GetWidth()) > 0;
Strm().WriteChar('{').WriteCharPtr(OOO_STRING_SVTOOLS_RTF_IGNORE).WriteCharPtr(OOO_STRING_SVTOOLS_RTF_FTNSEP);
if (bSeparator)
diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx
index aa0362d2191a..0fc558f546b1 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -666,9 +666,9 @@ namespace sw
{
Polygon aPoly(PolygonFromPolyPolygon(rPolyPoly));
const Size &rOrigSize = pNd->GetGraphic().GetPrefSize();
- boost::rational<long> aMapPolyX(ww::nWrap100Percent, rOrigSize.Width());
- boost::rational<long> aMapPolyY(ww::nWrap100Percent, rOrigSize.Height());
- aPoly.Scale(boost::rational_cast<double>(aMapPolyX), boost::rational_cast<double>(aMapPolyY));
+ Fraction aMapPolyX(ww::nWrap100Percent, rOrigSize.Width());
+ Fraction aMapPolyY(ww::nWrap100Percent, rOrigSize.Height());
+ aPoly.Scale(aMapPolyX, aMapPolyY);
/*
a) stretch right bound by 15twips
@@ -678,15 +678,15 @@ namespace sw
See the import for details
*/
const Size &rSize = pNd->GetTwipSize();
- boost::rational<long> aMoveHack(ww::nWrap100Percent, rSize.Width());
- aMoveHack *= boost::rational<long>(15, 1);
- long nMove(boost::rational_cast<long>(aMoveHack));
+ Fraction aMoveHack(ww::nWrap100Percent, rSize.Width());
+ aMoveHack *= Fraction(15, 1);
+ long nMove(aMoveHack);
- boost::rational<long> aHackX(ww::nWrap100Percent + nMove,
+ Fraction aHackX(ww::nWrap100Percent + nMove,
ww::nWrap100Percent);
- boost::rational<long> aHackY(ww::nWrap100Percent - nMove,
+ Fraction aHackY(ww::nWrap100Percent - nMove,
ww::nWrap100Percent);
- aPoly.Scale(boost::rational_cast<double>(aHackX), boost::rational_cast<double>(aHackY));
+ aPoly.Scale(aHackX, aHackY);
aPoly.Move(-nMove, 0);
return aPoly;
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index a259e9130d57..104cdbeddb01 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -2155,12 +2155,12 @@ void SwBasicEscherEx::Init()
// MS-DFF-Properties sind grossteils in EMU (English Metric Units) angegeben
// 1mm=36000emu, 1twip=635emu
- boost::rational<long> aFact(360, 1);
+ Fraction aFact(360, 1);
aFact /= GetMapFactor(MAP_100TH_MM, eMap).X();
// create little values
- aFact = boost::rational<long>(aFact.numerator(), aFact.denominator());
- mnEmuMul = aFact.numerator();
- mnEmuDiv = aFact.denominator();
+ aFact = Fraction(aFact.GetNumerator(), aFact.GetDenominator());
+ mnEmuMul = aFact.GetNumerator();
+ mnEmuDiv = aFact.GetDenominator();
SetHellLayerId(rWrt.pDoc->getIDocumentDrawModelAccess().GetHellId());
}
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 02abc6c6f2d1..56324f571182 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -1951,20 +1951,20 @@ void SwWW8ImplReader::MapWrapIntoFlyFmt(SvxMSDffImportRec* pRecord,
b) stretch bottom bound to where I think it should have been
in the first place
*/
- boost::rational<long> aMoveHack(ww::nWrap100Percent, rSize.Width());
- aMoveHack *= boost::rational<long>(15, 1);
- long nMove(boost::rational_cast<long>(aMoveHack));
+ Fraction aMoveHack(ww::nWrap100Percent, rSize.Width());
+ aMoveHack *= Fraction(15, 1);
+ long nMove(aMoveHack);
aPoly.Move(nMove, 0);
- boost::rational<long> aHackX(ww::nWrap100Percent, ww::nWrap100Percent + nMove);
- boost::rational<long> aHackY(ww::nWrap100Percent, ww::nWrap100Percent - nMove);
- aPoly.Scale(boost::rational_cast<double>(aHackX), boost::rational_cast<double>(aHackY));
+ Fraction aHackX(ww::nWrap100Percent, ww::nWrap100Percent + nMove);
+ Fraction aHackY(ww::nWrap100Percent, ww::nWrap100Percent - nMove);
+ aPoly.Scale(aHackX, aHackY);
// Turn polygon back into units that match the graphic's
const Size &rOrigSize = pNd->GetGraphic().GetPrefSize();
- boost::rational<long> aMapPolyX(rOrigSize.Width(), ww::nWrap100Percent);
- boost::rational<long> aMapPolyY(rOrigSize.Height(), ww::nWrap100Percent);
- aPoly.Scale(boost::rational_cast<double>(aMapPolyX), boost::rational_cast<double>(aMapPolyY));
+ Fraction aMapPolyX(rOrigSize.Width(), ww::nWrap100Percent);
+ Fraction aMapPolyY(rOrigSize.Height(), ww::nWrap100Percent);
+ aPoly.Scale(aMapPolyX, aMapPolyY);
// #i47277# - contour is already in unit of the
// graphic preferred unit. Thus, call method <SetContour(..)>
diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx
index b7dcac3b7831..b09fec67d5bf 100644
--- a/sw/source/filter/ww8/ww8par4.cxx
+++ b/sw/source/filter/ww8/ww8par4.cxx
@@ -170,8 +170,8 @@ static bool SwWw6ReadMetaStream(GDIMetaFile& rWMF, OLE_MFP* pMfp,
// neue Groesse am MetaFile setzen
Size aOldSiz( rWMF.GetPrefSize() );
Size aNewSiz( pMfp->xExt, pMfp->yExt );
- boost::rational<long> aFracX( aNewSiz.Width(), aOldSiz.Width() );
- boost::rational<long> aFracY( aNewSiz.Height(), aOldSiz.Height() );
+ Fraction aFracX( aNewSiz.Width(), aOldSiz.Width() );
+ Fraction aFracY( aNewSiz.Height(), aOldSiz.Height() );
rWMF.Scale( aFracX, aFracY );
rWMF.SetPrefSize( aNewSiz );
@@ -326,8 +326,8 @@ bool SwWW8ImplReader::ImportOleWMF(SvStorageRef xSrc1,GDIMetaFile &rWMF,
aFinalSize = OutputDevice::LogicToLogic(
aFinalSize, MAP_TWIP, rWMF.GetPrefMapMode() );
aOrigSize = rWMF.GetPrefSize();
- boost::rational<long> aScaleX(aFinalSize.Width(),aOrigSize.Width());
- boost::rational<long> aScaleY(aFinalSize.Height(),aOrigSize.Height());
+ Fraction aScaleX(aFinalSize.Width(),aOrigSize.Width());
+ Fraction aScaleY(aFinalSize.Height(),aOrigSize.Height());
rWMF.Scale( aScaleX, aScaleY );
bOk = true;
}
diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx
index 0c5d52970705..e81e2c34d6f4 100644
--- a/sw/source/ui/misc/pgfnote.cxx
+++ b/sw/source/ui/misc/pgfnote.cxx
@@ -243,9 +243,9 @@ void SwFootNotePage::Reset(const SfxItemSet *rSet)
m_pLinePosBox->SelectEntryPos( static_cast< sal_Int32 >(pFtnInfo->GetAdj()) );
// width
- boost::rational<long> aTmp( 100, 1 );
+ Fraction aTmp( 100, 1 );
aTmp *= pFtnInfo->GetWidth();
- m_pLineLengthEdit->SetValue( boost::rational_cast<long>(aTmp) );
+ m_pLineLengthEdit->SetValue( static_cast<long>(aTmp) );
// gap footnote area
m_pDistEdit->SetValue(m_pDistEdit->Normalize(pFtnInfo->GetTopDist()),FUNIT_TWIP);
@@ -292,7 +292,7 @@ bool SwFootNotePage::FillItemSet(SfxItemSet *rSet)
rFtnInfo.SetAdj((SwFtnAdj)m_pLinePosBox->GetSelectEntryPos());
// Breite
- rFtnInfo.SetWidth(boost::rational<long>( static_cast< long >(m_pLineLengthEdit->GetValue()), 100));
+ rFtnInfo.SetWidth(Fraction( static_cast< long >(m_pLineLengthEdit->GetValue()), 100));
const SfxPoolItem* pOldItem;
if(0 == (pOldItem = GetOldItem( *rSet, FN_PARAM_FTN_INFO )) ||
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 24880c94b6b5..c5e18c9b9565 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -1904,32 +1904,32 @@ void SwPostItMgr::Rescale()
sal_Int32 SwPostItMgr::GetInitialAnchorDistance() const
{
- const boost::rational<long>& f( mpEditWin->GetMapMode().GetScaleY() );
- return POSTIT_INITIAL_ANCHOR_DISTANCE * f.numerator() / f.denominator();
+ const Fraction& f( mpEditWin->GetMapMode().GetScaleY() );
+ return POSTIT_INITIAL_ANCHOR_DISTANCE * f.GetNumerator() / f.GetDenominator();
}
sal_Int32 SwPostItMgr::GetSpaceBetween() const
{
- const boost::rational<long>& f( mpEditWin->GetMapMode().GetScaleY() );
- return ( POSTIT_SPACE_BETWEEN ) * f.numerator() / f.denominator();
+ const Fraction& f( mpEditWin->GetMapMode().GetScaleY() );
+ return ( POSTIT_SPACE_BETWEEN ) * f.GetNumerator() / f.GetDenominator();
}
sal_Int32 SwPostItMgr::GetScrollSize() const
{
- const boost::rational<long>& f( mpEditWin->GetMapMode().GetScaleY() );
- return ( POSTIT_SPACE_BETWEEN + POSTIT_MINIMUMSIZE_WITH_META ) * f.numerator() / f.denominator();
+ const Fraction& f( mpEditWin->GetMapMode().GetScaleY() );
+ return ( POSTIT_SPACE_BETWEEN + POSTIT_MINIMUMSIZE_WITH_META ) * f.GetNumerator() / f.GetDenominator();
}
sal_Int32 SwPostItMgr::GetMinimumSizeWithMeta() const
{
- const boost::rational<long>& f( mpEditWin->GetMapMode().GetScaleY() );
- return POSTIT_MINIMUMSIZE_WITH_META * f.numerator() / f.denominator();
+ const Fraction& f( mpEditWin->GetMapMode().GetScaleY() );
+ return POSTIT_MINIMUMSIZE_WITH_META * f.GetNumerator() / f.GetDenominator();
}
sal_Int32 SwPostItMgr::GetSidebarScrollerHeight() const
{
- const boost::rational<long>& f( mpEditWin->GetMapMode().GetScaleY() );
- return POSTIT_SCROLL_SIDEBAR_HEIGHT * f.numerator() / f.denominator();
+ const Fraction& f( mpEditWin->GetMapMode().GetScaleY() );
+ return POSTIT_SCROLL_SIDEBAR_HEIGHT * f.GetNumerator() / f.GetDenominator();
}
void SwPostItMgr::SetSpellChecking()
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index e97589c76384..84d9974a378f 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -508,7 +508,7 @@ void SwSidebarWin::Rescale()
{
vcl::Font aFont( mpMetadataAuthor->GetSettings().GetStyleSettings().GetFieldFont() );
sal_Int32 nHeight = aFont.GetHeight();
- nHeight = nHeight * aMode.GetScaleY().numerator() / aMode.GetScaleY().denominator();
+ nHeight = nHeight * aMode.GetScaleY().GetNumerator() / aMode.GetScaleY().GetDenominator();
aFont.SetHeight( nHeight );
mpMetadataAuthor->SetControlFont( aFont );
}
@@ -516,7 +516,7 @@ void SwSidebarWin::Rescale()
{
vcl::Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetFieldFont() );
sal_Int32 nHeight = aFont.GetHeight();
- nHeight = nHeight * aMode.GetScaleY().numerator() / aMode.GetScaleY().denominator();
+ nHeight = nHeight * aMode.GetScaleY().GetNumerator() / aMode.GetScaleY().GetDenominator();
aFont.SetHeight( nHeight );
mpMetadataDate->SetControlFont( aFont );
}
@@ -780,26 +780,26 @@ void SwSidebarWin::DoResize()
mpVScrollbar->SetRange( Range(0, mpOutliner->GetTextHeight()));
//calculate rects for meta- button
- const boost::rational<long>& fx( GetMapMode().GetScaleX() );
- const boost::rational<long>& fy( GetMapMode().GetScaleY() );
+ const Fraction& fx( GetMapMode().GetScaleX() );
+ const Fraction& fy( GetMapMode().GetScaleY() );
const Point aPos( mpMetadataAuthor->GetPosPixel());
Rectangle aRectMetaButton;
if (IsPreview())
{
aRectMetaButton = PixelToLogic(
- Rectangle( Point( aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH*4+10)*fx.numerator()/fx.denominator(),
- aPos.Y()+5*fy.numerator()/fy.denominator() ),
- Size( METABUTTON_WIDTH*4*fx.numerator()/fx.denominator(),
- METABUTTON_HEIGHT*fy.numerator()/fy.denominator() ) ) );
+ Rectangle( Point( aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH*4+10)*fx.GetNumerator()/fx.GetDenominator(),
+ aPos.Y()+5*fy.GetNumerator()/fy.GetDenominator() ),
+ Size( METABUTTON_WIDTH*4*fx.GetNumerator()/fx.GetDenominator(),
+ METABUTTON_HEIGHT*fy.GetNumerator()/fy.GetDenominator() ) ) );
}
else
{
aRectMetaButton = PixelToLogic(
- Rectangle( Point( aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH+10)*fx.numerator()/fx.denominator(),
- aPos.Y()+5*fy.numerator()/fy.denominator() ),
- Size( METABUTTON_WIDTH*fx.numerator()/fx.denominator(),
- METABUTTON_HEIGHT*fy.numerator()/fy.denominator() ) ) );
+ Rectangle( Point( aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH+10)*fx.GetNumerator()/fx.GetDenominator(),
+ aPos.Y()+5*fy.GetNumerator()/fy.GetDenominator() ),
+ Size( METABUTTON_WIDTH*fx.GetNumerator()/fx.GetDenominator(),
+ METABUTTON_HEIGHT*fy.GetNumerator()/fy.GetDenominator() ) ) );
}
{
@@ -1208,17 +1208,17 @@ sal_Int32 SwSidebarWin::GetScrollbarWidth()
sal_Int32 SwSidebarWin::GetMetaButtonAreaWidth()
{
- const boost::rational<long>& f( GetMapMode().GetScaleX() );
+ const Fraction& f( GetMapMode().GetScaleX() );
if (IsPreview())
- return 3 * METABUTTON_AREA_WIDTH * f.numerator() / f.denominator();
+ return 3 * METABUTTON_AREA_WIDTH * f.GetNumerator() / f.GetDenominator();
else
- return METABUTTON_AREA_WIDTH * f.numerator() / f.denominator();
+ return METABUTTON_AREA_WIDTH * f.GetNumerator() / f.GetDenominator();
}
sal_Int32 SwSidebarWin::GetMetaHeight()
{
- const boost::rational<long>& f( GetMapMode().GetScaleY() );
- return POSTIT_META_HEIGHT * f.numerator() / f.denominator();
+ const Fraction& f( GetMapMode().GetScaleY() );
+ return POSTIT_META_HEIGHT * f.GetNumerator() / f.GetDenominator();
}
sal_Int32 SwSidebarWin::GetMinimumSizeWithMeta()
@@ -1228,8 +1228,8 @@ sal_Int32 SwSidebarWin::GetMinimumSizeWithMeta()
sal_Int32 SwSidebarWin::GetMinimumSizeWithoutMeta()
{
- const boost::rational<long>& f( GetMapMode().GetScaleY() );
- return POSTIT_MINIMUMSIZE_WITHOUT_META * f.numerator() / f.denominator();
+ const Fraction& f( GetMapMode().GetScaleY() );
+ return POSTIT_MINIMUMSIZE_WITHOUT_META * f.GetNumerator() / f.GetDenominator();
}
void SwSidebarWin::SetSpellChecking()
diff --git a/sw/source/uibase/frmdlg/colex.cxx b/sw/source/uibase/frmdlg/colex.cxx
index ba6af859461a..7732db8b2690 100644
--- a/sw/source/uibase/frmdlg/colex.cxx
+++ b/sw/source/uibase/frmdlg/colex.cxx
@@ -336,7 +336,7 @@ SwColumnOnlyExample::SwColumnOnlyExample(vcl::Window* pParent)
::FitToActualSize(m_aCols, (sal_uInt16)m_aFrmSize.Width());
long nHeight = m_aFrmSize.Height();
- boost::rational<long> aScale( m_aWinSize.Height(), nHeight );
+ Fraction aScale( m_aWinSize.Height(), nHeight );
MapMode aMapMode( GetMapMode() );
aMapMode.SetScaleX( aScale );
aMapMode.SetScaleY( aScale );
diff --git a/sw/source/uibase/inc/pview.hxx b/sw/source/uibase/inc/pview.hxx
index 96eb7760ef9d..162ef375eb3a 100644
--- a/sw/source/uibase/inc/pview.hxx
+++ b/sw/source/uibase/inc/pview.hxx
@@ -48,7 +48,7 @@ class SwPagePreviewWin : public vcl::Window
sal_uInt16 mnSttPage;
sal_uInt8 mnRow, mnCol;
Size maPxWinSize;
- boost::rational<long> maScale;
+ Fraction maScale;
SwPagePreview& mrView;
bool mbCalcScaleForPreviewLayout;
Rectangle maPaintedPreviewDocRect;
diff --git a/sw/source/uibase/inc/view.hxx b/sw/source/uibase/inc/view.hxx
index 64040606ccf7..e624560e071f 100644
--- a/sw/source/uibase/inc/view.hxx
+++ b/sw/source/uibase/inc/view.hxx
@@ -492,7 +492,7 @@ public:
void InsFrmMode(sal_uInt16 nCols);
void SetZoom( SvxZoomType eZoomType, short nFactor = 100, bool bViewOnly = false);
- virtual void SetZoomFactor( const boost::rational<long> &rX, const boost::rational<long> & ) SAL_OVERRIDE;
+ virtual void SetZoomFactor( const Fraction &rX, const Fraction & ) SAL_OVERRIDE;
void SetViewLayout( sal_uInt16 nColumns, bool bBookMode, bool bViewOnly = false );
diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index 912be1e4cedf..476307952304 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -1741,7 +1741,7 @@ void SwPagePreviewWin::AdjustPreviewToNewZoom( const sal_uInt16 _nZoomFactor,
else if ( _nZoomFactor != 0 )
{
// calculate new scaling and set mapping mode appropriately.
- boost::rational<long> aNewScale( _nZoomFactor, 100 );
+ Fraction aNewScale( _nZoomFactor, 100 );
MapMode aNewMapMode = GetMapMode();
aNewMapMode.SetScaleX( aNewScale );
aNewMapMode.SetScaleY( aNewScale );
diff --git a/sw/source/uibase/uiview/swcli.cxx b/sw/source/uibase/uiview/swcli.cxx
index 900bab9db0e7..71b57499ddb2 100644
--- a/sw/source/uibase/uiview/swcli.cxx
+++ b/sw/source/uibase/uiview/swcli.cxx
@@ -67,8 +67,8 @@ void SwOleClient::RequestNewObjectArea( Rectangle& aLogRect )
MapMode aObjectMap( VCLUnoHelper::UnoEmbed2VCLMapUnit( GetObject()->getMapUnit( GetAspect() ) ) );
MapMode aClientMap( GetEditWin()->GetMapMode().GetMapUnit() );
- Size aNewObjSize( boost::rational_cast<long>(aLogRect.GetWidth() / GetScaleWidth()),
- boost::rational_cast<long>(aLogRect.GetHeight() / GetScaleHeight()) );
+ Size aNewObjSize( Fraction( aLogRect.GetWidth() ) / GetScaleWidth(),
+ Fraction( aLogRect.GetHeight() ) / GetScaleHeight() );
// convert to logical coordinates of the embedded object
Size aNewSize = GetEditWin()->LogicToLogic( aNewObjSize, &aClientMap, &aObjectMap );
@@ -141,8 +141,8 @@ void SwOleClient::ViewChanged()
const MapMode aObjMap( VCLUnoHelper::UnoEmbed2VCLMapUnit( GetObject()->getMapUnit( GetAspect() ) ) );
aVisSize = OutputDevice::LogicToLogic( aVisSize, aObjMap, aMyMap );
- aVisSize.Width() = boost::rational_cast<long>(aVisSize.Width() * GetScaleWidth());
- aVisSize.Height()= boost::rational_cast<long>(aVisSize.Height() * GetScaleHeight());
+ aVisSize.Width() = Fraction( aVisSize.Width() ) * GetScaleWidth();
+ aVisSize.Height()= Fraction( aVisSize.Height() ) * GetScaleHeight();
SwRect aRect( Point( LONG_MIN, LONG_MIN ), aVisSize );
rSh.LockView( true ); // Prevent scrolling in the EndAction
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 7be4f15c7efd..64f9b729bdb2 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -892,7 +892,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
StartListening( *pDocSh, true );
// Set Zoom-factor from HRuler
- boost::rational<long> aZoomFract( aUsrPref.GetZoom(), 100 );
+ Fraction aZoomFract( aUsrPref.GetZoom(), 100 );
m_pHRuler->SetZoom( aZoomFract );
m_pVRuler->SetZoom( aZoomFract );
m_pHRuler->SetDoubleClickHdl(LINK( this, SwView, ExecRulerClick ));
diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx
index a8043956e0d3..0a1aba02f4f6 100644
--- a/sw/source/uibase/uiview/viewmdi.cxx
+++ b/sw/source/uibase/uiview/viewmdi.cxx
@@ -192,7 +192,7 @@ void SwView::_SetZoom( const Size &rEditSize, SvxZoomType eZoomType,
m_pWrtShell->ApplyViewOptions( aOpt );
}
- const boost::rational<long> aFrac( nFac, 100 );
+ const Fraction aFrac( nFac, 100 );
m_pVRuler->SetZoom( aFrac );
m_pVRuler->ForceUpdate();
m_pHRuler->SetZoom( aFrac );
diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx
index 1002cdceb769..3528c8315592 100644
--- a/sw/source/uibase/uiview/viewport.cxx
+++ b/sw/source/uibase/uiview/viewport.cxx
@@ -947,8 +947,8 @@ void SwView::InnerResizePixel( const Point &rOfst, const Size &rSize )
aSize.Width() -= (aBorder.Left() + aBorder.Right());
aSize.Height() -= (aBorder.Top() + aBorder.Bottom());
Size aObjSizePixel = GetWindow()->LogicToPixel( aObjSize, MAP_TWIP );
- SfxViewShell::SetZoomFactor( boost::rational<long>( aSize.Width(), aObjSizePixel.Width() ),
- boost::rational<long>( aSize.Height(), aObjSizePixel.Height() ) );
+ SfxViewShell::SetZoomFactor( Fraction( aSize.Width(), aObjSizePixel.Width() ),
+ Fraction( aSize.Height(), aObjSizePixel.Height() ) );
}
m_bInInnerResizePixel = true;
@@ -985,10 +985,12 @@ void SwView::InnerResizePixel( const Point &rOfst, const Size &rSize )
if( m_pHRuler->IsVisible() || m_pVRuler->IsVisible() )
{
- const boost::rational<long>& rFrac = GetEditWin().GetMapMode().GetScaleX();
- long nZoom = rFrac.numerator() * 100L / rFrac.denominator();
+ const Fraction& rFrac = GetEditWin().GetMapMode().GetScaleX();
+ long nZoom = 100;
+ if (rFrac.IsValid())
+ nZoom = rFrac.GetNumerator() * 100L / rFrac.GetDenominator();
- const boost::rational<long> aFrac( nZoom, 100 );
+ const Fraction aFrac( nZoom, 100 );
m_pVRuler->SetZoom( aFrac );
m_pHRuler->SetZoom( aFrac );
InvalidateRulerPos(); // Invalidate content.
@@ -1134,10 +1136,10 @@ void SwView::OuterResizePixel( const Point &rOfst, const Size &rSize )
}
}
-void SwView::SetZoomFactor( const boost::rational<long>& rX, const boost::rational<long>& rY )
+void SwView::SetZoomFactor( const Fraction &rX, const Fraction &rY )
{
- const boost::rational<long>&rFrac = rX < rY ? rX : rY;
- SetZoom( SVX_ZOOM_PERCENT, (short) boost::rational_cast<long>(rFrac * 100) );
+ const Fraction &rFrac = rX < rY ? rX : rY;
+ SetZoom( SVX_ZOOM_PERCENT, (short) long(rFrac * Fraction( 100, 1 )) );
// To minimize rounding errors we also adjust the odd values
// of the base class if necessary.
diff --git a/sw/source/uibase/utlui/uiitems.cxx b/sw/source/uibase/utlui/uiitems.cxx
index a15c23091ceb..2bd0c8b911b6 100644
--- a/sw/source/uibase/utlui/uiitems.cxx
+++ b/sw/source/uibase/utlui/uiitems.cxx
@@ -88,9 +88,9 @@ bool SwPageFtnInfoItem::QueryValue( Any& rVal, sal_uInt8 nMemberId ) const
case MID_LINE_COLOR : rVal <<= (sal_Int32)aFtnInfo.GetLineColor().GetColor();break;
case MID_LINE_RELWIDTH :
{
- boost::rational<long> aTmp( 100, 1 );
+ Fraction aTmp( 100, 1 );
aTmp *= aFtnInfo.GetWidth();
- rVal <<= (sal_Int8)boost::rational_cast<long>(aTmp);
+ rVal <<= (sal_Int8)(long)aTmp;
}
break;
case MID_LINE_ADJUST : rVal <<= (sal_Int16)aFtnInfo.GetAdj();break;//text::HorizontalAdjust
@@ -158,7 +158,7 @@ bool SwPageFtnInfoItem::PutValue(const Any& rVal, sal_uInt8 nMemberId)
if(nSet < 0)
bRet = false;
else
- aFtnInfo.SetWidth(boost::rational<long>(nSet, 100));
+ aFtnInfo.SetWidth(Fraction(nSet, 100));
}
break;
case MID_LINE_ADJUST :
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 9e8dfff229eb..fc3108076921 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -743,8 +743,8 @@ void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
Size _aVisArea( aSize.Width, aSize.Height );
- boost::rational<long> aScaleWidth( 1, 1 );
- boost::rational<long> aScaleHeight( 1, 1 );
+ Fraction aScaleWidth( 1, 1 );
+ Fraction aScaleHeight( 1, 1 );
bool bUseObjectSize = false;
@@ -777,8 +777,8 @@ void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
}
else
{
- aScaleWidth = boost::rational<long>( aObjArea.Width(), _aVisArea.Width() );
- aScaleHeight = boost::rational<long>( aObjArea.Height(), _aVisArea.Height());
+ aScaleWidth = Fraction( aObjArea.Width(), _aVisArea.Width() );
+ aScaleHeight = Fraction( aObjArea.Height(), _aVisArea.Height());
}
}
}
@@ -815,8 +815,8 @@ void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
}
else
{
- aArea.Width ( boost::rational_cast<long>(aArea.Width() / pCli->GetScaleWidth()) );
- aArea.Height( boost::rational_cast<long>(aArea.Height() / pCli->GetScaleHeight()) );
+ aArea.Width ( Fraction( aArea.Width() ) / pCli->GetScaleWidth() );
+ aArea.Height( Fraction( aArea.Height() ) / pCli->GetScaleHeight());
}
pCli->SetObjAreaAndScale( aArea.SVRect(), aScaleWidth, aScaleHeight );