diff options
author | Juan Picca <jumapico@gmail.com> | 2014-09-19 14:19:30 -0300 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2014-10-09 11:33:33 +0000 |
commit | 47a2d7642d249d70b5da0c330a73f3a0032e4bba (patch) | |
tree | 202b04810382ea87cf8015a7b4de29e931408948 /sw/source/filter/ww8/ww8par4.cxx | |
parent | ae77dc81c33ab0817264bcf5fc8bb71a55b78a73 (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 'sw/source/filter/ww8/ww8par4.cxx')
-rw-r--r-- | sw/source/filter/ww8/ww8par4.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx index b09fec67d5bf..b7dcac3b7831 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 ); - Fraction aFracX( aNewSiz.Width(), aOldSiz.Width() ); - Fraction aFracY( aNewSiz.Height(), aOldSiz.Height() ); + boost::rational<long> aFracX( aNewSiz.Width(), aOldSiz.Width() ); + boost::rational<long> 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(); - Fraction aScaleX(aFinalSize.Width(),aOrigSize.Width()); - Fraction aScaleY(aFinalSize.Height(),aOrigSize.Height()); + boost::rational<long> aScaleX(aFinalSize.Width(),aOrigSize.Width()); + boost::rational<long> aScaleY(aFinalSize.Height(),aOrigSize.Height()); rWMF.Scale( aScaleX, aScaleY ); bOk = true; } |