summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2014-10-23 17:41:47 +0200
committerJan Holesovsky <kendy@collabora.com>2014-10-23 18:34:39 +0200
commit31af61ea091cc895b893c849f2130aa35792b7db (patch)
tree6c7b63c5b538034bd5d356c5a8667b7e95d59b9c /filter
parente92c0d6f9b7a6251e00dc55219a203a7e53c96e2 (diff)
Fraction: Revert "fdo#81356: convert Fraction to boost::rational<long> - wip"
This reverts commit 47a2d7642d249d70b5da0c330a73f3a0032e4bba. Conflicts: cui/source/tabpages/transfrm.cxx svx/source/svdraw/svdedtv1.cxx svx/source/svdraw/svdibrow.cxx sw/source/filter/ww1/w1filter.cxx tools/source/generic/rational.cxx Change-Id: I4849916f5f277a4afef0e279b0135c76b36b9d15
Diffstat (limited to 'filter')
-rw-r--r--filter/source/graphicfilter/eos2met/eos2met.cxx36
-rw-r--r--filter/source/graphicfilter/epict/epict.cxx38
-rw-r--r--filter/source/graphicfilter/eps/eps.cxx4
-rw-r--r--filter/source/graphicfilter/ios2met/ios2met.cxx4
-rw-r--r--filter/source/graphicfilter/ipict/ipict.cxx6
-rw-r--r--filter/source/graphicfilter/ipsd/ipsd.cxx4
-rw-r--r--filter/source/graphicfilter/itiff/itiff.cxx2
-rw-r--r--filter/source/msfilter/eschesdo.cxx2
-rw-r--r--filter/source/msfilter/msdffimp.cxx44
-rw-r--r--filter/source/msfilter/svdfppt.cxx6
-rw-r--r--filter/source/pdf/pdfexport.cxx1
-rw-r--r--filter/source/svg/svgwriter.cxx8
12 files changed, 78 insertions, 77 deletions
diff --git a/filter/source/graphicfilter/eos2met/eos2met.cxx b/filter/source/graphicfilter/eos2met/eos2met.cxx
index 173d2317321c..aa64100a7841 100644
--- a/filter/source/graphicfilter/eos2met/eos2met.cxx
+++ b/filter/source/graphicfilter/eos2met/eos2met.cxx
@@ -2168,50 +2168,50 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF )
if ( pA->GetMapMode().GetMapUnit() == MAP_RELATIVE )
{
MapMode aMM = pA->GetMapMode();
- boost::rational<long> aScaleX = aMM.GetScaleX();
- boost::rational<long> aScaleY = aMM.GetScaleY();
+ Fraction aScaleX = aMM.GetScaleX();
+ Fraction aScaleY = aMM.GetScaleY();
Point aOrigin = aPictureMapMode.GetOrigin();
BigInt aX( aOrigin.X() );
- aX *= BigInt( aScaleX.denominator() );
+ aX *= BigInt( aScaleX.GetDenominator() );
if( aOrigin.X() >= 0 )
{
- if( aScaleX.numerator() >= 0 )
- aX += BigInt( aScaleX.numerator()/2 );
+ if( aScaleX.GetNumerator() >= 0 )
+ aX += BigInt( aScaleX.GetNumerator()/2 );
else
- aX -= BigInt( (aScaleX.numerator()+1)/2 );
+ aX -= BigInt( (aScaleX.GetNumerator()+1)/2 );
}
else
{
- if( aScaleX.numerator() >= 0 )
- aX -= BigInt( (aScaleX.numerator()-1)/2 );
+ if( aScaleX.GetNumerator() >= 0 )
+ aX -= BigInt( (aScaleX.GetNumerator()-1)/2 );
else
- aX += BigInt( aScaleX.numerator()/2 );
+ aX += BigInt( aScaleX.GetNumerator()/2 );
}
- aX /= BigInt( aScaleX.numerator() );
+ aX /= BigInt( aScaleX.GetNumerator() );
aOrigin.X() = (long) aX + aMM.GetOrigin().X();
BigInt aY( aOrigin.Y() );
- aY *= BigInt( aScaleY.denominator() );
+ aY *= BigInt( aScaleY.GetDenominator() );
if( aOrigin.Y() >= 0 )
{
- if( aScaleY.numerator() >= 0 )
- aY += BigInt( aScaleY.numerator()/2 );
+ if( aScaleY.GetNumerator() >= 0 )
+ aY += BigInt( aScaleY.GetNumerator()/2 );
else
- aY -= BigInt( (aScaleY.numerator()+1)/2 );
+ aY -= BigInt( (aScaleY.GetNumerator()+1)/2 );
}
else
{
- if( aScaleY.numerator() >= 0 )
- aY -= BigInt( (aScaleY.numerator()-1)/2 );
+ if( aScaleY.GetNumerator() >= 0 )
+ aY -= BigInt( (aScaleY.GetNumerator()-1)/2 );
else
- aY += BigInt( aScaleY.numerator()/2 );
+ aY += BigInt( aScaleY.GetNumerator()/2 );
}
- aY /= BigInt( aScaleY.numerator() );
+ aY /= BigInt( aScaleY.GetNumerator() );
aOrigin.Y() = (long)aY + aMM.GetOrigin().Y();
aPictureMapMode.SetOrigin( aOrigin );
diff --git a/filter/source/graphicfilter/epict/epict.cxx b/filter/source/graphicfilter/epict/epict.cxx
index b0f61f328bc6..1aad8c1e22db 100644
--- a/filter/source/graphicfilter/epict/epict.cxx
+++ b/filter/source/graphicfilter/epict/epict.cxx
@@ -1962,48 +1962,48 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
if( pA->GetMapMode().GetMapUnit() == MAP_RELATIVE )
{
MapMode aMM = pA->GetMapMode();
- boost::rational<long> aScaleX = aMM.GetScaleX();
- boost::rational<long> aScaleY = aMM.GetScaleY();
+ Fraction aScaleX = aMM.GetScaleX();
+ Fraction aScaleY = aMM.GetScaleY();
Point aOrigin = aSrcMapMode.GetOrigin();
BigInt aX( aOrigin.X() );
- aX *= BigInt( aScaleX.denominator() );
+ aX *= BigInt( aScaleX.GetDenominator() );
if( aOrigin.X() >= 0 )
{
- if( aScaleX.numerator() >= 0 )
- aX += BigInt( aScaleX.numerator()/2 );
+ if( aScaleX.GetNumerator() >= 0 )
+ aX += BigInt( aScaleX.GetNumerator()/2 );
else
- aX -= BigInt( (aScaleX.numerator()+1)/2 );
+ aX -= BigInt( (aScaleX.GetNumerator()+1)/2 );
}
else
{
- if( aScaleX.numerator() >= 0 )
- aX -= BigInt( (aScaleX.numerator()-1)/2 );
+ if( aScaleX.GetNumerator() >= 0 )
+ aX -= BigInt( (aScaleX.GetNumerator()-1)/2 );
else
- aX += BigInt( aScaleX.numerator()/2 );
+ aX += BigInt( aScaleX.GetNumerator()/2 );
}
- aX /= BigInt( aScaleX.numerator() );
+ aX /= BigInt( aScaleX.GetNumerator() );
aOrigin.X() = (long)aX + aMM.GetOrigin().X();
BigInt aY( aOrigin.Y() );
- aY *= BigInt( aScaleY.denominator() );
+ aY *= BigInt( aScaleY.GetDenominator() );
if( aOrigin.Y() >= 0 )
{
- if( aScaleY.numerator() >= 0 )
- aY += BigInt( aScaleY.numerator()/2 );
+ if( aScaleY.GetNumerator() >= 0 )
+ aY += BigInt( aScaleY.GetNumerator()/2 );
else
- aY -= BigInt( (aScaleY.numerator()+1)/2 );
+ aY -= BigInt( (aScaleY.GetNumerator()+1)/2 );
}
else
{
- if( aScaleY.numerator() >= 0 )
- aY -= BigInt( (aScaleY.numerator()-1)/2 );
+ if( aScaleY.GetNumerator() >= 0 )
+ aY -= BigInt( (aScaleY.GetNumerator()-1)/2 );
else
- aY += BigInt( aScaleY.numerator()/2 );
+ aY += BigInt( aScaleY.GetNumerator()/2 );
}
- aY /= BigInt( aScaleY.numerator() );
+ aY /= BigInt( aScaleY.GetNumerator() );
aOrigin.Y() = (long)aY + aMM.GetOrigin().Y();
aSrcMapMode.SetOrigin( aOrigin );
@@ -2183,7 +2183,7 @@ bool PictWriter::WritePict(const GDIMetaFile & rMTF, SvStream & rTargetStream, F
{
PictWriterAttrStackMember* pAt;
MapMode aMap72( MAP_INCH );
- boost::rational<long> aDPIFrac( 1, 72 );
+ Fraction aDPIFrac( 1, 72 );
bStatus=true;
nLastPercent=0;
diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
index c9b1314078db..19465a6505bd 100644
--- a/filter/source/graphicfilter/eps/eps.cxx
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -2376,8 +2376,8 @@ void PSWriter::ImplGetMapMode( const MapMode& rMapMode )
{
ImplWriteLine( "tm setmatrix" );
double fMul = ImplGetScaling( rMapMode );
- double fScaleX = boost::rational_cast<double>(rMapMode.GetScaleX()) * fMul;
- double fScaleY = boost::rational_cast<double>(rMapMode.GetScaleY()) * fMul;
+ double fScaleX = (double)rMapMode.GetScaleX() * fMul;
+ double fScaleY = (double)rMapMode.GetScaleY() * fMul;
ImplTranslate( rMapMode.GetOrigin().X() * fScaleX, rMapMode.GetOrigin().Y() * fScaleY );
ImplScale( fScaleX, fScaleY );
}
diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx b/filter/source/graphicfilter/ios2met/ios2met.cxx
index 87ea75d050ae..b31fefb525c6 100644
--- a/filter/source/graphicfilter/ios2met/ios2met.cxx
+++ b/filter/source/graphicfilter/ios2met/ios2met.cxx
@@ -2127,9 +2127,9 @@ void OS2METReader::ReadDsc(sal_uInt16 nDscID, sal_uInt16 /*nDscLen*/)
ReadCoord(b32);
if (nUnitType==0x00 && xr>0 && yr>0)
- aGlobMapMode=MapMode(MAP_INCH,Point(0,0),boost::rational<long>(10,xr),boost::rational<long>(10,yr));
+ aGlobMapMode=MapMode(MAP_INCH,Point(0,0),Fraction(10,xr),Fraction(10,yr));
else if (nUnitType==0x01 && xr>0 && yr>0)
- aGlobMapMode=MapMode(MAP_CM,Point(0,0),boost::rational<long>(10,xr),boost::rational<long>(10,yr));
+ aGlobMapMode=MapMode(MAP_CM,Point(0,0),Fraction(10,xr),Fraction(10,yr));
else
aGlobMapMode=MapMode();
diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx
index b0d07d805a3b..41ba717b6b13 100644
--- a/filter/source/graphicfilter/ipict/ipict.cxx
+++ b/filter/source/graphicfilter/ipict/ipict.cxx
@@ -166,8 +166,8 @@ private:
Size aActOvalSize;
vcl::Font aActFont;
- boost::rational<long> aHRes;
- boost::rational<long> aVRes;
+ Fraction aHRes;
+ Fraction aVRes;
bool Callback(sal_uInt16 nPercent);
@@ -1841,7 +1841,7 @@ void PictReader::ReadPict( SvStream & rStreamPict, GDIMetaFile & rGDIMetaFile )
aActFont.SetSize(Size(0,12));
aActFont.SetAlign(ALIGN_BASELINE);
- aHRes = aVRes = boost::rational<long>( 1, 1 );
+ aHRes = aVRes = Fraction( 1, 1 );
pVirDev = new VirtualDevice();
pVirDev->EnableOutput(false);
diff --git a/filter/source/graphicfilter/ipsd/ipsd.cxx b/filter/source/graphicfilter/ipsd/ipsd.cxx
index dbba04cb9983..c95991d5e2da 100644
--- a/filter/source/graphicfilter/ipsd/ipsd.cxx
+++ b/filter/source/graphicfilter/ipsd/ipsd.cxx
@@ -148,8 +148,8 @@ bool PSDReader::ReadPSD(Graphic & rGraphic )
if ( mnXResFixed && mnYResFixed )
{
Point aEmptyPoint;
- boost::rational<long> aFractX( 1, mnXResFixed >> 16 );
- boost::rational<long> aFractY( 1, mnYResFixed >> 16 );
+ Fraction aFractX( 1, mnXResFixed >> 16 );
+ Fraction aFractY( 1, mnYResFixed >> 16 );
MapMode aMapMode( MAP_INCH, aEmptyPoint, aFractX, aFractY );
Size aPrefSize = OutputDevice::LogicToLogic( aBitmapSize, aMapMode, MAP_100TH_MM );
rGraphic.SetPrefSize( aPrefSize );
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx
index 82575a5d057c..4606271017a9 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -1127,7 +1127,7 @@ void TIFFReader::MakePalCol( void )
nRX=(sal_uLong)(fXResolution*2.54+0.5);
nRY=(sal_uLong)(fYResolution*2.54+0.5);
}
- MapMode aMapMode(MAP_INCH,Point(0,0),boost::rational<long>(1,nRX),boost::rational<long>(1,nRY));
+ MapMode aMapMode(MAP_INCH,Point(0,0),Fraction(1,nRX),Fraction(1,nRY));
aBitmap.SetPrefMapMode(aMapMode);
aBitmap.SetPrefSize(Size(nImageWidth,nImageLength));
}
diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx
index 0c2b757284a3..2e9227042eb7 100644
--- a/filter/source/msfilter/eschesdo.cxx
+++ b/filter/source/msfilter/eschesdo.cxx
@@ -64,7 +64,7 @@ ImplEESdrWriter::ImplEESdrWriter( EscherEx& rEx )
: mpEscherEx(&rEx)
, maMapModeSrc(MAP_100TH_MM)
// PowerPoint: 576 dpi, WinWord: 1440 dpi, Excel: 1440 dpi
- , maMapModeDest( MAP_INCH, Point(), boost::rational<long>( 1, EES_MAP_FRACTION ), boost::rational<long>( 1, EES_MAP_FRACTION ) )
+ , maMapModeDest( MAP_INCH, Point(), Fraction( 1, EES_MAP_FRACTION ), Fraction( 1, EES_MAP_FRACTION ) )
, mpPicStrm(NULL)
, mpHostAppData(NULL)
, mnPagesWritten(0)
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 231af88c3eda..b7bf147031a2 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -170,9 +170,9 @@ void Impl_OlePres::Write( SvStream & rStm )
{
// Always to 1/100 mm, until Mtf-Solution found
// Assumption (no scaling, no origin translation)
- DBG_ASSERT( pMtf->GetPrefMapMode().GetScaleX() == boost::rational<long>( 1, 1 ),
+ DBG_ASSERT( pMtf->GetPrefMapMode().GetScaleX() == Fraction( 1, 1 ),
"X-Skalierung im Mtf" );
- DBG_ASSERT( pMtf->GetPrefMapMode().GetScaleY() == boost::rational<long>( 1, 1 ),
+ DBG_ASSERT( pMtf->GetPrefMapMode().GetScaleY() == Fraction( 1, 1 ),
"Y-Skalierung im Mtf" );
DBG_ASSERT( pMtf->GetPrefMapMode().GetOrigin() == Point(),
"Origin-Verschiebung im Mtf" );
@@ -183,8 +183,8 @@ void Impl_OlePres::Write( SvStream & rStm )
Size aS( aPrefS );
aS = OutputDevice::LogicToLogic( aS, nMU, MAP_100TH_MM );
- pMtf->Scale( boost::rational<long>( aS.Width(), aPrefS.Width() ),
- boost::rational<long>( aS.Height(), aPrefS.Height() ) );
+ pMtf->Scale( Fraction( aS.Width(), aPrefS.Width() ),
+ Fraction( aS.Height(), aPrefS.Height() ) );
pMtf->SetPrefMapMode( MAP_100TH_MM );
pMtf->SetPrefSize( aS );
}
@@ -3118,11 +3118,11 @@ void SvxMSDffManager::ScaleEmu( sal_Int32& rVal ) const
sal_uInt32 SvxMSDffManager::ScalePt( sal_uInt32 nVal ) const
{
MapUnit eMap = pSdrModel->GetScaleUnit();
- boost::rational<long> aFact( GetMapFactor( MAP_POINT, eMap ).X() );
- long aMul = aFact.numerator();
- long aDiv = aFact.denominator() * 65536;
- aFact = boost::rational<long>( aMul, aDiv ); // try again to shorten it
- return BigMulDiv( nVal, aFact.numerator(), aFact.denominator() );
+ Fraction aFact( GetMapFactor( MAP_POINT, eMap ).X() );
+ long aMul = aFact.GetNumerator();
+ long aDiv = aFact.GetDenominator() * 65536;
+ aFact = Fraction( aMul, aDiv ); // try again to shorten it
+ return BigMulDiv( nVal, aFact.GetNumerator(), aFact.GetDenominator() );
}
sal_Int32 SvxMSDffManager::ScalePoint( sal_Int32 nVal ) const
@@ -3138,31 +3138,31 @@ void SvxMSDffManager::SetModel(SdrModel* pModel, long nApplicationScale)
// PPT works in units of 576DPI
// WW on the other side uses twips, i.e. 1440DPI.
MapUnit eMap = pSdrModel->GetScaleUnit();
- boost::rational<long> aFact = GetMapFactor(MAP_INCH, eMap).X();
- long nMul=aFact.numerator();
- long nDiv=aFact.denominator()*nApplicationScale;
- aFact=boost::rational<long>(nMul,nDiv); // try again to shorten it
+ Fraction aFact( GetMapFactor(MAP_INCH, eMap).X() );
+ long nMul=aFact.GetNumerator();
+ long nDiv=aFact.GetDenominator()*nApplicationScale;
+ aFact=Fraction(nMul,nDiv); // try again to shorten it
// For 100TH_MM -> 2540/576=635/144
// For Twip -> 1440/576=5/2
- nMapMul = aFact.numerator();
- nMapDiv = aFact.denominator();
+ nMapMul = aFact.GetNumerator();
+ nMapDiv = aFact.GetDenominator();
bNeedMap = nMapMul!=nMapDiv;
// MS-DFF-Properties are mostly given in EMU (English Metric Units)
// 1mm=36000emu, 1twip=635emu
aFact=GetMapFactor(MAP_100TH_MM,eMap).X();
- nMul=aFact.numerator();
- nDiv=aFact.denominator()*360;
- aFact=boost::rational<long>(nMul,nDiv); // try again to shorten it
+ nMul=aFact.GetNumerator();
+ nDiv=aFact.GetDenominator()*360;
+ aFact=Fraction(nMul,nDiv); // try again to shorten it
// For 100TH_MM -> 1/360
// For Twip -> 14,40/(25,4*360)=144/91440=1/635
- nEmuMul=aFact.numerator();
- nEmuDiv=aFact.denominator();
+ nEmuMul=aFact.GetNumerator();
+ nEmuDiv=aFact.GetDenominator();
// And something for typographic Points
aFact=GetMapFactor(MAP_POINT,eMap).X();
- nPntMul=aFact.numerator();
- nPntDiv=aFact.denominator();
+ nPntMul=aFact.GetNumerator();
+ nPntDiv=aFact.GetDenominator();
}
else
{
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 759b6bb5e624..c2cd0b3ba98c 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -2474,9 +2474,9 @@ Size SdrPowerPointImport::GetPageSize() const
long nInchMul = 1, nInchDiv = 1;
if ( bInch )
{ // temporarily convert size (for rounding it) from inch to metric units
- boost::rational<long> aFact = GetMapFactor(eMap,MAP_100TH_MM).X();
- nInchMul = aFact.numerator();
- nInchDiv = aFact.denominator();
+ Fraction aFact(GetMapFactor(eMap,MAP_100TH_MM).X());
+ nInchMul = aFact.GetNumerator();
+ nInchDiv = aFact.GetDenominator();
aRet.Width() = BigMulDiv( aRet.Width(), nInchMul, nInchDiv );
aRet.Height() = BigMulDiv( aRet.Height(), nInchMul, nInchDiv );
}
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 2393c27a039b..749dbb8cc1bf 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -23,6 +23,7 @@
#include "pdf.hrc"
#include "tools/urlobj.hxx"
+#include "tools/fract.hxx"
#include "tools/poly.hxx"
#include "vcl/mapmod.hxx"
#include "vcl/virdev.hxx"
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 6dff611d8519..6d2efbad1713 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -3583,14 +3583,14 @@ void SVGActionWriter::WriteMetaFile( const Point& rPos100thmm,
{
MapMode aMapMode( rMtf.GetPrefMapMode() );
Size aPrefSize( rMtf.GetPrefSize() );
- boost::rational<long> aFractionX = aMapMode.GetScaleX();
- boost::rational<long> aFractionY = aMapMode.GetScaleY();
+ Fraction aFractionX( aMapMode.GetScaleX() );
+ Fraction aFractionY( aMapMode.GetScaleY() );
mpVDev->Push();
Size aSize( OutputDevice::LogicToLogic( rSize100thmm, MAP_100TH_MM, aMapMode ) );
- aMapMode.SetScaleX( aFractionX *= boost::rational<long>( aSize.Width(), aPrefSize.Width() ) );
- aMapMode.SetScaleY( aFractionY *= boost::rational<long>( aSize.Height(), aPrefSize.Height() ) );
+ aMapMode.SetScaleX( aFractionX *= Fraction( aSize.Width(), aPrefSize.Width() ) );
+ aMapMode.SetScaleY( aFractionY *= Fraction( aSize.Height(), aPrefSize.Height() ) );
Point aOffset( OutputDevice::LogicToLogic( rPos100thmm, MAP_100TH_MM, aMapMode ) );
aMapMode.SetOrigin( aOffset += aMapMode.GetOrigin() );