summaryrefslogtreecommitdiff
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
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>
-rw-r--r--basctl/source/dlged/dlged.cxx4
-rw-r--r--basctl/source/dlged/dlgedobj.cxx4
-rw-r--r--basctl/source/inc/dlgedobj.hxx4
-rw-r--r--basic/source/runtime/methods1.cxx4
-rw-r--r--chart2/source/controller/main/ChartController_Window.cxx4
-rw-r--r--chart2/source/view/main/DrawModelWrapper.cxx2
-rw-r--r--connectivity/inc/pch/precompiled_dbtools.hxx2
-rw-r--r--connectivity/source/commontools/RowFunctionParser.cxx2
-rw-r--r--cui/source/tabpages/grfpage.cxx4
-rw-r--r--cui/source/tabpages/transfrm.cxx28
-rw-r--r--dbaccess/source/ui/inc/JoinController.hxx2
-rw-r--r--desktop/source/lib/init.cxx2
-rw-r--r--drawinglayer/source/primitive2d/metafileprimitive2d.cxx6
-rw-r--r--editeng/source/editeng/impedit3.cxx6
-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
-rw-r--r--forms/source/richtext/richtextimplcontrol.cxx2
-rw-r--r--include/oox/export/chartexport.hxx2
-rw-r--r--include/oox/export/shapes.hxx2
-rw-r--r--include/sfx2/ipclient.hxx10
-rw-r--r--include/sfx2/objsh.hxx4
-rw-r--r--include/sfx2/viewfrm.hxx4
-rw-r--r--include/sfx2/viewsh.hxx4
-rw-r--r--include/svtools/imap.hxx4
-rw-r--r--include/svtools/imapcirc.hxx4
-rw-r--r--include/svtools/imappoly.hxx4
-rw-r--r--include/svtools/imaprect.hxx4
-rw-r--r--include/svtools/ruler.hxx6
-rw-r--r--include/svx/obj3d.hxx2
-rw-r--r--include/svx/scene3d.hxx4
-rw-r--r--include/svx/sdr/properties/defaultproperties.hxx2
-rw-r--r--include/svx/sdr/properties/properties.hxx4
-rw-r--r--include/svx/svddrag.hxx6
-rw-r--r--include/svx/svddrgmt.hxx4
-rw-r--r--include/svx/svdedtv.hxx6
-rw-r--r--include/svx/svdetc.hxx6
-rw-r--r--include/svx/svdglev.hxx2
-rw-r--r--include/svx/svdmodel.hxx22
-rw-r--r--include/svx/svdoashp.hxx4
-rw-r--r--include/svx/svdobj.hxx4
-rw-r--r--include/svx/svdocapt.hxx2
-rw-r--r--include/svx/svdocirc.hxx2
-rw-r--r--include/svx/svdoedge.hxx2
-rw-r--r--include/svx/svdograf.hxx2
-rw-r--r--include/svx/svdogrp.hxx4
-rw-r--r--include/svx/svdomeas.hxx2
-rw-r--r--include/svx/svdoole2.hxx4
-rw-r--r--include/svx/svdopath.hxx2
-rw-r--r--include/svx/svdorect.hxx2
-rw-r--r--include/svx/svdotable.hxx2
-rw-r--r--include/svx/svdotext.hxx6
-rw-r--r--include/svx/svdouno.hxx2
-rw-r--r--include/svx/svdovirt.hxx4
-rw-r--r--include/svx/svdpoev.hxx2
-rw-r--r--include/svx/svdsnpv.hxx12
-rw-r--r--include/svx/svdtrans.hxx40
-rw-r--r--include/svx/sxfiitm.hxx10
-rw-r--r--include/svx/sxsiitm.hxx4
-rw-r--r--include/tools/bigint.hxx4
-rw-r--r--include/tools/fract.hxx142
-rw-r--r--include/tools/rational.hxx25
-rw-r--r--include/vcl/gdimtf.hxx2
-rw-r--r--include/vcl/mapmod.hxx16
-rw-r--r--include/vcl/virdev.hxx2
-rw-r--r--include/vcl/window.hxx4
-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
-rw-r--r--sc/inc/column.hxx6
-rw-r--r--sc/inc/document.hxx8
-rw-r--r--sc/inc/editutil.hxx8
-rw-r--r--sc/inc/patattr.hxx6
-rw-r--r--sc/inc/pch/precompiled_sc.hxx2
-rw-r--r--sc/inc/rowheightcontext.hxx12
-rw-r--r--sc/inc/table.hxx6
-rw-r--r--sc/source/core/data/column2.cxx12
-rw-r--r--sc/source/core/data/dociter.cxx6
-rw-r--r--sc/source/core/data/documen8.cxx4
-rw-r--r--sc/source/core/data/document.cxx6
-rw-r--r--sc/source/core/data/drwlayer.cxx10
-rw-r--r--sc/source/core/data/patattr.cxx8
-rw-r--r--sc/source/core/data/rowheightcontext.cxx2
-rw-r--r--sc/source/core/data/table1.cxx6
-rw-r--r--sc/source/core/data/table2.cxx2
-rw-r--r--sc/source/filter/rtf/eeimpars.cxx6
-rw-r--r--sc/source/ui/app/client.cxx6
-rw-r--r--sc/source/ui/app/inputhdl.cxx2
-rw-r--r--sc/source/ui/cctrl/dpcontrol.cxx6
-rw-r--r--sc/source/ui/docshell/docfunc.cxx6
-rw-r--r--sc/source/ui/docshell/docsh.cxx6
-rw-r--r--sc/source/ui/docshell/docsh5.cxx4
-rw-r--r--sc/source/ui/drawfunc/fuins1.cxx2
-rw-r--r--sc/source/ui/inc/dpcontrol.hxx10
-rw-r--r--sc/source/ui/inc/drawutil.hxx6
-rw-r--r--sc/source/ui/inc/drawview.hxx8
-rw-r--r--sc/source/ui/inc/inputhdl.hxx10
-rw-r--r--sc/source/ui/inc/output.hxx10
-rw-r--r--sc/source/ui/inc/tabview.hxx2
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx2
-rw-r--r--sc/source/ui/inc/viewdata.hxx26
-rw-r--r--sc/source/ui/undo/undobase.cxx8
-rw-r--r--sc/source/ui/undo/undoblk3.cxx4
-rw-r--r--sc/source/ui/undo/undostyl.cxx2
-rw-r--r--sc/source/ui/unoobj/docuno.cxx18
-rw-r--r--sc/source/ui/unoobj/styleuno.cxx8
-rw-r--r--sc/source/ui/unoobj/viewuno.cxx6
-rw-r--r--sc/source/ui/vba/excelvbahelper.cxx2
-rw-r--r--sc/source/ui/view/drawutil.cxx24
-rw-r--r--sc/source/ui/view/drawvie4.cxx10
-rw-r--r--sc/source/ui/view/drawview.cxx10
-rw-r--r--sc/source/ui/view/gridwin.cxx4
-rw-r--r--sc/source/ui/view/gridwin3.cxx4
-rw-r--r--sc/source/ui/view/gridwin4.cxx10
-rw-r--r--sc/source/ui/view/output.cxx6
-rw-r--r--sc/source/ui/view/output2.cxx12
-rw-r--r--sc/source/ui/view/overlayobject.cxx1
-rw-r--r--sc/source/ui/view/preview.cxx24
-rw-r--r--sc/source/ui/view/printfun.cxx10
-rw-r--r--sc/source/ui/view/tabview.cxx14
-rw-r--r--sc/source/ui/view/tabview2.cxx2
-rw-r--r--sc/source/ui/view/tabview3.cxx4
-rw-r--r--sc/source/ui/view/tabview5.cxx2
-rw-r--r--sc/source/ui/view/tabvwsh3.cxx10
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx20
-rw-r--r--sc/source/ui/view/tabvwsha.cxx9
-rw-r--r--sc/source/ui/view/tabvwshb.cxx18
-rw-r--r--sc/source/ui/view/tabvwshh.cxx8
-rw-r--r--sc/source/ui/view/viewdata.cxx74
-rw-r--r--sc/source/ui/view/viewfun2.cxx12
-rw-r--r--sc/source/ui/view/viewfun7.cxx2
-rw-r--r--sc/source/ui/view/viewfunc.cxx18
-rw-r--r--sd/source/core/drawdoc.cxx6
-rw-r--r--sd/source/core/sdpage.cxx22
-rw-r--r--sd/source/filter/eppt/eppt.cxx2
-rw-r--r--sd/source/filter/eppt/epptbase.hxx2
-rw-r--r--sd/source/filter/eppt/pptx-text.cxx4
-rw-r--r--sd/source/ui/animations/motionpathtag.cxx2
-rw-r--r--sd/source/ui/annotations/annotationwindow.cxx2
-rw-r--r--sd/source/ui/app/optsitem.cxx4
-rw-r--r--sd/source/ui/app/sdmod2.cxx8
-rw-r--r--sd/source/ui/dlg/animobjs.cxx18
-rw-r--r--sd/source/ui/dlg/copydlg.cxx30
-rw-r--r--sd/source/ui/dlg/dlgsnap.cxx16
-rw-r--r--sd/source/ui/dlg/docprev.cxx2
-rw-r--r--sd/source/ui/dlg/vectdlg.cxx8
-rw-r--r--sd/source/ui/docshell/docshel2.cxx4
-rw-r--r--sd/source/ui/docshell/sdclient.cxx4
-rw-r--r--sd/source/ui/func/fucopy.cxx4
-rw-r--r--sd/source/ui/inc/DrawViewShell.hxx2
-rw-r--r--sd/source/ui/inc/ViewShell.hxx4
-rw-r--r--sd/source/ui/inc/ViewShellBase.hxx4
-rw-r--r--sd/source/ui/inc/animobjs.hxx6
-rw-r--r--sd/source/ui/inc/copydlg.hxx2
-rw-r--r--sd/source/ui/inc/dlgsnap.hxx4
-rw-r--r--sd/source/ui/inc/vectdlg.hxx2
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx4
-rw-r--r--sd/source/ui/tools/PreviewRenderer.cxx4
-rw-r--r--sd/source/ui/unoidl/UnoDocumentSettings.cxx8
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx8
-rw-r--r--sd/source/ui/view/DocumentRenderer.cxx20
-rw-r--r--sd/source/ui/view/ViewShellBase.cxx8
-rw-r--r--sd/source/ui/view/drviews1.cxx4
-rw-r--r--sd/source/ui/view/drviews5.cxx2
-rw-r--r--sd/source/ui/view/drviewsa.cxx22
-rw-r--r--sd/source/ui/view/frmview.cxx26
-rw-r--r--sd/source/ui/view/sdview.cxx12
-rw-r--r--sd/source/ui/view/sdview3.cxx4
-rw-r--r--sd/source/ui/view/sdview4.cxx4
-rw-r--r--sd/source/ui/view/sdwindow.cxx10
-rw-r--r--sd/source/ui/view/viewshe2.cxx16
-rw-r--r--sfx2/inc/pch/precompiled_sfx.hxx2
-rw-r--r--sfx2/source/doc/objembed.cxx8
-rw-r--r--sfx2/source/view/ipclient.cxx40
-rw-r--r--sfx2/source/view/viewfrm2.cxx2
-rw-r--r--sfx2/source/view/viewsh.cxx4
-rw-r--r--starmath/inc/node.hxx12
-rw-r--r--starmath/inc/pch/precompiled_sm.hxx2
-rw-r--r--starmath/inc/utility.hxx24
-rw-r--r--starmath/inc/view.hxx2
-rw-r--r--starmath/source/ElementsDockingWindow.cxx2
-rw-r--r--starmath/source/mathmlexport.cxx12
-rw-r--r--starmath/source/mathmlimport.cxx6
-rw-r--r--starmath/source/node.cxx42
-rw-r--r--starmath/source/parse.cxx10
-rw-r--r--starmath/source/utility.cxx6
-rw-r--r--starmath/source/view.cxx26
-rw-r--r--starmath/source/visitors.cxx2
-rw-r--r--svtools/source/brwbox/brwbox1.cxx6
-rw-r--r--svtools/source/brwbox/brwbox2.cxx4
-rw-r--r--svtools/source/brwbox/datwin.cxx18
-rw-r--r--svtools/source/brwbox/datwin.hxx6
-rw-r--r--svtools/source/control/ctrltool.cxx2
-rw-r--r--svtools/source/control/ruler.cxx6
-rw-r--r--svtools/source/filter/exportdialog.cxx4
-rw-r--r--svtools/source/graphic/grfmgr.cxx2
-rw-r--r--svtools/source/misc/imap.cxx42
-rw-r--r--svx/inc/pch/precompiled_svxcore.hxx2
-rw-r--r--svx/inc/sdr/properties/itemsettools.hxx4
-rw-r--r--svx/inc/svdoopengl.hxx2
-rw-r--r--svx/inc/sxmsitm.hxx4
-rw-r--r--svx/inc/sxreaitm.hxx8
-rw-r--r--svx/inc/sxreoitm.hxx8
-rw-r--r--svx/source/customshapes/EnhancedCustomShape3d.cxx8
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx12
-rw-r--r--svx/source/dialog/connctrl.cxx28
-rw-r--r--svx/source/dialog/graphctl.cxx6
-rw-r--r--svx/source/dialog/measctrl.cxx26
-rw-r--r--svx/source/dialog/pagectrl.cxx10
-rw-r--r--svx/source/engine3d/obj3d.cxx6
-rw-r--r--svx/source/engine3d/scene3d.cxx4
-rw-r--r--svx/source/fmcomp/gridctrl.cxx2
-rw-r--r--svx/source/form/fmvwimp.cxx12
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx10
-rw-r--r--svx/source/sdr/properties/attributeproperties.cxx2
-rw-r--r--svx/source/sdr/properties/defaultproperties.cxx2
-rw-r--r--svx/source/sdr/properties/itemsettools.cxx11
-rw-r--r--svx/source/sdr/properties/properties.cxx2
-rw-r--r--svx/source/sidebar/possize/PosSizePropertyPanel.cxx36
-rw-r--r--svx/source/sidebar/possize/PosSizePropertyPanel.hxx2
-rw-r--r--svx/source/svdraw/svdattr.cxx32
-rw-r--r--svx/source/svdraw/svddrag.cxx8
-rw-r--r--svx/source/svdraw/svddrgm1.hxx4
-rw-r--r--svx/source/svdraw/svddrgmt.cxx64
-rw-r--r--svx/source/svdraw/svdedtv1.cxx20
-rw-r--r--svx/source/svdraw/svdfmtf.cxx8
-rw-r--r--svx/source/svdraw/svdfmtf.hxx4
-rw-r--r--svx/source/svdraw/svdglev.cxx4
-rw-r--r--svx/source/svdraw/svdibrow.cxx2
-rw-r--r--svx/source/svdraw/svdmodel.cxx36
-rw-r--r--svx/source/svdraw/svdoashp.cxx20
-rw-r--r--svx/source/svdraw/svdobj.cxx28
-rw-r--r--svx/source/svdraw/svdocapt.cxx2
-rw-r--r--svx/source/svdraw/svdocirc.cxx8
-rw-r--r--svx/source/svdraw/svdoedge.cxx6
-rw-r--r--svx/source/svdraw/svdograf.cxx6
-rw-r--r--svx/source/svdraw/svdogrp.cxx22
-rw-r--r--svx/source/svdraw/svdomeas.cxx20
-rw-r--r--svx/source/svdraw/svdoole2.cxx50
-rw-r--r--svx/source/svdraw/svdoopengl.cxx2
-rw-r--r--svx/source/svdraw/svdopath.cxx8
-rw-r--r--svx/source/svdraw/svdorect.cxx2
-rw-r--r--svx/source/svdraw/svdotext.cxx10
-rw-r--r--svx/source/svdraw/svdotxdr.cxx12
-rw-r--r--svx/source/svdraw/svdotxed.cxx2
-rw-r--r--svx/source/svdraw/svdotxtr.cxx8
-rw-r--r--svx/source/svdraw/svdouno.cxx2
-rw-r--r--svx/source/svdraw/svdovirt.cxx6
-rw-r--r--svx/source/svdraw/svdpntv.cxx6
-rw-r--r--svx/source/svdraw/svdpoev.cxx8
-rw-r--r--svx/source/svdraw/svdsnpv.cxx4
-rw-r--r--svx/source/svdraw/svdtext.cxx4
-rw-r--r--svx/source/svdraw/svdtrans.cxx72
-rw-r--r--svx/source/svdraw/svdview.cxx4
-rw-r--r--svx/source/svdraw/svdxcgv.cxx32
-rw-r--r--svx/source/table/svdotable.cxx2
-rw-r--r--svx/source/unodraw/UnoGraphicExporter.cxx16
-rw-r--r--svx/source/unodraw/unoshape.cxx4
-rw-r--r--sw/inc/accmap.hxx6
-rw-r--r--sw/inc/dcontact.hxx4
-rw-r--r--sw/inc/pagedesc.hxx8
-rw-r--r--sw/inc/pagepreviewlayout.hxx6
-rw-r--r--sw/inc/pch/precompiled_sw.hxx2
-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/ww1/w1filter.cxx4
-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
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx4
-rw-r--r--toolkit/source/awt/vclxwindow.cxx2
-rw-r--r--tools/CppunitTest_tools_test.mk1
-rw-r--r--tools/Library_tl.mk2
-rw-r--r--tools/qa/cppunit/test_rational.cxx101
-rw-r--r--tools/source/generic/fract.cxx504
-rw-r--r--tools/source/generic/rational.cxx172
-rw-r--r--tools/test/tests.cxx111
-rw-r--r--vcl/inc/unx/salgdi.h2
-rw-r--r--vcl/inc/window.h2
-rw-r--r--vcl/source/filter/graphicfilter.cxx6
-rw-r--r--vcl/source/filter/graphicfilter2.cxx6
-rw-r--r--vcl/source/filter/jpeg/JpegReader.cxx4
-rw-r--r--vcl/source/filter/sgfbram.cxx2
-rw-r--r--vcl/source/filter/sgvmain.cxx2
-rw-r--r--vcl/source/filter/sgvtext.cxx2
-rw-r--r--vcl/source/filter/wmf/emfwr.cxx4
-rw-r--r--vcl/source/filter/wmf/winmtf.cxx4
-rw-r--r--vcl/source/filter/wmf/winwmf.cxx2
-rw-r--r--vcl/source/filter/wmf/wmfwr.cxx42
-rw-r--r--vcl/source/gdi/cvtsvm.cxx10
-rw-r--r--vcl/source/gdi/dibtools.cxx4
-rw-r--r--vcl/source/gdi/gdimtf.cxx12
-rw-r--r--vcl/source/gdi/impgraph.cxx12
-rw-r--r--vcl/source/gdi/mapmod.cxx8
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx4
-rw-r--r--vcl/source/gdi/pdfwriter_impl2.cxx4
-rw-r--r--vcl/source/gdi/textlayout.cxx2
-rw-r--r--vcl/source/gdi/virdev.cxx2
-rw-r--r--vcl/source/outdev/font.cxx2
-rw-r--r--vcl/source/outdev/map.cxx157
-rw-r--r--vcl/source/window/window.cxx2
-rw-r--r--vcl/source/window/window2.cxx26
-rw-r--r--writerfilter/source/dmapper/WrapPolygonHandler.cxx18
-rw-r--r--writerfilter/source/dmapper/WrapPolygonHandler.hxx4
365 files changed, 1879 insertions, 2448 deletions
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index 9800c4c5d2bf..5d8373a0815e 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -234,7 +234,7 @@ DlgEditor::DlgEditor (
pDlgEdView->SetWorkArea( Rectangle( Point( 0, 0 ), pDlgEdPage->GetSize() ) );
pDlgEdView->SetGridCoarse( aGridSize );
- pDlgEdView->SetSnapGridWidth(Fraction(aGridSize.Width(), 1), Fraction(aGridSize.Height(), 1));
+ pDlgEdView->SetSnapGridWidth(boost::rational<long>(aGridSize.Width(),1), boost::rational<long>(aGridSize.Height(),1));
pDlgEdView->SetGridSnap( bGridSnap );
pDlgEdView->SetGridVisible( bGridVisible );
pDlgEdView->SetDragStripes(false);
@@ -508,7 +508,7 @@ IMPL_LINK_NOARG(DlgEditor, PaintTimeout)
Size aSize = rWindow.PixelToLogic( Size( 400, 300 ) );
// align with grid
- Size aGridSize_(long(pDlgEdView->GetSnapGridWidthX()), long(pDlgEdView->GetSnapGridWidthY()));
+ Size aGridSize_(boost::rational_cast<long>(pDlgEdView->GetSnapGridWidthX()), boost::rational_cast<long>(pDlgEdView->GetSnapGridWidthY()));
aSize.Width() -= aSize.Width() % aGridSize_.Width();
aSize.Height() -= aSize.Height() % aGridSize_.Height();
diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx
index 4d52b5f1b5ad..89a0207989d8 100644
--- a/basctl/source/dlged/dlgedobj.cxx
+++ b/basctl/source/dlged/dlgedobj.cxx
@@ -940,7 +940,7 @@ void DlgEdObj::NbcMove( const Size& rSize )
GetDlgEdForm()->GetDlgEditor().SetDialogModelChanged(true);
}
-void DlgEdObj::NbcResize(const Point& rRef, const Fraction& xFract, const Fraction& yFract)
+void DlgEdObj::NbcResize(const Point& rRef, const boost::rational<long>& xFract, const boost::rational<long>& yFract)
{
SdrUnoObj::NbcResize( rRef, xFract, yFract );
@@ -1590,7 +1590,7 @@ void DlgEdForm::NbcMove( const Size& rSize )
GetDlgEditor().SetDialogModelChanged(true);
}
-void DlgEdForm::NbcResize(const Point& rRef, const Fraction& xFract, const Fraction& yFract)
+void DlgEdForm::NbcResize(const Point& rRef, const boost::rational<long>& xFract, const boost::rational<long>& yFract)
{
SdrUnoObj::NbcResize( rRef, xFract, yFract );
diff --git a/basctl/source/inc/dlgedobj.hxx b/basctl/source/inc/dlgedobj.hxx
index 525a5518f271..33e489ff06e1 100644
--- a/basctl/source/inc/dlgedobj.hxx
+++ b/basctl/source/inc/dlgedobj.hxx
@@ -63,7 +63,7 @@ protected:
const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSFac);
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 bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) SAL_OVERRIDE;
using SfxListener::StartListening;
@@ -153,7 +153,7 @@ private:
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 bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) SAL_OVERRIDE;
public:
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 56879a75e2f4..472d4b726f82 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -1340,8 +1340,8 @@ static double GetDialogZoomFactor( bool bX, long nValue )
if( pDevice )
{
Size aRefSize( nValue, nValue );
- Fraction aFracX( 1, 26 );
- Fraction aFracY( 1, 24 );
+ boost::rational<long> aFracX( 1, 26 );
+ boost::rational<long> aFracY( 1, 24 );
MapMode aMap( MAP_APPFONT, Point(), aFracX, aFracY );
Size aScaledSize = pDevice->LogicToPixel( aRefSize, aMap );
aRefSize = pDevice->LogicToPixel( aRefSize, MapMode(MAP_TWIP) );
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index c367f6563e40..d8fbd16f55bc 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -244,8 +244,8 @@ void SAL_CALL ChartController::setPosSize(
MapMode aNewMapMode(
MAP_100TH_MM,
Point(0,0),
- Fraction(nScaleXNumerator, nScaleXDenominator),
- Fraction(nScaleYNumerator, nScaleYDenominator) );
+ boost::rational<long>(nScaleXNumerator, nScaleXDenominator),
+ boost::rational<long>(nScaleYNumerator, nScaleYDenominator) );
m_pChartWindow->SetMapMode(aNewMapMode);
m_pChartWindow->setPosSizePixel( X, Y, Width, Height, Flags );
diff --git a/chart2/source/view/main/DrawModelWrapper.cxx b/chart2/source/view/main/DrawModelWrapper.cxx
index d917ee16aadd..65d98b660930 100644
--- a/chart2/source/view/main/DrawModelWrapper.cxx
+++ b/chart2/source/view/main/DrawModelWrapper.cxx
@@ -99,7 +99,7 @@ DrawModelWrapper::DrawModelWrapper( const uno::Reference<uno::XComponentContext>
m_pChartItemPool = ChartItemPool::CreateChartItemPool();
SetScaleUnit(MAP_100TH_MM);
- SetScaleFraction(Fraction(1, 1));
+ SetScaleFraction(boost::rational<long>(1, 1));
SetDefaultFontHeight(423); // 12pt
SfxItemPool* pMasterPool = &GetItemPool();
diff --git a/connectivity/inc/pch/precompiled_dbtools.hxx b/connectivity/inc/pch/precompiled_dbtools.hxx
index 40fa64c705a9..3d637007fa0c 100644
--- a/connectivity/inc/pch/precompiled_dbtools.hxx
+++ b/connectivity/inc/pch/precompiled_dbtools.hxx
@@ -168,7 +168,7 @@
#include <svtools/miscopt.hxx>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
#include <tools/wldcrd.hxx>
#include <unotools/confignode.hxx>
#include <unotools/datetime.hxx>
diff --git a/connectivity/source/commontools/RowFunctionParser.cxx b/connectivity/source/commontools/RowFunctionParser.cxx
index c296337b4f80..f6df2ea4c889 100644
--- a/connectivity/source/commontools/RowFunctionParser.cxx
+++ b/connectivity/source/commontools/RowFunctionParser.cxx
@@ -30,7 +30,7 @@
#include <boost/spirit/include/classic_core.hpp>
#include "RowFunctionParser.hxx"
#include <rtl/ustring.hxx>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx
index 0fcd835987ab..59e24f9f7c34 100644
--- a/cui/source/tabpages/grfpage.cxx
+++ b/cui/source/tabpages/grfpage.cxx
@@ -812,8 +812,8 @@ void SvxCropExample::SetFrameSize( const Size& rSz )
if(!aFrameSize.Height())
aFrameSize.Height() = 1;
Size aWinSize( GetOutputSizePixel() );
- Fraction aXScale( aWinSize.Width() * 4, aFrameSize.Width() * 5 );
- Fraction aYScale( aWinSize.Height() * 4, aFrameSize.Height() * 5 );
+ boost::rational<long> aXScale( aWinSize.Width() * 4, aFrameSize.Width() * 5 );
+ boost::rational<long> aYScale( aWinSize.Height() * 4, aFrameSize.Height() * 5 );
if( aYScale < aXScale )
aXScale = aYScale;
diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx
index c6273945c7cb..ff024add4d14 100644
--- a/cui/source/tabpages/transfrm.cxx
+++ b/cui/source/tabpages/transfrm.cxx
@@ -90,9 +90,9 @@ static void lcl_ConvertRect(basegfx::B2DRange& rRange, const sal_uInt16 nDigits,
rRange = basegfx::B2DRange(aTopLeft, aBottomRight);
}
-static void lcl_ScaleRect(basegfx::B2DRange& rRange, const Fraction aUIScale)
+static void lcl_ScaleRect(basegfx::B2DRange& rRange, const boost::rational<long> aUIScale)
{
- const double fFactor(1.0 / double(aUIScale));
+ const double fFactor(1.0 / boost::rational_cast<double>(aUIScale));
rRange = basegfx::B2DRange(rRange.getMinimum() * fFactor, rRange.getMaximum() * fFactor);
}
@@ -254,7 +254,7 @@ void SvxAngleTabPage::Construct()
}
// take scale into account
- const Fraction aUIScale(pView->GetModel()->GetUIScale());
+ const boost::rational<long> aUIScale = pView->GetModel()->GetUIScale();
lcl_ScaleRect(maRange, aUIScale);
// take UI units into account
@@ -274,7 +274,7 @@ bool SvxAngleTabPage::FillItemSet(SfxItemSet* rSet)
if(m_pCtlAngle->IsValueModified() || m_pMtrPosX->IsValueModified() || m_pMtrPosY->IsValueModified())
{
- const double fUIScale(double(pView->GetModel()->GetUIScale()));
+ const double fUIScale(boost::rational_cast<double>(this->pView->GetModel()->GetUIScale()));
const double fTmpX((GetCoreValue(*m_pMtrPosX, ePoolUnit) + maAnchor.getX()) * fUIScale);
const double fTmpY((GetCoreValue(*m_pMtrPosY, ePoolUnit) + maAnchor.getY()) * fUIScale);
@@ -292,7 +292,7 @@ bool SvxAngleTabPage::FillItemSet(SfxItemSet* rSet)
void SvxAngleTabPage::Reset(const SfxItemSet* rAttrs)
{
- const double fUIScale(double(pView->GetModel()->GetUIScale()));
+ const double fUIScale(boost::rational_cast<double>(this->pView->GetModel()->GetUIScale()));
const SfxPoolItem* pItem = GetItem( *rAttrs, SID_ATTR_TRANSFORM_ROT_X );
if(pItem)
@@ -475,9 +475,9 @@ bool SvxSlantTabPage::FillItemSet(SfxItemSet* rAttrs)
if( m_pMtrRadius->IsValueChangedFromSaved() )
{
- Fraction aUIScale = pView->GetModel()->GetUIScale();
+ boost::rational<long> aUIScale = pView->GetModel()->GetUIScale();
long nTmp = GetCoreValue( *m_pMtrRadius, ePoolUnit );
- nTmp = Fraction( nTmp ) * aUIScale;
+ nTmp = boost::rational_cast<long>(nTmp * aUIScale);
rAttrs->Put( makeSdrEckenradiusItem( nTmp ) );
bModified = true;
@@ -527,7 +527,7 @@ void SvxSlantTabPage::Reset(const SfxItemSet* rAttrs)
if( pItem )
{
- const double fUIScale(double(pView->GetModel()->GetUIScale()));
+ const double fUIScale(boost::rational_cast<double>(this->pView->GetModel()->GetUIScale()));
const double fTmp((double)((const SdrMetricItem*)pItem)->GetValue() / fUIScale);
SetMetricValue(*m_pMtrRadius, basegfx::fround(fTmp), ePoolUnit);
}
@@ -758,7 +758,7 @@ void SvxPositionSizeTabPage::Construct()
}
// take scale into account
- const Fraction aUIScale(mpView->GetModel()->GetUIScale());
+ const boost::rational<long> aUIScale = mpView->GetModel()->GetUIScale();
lcl_ScaleRect( maWorkRange, aUIScale );
lcl_ScaleRect( maRange, aUIScale );
@@ -790,7 +790,7 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* rOutAttrs )
{
if ( m_pMtrPosX->IsValueModified() || m_pMtrPosY->IsValueModified() )
{
- const double fUIScale(double(mpView->GetModel()->GetUIScale()));
+ const double fUIScale(boost::rational_cast<double>(this->mpView->GetModel()->GetUIScale()));
double fX((GetCoreValue( *m_pMtrPosX, mePoolUnit ) + maAnchor.getX()) * fUIScale);
double fY((GetCoreValue( *m_pMtrPosY, mePoolUnit ) + maAnchor.getY()) * fUIScale);
@@ -828,19 +828,19 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* rOutAttrs )
if ( m_pMtrWidth->IsValueModified() || m_pMtrHeight->IsValueModified() )
{
- Fraction aUIScale = mpView->GetModel()->GetUIScale();
+ boost::rational<long> aUIScale = mpView->GetModel()->GetUIScale();
// get Width
double nWidth = static_cast<double>(m_pMtrWidth->GetValue( meDlgUnit ));
nWidth = MetricField::ConvertDoubleValue( nWidth, m_pMtrWidth->GetBaseValue(), m_pMtrWidth->GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM );
- long lWidth = long(nWidth * (double)aUIScale);
+ long lWidth = long(nWidth * boost::rational_cast<double>(aUIScale));
lWidth = OutputDevice::LogicToLogic( lWidth, MAP_100TH_MM, (MapUnit)mePoolUnit );
lWidth = static_cast<long>(m_pMtrWidth->Denormalize( lWidth ));
// get Height
double nHeight = static_cast<double>(m_pMtrHeight->GetValue( meDlgUnit ));
nHeight = MetricField::ConvertDoubleValue( nHeight, m_pMtrHeight->GetBaseValue(), m_pMtrHeight->GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM );
- long lHeight = long(nHeight * (double)aUIScale);
+ long lHeight = long(nHeight * boost::rational_cast<double>(aUIScale));
lHeight = OutputDevice::LogicToLogic( lHeight, MAP_100TH_MM, (MapUnit)mePoolUnit );
lHeight = static_cast<long>(m_pMtrHeight->Denormalize( lHeight ));
@@ -899,7 +899,7 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* rOutAttrs )
void SvxPositionSizeTabPage::Reset( const SfxItemSet* )
{
const SfxPoolItem* pItem;
- const double fUIScale(double(mpView->GetModel()->GetUIScale()));
+ const double fUIScale(boost::rational_cast<double>(this->mpView->GetModel()->GetUIScale()));
if ( !mbPageDisabled )
{
diff --git a/dbaccess/source/ui/inc/JoinController.hxx b/dbaccess/source/ui/inc/JoinController.hxx
index d4faccffed41..c527a3e648b0 100644
--- a/dbaccess/source/ui/inc/JoinController.hxx
+++ b/dbaccess/source/ui/inc/JoinController.hxx
@@ -47,7 +47,7 @@ namespace dbaui
TTableConnectionData m_vTableConnectionData;
TTableWindowData m_vTableData;
- Fraction m_aZoom;
+ boost::rational<long> m_aZoom;
::dbtools::SQLExceptionInfo m_aExceptionInfo;
OAddTableDlg* m_pAddTableDialog;
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 60c53fb16bf6..465cd5e250a4 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -558,7 +558,7 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
VirtualDevice aDevice(0, (sal_uInt16)32);
boost::shared_array< sal_uInt8 > aBuffer( pBuffer, NoDelete< sal_uInt8 >() );
aDevice.SetOutputSizePixelScaleOffsetAndBuffer(
- Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(),
+ Size(nCanvasWidth, nCanvasHeight), rational_FromDouble(1.0), Point(),
aBuffer, true );
pDoc->paintTile(aDevice, nCanvasWidth, nCanvasHeight,
diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
index b546ede49a1b..f51099bc4c67 100644
--- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
@@ -573,7 +573,7 @@ namespace
basegfx::B2DHomMatrix getTransformFromMapMode(const MapMode& rMapMode)
{
basegfx::B2DHomMatrix aMapping;
- const Fraction aNoScale(1, 1);
+ const boost::rational<long> aNoScale(1, 1);
const Point& rOrigin(rMapMode.GetOrigin());
if(0 != rOrigin.X() || 0 != rOrigin.Y())
@@ -584,8 +584,8 @@ namespace
if(rMapMode.GetScaleX() != aNoScale || rMapMode.GetScaleY() != aNoScale)
{
aMapping.scale(
- double(rMapMode.GetScaleX()),
- double(rMapMode.GetScaleY()));
+ boost::rational_cast<double>(rMapMode.GetScaleX()),
+ boost::rational_cast<double>(rMapMode.GetScaleY()));
}
return aMapping;
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 06180a1b8d62..1f5cd00bd2b0 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -494,14 +494,14 @@ bool ImpEditEngine::ImpCheckRefMapMode()
if ( aStatus.DoFormat100() )
{
MapMode aMapMode( GetRefDevice()->GetMapMode() );
- if ( aMapMode.GetScaleX().GetNumerator() != aMapMode.GetScaleX().GetDenominator() )
+ if ( aMapMode.GetScaleX().numerator() != aMapMode.GetScaleX().denominator() )
bChange = true;
- else if ( aMapMode.GetScaleY().GetNumerator() != aMapMode.GetScaleY().GetDenominator() )
+ else if ( aMapMode.GetScaleY().numerator() != aMapMode.GetScaleY().denominator() )
bChange = true;
if ( bChange )
{
- Fraction Scale1( 1, 1 );
+ boost::rational<long> Scale1( 1, 1 );
aMapMode.SetScaleX( Scale1 );
aMapMode.SetScaleY( Scale1 );
GetRefDevice()->Push();
diff --git a/filter/source/graphicfilter/eos2met/eos2met.cxx b/filter/source/graphicfilter/eos2met/eos2met.cxx
index d1a145941272..33f5f514b713 100644
--- a/filter/source/graphicfilter/eos2met/eos2met.cxx
+++ b/filter/source/graphicfilter/eos2met/eos2met.cxx
@@ -2169,50 +2169,50 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF )
if ( pA->GetMapMode().GetMapUnit() == MAP_RELATIVE )
{
MapMode aMM = pA->GetMapMode();
- Fraction aScaleX = aMM.GetScaleX();
- Fraction aScaleY = aMM.GetScaleY();
+ boost::rational<long> aScaleX = aMM.GetScaleX();
+ boost::rational<long> aScaleY = aMM.GetScaleY();
Point aOrigin = aPictureMapMode.GetOrigin();
BigInt aX( aOrigin.X() );
- aX *= BigInt( aScaleX.GetDenominator() );
+ aX *= BigInt( aScaleX.denominator() );
if( aOrigin.X() >= 0 )
{
- if( aScaleX.GetNumerator() >= 0 )
- aX += BigInt( aScaleX.GetNumerator()/2 );
+ if( aScaleX.numerator() >= 0 )
+ aX += BigInt( aScaleX.numerator()/2 );
else
- aX -= BigInt( (aScaleX.GetNumerator()+1)/2 );
+ aX -= BigInt( (aScaleX.numerator()+1)/2 );
}
else
{
- if( aScaleX.GetNumerator() >= 0 )
- aX -= BigInt( (aScaleX.GetNumerator()-1)/2 );
+ if( aScaleX.numerator() >= 0 )
+ aX -= BigInt( (aScaleX.numerator()-1)/2 );
else
- aX += BigInt( aScaleX.GetNumerator()/2 );
+ aX += BigInt( aScaleX.numerator()/2 );
}
- aX /= BigInt( aScaleX.GetNumerator() );
+ aX /= BigInt( aScaleX.numerator() );
aOrigin.X() = (long) aX + aMM.GetOrigin().X();
BigInt aY( aOrigin.Y() );
- aY *= BigInt( aScaleY.GetDenominator() );
+ aY *= BigInt( aScaleY.denominator() );
if( aOrigin.Y() >= 0 )
{
- if( aScaleY.GetNumerator() >= 0 )
- aY += BigInt( aScaleY.GetNumerator()/2 );
+ if( aScaleY.numerator() >= 0 )
+ aY += BigInt( aScaleY.numerator()/2 );
else
- aY -= BigInt( (aScaleY.GetNumerator()+1)/2 );
+ aY -= BigInt( (aScaleY.numerator()+1)/2 );
}
else
{
- if( aScaleY.GetNumerator() >= 0 )
- aY -= BigInt( (aScaleY.GetNumerator()-1)/2 );
+ if( aScaleY.numerator() >= 0 )
+ aY -= BigInt( (aScaleY.numerator()-1)/2 );
else
- aY += BigInt( aScaleY.GetNumerator()/2 );
+ aY += BigInt( aScaleY.numerator()/2 );
}
- aY /= BigInt( aScaleY.GetNumerator() );
+ aY /= BigInt( aScaleY.numerator() );
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 1aad8c1e22db..b0f61f328bc6 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();
- Fraction aScaleX = aMM.GetScaleX();
- Fraction aScaleY = aMM.GetScaleY();
+ boost::rational<long> aScaleX = aMM.GetScaleX();
+ boost::rational<long> aScaleY = aMM.GetScaleY();
Point aOrigin = aSrcMapMode.GetOrigin();
BigInt aX( aOrigin.X() );
- aX *= BigInt( aScaleX.GetDenominator() );
+ aX *= BigInt( aScaleX.denominator() );
if( aOrigin.X() >= 0 )
{
- if( aScaleX.GetNumerator() >= 0 )
- aX += BigInt( aScaleX.GetNumerator()/2 );
+ if( aScaleX.numerator() >= 0 )
+ aX += BigInt( aScaleX.numerator()/2 );
else
- aX -= BigInt( (aScaleX.GetNumerator()+1)/2 );
+ aX -= BigInt( (aScaleX.numerator()+1)/2 );
}
else
{
- if( aScaleX.GetNumerator() >= 0 )
- aX -= BigInt( (aScaleX.GetNumerator()-1)/2 );
+ if( aScaleX.numerator() >= 0 )
+ aX -= BigInt( (aScaleX.numerator()-1)/2 );
else
- aX += BigInt( aScaleX.GetNumerator()/2 );
+ aX += BigInt( aScaleX.numerator()/2 );
}
- aX /= BigInt( aScaleX.GetNumerator() );
+ aX /= BigInt( aScaleX.numerator() );
aOrigin.X() = (long)aX + aMM.GetOrigin().X();
BigInt aY( aOrigin.Y() );
- aY *= BigInt( aScaleY.GetDenominator() );
+ aY *= BigInt( aScaleY.denominator() );
if( aOrigin.Y() >= 0 )
{
- if( aScaleY.GetNumerator() >= 0 )
- aY += BigInt( aScaleY.GetNumerator()/2 );
+ if( aScaleY.numerator() >= 0 )
+ aY += BigInt( aScaleY.numerator()/2 );
else
- aY -= BigInt( (aScaleY.GetNumerator()+1)/2 );
+ aY -= BigInt( (aScaleY.numerator()+1)/2 );
}
else
{
- if( aScaleY.GetNumerator() >= 0 )
- aY -= BigInt( (aScaleY.GetNumerator()-1)/2 );
+ if( aScaleY.numerator() >= 0 )
+ aY -= BigInt( (aScaleY.numerator()-1)/2 );
else
- aY += BigInt( aScaleY.GetNumerator()/2 );
+ aY += BigInt( aScaleY.numerator()/2 );
}
- aY /= BigInt( aScaleY.GetNumerator() );
+ aY /= BigInt( aScaleY.numerator() );
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 );
- Fraction aDPIFrac( 1, 72 );
+ boost::rational<long> aDPIFrac( 1, 72 );
bStatus=true;
nLastPercent=0;
diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
index 19465a6505bd..c9b1314078db 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 = (double)rMapMode.GetScaleX() * fMul;
- double fScaleY = (double)rMapMode.GetScaleY() * fMul;
+ double fScaleX = boost::rational_cast<double>(rMapMode.GetScaleX()) * fMul;
+ double fScaleY = boost::rational_cast<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 cc2d6bbecef7..f3b61dcafae6 100644
--- a/filter/source/graphicfilter/ios2met/ios2met.cxx
+++ b/filter/source/graphicfilter/ios2met/ios2met.cxx
@@ -2125,9 +2125,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),Fraction(10,xr),Fraction(10,yr));
+ aGlobMapMode=MapMode(MAP_INCH,Point(0,0),boost::rational<long>(10,xr),boost::rational<long>(10,yr));
else if (nUnitType==0x01 && xr>0 && yr>0)
- aGlobMapMode=MapMode(MAP_CM,Point(0,0),Fraction(10,xr),Fraction(10,yr));
+ aGlobMapMode=MapMode(MAP_CM,Point(0,0),boost::rational<long>(10,xr),boost::rational<long>(10,yr));
else
aGlobMapMode=MapMode();
diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx
index 41ba717b6b13..b0d07d805a3b 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;
- Fraction aHRes;
- Fraction aVRes;
+ boost::rational<long> aHRes;
+ boost::rational<long> 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 = Fraction( 1, 1 );
+ aHRes = aVRes = boost::rational<long>( 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 c95991d5e2da..dbba04cb9983 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;
- Fraction aFractX( 1, mnXResFixed >> 16 );
- Fraction aFractY( 1, mnYResFixed >> 16 );
+ boost::rational<long> aFractX( 1, mnXResFixed >> 16 );
+ boost::rational<long> 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 4606271017a9..82575a5d057c 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),Fraction(1,nRX),Fraction(1,nRY));
+ MapMode aMapMode(MAP_INCH,Point(0,0),boost::rational<long>(1,nRX),boost::rational<long>(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 2e9227042eb7..0c2b757284a3 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(), Fraction( 1, EES_MAP_FRACTION ), Fraction( 1, EES_MAP_FRACTION ) )
+ , maMapModeDest( MAP_INCH, Point(), boost::rational<long>( 1, EES_MAP_FRACTION ), boost::rational<long>( 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 1fe026ce0fed..26db18f9b0f1 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() == Fraction( 1, 1 ),
+ DBG_ASSERT( pMtf->GetPrefMapMode().GetScaleX() == boost::rational<long>( 1, 1 ),
"X-Skalierung im Mtf" );
- DBG_ASSERT( pMtf->GetPrefMapMode().GetScaleY() == Fraction( 1, 1 ),
+ DBG_ASSERT( pMtf->GetPrefMapMode().GetScaleY() == boost::rational<long>( 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( Fraction( aS.Width(), aPrefS.Width() ),
- Fraction( aS.Height(), aPrefS.Height() ) );
+ pMtf->Scale( boost::rational<long>( aS.Width(), aPrefS.Width() ),
+ boost::rational<long>( aS.Height(), aPrefS.Height() ) );
pMtf->SetPrefMapMode( MAP_100TH_MM );
pMtf->SetPrefSize( aS );
}
@@ -3088,11 +3088,11 @@ void SvxMSDffManager::ScaleEmu( sal_Int32& rVal ) const
sal_uInt32 SvxMSDffManager::ScalePt( sal_uInt32 nVal ) const
{
MapUnit eMap = pSdrModel->GetScaleUnit();
- 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() );
+ 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() );
}
sal_Int32 SvxMSDffManager::ScalePoint( sal_Int32 nVal ) const
@@ -3108,31 +3108,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();
- 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
+ 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
// For 100TH_MM -> 2540/576=635/144
// For Twip -> 1440/576=5/2
- nMapMul = aFact.GetNumerator();
- nMapDiv = aFact.GetDenominator();
+ nMapMul = aFact.numerator();
+ nMapDiv = aFact.denominator();
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.GetNumerator();
- nDiv=aFact.GetDenominator()*360;
- aFact=Fraction(nMul,nDiv); // try again to shorten it
+ nMul=aFact.numerator();
+ nDiv=aFact.denominator()*360;
+ aFact=boost::rational<long>(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.GetNumerator();
- nEmuDiv=aFact.GetDenominator();
+ nEmuMul=aFact.numerator();
+ nEmuDiv=aFact.denominator();
// And something for typographic Points
aFact=GetMapFactor(MAP_POINT,eMap).X();
- nPntMul=aFact.GetNumerator();
- nPntDiv=aFact.GetDenominator();
+ nPntMul=aFact.numerator();
+ nPntDiv=aFact.denominator();
}
else
{
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index e4c54f028c43..b6300bb03d38 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -2470,9 +2470,9 @@ Size SdrPowerPointImport::GetPageSize() const
long nInchMul = 1, nInchDiv = 1;
if ( bInch )
{ // temporarily convert size (for rounding it) from inch to metric units
- Fraction aFact(GetMapFactor(eMap,MAP_100TH_MM).X());
- nInchMul = aFact.GetNumerator();
- nInchDiv = aFact.GetDenominator();
+ boost::rational<long> aFact = GetMapFactor(eMap,MAP_100TH_MM).X();
+ nInchMul = aFact.numerator();
+ nInchDiv = aFact.denominator();
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 8aceae6e9307..5d19fd77bd6f 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -23,7 +23,6 @@
#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 6d2efbad1713..6dff611d8519 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() );
- Fraction aFractionX( aMapMode.GetScaleX() );
- Fraction aFractionY( aMapMode.GetScaleY() );
+ boost::rational<long> aFractionX = aMapMode.GetScaleX();
+ boost::rational<long> aFractionY = aMapMode.GetScaleY();
mpVDev->Push();
Size aSize( OutputDevice::LogicToLogic( rSize100thmm, MAP_100TH_MM, aMapMode ) );
- aMapMode.SetScaleX( aFractionX *= Fraction( aSize.Width(), aPrefSize.Width() ) );
- aMapMode.SetScaleY( aFractionY *= Fraction( aSize.Height(), aPrefSize.Height() ) );
+ aMapMode.SetScaleX( aFractionX *= boost::rational<long>( aSize.Width(), aPrefSize.Width() ) );
+ aMapMode.SetScaleY( aFractionY *= boost::rational<long>( aSize.Height(), aPrefSize.Height() ) );
Point aOffset( OutputDevice::LogicToLogic( rPos100thmm, MAP_100TH_MM, aMapMode ) );
aMapMode.SetOrigin( aOffset += aMapMode.GetOrigin() );
diff --git a/forms/source/richtext/richtextimplcontrol.cxx b/forms/source/richtext/richtextimplcontrol.cxx
index 2bae5a457e66..55e039c0d375 100644
--- a/forms/source/richtext/richtextimplcontrol.cxx
+++ b/forms/source/richtext/richtextimplcontrol.cxx
@@ -515,7 +515,7 @@ namespace frm
void RichTextControlImpl::notifyZoomChanged()
{
- const Fraction& rZoom = m_pAntiImpl->GetZoom();
+ const boost::rational<long>& rZoom = m_pAntiImpl->GetZoom();
MapMode aMapMode( m_pAntiImpl->GetMapMode() );
aMapMode.SetScaleX( rZoom );
diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx
index 02ee8f19bba4..74f9236119d4 100644
--- a/include/oox/export/chartexport.hxx
+++ b/include/oox/export/chartexport.hxx
@@ -84,7 +84,7 @@ public:
private:
sal_Int32 mnXmlNamespace;
sal_Int32 mnSeriesCount;
- Fraction maFraction;
+ boost::rational<long> maFraction;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxChartModel;
com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > mxDiagram;
com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > mxNewDiagram;
diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx
index 995ef356bae7..250729b243a3 100644
--- a/include/oox/export/shapes.hxx
+++ b/include/oox/export/shapes.hxx
@@ -66,7 +66,7 @@ protected:
private:
sal_Int32 mnXmlNamespace;
- Fraction maFraction;
+ boost::rational<long> maFraction;
MapMode maMapModeSrc, maMapModeDest;
::com::sun::star::awt::Size MapSize( const ::com::sun::star::awt::Size& ) const;
diff --git a/include/sfx2/ipclient.hxx b/include/sfx2/ipclient.hxx
index 10ab174bbdbd..350c7ac14944 100644
--- a/include/sfx2/ipclient.hxx
+++ b/include/sfx2/ipclient.hxx
@@ -34,7 +34,7 @@ class SfxInPlaceClient_Impl;
class SfxViewShell;
class SfxObjectShell;
namespace vcl { class Window; }
-class Fraction;
+namespace boost { template<typename T> class rational; }
@@ -74,10 +74,10 @@ public:
bool SetObjArea( const Rectangle & );
Rectangle GetObjArea() const;
Rectangle GetScaledObjArea() const;
- void SetSizeScale( const Fraction & rScaleWidth, const Fraction & rScaleHeight );
- bool SetObjAreaAndScale( const Rectangle&, const Fraction&, const Fraction& );
- const Fraction& GetScaleWidth() const;
- const Fraction& GetScaleHeight() const;
+ void SetSizeScale( const boost::rational<long> & rScaleWidth, const boost::rational<long> & rScaleHeight );
+ bool SetObjAreaAndScale( const Rectangle&, const boost::rational<long>&, const boost::rational<long>& );
+ const boost::rational<long>& GetScaleWidth() const;
+ const boost::rational<long>& GetScaleHeight() const;
void Invalidate();
static SfxInPlaceClient* GetClient( SfxObjectShell* pDoc, const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& xObject );
sal_Int64 GetAspect() const;
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index d9d4e956e5cd..42487bcc8333 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -638,8 +638,8 @@ public:
SAL_DLLPRIVATE void DoDraw_Impl( OutputDevice* pDev,
const Point & rViewPos,
- const Fraction & rScaleX,
- const Fraction & rScaleY,
+ const boost::rational<long>& rScaleX,
+ const boost::rational<long>& rScaleY,
const JobSetup & rSetup,
sal_uInt16 nAspect );
diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx
index 1d043fcd2ded..9acc0e23fd85 100644
--- a/include/sfx2/viewfrm.hxx
+++ b/include/sfx2/viewfrm.hxx
@@ -43,7 +43,7 @@ class SfxProgress;
class SvData;
class SfxViewShell;
class SystemWindow;
-class Fraction;
+namespace boost { template<typename T> class rational; }
class Point;
class Size;
class SfxChildWindow;
@@ -118,7 +118,7 @@ public:
SfxBindings& GetBindings() { return *pBindings; }
const SfxBindings& GetBindings() const { return *pBindings; }
vcl::Window& GetWindow() const;
- virtual void SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY );
+ virtual void SetZoomFactor( const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY );
SfxProgress* GetProgress() const;
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index 20114cfac991..827bdfd8a615 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -39,7 +39,7 @@
class SfxBaseController;
class Size;
-class Fraction;
+namespace boost { template<typename T> class rational; }
namespace vcl { class Window; }
class KeyEvent;
class WorkWindow;
@@ -146,7 +146,7 @@ protected:
virtual void InnerResizePixel( const Point &rOfs, const Size &rSize );
virtual void OuterResizePixel( const Point &rOfs, const Size &rSize );
- virtual void SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY );
+ virtual void SetZoomFactor( const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY );
virtual void Move();
diff --git a/include/svtools/imap.hxx b/include/svtools/imap.hxx
index 951251d11bf0..37a513352778 100644
--- a/include/svtools/imap.hxx
+++ b/include/svtools/imap.hxx
@@ -27,7 +27,7 @@
class Point;
class Rectangle;
class Size;
-class Fraction;
+namespace boost { template<typename T> class rational; }
class IMapObject;
typedef ::std::vector< IMapObject* > IMapObjectList_impl;
@@ -117,7 +117,7 @@ public:
void SetName( const OUString& rName ) { aName = rName; }
// skaliert alle Objekte der ImageMap entpr. dem uebergebenen Faktor
- void Scale( const Fraction& rFractX, const Fraction& rFracY );
+ void Scale( const boost::rational<long>& rFractX, const boost::rational<long>& rFracY );
// Im-/Export
void Write ( SvStream& rOStm, const OUString& rBaseURL ) const;
diff --git a/include/svtools/imapcirc.hxx b/include/svtools/imapcirc.hxx
index 2ce4127b1bc7..fd6c164c439a 100644
--- a/include/svtools/imapcirc.hxx
+++ b/include/svtools/imapcirc.hxx
@@ -23,7 +23,7 @@
#include <tools/gen.hxx>
#include <svtools/imapobj.hxx>
-class Fraction;
+namespace boost { template<typename T> class rational; }
class SVT_DLLPUBLIC IMapCircleObject : public IMapObject
{
@@ -60,7 +60,7 @@ public:
// liefert das BoundRect des Kreis-Objektes in 1/100mm
virtual Rectangle GetBoundRect() const SAL_OVERRIDE;
- void Scale( const Fraction& rFractX, const Fraction& rFracY );
+ void Scale( const boost::rational<long>& rFractX, const boost::rational<long>& rFracY );
using IMapObject::IsEqual;
bool IsEqual( const IMapCircleObject& rEqObj );
diff --git a/include/svtools/imappoly.hxx b/include/svtools/imappoly.hxx
index 79ca52a0a1c7..e01b3114205b 100644
--- a/include/svtools/imappoly.hxx
+++ b/include/svtools/imappoly.hxx
@@ -24,7 +24,7 @@
#include <svtools/imapobj.hxx>
#include <tools/poly.hxx>
-class Fraction;
+namespace boost { template<typename T> class rational; }
class SVT_DLLPUBLIC IMapPolygonObject : public IMapObject
{
@@ -66,7 +66,7 @@ public:
const Rectangle& GetExtraEllipse() const { return aEllipse; }
void SetExtraEllipse( const Rectangle& rEllipse );
- void Scale( const Fraction& rFractX, const Fraction& rFracY );
+ void Scale( const boost::rational<long>& rFractX, const boost::rational<long>& rFracY );
using IMapObject::IsEqual;
bool IsEqual( const IMapPolygonObject& rEqObj );
diff --git a/include/svtools/imaprect.hxx b/include/svtools/imaprect.hxx
index 17c96841a5d1..6855fb36926c 100644
--- a/include/svtools/imaprect.hxx
+++ b/include/svtools/imaprect.hxx
@@ -23,7 +23,7 @@
#include <svtools/imapobj.hxx>
#include <tools/gen.hxx>
-class Fraction;
+namespace boost { template<typename T> class rational; }
class SVT_DLLPUBLIC IMapRectangleObject : public IMapObject
{
@@ -58,7 +58,7 @@ public:
// liefert das BoundRect des Rechteck-Objektes in 1/100mm
virtual Rectangle GetBoundRect() const SAL_OVERRIDE { return aRect; }
- void Scale( const Fraction& rFractX, const Fraction& rFracY );
+ void Scale( const boost::rational<long>& rFractX, const boost::rational<long>& rFracY );
using IMapObject::IsEqual;
bool IsEqual( const IMapRectangleObject& rEqObj );
diff --git a/include/svtools/ruler.hxx b/include/svtools/ruler.hxx
index 49d4e424da4b..a27a92175a5f 100644
--- a/include/svtools/ruler.hxx
+++ b/include/svtools/ruler.hxx
@@ -644,7 +644,7 @@ private:
RulerType meDragType;
MapUnit meSourceUnit;
FieldUnit meUnit;
- Fraction maZoom;
+ boost::rational<long> maZoom;
bool mbCalc;
bool mbFormat;
bool mbDrag;
@@ -745,8 +745,8 @@ public:
void SetUnit( FieldUnit eNewUnit );
FieldUnit GetUnit() const { return meUnit; }
- void SetZoom( const Fraction& rNewZoom );
- Fraction GetZoom() const { return maZoom; }
+ void SetZoom( const boost::rational<long>& rNewZoom );
+ boost::rational<long> GetZoom() const { return maZoom; }
void SetSourceUnit( MapUnit eNewUnit ) { meSourceUnit = eNewUnit; }
MapUnit GetSourceUnit() const { return meSourceUnit; }
diff --git a/include/svx/obj3d.hxx b/include/svx/obj3d.hxx
index ac7e52493ef7..c1e37963c70c 100644
--- a/include/svx/obj3d.hxx
+++ b/include/svx/obj3d.hxx
@@ -153,7 +153,7 @@ public:
virtual void SetPage(SdrPage* pNewPage) SAL_OVERRIDE;
virtual void SetModel(SdrModel* pNewModel) SAL_OVERRIDE;
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 SdrObjList* GetSubList() const SAL_OVERRIDE;
// Insert 3D object into the group; transfer to other owner!
diff --git a/include/svx/scene3d.hxx b/include/svx/scene3d.hxx
index 332fa2a7fa8d..b519126bea54 100644
--- a/include/svx/scene3d.hxx
+++ b/include/svx/scene3d.hxx
@@ -191,8 +191,8 @@ public:
virtual void NbcSetSnapRect(const Rectangle& rRect) SAL_OVERRIDE;
virtual void NbcMove(const Size& rSize) SAL_OVERRIDE;
- virtual void NbcResize(const Point& rRef, const Fraction& rXFact,
- const Fraction& rYFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRef, const boost::rational<long>& rXFact,
+ const boost::rational<long>& rYFact) SAL_OVERRIDE;
virtual void RecalcSnapRect() SAL_OVERRIDE;
virtual E3dScene* GetScene() const SAL_OVERRIDE;
diff --git a/include/svx/sdr/properties/defaultproperties.hxx b/include/svx/sdr/properties/defaultproperties.hxx
index 97fca16cb310..9e9defe1e65a 100644
--- a/include/svx/sdr/properties/defaultproperties.hxx
+++ b/include/svx/sdr/properties/defaultproperties.hxx
@@ -94,7 +94,7 @@ namespace sdr
virtual void ForceDefaultAttributes();
// Scale the included ItemSet.
- virtual void Scale(const Fraction& rScale) SAL_OVERRIDE;
+ virtual void Scale(const boost::rational<long>& rScale) SAL_OVERRIDE;
};
} // end of namespace properties
} // end of namespace sdr
diff --git a/include/svx/sdr/properties/properties.hxx b/include/svx/sdr/properties/properties.hxx
index 6229e45e388e..2bb32dfae246 100644
--- a/include/svx/sdr/properties/properties.hxx
+++ b/include/svx/sdr/properties/properties.hxx
@@ -30,7 +30,7 @@ class SdrObject;
class SfxItemSet;
class SfxPoolItem;
class SfxStyleSheet;
-class Fraction;
+namespace boost { template<typename T> class rational; }
class SfxItemPool;
class SdrModel;
@@ -146,7 +146,7 @@ namespace sdr
// Scale the local ItemSet as far as it contains metric items. This needs to be
// overloaded to do it for hierarchical objects like e.g. groups.
- virtual void Scale(const Fraction& rScale);
+ virtual void Scale(const boost::rational<long>& rScale);
// Move local items to a new ItemPool. This needs to be
// overloaded to do it for hierarchical objects like e.g. groups.
diff --git a/include/svx/svddrag.hxx b/include/svx/svddrag.hxx
index fd43db2bf1d7..1a11e0c6f4bb 100644
--- a/include/svx/svddrag.hxx
+++ b/include/svx/svddrag.hxx
@@ -22,7 +22,7 @@
#include <tools/gen.hxx>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
#include <svx/svxdllapi.h>
// Status information for specialized object dragging. In order for the model
@@ -146,8 +146,8 @@ public:
bool CheckMinMoved(const Point& rPnt);
long GetDX() const { return GetNow().X()-GetPrev().X(); }
long GetDY() const { return GetNow().Y()-GetPrev().Y(); }
- Fraction GetXFact() const;
- Fraction GetYFact() const;
+ boost::rational<long> GetXFact() const;
+ boost::rational<long> GetYFact() const;
SdrDragMethod* GetDragMethod() const { return pDragMethod; }
void SetDragMethod(SdrDragMethod* pMth) { pDragMethod=pMth; }
diff --git a/include/svx/svddrgmt.hxx b/include/svx/svddrgmt.hxx
index 6e2fa4a87359..ad37eeee3099 100644
--- a/include/svx/svddrgmt.hxx
+++ b/include/svx/svddrgmt.hxx
@@ -258,8 +258,8 @@ public:
class SVX_DLLPUBLIC SdrDragResize : public SdrDragMethod
{
protected:
- Fraction aXFact;
- Fraction aYFact;
+ boost::rational<long> aXFact;
+ boost::rational<long> aYFact;
public:
TYPEINFO_OVERRIDE();
diff --git a/include/svx/svdedtv.hxx b/include/svx/svdedtv.hxx
index 178282064075..12b27b84bb41 100644
--- a/include/svx/svdedtv.hxx
+++ b/include/svx/svdedtv.hxx
@@ -212,8 +212,8 @@ public:
// waagerechte Linie hat z.B. immer eine Hoehe von 0.
void SetMarkedObjRect(const Rectangle& rRect, bool bCopy=false);
void MoveMarkedObj(const Size& rSiz, bool bCopy=false);
- void ResizeMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy=false);
- void ResizeMultMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, const bool bCopy, const bool bWdh, const bool bHgt);
+ void ResizeMarkedObj(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bCopy=false);
+ void ResizeMultMarkedObj(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, const bool bCopy, const bool bWdh, const bool bHgt);
long GetMarkedObjRotate() const;
void RotateMarkedObj(const Point& rRef, long nWink, bool bCopy=false);
void MirrorMarkedObj(const Point& rRef1, const Point& rRef2, bool bCopy=false);
@@ -228,7 +228,7 @@ public:
void CopyMarkedObj();
void SetAllMarkedRect(const Rectangle& rRect, bool bCopy=false) { SetMarkedObjRect(rRect,bCopy); }
void MoveAllMarked(const Size& rSiz, bool bCopy=false) { MoveMarkedObj (rSiz,bCopy); }
- void ResizeAllMarked(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy=false) { ResizeMarkedObj (rRef,xFact,yFact,bCopy); }
+ void ResizeAllMarked(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bCopy=false) { ResizeMarkedObj (rRef,xFact,yFact,bCopy); }
long GetAllMarkedRotate() const { return GetMarkedObjRotate(); }
void RotateAllMarked(const Point& rRef, long nWink, bool bCopy=false) { RotateMarkedObj(rRef,nWink,bCopy); }
void MirrorAllMarked(const Point& rRef1, const Point& rRef2, bool bCopy=false) { MirrorMarkedObj(rRef1,rRef2,bCopy); }
diff --git a/include/svx/svdetc.hxx b/include/svx/svdetc.hxx
index e524364ed080..2ec177c4daa9 100644
--- a/include/svx/svdetc.hxx
+++ b/include/svx/svdetc.hxx
@@ -62,7 +62,7 @@ friend class SdrAttrObj;
Color aFontColor;
sal_uIntPtr nFontHeight;
MapUnit eMapUnit;
- Fraction aMapFraction;
+ boost::rational<long> aMapFraction;
private:
static SdrEngineDefaults& GetDefaults();
@@ -92,8 +92,8 @@ public:
static void SetMapUnit(MapUnit eMap) { GetDefaults().eMapUnit=eMap; }
static MapUnit GetMapUnit() { return GetDefaults().eMapUnit; }
// Default MapFraction ist 1/1.
- static void SetMapFraction(const Fraction& rMap) { GetDefaults().aMapFraction=rMap; }
- static Fraction GetMapFraction() { return GetDefaults().aMapFraction; }
+ static void SetMapFraction(const boost::rational<long>& rMap) { GetDefaults().aMapFraction=rMap; }
+ static boost::rational<long> GetMapFraction() { return GetDefaults().aMapFraction; }
// Einen Outliner mit den engineglobalen
// Defaulteinstellungen auf dem Heap erzeugen.
diff --git a/include/svx/svdglev.hxx b/include/svx/svdglev.hxx
index 8a9e420815a2..b1576bda5047 100644
--- a/include/svx/svdglev.hxx
+++ b/include/svx/svdglev.hxx
@@ -78,7 +78,7 @@ public:
void DeleteMarkedGluePoints();
void MoveMarkedGluePoints (const Size& rSiz, bool bCopy=false);
- void ResizeMarkedGluePoints(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy=false);
+ void ResizeMarkedGluePoints(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bCopy=false);
void RotateMarkedGluePoints(const Point& rRef, long nWink, bool bCopy=false);
void MirrorMarkedGluePoints(const Point& rRef1, const Point& rRef2, bool bCopy=false);
void MirrorMarkedGluePointsHorizontal(bool bCopy=false);
diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index 0d9b03b3480a..850185edb581 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -155,12 +155,12 @@ protected:
Link aIOProgressLink;
OUString aTablePath;
Size aMaxObjSize; // e.g. for auto-growing text
- Fraction aObjUnit; // description of the coordinate units for ClipBoard, Drag&Drop, ...
+ boost::rational<long> aObjUnit; // description of the coordinate units for ClipBoard, Drag&Drop, ...
MapUnit eObjUnit; // see above
FieldUnit eUIUnit; // unit, scale (e.g. 1/1000) for the UI (status bar) is set by ImpSetUIUnit()
- Fraction aUIScale; // see above
+ boost::rational<long> aUIScale; // see above
OUString aUIUnitStr; // see above
- Fraction aUIUnitFact; // see above
+ boost::rational<long> aUIUnitFact; // see above
int nUIUnitKomma; // see above
SdrLayerAdmin* pLayerAdmin;
@@ -374,10 +374,10 @@ public:
// with the correct sizes.
MapUnit GetScaleUnit() const { return eObjUnit; }
void SetScaleUnit(MapUnit eMap);
- const Fraction& GetScaleFraction() const { return aObjUnit; }
- void SetScaleFraction(const Fraction& rFrac);
+ const boost::rational<long>& GetScaleFraction() const { return aObjUnit; }
+ void SetScaleFraction(const boost::rational<long>& rFrac);
// Setting both simultaneously performs a little better
- void SetScaleUnit(MapUnit eMap, const Fraction& rFrac);
+ void SetScaleUnit(MapUnit eMap, const boost::rational<long>& rFrac);
// maximal size e.g. for auto growing texts
const Size& GetMaxObjSize() const { return aMaxObjSize; }
@@ -387,12 +387,12 @@ public:
void SetUIUnit(FieldUnit eUnit);
FieldUnit GetUIUnit() const { return eUIUnit; }
// The scale of the drawing. Default 1/1.
- void SetUIScale(const Fraction& rScale);
- const Fraction& GetUIScale() const { return aUIScale; }
+ void SetUIScale(const boost::rational<long>& rScale);
+ const boost::rational<long>& GetUIScale() const { return aUIScale; }
// Setting both simultaneously performs a little better
- void SetUIUnit(FieldUnit eUnit, const Fraction& rScale);
+ void SetUIUnit(FieldUnit eUnit, const boost::rational<long>& rScale);
- const Fraction& GetUIUnitFact() const { return aUIUnitFact; }
+ const boost::rational<long>& GetUIUnitFact() const { return aUIUnitFact; }
const OUString& GetUIUnitStr() const { return aUIUnitStr; }
int GetUIUnitKomma() const { return nUIUnitKomma; }
bool IsUIOnlyKomma() const { return bUIOnlyKomma; }
@@ -400,7 +400,7 @@ public:
static void TakeUnitStr(FieldUnit eUnit, OUString& rStr);
void TakeMetricStr(long nVal, OUString& rStr, bool bNoUnitChars = false, sal_Int32 nNumDigits = -1) const;
void TakeWinkStr(long nWink, OUString& rStr, bool bNoDegChar = false) const;
- void TakePercentStr(const Fraction& rVal, OUString& rStr, bool bNoPercentChar = false) const;
+ void TakePercentStr(const boost::rational<long>& rVal, OUString& rStr, bool bNoPercentChar = false) const;
// RecalcPageNums is ordinarily only called by the Page.
bool IsPagNumsDirty() const { return bPagNumsDirty; };
diff --git a/include/svx/svdoashp.hxx b/include/svx/svdoashp.hxx
index 169dd13b9dca..bca9283c6f93 100644
--- a/include/svx/svdoashp.hxx
+++ b/include/svx/svdoashp.hxx
@@ -188,13 +188,13 @@ public:
virtual const Rectangle& GetLogicRect() const SAL_OVERRIDE;
virtual void Move(const Size& rSiz) SAL_OVERRIDE;
- virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true) 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 Shear(const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE;
virtual void SetSnapRect(const Rectangle& rRect) SAL_OVERRIDE;
virtual void SetLogicRect(const Rectangle& rRect) SAL_OVERRIDE;
virtual void NbcMove(const Size& rSiz) 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 NbcRotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE;
virtual void NbcMirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE;
virtual void NbcShear(const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE;
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index 81b176a668f5..f1dc3a3bf94c 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -672,13 +672,13 @@ public:
// Objekte sollten i.d.R. nur die Nbc-Methoden ueberladen.
// Nbc bedeutet: 'NoBroadcast'.
virtual void NbcMove (const Size& rSiz);
- virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+ virtual void NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact);
virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
virtual void NbcShear (const Point& rRef, long nWink, double tn, bool bVShear);
virtual void Move (const Size& rSiz);
- virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true);
+ virtual void Resize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bUnsetRelative = true);
virtual void Rotate(const Point& rRef, long nWink, double sn, double cs);
virtual void Mirror(const Point& rRef1, const Point& rRef2);
virtual void Shear (const Point& rRef, long nWink, double tn, bool bVShear);
diff --git a/include/svx/svdocapt.hxx b/include/svx/svdocapt.hxx
index e7e372866280..a10b0f7f6e1b 100644
--- a/include/svx/svdocapt.hxx
+++ b/include/svx/svdocapt.hxx
@@ -116,7 +116,7 @@ public:
virtual Pointer GetCreatePointer() const SAL_OVERRIDE;
virtual void NbcMove(const Size& rSiz) 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 NbcSetRelativePos(const Point& rPnt) SAL_OVERRIDE;
virtual Point GetRelativePos() const SAL_OVERRIDE;
diff --git a/include/svx/svdocirc.hxx b/include/svx/svdocirc.hxx
index 40386fdf989d..036a4bee4df4 100644
--- a/include/svx/svdocirc.hxx
+++ b/include/svx/svdocirc.hxx
@@ -112,7 +112,7 @@ public:
virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const SAL_OVERRIDE;
virtual Pointer GetCreatePointer() const SAL_OVERRIDE;
virtual void NbcMove(const Size& aSiz) 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 NbcMirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE;
virtual void NbcShear (const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE;
virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const SAL_OVERRIDE;
diff --git a/include/svx/svdoedge.hxx b/include/svx/svdoedge.hxx
index 438c5e764188..8161ca55cf2b 100644
--- a/include/svx/svdoedge.hxx
+++ b/include/svx/svdoedge.hxx
@@ -264,7 +264,7 @@ public:
virtual void NbcSetSnapRect(const Rectangle& rRect) SAL_OVERRIDE;
virtual void NbcMove(const Size& aSize) SAL_OVERRIDE;
- virtual void NbcResize(const Point& rRefPnt, const Fraction& aXFact, const Fraction& aYFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRefPnt, const boost::rational<long>& aXFact, const boost::rational<long>& aYFact) SAL_OVERRIDE;
// #i54102# added rotate, mirrorn and shear support
virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE;
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx
index e60060968fae..3179369711e6 100644
--- a/include/svx/svdograf.hxx
+++ b/include/svx/svdograf.hxx
@@ -162,7 +162,7 @@ public:
virtual sal_uInt32 GetHdlCount() const SAL_OVERRIDE;
virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const 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 NbcRotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE;
virtual void NbcMirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE;
virtual void NbcShear (const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE;
diff --git a/include/svx/svdogrp.hxx b/include/svx/svdogrp.hxx
index 4a89e8f3a61d..4dc70df5b93d 100644
--- a/include/svx/svdogrp.hxx
+++ b/include/svx/svdogrp.hxx
@@ -85,7 +85,7 @@ public:
virtual long GetShearAngle(bool bVertical = false) const SAL_OVERRIDE;
virtual void Move(const Size& rSiz) SAL_OVERRIDE;
- virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true) 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 Rotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE;
virtual void Mirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE;
virtual void Shear(const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE;
@@ -95,7 +95,7 @@ public:
virtual void SetLogicRect(const Rectangle& rRect) SAL_OVERRIDE;
virtual void NbcMove(const Size& rSiz) 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 NbcRotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE;
virtual void NbcMirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE;
virtual void NbcShear(const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE;
diff --git a/include/svx/svdomeas.hxx b/include/svx/svdomeas.hxx
index 5cea5fe2de8b..f0cb6a7b624c 100644
--- a/include/svx/svdomeas.hxx
+++ b/include/svx/svdomeas.hxx
@@ -117,7 +117,7 @@ public:
virtual Pointer GetCreatePointer() const SAL_OVERRIDE;
virtual void NbcMove(const Size& rSiz) 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 NbcRotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE;
virtual void NbcMirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE;
virtual void NbcShear(const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE;
diff --git a/include/svx/svdoole2.hxx b/include/svx/svdoole2.hxx
index f14646b20428..a27a35e8d0eb 100644
--- a/include/svx/svdoole2.hxx
+++ b/include/svx/svdoole2.hxx
@@ -136,7 +136,7 @@ public:
SdrOle2Obj& operator=(const SdrOle2Obj& rObj);
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 NbcSetSnapRect(const Rectangle& rRect) SAL_OVERRIDE;
virtual void NbcSetLogicRect(const Rectangle& rRect) SAL_OVERRIDE;
virtual void SetGeoData(const SdrObjGeoData& rGeo) SAL_OVERRIDE;
@@ -167,7 +167,7 @@ public:
const OUString& aMediaType );
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetParentXModel() const;
- bool CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHeight, Size& aObjAreaSize );
+ bool CalculateNewScaling( boost::rational<long>& aScaleWidth, boost::rational<long>& aScaleHeight, Size& aObjAreaSize );
bool AddOwnLightClient();
// handy to get the empty replacement graphic without accessing all the old stuff
diff --git a/include/svx/svdopath.hxx b/include/svx/svdopath.hxx
index b9cb18f73630..f3e4a46b9004 100644
--- a/include/svx/svdopath.hxx
+++ b/include/svx/svdopath.hxx
@@ -114,7 +114,7 @@ public:
basegfx::B2DPolyPolygon getDragPolyPolygon(const SdrDragStat& rDrag) const;
virtual void NbcMove(const Size& aSize) SAL_OVERRIDE;
- virtual void NbcResize(const Point& rRefPnt, const Fraction& aXFact, const Fraction& aYFact) SAL_OVERRIDE;
+ virtual void NbcResize(const Point& rRefPnt, const boost::rational<long>& aXFact, const boost::rational<long>& aYFact) SAL_OVERRIDE;
virtual void NbcRotate(const Point& rRefPnt, long nAngle, double fSin, double fCos) SAL_OVERRIDE;
virtual void NbcMirror(const Point& rRefPnt1, const Point& rRefPnt2) SAL_OVERRIDE;
virtual void NbcShear(const Point& rRefPnt, long nAngle, double fTan, bool bVShear) SAL_OVERRIDE;
diff --git a/include/svx/svdorect.hxx b/include/svx/svdorect.hxx
index afd1d57b08b4..db40274f3496 100644
--- a/include/svx/svdorect.hxx
+++ b/include/svx/svdorect.hxx
@@ -105,7 +105,7 @@ public:
virtual Pointer GetCreatePointer() const SAL_OVERRIDE;
virtual void NbcMove(const Size& rSiz) 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 NbcRotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE;
virtual void NbcMirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE;
virtual void NbcShear(const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE;
diff --git a/include/svx/svdotable.hxx b/include/svx/svdotable.hxx
index 2594a3544e3d..8b461b6c6aaa 100644
--- a/include/svx/svdotable.hxx
+++ b/include/svx/svdotable.hxx
@@ -241,7 +241,7 @@ public:
virtual Pointer GetCreatePointer() const SAL_OVERRIDE;
virtual void NbcMove(const Size& rSiz) 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 bool BegTextEdit(SdrOutliner& rOutl) SAL_OVERRIDE;
virtual void EndTextEdit(SdrOutliner& rOutl) SAL_OVERRIDE;
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index a2b7b1f3e21c..94a032c2b585 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -264,7 +264,7 @@ private:
Rectangle& rTextRect,
Rectangle& rAnchorRect,
Rectangle& rPaintRect,
- Fraction& aFitXKorreg ) const;
+ boost::rational<long>& aFitXKorreg ) const;
void ImpAutoFitText( SdrOutliner& rOutliner ) const;
static void ImpAutoFitText( SdrOutliner& rOutliner, const Size& rShapeSize, bool bIsVerticalWriting );
SVX_DLLPRIVATE SdrObject* ImpConvertContainedTextToSdrPathObjs(bool bToPoly) const;
@@ -284,7 +284,7 @@ protected:
SdrObject* ImpConvertMakeObj(const basegfx::B2DPolyPolygon& rPolyPolygon, bool bClosed, bool bBezier, bool bNoSetAttr = false) const;
SdrObject* ImpConvertAddText(SdrObject* pObj, bool bBezier) const;
void ImpSetTextStyleSheetListeners();
- void ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextSize, const Size& rShapeSize, Fraction& rFitXKorreg) const;
+ void ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextSize, const Size& rShapeSize, boost::rational<long>& rFitXKorreg) const;
void ImpJustifyRect(Rectangle& rRect) const;
void ImpCheckShear();
Rectangle ImpDragCalcRect(const SdrDragStat& rDrag) const;
@@ -465,7 +465,7 @@ public:
virtual Pointer GetCreatePointer() const SAL_OVERRIDE;
virtual void NbcMove(const Size& rSiz) 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 NbcRotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE;
virtual void NbcMirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE;
virtual void NbcShear(const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE;
diff --git a/include/svx/svdouno.hxx b/include/svx/svdouno.hxx
index 0a796da753ba..f22cb57f161f 100644
--- a/include/svx/svdouno.hxx
+++ b/include/svx/svdouno.hxx
@@ -80,7 +80,7 @@ public:
virtual SdrUnoObj* Clone() const SAL_OVERRIDE;
SdrUnoObj& operator= (const SdrUnoObj& rObj);
- 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 NbcSetLayer(SdrLayerID nLayer) SAL_OVERRIDE;
// SpecialDrag support
diff --git a/include/svx/svdovirt.hxx b/include/svx/svdovirt.hxx
index 766b8070c9ec..82c311ef9c5f 100644
--- a/include/svx/svdovirt.hxx
+++ b/include/svx/svdovirt.hxx
@@ -101,13 +101,13 @@ public:
virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const SAL_OVERRIDE;
virtual void NbcMove(const Size& rSiz) 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 NbcRotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE;
virtual void NbcMirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE;
virtual void NbcShear(const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE;
virtual void Move(const Size& rSiz) SAL_OVERRIDE;
- virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true) 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 Rotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE;
virtual void Mirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE;
virtual void Shear(const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE;
diff --git a/include/svx/svdpoev.hxx b/include/svx/svdpoev.hxx
index ef73aa49b154..b0adf6d09f97 100644
--- a/include/svx/svdpoev.hxx
+++ b/include/svx/svdpoev.hxx
@@ -64,7 +64,7 @@ public:
bool IsDeleteMarkedPointsPossible() const SAL_OVERRIDE;
void MoveMarkedPoints(const Size& rSiz);
- void ResizeMarkedPoints(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+ void ResizeMarkedPoints(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact);
void RotateMarkedPoints(const Point& rRef, long nWink);
// Hierbei entstehen eventuell beliebig viele neue Objekte:
diff --git a/include/svx/svdsnpv.hxx b/include/svx/svdsnpv.hxx
index 815656a77a39..c963d8031ad9 100644
--- a/include/svx/svdsnpv.hxx
+++ b/include/svx/svdsnpv.hxx
@@ -51,10 +51,10 @@ protected:
class ImplHelpLineOverlay* mpHelpLineOverlay;
Size aMagnSiz;
- Fraction aSnapWdtX;
- Fraction aSnapWdtY;
+ boost::rational<long> aSnapWdtX;
+ boost::rational<long> aSnapWdtY;
- sal_uInt16 nMagnSizPix;
+ sal_uInt16 nMagnSizPix;
long nSnapAngle;
long nEliminatePolyPointLimitAngle;
@@ -98,9 +98,9 @@ public:
virtual void BrkAction() SAL_OVERRIDE; // f.abg.Klassen Actions z,B, Draggen abbrechen.
virtual void TakeActionRect(Rectangle& rRect) const SAL_OVERRIDE;
- void SetSnapGridWidth(const Fraction& rX, const Fraction& rY) { aSnapWdtX=rX; aSnapWdtY=rY; }
- const Fraction& GetSnapGridWidthX() const { return aSnapWdtX; }
- const Fraction& GetSnapGridWidthY() const { return aSnapWdtY; }
+ void SetSnapGridWidth(const boost::rational<long>& rX, const boost::rational<long>& rY) { aSnapWdtX=rX; aSnapWdtY=rY; }
+ const boost::rational<long>& GetSnapGridWidthX() const { return aSnapWdtX; }
+ const boost::rational<long>& GetSnapGridWidthY() const { return aSnapWdtY; }
void SetSnapMagnetic(const Size& rSiz) { if (rSiz!=aMagnSiz) { aMagnSiz=rSiz; } }
const Size& GetSnapMagnetic() const { return aMagnSiz; }
diff --git a/include/svx/svdtrans.hxx b/include/svx/svdtrans.hxx
index b287c23816f3..d29ab1f77e9a 100644
--- a/include/svx/svdtrans.hxx
+++ b/include/svx/svdtrans.hxx
@@ -22,7 +22,7 @@
#include <rtl/ustring.hxx>
#include <svx/svxdllapi.h>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
#include <tools/gen.hxx>
#include <tools/poly.hxx>
#include <vcl/field.hxx>
@@ -55,10 +55,10 @@ inline void MovePoly(Polygon& rPoly, const Size& S) { rPoly.Move(S.Width(),
inline void MovePoly(tools::PolyPolygon& rPoly, const Size& S) { rPoly.Move(S.Width(),S.Height()); }
void MoveXPoly(XPolygon& rPoly, const Size& S);
-SVX_DLLPUBLIC void ResizeRect(Rectangle& rRect, const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bNoJustify = false);
-inline void ResizePoint(Point& rPnt, const Point& rRef, Fraction xFact, Fraction yFact);
-void ResizePoly(Polygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact);
-void ResizeXPoly(XPolygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+SVX_DLLPUBLIC void ResizeRect(Rectangle& rRect, const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bNoJustify = false);
+inline void ResizePoint(Point& rPnt, const Point& rRef, boost::rational<long> xFact, boost::rational<long> yFact);
+void ResizePoly(Polygon& rPoly, const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact);
+void ResizeXPoly(XPolygon& rPoly, const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact);
inline void RotatePoint(Point& rPnt, const Point& rRef, double sn, double cs);
SVX_DLLPUBLIC void RotatePoly(Polygon& rPoly, const Point& rRef, double sn, double cs);
@@ -102,12 +102,10 @@ void CrookStretchPoly(XPolyPolygon& rPoly, const Point& rCenter, const Point& rR
/* Inline */
/**************************************************************************************************/
-inline void ResizePoint(Point& rPnt, const Point& rRef, Fraction xFact, Fraction yFact)
+inline void ResizePoint(Point& rPnt, const Point& rRef, boost::rational<long> xFact, boost::rational<long> yFact)
{
- if (xFact.GetDenominator()==0) xFact=Fraction(xFact.GetNumerator(),1); // DivZero abfangen
- if (yFact.GetDenominator()==0) yFact=Fraction(yFact.GetNumerator(),1); // DivZero abfangen
- rPnt.X()=rRef.X()+ Round(((double)(rPnt.X()-rRef.X())*xFact.GetNumerator())/xFact.GetDenominator());
- rPnt.Y()=rRef.Y()+ Round(((double)(rPnt.Y()-rRef.Y())*yFact.GetNumerator())/yFact.GetDenominator());
+ rPnt.X()=rRef.X()+ Round(((double)(rPnt.X()-rRef.X())*xFact.numerator())/xFact.denominator());
+ rPnt.Y()=rRef.Y()+ Round(((double)(rPnt.Y()-rRef.Y())*yFact.numerator())/yFact.denominator());
}
inline void RotatePoint(Point& rPnt, const Point& rRef, double sn, double cs)
@@ -221,25 +219,25 @@ SVX_DLLPUBLIC void OrthoDistance4(const Point& rPt0, Point& rPt, bool bBigOrtho)
// Rechnung und Zwischenergebnis sind BigInt.
SVX_DLLPUBLIC long BigMulDiv(long nVal, long nMul, long nDiv);
-// Fehlerbehaftetes Kuerzen einer Fraction.
+// Fehlerbehaftetes Kuerzen einer boost::rational<long>.
// nDigits gibt an, wieviele signifikante Stellen in
// Zaehler/Nenner mindestens erhalten bleiben sollen.
-void Kuerzen(Fraction& rF, unsigned nDigits);
+void Kuerzen(boost::rational<long>& rF, unsigned nDigits);
class FrPair {
- Fraction aX;
- Fraction aY;
+ boost::rational<long> aX;
+ boost::rational<long> aY;
public:
FrPair() : aX(0,1),aY(0,1) {}
- FrPair(const Fraction& rBoth) : aX(rBoth),aY(rBoth) {}
- FrPair(const Fraction& rX, const Fraction& rY) : aX(rX),aY(rY) {}
+ FrPair(const boost::rational<long>& rBoth) : aX(rBoth),aY(rBoth) {}
+ FrPair(const boost::rational<long>& rX, const boost::rational<long>& rY) : aX(rX),aY(rY) {}
FrPair(long nMul, long nDiv) : aX(nMul,nDiv),aY(nMul,nDiv) {}
FrPair(long xMul, long xDiv, long yMul, long yDiv): aX(xMul,xDiv),aY(yMul,yDiv) {}
- const Fraction& X() const { return aX; }
- const Fraction& Y() const { return aY; }
- Fraction& X() { return aX; }
- Fraction& Y() { return aY; }
+ const boost::rational<long>& X() const { return aX; }
+ const boost::rational<long>& Y() const { return aY; }
+ boost::rational<long>& X() { return aX; }
+ boost::rational<long>& Y() { return aY; }
};
// Fuer die Umrechnung von Masseinheiten
@@ -265,7 +263,7 @@ inline bool IsInch(FieldUnit eU) {
}
class SVX_DLLPUBLIC SdrFormatter {
- Fraction aScale;
+ boost::rational<long> aScale;
long nMul_;
long nDiv_;
short nKomma_;
diff --git a/include/svx/sxfiitm.hxx b/include/svx/sxfiitm.hxx
index 570ebd02aa8c..6aa43ac3532d 100644
--- a/include/svx/sxfiitm.hxx
+++ b/include/svx/sxfiitm.hxx
@@ -20,26 +20,26 @@
#define INCLUDED_SVX_SXFIITM_HXX
#include <svl/poolitem.hxx>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
/*************************************************************************/
/* FractionItem */
/*************************************************************************/
class SdrFractionItem: public SfxPoolItem {
- Fraction nValue;
+ boost::rational<long> nValue;
public:
TYPEINFO_VISIBILITY( SVX_DLLPUBLIC );
SdrFractionItem(sal_uInt16 nId=0): SfxPoolItem(nId) {}
- SdrFractionItem(sal_uInt16 nId, const Fraction& rVal): SfxPoolItem(nId), nValue(rVal) {}
+ SdrFractionItem(sal_uInt16 nId, const boost::rational<long>& rVal): SfxPoolItem(nId), nValue(rVal) {}
SdrFractionItem(sal_uInt16 nId, SvStream& rIn);
virtual bool operator==(const SfxPoolItem&) const SAL_OVERRIDE;
virtual bool GetPresentation(SfxItemPresentation ePresentation, SfxMapUnit eCoreMetric, SfxMapUnit ePresentationMetric, OUString &rText, const IntlWrapper * = 0) const SAL_OVERRIDE;
virtual SfxPoolItem* Create(SvStream&, sal_uInt16 nVer) const SAL_OVERRIDE;
virtual SvStream& Store(SvStream&, sal_uInt16 nItemVers) const SAL_OVERRIDE;
virtual SfxPoolItem* Clone(SfxItemPool *pPool=NULL) const SAL_OVERRIDE;
- const Fraction& GetValue() const { return nValue; }
- void SetValue(const Fraction& rVal) { nValue = rVal; }
+ const boost::rational<long>& GetValue() const { return nValue; }
+ void SetValue(const boost::rational<long>& rVal) { nValue = rVal; }
};
diff --git a/include/svx/sxsiitm.hxx b/include/svx/sxsiitm.hxx
index 29fdf624dd81..8a7625a576ad 100644
--- a/include/svx/sxsiitm.hxx
+++ b/include/svx/sxsiitm.hxx
@@ -24,8 +24,8 @@
class SdrScaleItem: public SdrFractionItem {
public:
TYPEINFO_OVERRIDE();
- SdrScaleItem(sal_uInt16 nId=0): SdrFractionItem(nId,Fraction(1,1)) {}
- SdrScaleItem(sal_uInt16 nId, const Fraction& rVal): SdrFractionItem(nId,rVal) {}
+ SdrScaleItem(sal_uInt16 nId=0): SdrFractionItem(nId, boost::rational<long>(1,1) ) {}
+ SdrScaleItem(sal_uInt16 nId, const boost::rational<long>& rVal): SdrFractionItem(nId,rVal) {}
SdrScaleItem(sal_uInt16 nId, SvStream& rIn): SdrFractionItem(nId,rIn) {}
virtual bool GetPresentation(SfxItemPresentation ePresentation, SfxMapUnit eCoreMetric, SfxMapUnit ePresentationMetric, OUString &rText, const IntlWrapper * = 0) const SAL_OVERRIDE;
virtual SfxPoolItem* Create(SvStream&, sal_uInt16 nVer) const SAL_OVERRIDE;
diff --git a/include/tools/bigint.hxx b/include/tools/bigint.hxx
index 33d19bc67c0c..c4c1c6d7b9fe 100644
--- a/include/tools/bigint.hxx
+++ b/include/tools/bigint.hxx
@@ -28,8 +28,6 @@ class SvStream;
#define MAX_DIGITS 8
-class Fraction;
-
class TOOLS_DLLPUBLIC SAL_WARN_UNUSED BigInt
{
private:
@@ -144,8 +142,6 @@ public:
TOOLS_DLLPUBLIC friend bool operator> ( const BigInt& rVal1, const BigInt& rVal2 );
friend inline bool operator<=( const BigInt& rVal1, const BigInt& rVal2 );
friend inline bool operator>=( const BigInt& rVal1, const BigInt& rVal2 );
-
- friend class Fraction;
};
inline BigInt::operator short() const
diff --git a/include/tools/fract.hxx b/include/tools/fract.hxx
deleted file mode 100644
index 10e810ecb4ca..000000000000
--- a/include/tools/fract.hxx
+++ /dev/null
@@ -1,142 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_TOOLS_FRACT_HXX
-#define INCLUDED_TOOLS_FRACT_HXX
-
-#include <tools/toolsdllapi.h>
-
-class SvStream;
-
-class TOOLS_DLLPUBLIC SAL_WARN_UNUSED Fraction
-{
-private:
- long nNumerator;
- long nDenominator;
-
-public:
- Fraction() { nNumerator = 0; nDenominator = 1; }
- Fraction( const Fraction & rFrac );
- Fraction( long nNum, long nDen=1 );
- Fraction( double dVal );
-
- bool IsValid() const;
-
- long GetNumerator() const { return nNumerator; }
- long GetDenominator() const { return nDenominator; }
-
- operator long() const;
- operator double() const;
-
- Fraction& operator=( const Fraction& rfrFrac );
-
- Fraction& operator+=( const Fraction& rfrFrac );
- Fraction& operator-=( const Fraction& rfrFrac );
- Fraction& operator*=( const Fraction& rfrFrac );
- Fraction& operator/=( const Fraction& rfrFrac );
-
- void ReduceInaccurate( unsigned nSignificantBits );
-
- friend inline Fraction operator+( const Fraction& rVal1, const Fraction& rVal2 );
- friend inline Fraction operator-( const Fraction& rVal1, const Fraction& rVal2 );
- friend inline Fraction operator*( const Fraction& rVal1, const Fraction& rVal2 );
- friend inline Fraction operator/( const Fraction& rVal1, const Fraction& rVal2 );
-
- TOOLS_DLLPUBLIC friend bool operator==( const Fraction& rVal1, const Fraction& rVal2 );
- friend inline bool operator!=( const Fraction& rVal1, const Fraction& rVal2 );
- TOOLS_DLLPUBLIC friend bool operator< ( const Fraction& rVal1, const Fraction& rVal2 );
- TOOLS_DLLPUBLIC friend bool operator> ( const Fraction& rVal1, const Fraction& rVal2 );
- friend inline bool operator<=( const Fraction& rVal1, const Fraction& rVal2 );
- friend inline bool operator>=( const Fraction& rVal1, const Fraction& rVal2 );
-
- TOOLS_DLLPUBLIC friend SvStream& ReadFraction( SvStream& rIStream, Fraction& rFract );
- TOOLS_DLLPUBLIC friend SvStream& WriteFraction( SvStream& rOStream, const Fraction& rFract );
-};
-
-inline Fraction::Fraction( const Fraction& rFrac )
-{
- nNumerator = rFrac.nNumerator;
- nDenominator = rFrac.nDenominator;
-}
-
-inline Fraction& Fraction::operator=( const Fraction& rFrac )
-{
- nNumerator = rFrac.nNumerator;
- nDenominator = rFrac.nDenominator;
- return *this;
-}
-
-inline bool Fraction::IsValid() const
-{
- return (nDenominator > 0);
-}
-
-inline Fraction::operator long() const
-{
- if ( nDenominator > 0 )
- return (nNumerator / nDenominator);
- else
- return 0;
-}
-
-inline Fraction operator+( const Fraction& rVal1, const Fraction& rVal2 )
-{
- Fraction aErg( rVal1 );
- aErg += rVal2;
- return aErg;
-}
-
-inline Fraction operator-( const Fraction& rVal1, const Fraction& rVal2 )
-{
- Fraction aErg( rVal1 );
- aErg -= rVal2;
- return aErg;
-}
-
-inline Fraction operator*( const Fraction& rVal1, const Fraction& rVal2 )
-{
- Fraction aErg( rVal1 );
- aErg *= rVal2;
- return aErg;
-}
-
-inline Fraction operator/( const Fraction& rVal1, const Fraction& rVal2 )
-{
- Fraction aErg( rVal1 );
- aErg /= rVal2;
- return aErg;
-}
-
-inline bool operator !=( const Fraction& rVal1, const Fraction& rVal2 )
-{
- return !(rVal1 == rVal2);
-}
-
-inline bool operator <=( const Fraction& rVal1, const Fraction& rVal2 )
-{
- return !(rVal1 > rVal2);
-}
-
-inline bool operator >=( const Fraction& rVal1, const Fraction& rVal2 )
-{
- return !(rVal1 < rVal2);
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/tools/rational.hxx b/include/tools/rational.hxx
new file mode 100644
index 000000000000..0eeb1032a83c
--- /dev/null
+++ b/include/tools/rational.hxx
@@ -0,0 +1,25 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+#ifndef INCLUDED_TOOLS_RATIONAL_HXX
+#define INCLUDED_TOOLS_RATIONAL_HXX
+
+#include <boost/rational.hpp>
+#include <tools/toolsdllapi.h>
+
+class SvStream;
+
+TOOLS_DLLPUBLIC boost::rational<long> rational_FromDouble(double dVal);
+TOOLS_DLLPUBLIC void rational_ReduceInaccurate(boost::rational<long>& rRational, unsigned nSignificantBits);
+TOOLS_DLLPUBLIC SvStream& ReadFraction(SvStream& rIStream, boost::rational<long>& rRational);
+TOOLS_DLLPUBLIC SvStream& WriteFraction(SvStream& rOStream, const boost::rational<long>& rRational);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/gdimtf.hxx b/include/vcl/gdimtf.hxx
index 5a80213a7550..128895fc0675 100644
--- a/include/vcl/gdimtf.hxx
+++ b/include/vcl/gdimtf.hxx
@@ -136,7 +136,7 @@ public:
// additional Move method getting specifics how to handle MapMode( MAP_PIXEL )
void Move( long nX, long nY, long nDPIX, long nDPIY );
void Scale( double fScaleX, double fScaleY );
- void Scale( const Fraction& rScaleX, const Fraction& rScaleY );
+ void Scale( const boost::rational<long>& rScaleX, const boost::rational<long>& rScaleY );
void Rotate( long nAngle10 );
void Clip( const Rectangle& );
/* get the bound rect of the contained actions
diff --git a/include/vcl/mapmod.hxx b/include/vcl/mapmod.hxx
index 10e06d2e9ca3..211727f39660 100644
--- a/include/vcl/mapmod.hxx
+++ b/include/vcl/mapmod.hxx
@@ -21,7 +21,7 @@
#define INCLUDED_VCL_MAPMOD_HXX
#include <tools/gen.hxx>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
#include <tools/solar.h>
#include <vcl/dllapi.h>
#include <tools/resid.hxx>
@@ -44,8 +44,8 @@ private:
sal_uLong mnRefCount;
MapUnit meUnit;
Point maOrigin;
- Fraction maScaleX;
- Fraction maScaleY;
+ boost::rational<long> maScaleX;
+ boost::rational<long> maScaleY;
bool mbSimple;
friend SvStream& ReadImplMapMode( SvStream& rIStm, ImplMapMode& rMapMode );
@@ -75,7 +75,7 @@ public:
MapMode( const MapMode& rMapMode );
MapMode( MapUnit eUnit );
MapMode( MapUnit eUnit, const Point& rLogicOrg,
- const Fraction& rScaleX, const Fraction& rScaleY );
+ const boost::rational<long>& rScaleX, const boost::rational<long>& rScaleY );
~MapMode();
void SetMapUnit( MapUnit eUnit );
@@ -86,11 +86,11 @@ public:
const Point& GetOrigin() const
{ return mpImplMapMode->maOrigin; }
- void SetScaleX( const Fraction& rScaleX );
- const Fraction& GetScaleX() const
+ void SetScaleX( const boost::rational<long>& rScaleX );
+ const boost::rational<long>& GetScaleX() const
{ return mpImplMapMode->maScaleX; }
- void SetScaleY( const Fraction& rScaleY );
- const Fraction& GetScaleY() const
+ void SetScaleY( const boost::rational<long>& rScaleY );
+ const boost::rational<long>& GetScaleY() const
{ return mpImplMapMode->maScaleY; }
MapMode& operator=( const MapMode& rMapMode );
diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx
index 624cb2f0f31a..4886410bd2aa 100644
--- a/include/vcl/virdev.hxx
+++ b/include/vcl/virdev.hxx
@@ -124,7 +124,7 @@ public:
bool SetOutputSizePixel( const Size& rNewSize, bool bErase = true );
bool SetOutputSizePixelScaleOffsetAndBuffer( const Size& rNewSize,
- const Fraction& rScale,
+ const boost::rational<long>& rScale,
const Point& rNewOffset,
const basebmp::RawMemorySharedArray &pBuffer,
const bool bTopDown = false );
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index decc15c1c88e..14c23bdfbcff 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -1009,8 +1009,8 @@ public:
void SetCursor( vcl::Cursor* pCursor );
vcl::Cursor* GetCursor() const;
- void SetZoom( const Fraction& rZoom );
- const Fraction& GetZoom() const;
+ void SetZoom( const boost::rational<long>& rZoom );
+ const boost::rational<long>& GetZoom() const;
bool IsZoom() const;
long CalcZoom( long n ) const;
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 ) )
{
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 9398d2471581..6c33f74bed8d 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -69,7 +69,7 @@ class RefMovedHint;
}
-class Fraction;
+namespace boost { template<typename T> class rational; }
class OutputDevice;
class SfxItemPoolCache;
class SvtListener;
@@ -456,12 +456,12 @@ public:
long GetNeededSize(
SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY,
- const Fraction& rZoomX, const Fraction& rZoomY,
+ const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY,
bool bWidth, const ScNeededSizeOptions& rOptions, const ScPatternAttr** pPatternChange ) const;
sal_uInt16 GetOptimalColWidth(
OutputDevice* pDev, double nPPTX, double nPPTY,
- const Fraction& rZoomX, const Fraction& rZoomY,
+ const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY,
bool bFormula, sal_uInt16 nOldWidth, const ScMarkData* pMarkData, const ScColWidthParam* pParam) const;
void GetOptimalHeight(
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 063c9f6d9a9f..93f33bdc3cf3 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -37,7 +37,7 @@
#include "compressedarray.hxx"
#include "calcmacros.hxx"
#include "calcconfig.hxx"
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
#include <tools/gen.hxx>
#include <svl/zforlist.hxx>
@@ -1453,7 +1453,7 @@ public:
void StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, bool bRemoved,
OutputDevice* pDev,
double nPPTX, double nPPTY,
- const Fraction& rZoomX, const Fraction& rZoomY );
+ const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY );
bool IsStyleSheetUsed( const ScStyleSheet& rStyle, bool bGatherAllStyles ) const;
@@ -1521,7 +1521,7 @@ public:
sal_uInt16 GetOptimalColWidth( SCCOL nCol, SCTAB nTab, OutputDevice* pDev,
double nPPTX, double nPPTY,
- const Fraction& rZoomX, const Fraction& rZoomY,
+ const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY,
bool bFormula,
const ScMarkData* pMarkData = NULL,
const ScColWidthParam* pParam = NULL );
@@ -1534,7 +1534,7 @@ public:
long GetNeededSize( SCCOL nCol, SCROW nRow, SCTAB nTab,
OutputDevice* pDev,
double nPPTX, double nPPTY,
- const Fraction& rZoomX, const Fraction& rZoomY,
+ const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY,
bool bWidth, bool bTotalSize = false );
SC_DLLPUBLIC void ShowCol(SCCOL nCol, SCTAB nTab, bool bShow);
diff --git a/sc/inc/editutil.hxx b/sc/inc/editutil.hxx
index 142650fa9fa1..d3f7b3be986d 100644
--- a/sc/inc/editutil.hxx
+++ b/sc/inc/editutil.hxx
@@ -27,7 +27,7 @@
#include <tools/date.hxx>
#include <tools/time.hxx>
#include <tools/gen.hxx>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
class OutputDevice;
class ScDocument;
@@ -44,8 +44,8 @@ class ScEditUtil
OutputDevice* pDev; // MapMode has to be set
double nPPTX;
double nPPTY;
- Fraction aZoomX;
- Fraction aZoomY;
+ boost::rational<long> aZoomX;
+ boost::rational<long> aZoomY;
static const char pCalcDelimiters[];
@@ -82,7 +82,7 @@ public:
ScEditUtil( ScDocument* pDocument, SCCOL nX, SCROW nY, SCTAB nZ,
const Point& rScrPosPixel,
OutputDevice* pDevice, double nScaleX, double nScaleY,
- const Fraction& rX, const Fraction& rY ) :
+ const boost::rational<long>& rX, const boost::rational<long>& rY ) :
pDoc(pDocument),nCol(nX),nRow(nY),nTab(nZ),
aScrPos(rScrPosPixel),pDev(pDevice),
nPPTX(nScaleX),nPPTY(nScaleY),aZoomX(rX),aZoomY(rY) {}
diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx
index 90516ccf0c37..67b07f5eaf01 100644
--- a/sc/inc/patattr.hxx
+++ b/sc/inc/patattr.hxx
@@ -28,7 +28,7 @@
namespace vcl { class Font; }
class OutputDevice;
-class Fraction;
+namespace boost { template<class T> class rational; }
class ScStyleSheet;
class SvNumberFormatter;
class ScDocument;
@@ -83,14 +83,14 @@ public:
static void GetFont( vcl::Font& rFont, const SfxItemSet& rItemSet,
ScAutoFontColorMode eAutoMode,
OutputDevice* pOutDev = NULL,
- const Fraction* pScale = NULL,
+ const boost::rational<long>* pScale = NULL,
const SfxItemSet* pCondSet = NULL,
sal_uInt8 nScript = 0, const Color* pBackConfigColor = NULL,
const Color* pTextConfigColor = NULL );
/** Fills a font object from the own item set. */
void GetFont( vcl::Font& rFont, ScAutoFontColorMode eAutoMode,
OutputDevice* pOutDev = NULL,
- const Fraction* pScale = NULL,
+ const boost::rational<long>* pScale = NULL,
const SfxItemSet* pCondSet = NULL,
sal_uInt8 nScript = 0, const Color* pBackConfigColor = NULL,
const Color* pTextConfigColor = NULL ) const;
diff --git a/sc/inc/pch/precompiled_sc.hxx b/sc/inc/pch/precompiled_sc.hxx
index 5e4dada012d9..a78426ac22d9 100644
--- a/sc/inc/pch/precompiled_sc.hxx
+++ b/sc/inc/pch/precompiled_sc.hxx
@@ -876,7 +876,7 @@
#include <tools/datetime.hxx>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
#include <tools/gen.hxx>
#include <tools/globname.hxx>
#include <tools/mempool.hxx>
diff --git a/sc/inc/rowheightcontext.hxx b/sc/inc/rowheightcontext.hxx
index a33455444438..0db012c4a263 100644
--- a/sc/inc/rowheightcontext.hxx
+++ b/sc/inc/rowheightcontext.hxx
@@ -12,7 +12,7 @@
#include "scdllapi.h"
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
class OutputDevice;
@@ -22,8 +22,8 @@ class SC_DLLPUBLIC RowHeightContext
{
double mfPPTX;
double mfPPTY;
- Fraction maZoomX;
- Fraction maZoomY;
+ boost::rational<long> maZoomX;
+ boost::rational<long> maZoomY;
OutputDevice* mpOutDev;
sal_uInt16 mnExtraHeight;
@@ -31,15 +31,15 @@ class SC_DLLPUBLIC RowHeightContext
public:
RowHeightContext(
- double fPPTX, double fPPTY, const Fraction& rZoomX, const Fraction& rZoomY,
+ double fPPTX, double fPPTY, const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY,
OutputDevice* pOutDev );
~RowHeightContext();
double getPPTX() const { return mfPPTX;}
double getPPTY() const { return mfPPTY;}
- const Fraction& getZoomX() const { return maZoomX;}
- const Fraction& getZoomY() const { return maZoomY;}
+ const boost::rational<long>& getZoomX() const { return maZoomX;}
+ const boost::rational<long>& getZoomY() const { return maZoomY;}
OutputDevice* getOutputDevice() { return mpOutDev;}
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 30df498c71d0..c59dc473aeb6 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -637,7 +637,7 @@ public:
void StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, bool bRemoved,
OutputDevice* pDev,
double nPPTX, double nPPTY,
- const Fraction& rZoomX, const Fraction& rZoomY );
+ const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY );
bool IsStyleSheetUsed( const ScStyleSheet& rStyle, bool bGatherAllStyles ) const;
@@ -672,7 +672,7 @@ public:
sal_uInt16 GetOptimalColWidth( SCCOL nCol, OutputDevice* pDev,
double nPPTX, double nPPTY,
- const Fraction& rZoomX, const Fraction& rZoomY,
+ const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY,
bool bFormula, const ScMarkData* pMarkData,
const ScColWidthParam* pParam );
bool SetOptimalHeight(
@@ -686,7 +686,7 @@ public:
long GetNeededSize( SCCOL nCol, SCROW nRow,
OutputDevice* pDev,
double nPPTX, double nPPTY,
- const Fraction& rZoomX, const Fraction& rZoomY,
+ const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY,
bool bWidth, bool bTotalSize );
void SetColWidth( SCCOL nCol, sal_uInt16 nNewWidth );
void SetColWidthOnly( SCCOL nCol, sal_uInt16 nNewWidth );
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 13cdee827c86..fd05c65a46e8 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -83,7 +83,7 @@ inline bool IsAmbiguousScript( sal_uInt8 nScript )
long ScColumn::GetNeededSize(
SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY,
- const Fraction& rZoomX, const Fraction& rZoomY,
+ const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY,
bool bWidth, const ScNeededSizeOptions& rOptions,
const ScPatternAttr** ppPatternChange ) const
{
@@ -240,7 +240,7 @@ long ScColumn::GetNeededSize(
// bGetFont is set also if script type changes
if (rOptions.bGetFont)
{
- Fraction aFontZoom = ( eOrient == SVX_ORIENTATION_STANDARD ) ? rZoomX : rZoomY;
+ boost::rational<long> aFontZoom = ( eOrient == SVX_ORIENTATION_STANDARD ) ? rZoomX : rZoomY;
vcl::Font aFont;
// font color doesn't matter here
pPattern->GetFont( aFont, SC_AUTOCOL_BLACK, pDev, &aFontZoom, pCondSet, nScript );
@@ -413,7 +413,7 @@ long ScColumn::GetNeededSize(
// space for AutoFilter button: 20 * nZoom/100
if ( pFlag->HasAutoFilter() && !bTextWysiwyg )
- nDocWidth -= (rZoomX.GetNumerator()*20)/rZoomX.GetDenominator();
+ nDocWidth -= (rZoomX.numerator()*20)/rZoomX.denominator();
aPaper.Width() = nDocWidth;
@@ -501,7 +501,7 @@ long ScColumn::GetNeededSize(
aHMMMode).Height();
// With non-100% zoom and several lines or paragraphs, don't shrink below the result with FORMAT100 set
- if ( !bTextWysiwyg && ( rZoomY.GetNumerator() != 1 || rZoomY.GetDenominator() != 1 ) &&
+ if ( !bTextWysiwyg && ( rZoomY.numerator() != 1 || rZoomY.denominator() != 1 ) &&
( pEngine->GetParagraphCount() > 1 || ( bBreak && pEngine->GetLineCount(0) > 1 ) ) )
{
pEngine->SetControlWord( nCtrl | EE_CNTRL_FORMAT100 );
@@ -551,7 +551,7 @@ long ScColumn::GetNeededSize(
sal_Int16 nFlags = ((const ScMergeFlagAttr&)pPattern->GetItem(ATTR_MERGE_FLAG)).GetValue();
if (nFlags & SC_MF_AUTO)
- nValue += (rZoomX.GetNumerator()*20)/rZoomX.GetDenominator();
+ nValue += (rZoomX.numerator()*20)/rZoomX.denominator();
}
return nValue;
}
@@ -616,7 +616,7 @@ public:
}
sal_uInt16 ScColumn::GetOptimalColWidth(
- OutputDevice* pDev, double nPPTX, double nPPTY, const Fraction& rZoomX, const Fraction& rZoomY,
+ OutputDevice* pDev, double nPPTX, double nPPTY, const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY,
bool bFormula, sal_uInt16 nOldWidth, const ScMarkData* pMarkData, const ScColWidthParam* pParam) const
{
if (maCells.block_size() == 1 && maCells.begin()->type == sc::element_type_empty)
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 2c5a59710f4a..3613477e948a 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -40,7 +40,7 @@
#include "scmatrix.hxx"
#include <rowheightcontext.hxx>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
#include <editeng/editobj.hxx>
#include <svl/sharedstring.hxx>
@@ -2544,7 +2544,7 @@ void ScDocRowHeightUpdater::update()
ScProgress aProgress(mrDoc.GetDocumentShell(), ScGlobal::GetRscString(STR_PROGRESS_HEIGHTING), nCellCount);
- Fraction aZoom(1, 1);
+ boost::rational<long> aZoom(1, 1);
itr = mpTabRangesArray->begin();
sal_uInt32 nProgressStart = 0;
sc::RowHeightContext aCxt(mfPPTX, mfPPTY, aZoom, aZoom, mpOutDev);
@@ -2582,7 +2582,7 @@ void ScDocRowHeightUpdater::updateAll()
ScProgress aProgress(mrDoc.GetDocumentShell(), ScGlobal::GetRscString(STR_PROGRESS_HEIGHTING), nCellCount);
- Fraction aZoom(1, 1);
+ boost::rational<long> aZoom(1, 1);
sc::RowHeightContext aCxt(mfPPTX, mfPPTY, aZoom, aZoom, mpOutDev);
sal_uLong nProgressStart = 0;
for (SCTAB nTab = 0; nTab < mrDoc.GetTableCount(); ++nTab)
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index ddb8acdbd5dc..a7ba4025851b 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -569,7 +569,7 @@ bool ScDocument::IdleCalcTextWidth() // true = demnaechst wieder vers
}
sal_uInt16 nZoom = getScaleValue(*pStyle, ATTR_PAGE_SCALE);
- Fraction aZoomFract(nZoom, 100);
+ boost::rational<long> aZoomFract(nZoom, 100);
// Start at specified cell position (nCol, nRow, nTab).
ScColumn* pCol = &pTab->aCol[aScope.Col()];
@@ -655,7 +655,7 @@ bool ScDocument::IdleCalcTextWidth() // true = demnaechst wieder vers
if (getScaleValue(*pStyle, ATTR_PAGE_SCALETOPAGES) == 0)
{
nZoom = getScaleValue(*pStyle, ATTR_PAGE_SCALE);
- aZoomFract = Fraction(nZoom, 100);
+ aZoomFract = boost::rational<long>(nZoom, 100);
}
else
nZoom = 0;
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index a582db4bbcab..fb0c664ded76 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3883,7 +3883,7 @@ sal_uLong ScDocument::GetRowOffset( SCROW nRow, SCTAB nTab, bool bHiddenAsZero )
sal_uInt16 ScDocument::GetOptimalColWidth( SCCOL nCol, SCTAB nTab, OutputDevice* pDev,
double nPPTX, double nPPTY,
- const Fraction& rZoomX, const Fraction& rZoomY,
+ const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY,
bool bFormula, const ScMarkData* pMarkData,
const ScColWidthParam* pParam )
{
@@ -3897,7 +3897,7 @@ sal_uInt16 ScDocument::GetOptimalColWidth( SCCOL nCol, SCTAB nTab, OutputDevice*
long ScDocument::GetNeededSize( SCCOL nCol, SCROW nRow, SCTAB nTab,
OutputDevice* pDev,
double nPPTX, double nPPTY,
- const Fraction& rZoomX, const Fraction& rZoomY,
+ const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY,
bool bWidth, bool bTotalSize )
{
if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] )
@@ -4594,7 +4594,7 @@ const ScStyleSheet* ScDocument::GetSelectionStyle( const ScMarkData& rMark ) con
void ScDocument::StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, bool bRemoved,
OutputDevice* pDev,
double nPPTX, double nPPTY,
- const Fraction& rZoomX, const Fraction& rZoomY )
+ const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY )
{
TableContainer::iterator it = maTabs.begin();
for (; it != maTabs.end(); ++it)
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index ca702d97de48..c6d58eff68c2 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -824,7 +824,7 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati
double fXFrac = static_cast<double>(aNew.GetWidth()) / static_cast<double>(aOld.GetWidth());
double fYFrac = static_cast<double>(aNew.GetHeight()) / static_cast<double>(aOld.GetHeight());
- pObj->NbcResize(aNew.TopLeft(), Fraction(fXFrac), Fraction(fYFrac));
+ pObj->NbcResize(aNew.TopLeft(), rational_FromDouble(fXFrac), rational_FromDouble(fYFrac));
}
// order of these lines is important, modify rData.maLastRect carefully it is used as both
// a value and a flag for initialisation
@@ -1421,19 +1421,19 @@ void ScDrawLayer::CopyFromClip( ScDrawLayer* pClipModel, SCTAB nSourceTab, const
long nWidthDiff = nDestWidth - nSourceWidth;
long nHeightDiff = nDestHeight - nSourceHeight;
- Fraction aHorFract(1,1);
- Fraction aVerFract(1,1);
+ boost::rational<long> aHorFract(1,1);
+ boost::rational<long> aVerFract(1,1);
bool bResize = false;
// sizes can differ by 1 from twips->1/100mm conversion for equal cell sizes,
// don't resize to empty size when pasting into hidden columns or rows
if ( std::abs(nWidthDiff) > 1 && nDestWidth > 1 && nSourceWidth > 1 )
{
- aHorFract = Fraction( nDestWidth, nSourceWidth );
+ aHorFract = boost::rational<long>( nDestWidth, nSourceWidth );
bResize = true;
}
if ( std::abs(nHeightDiff) > 1 && nDestHeight > 1 && nSourceHeight > 1 )
{
- aVerFract = Fraction( nDestHeight, nSourceHeight );
+ aVerFract = boost::rational<long>( nDestHeight, nSourceHeight );
bResize = true;
}
Point aRefPos = rDestRange.TopLeft(); // for resizing (after moving)
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index acbaeda1aaed..f0c6d478010a 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -216,7 +216,7 @@ SvxCellOrientation ScPatternAttr::GetCellOrientation( const SfxItemSet* pCondSet
void ScPatternAttr::GetFont(
vcl::Font& rFont, const SfxItemSet& rItemSet, ScAutoFontColorMode eAutoMode,
- OutputDevice* pOutDev, const Fraction* pScale,
+ OutputDevice* pOutDev, const boost::rational<long>* pScale,
const SfxItemSet* pCondSet, sal_uInt8 nScript,
const Color* pBackConfigColor, const Color* pTextConfigColor )
{
@@ -376,7 +376,7 @@ void ScPatternAttr::GetFont(
if ( pOutDev != NULL )
{
Size aEffSize;
- Fraction aFraction( 1,1 );
+ boost::rational<long> aFraction( 1,1 );
if (pScale)
aFraction = *pScale;
Size aSize( 0, (long) nFontHeight );
@@ -386,7 +386,7 @@ void ScPatternAttr::GetFont(
aEffSize = pOutDev->LogicToPixel( aSize, aSrcMode );
else
{
- Fraction aFractOne(1,1);
+ boost::rational<long> aFractOne(1,1);
aDestMode.SetScaleX( aFractOne );
aDestMode.SetScaleY( aFractOne );
aEffSize = OutputDevice::LogicToLogic( aSize, aSrcMode, aDestMode );
@@ -482,7 +482,7 @@ void ScPatternAttr::GetFont(
void ScPatternAttr::GetFont(
vcl::Font& rFont, ScAutoFontColorMode eAutoMode,
- OutputDevice* pOutDev, const Fraction* pScale,
+ OutputDevice* pOutDev, const boost::rational<long>* pScale,
const SfxItemSet* pCondSet, sal_uInt8 nScript,
const Color* pBackConfigColor, const Color* pTextConfigColor ) const
{
diff --git a/sc/source/core/data/rowheightcontext.cxx b/sc/source/core/data/rowheightcontext.cxx
index 5f51dfab0878..46cce64908fc 100644
--- a/sc/source/core/data/rowheightcontext.cxx
+++ b/sc/source/core/data/rowheightcontext.cxx
@@ -12,7 +12,7 @@
namespace sc {
RowHeightContext::RowHeightContext(
- double fPPTX, double fPPTY, const Fraction& rZoomX, const Fraction& rZoomY,
+ double fPPTX, double fPPTY, const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY,
OutputDevice* pOutDev ) :
mfPPTX(fPPTX), mfPPTY(fPPTY),
maZoomX(rZoomX), maZoomY(rZoomY),
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 88631d59acc2..9917e110698d 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -427,7 +427,7 @@ void ScTable::SetLink( sal_uInt8 nMode,
sal_uInt16 ScTable::GetOptimalColWidth( SCCOL nCol, OutputDevice* pDev,
double nPPTX, double nPPTY,
- const Fraction& rZoomX, const Fraction& rZoomY,
+ const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY,
bool bFormula, const ScMarkData* pMarkData,
const ScColWidthParam* pParam )
{
@@ -438,7 +438,7 @@ sal_uInt16 ScTable::GetOptimalColWidth( SCCOL nCol, OutputDevice* pDev,
long ScTable::GetNeededSize( SCCOL nCol, SCROW nRow,
OutputDevice* pDev,
double nPPTX, double nPPTY,
- const Fraction& rZoomX, const Fraction& rZoomY,
+ const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY,
bool bWidth, bool bTotalSize )
{
ScNeededSizeOptions aOptions;
@@ -1800,7 +1800,7 @@ void ScTable::MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, d
aOptions.bFormula = bFormula;
aOptions.bSkipMerged = false;
- Fraction aZoom(1,1);
+ boost::rational<long> aZoom(1,1);
nPixel = aCol[rCol].GetNeededSize(
nRow, pDev, nPPTX, nPPTY, aZoom, aZoom, true, aOptions, NULL );
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index f603c8b6c961..5e67a6ac8d1e 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2535,7 +2535,7 @@ bool ScTable::IsStyleSheetUsed( const ScStyleSheet& rStyle, bool bGatherAllStyle
void ScTable::StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, bool bRemoved,
OutputDevice* pDev,
double nPPTX, double nPPTY,
- const Fraction& rZoomX, const Fraction& rZoomY )
+ const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY )
{
ScFlatBoolRowSegments aUsedRows;
for (SCCOL i = 0; i <= MAXCOL; ++i)
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index 1989a2e9534b..1ba6ca2ad959 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -429,10 +429,10 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
}
DELETEZ( pProgress ); // SetOptimalHeight has its own ProgressBar
// Adjust line height, base is 100% zoom
- Fraction aZoom( 1, 1 );
+ boost::rational<long> aZoom( 1, 1 );
// Factor is printer to display ratio
- double nPPTX = ScGlobal::nScreenPPTX * (double) aZoom / nOutputFactor;
- double nPPTY = ScGlobal::nScreenPPTY * (double) aZoom;
+ double nPPTX = ScGlobal::nScreenPPTX * boost::rational_cast<double>(aZoom) / nOutputFactor;
+ double nPPTY = ScGlobal::nScreenPPTY * boost::rational_cast<double>(aZoom);
VirtualDevice aVirtDev;
sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoom, aZoom, &aVirtDev);
aCxt.setExtraHeight(ScGlobal::nLastRowHeightExtra);
diff --git a/sc/source/ui/app/client.cxx b/sc/source/ui/app/client.cxx
index 7472b7435d5f..080b0f3ce212 100644
--- a/sc/source/ui/app/client.cxx
+++ b/sc/source/ui/app/client.cxx
@@ -213,11 +213,11 @@ void ScClient::ViewChanged()
if (pDrawObj)
{
Rectangle aLogicRect = pDrawObj->GetLogicRect();
- Fraction aFractX = GetScaleWidth();
- Fraction aFractY = GetScaleHeight();
+ boost::rational<long> aFractX = GetScaleWidth();
+ boost::rational<long> aFractY = GetScaleHeight();
aFractX *= aVisSize.Width();
aFractY *= aVisSize.Height();
- aVisSize = Size( (long) aFractX, (long) aFractY ); // Scaled for Draw model
+ aVisSize = Size( boost::rational_cast<long>(aFractX), boost::rational_cast<long>(aFractY) ); // Scaled for Draw model
// pClientData->SetObjArea before pDrawObj->SetLogicRect, so that we don't
// calculate wrong scalings:
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 87cdfebb4d34..0dcc849ee080 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -569,7 +569,7 @@ ScInputHandler::~ScInputHandler()
delete pFormulaDataPara;
}
-void ScInputHandler::SetRefScale( const Fraction& rX, const Fraction& rY )
+void ScInputHandler::SetRefScale( const boost::rational<long>& rX, const boost::rational<long>& rY )
{
if ( rX != aScaleX || rY != aScaleY )
{
diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx
index 74caa07088af..ba9ae8c2b63c 100644
--- a/sc/source/ui/cctrl/dpcontrol.cxx
+++ b/sc/source/ui/cctrl/dpcontrol.cxx
@@ -27,7 +27,7 @@
#include "docpool.hxx"
#include "patattr.hxx"
-ScDPFieldButton::ScDPFieldButton(OutputDevice* pOutDev, const StyleSettings* pStyle, const Fraction* pZoomX, const Fraction* pZoomY, ScDocument* pDoc) :
+ScDPFieldButton::ScDPFieldButton(OutputDevice* pOutDev, const StyleSettings* pStyle, const boost::rational<long>* pZoomX, const boost::rational<long>* pZoomY, ScDocument* pDoc) :
mpDoc(pDoc),
mpOutDev(pOutDev),
mpStyle(pStyle),
@@ -40,12 +40,12 @@ ScDPFieldButton::ScDPFieldButton(OutputDevice* pOutDev, const StyleSettings* pSt
if (pZoomX)
maZoomX = *pZoomX;
else
- maZoomX = Fraction(1, 1);
+ maZoomX = boost::rational<long>(1, 1);
if (pZoomY)
maZoomY = *pZoomY;
else
- maZoomY = Fraction(1, 1);
+ maZoomY = boost::rational<long>(1, 1);
}
ScDPFieldButton::~ScDPFieldButton()
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index c529527cd46b..03a3a9dabd21 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -153,7 +153,7 @@ bool ScDocFunc::AdjustRowHeight( const ScRange& rRange, bool bPaint )
SCROW nEndRow = rRange.aEnd.Row();
ScSizeDeviceProvider aProv( &rDocShell );
- Fraction aOne(1,1);
+ boost::rational<long> aOne(1,1);
sc::RowHeightContext aCxt(aProv.GetPPTX(), aProv.GetPPTY(), aOne, aOne, aProv.GetDevice());
bool bChanged = rDoc.SetOptimalHeight(aCxt, nStartRow, nEndRow, nTab);
@@ -3290,7 +3290,7 @@ static sal_uInt16 lcl_GetOptimalColWidth( ScDocShell& rDocShell, SCCOL nCol, SCT
double nPPTY = aProv.GetPPTY();
ScDocument& rDoc = rDocShell.GetDocument();
- Fraction aOne(1,1);
+ boost::rational<long> aOne(1,1);
sal_uInt16 nTwips = rDoc.GetOptimalColWidth( nCol, nTab, pDev, nPPTX, nPPTY, aOne, aOne,
bFormula, NULL );
@@ -3383,7 +3383,7 @@ bool ScDocFunc::SetWidthOrHeight(
}
ScSizeDeviceProvider aProv( &rDocShell );
- Fraction aOne(1,1);
+ boost::rational<long> aOne(1,1);
sc::RowHeightContext aCxt(aProv.GetPPTX(), aProv.GetPPTY(), aOne, aOne, aProv.GetDevice());
aCxt.setForceAutoSize(bAll);
rDoc.SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab);
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 0db4a22e40ec..6b25a783e6fe 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -1457,9 +1457,9 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium )
CalcOutputFactor();
if ( bRet && (bSetColWidths || bSetRowHeights) )
{ // Adjust column width/row height; base 100% zoom
- Fraction aZoom( 1, 1 );
- double nPPTX = ScGlobal::nScreenPPTX * (double) aZoom / GetOutputFactor(); // Factor is printer display ratio
- double nPPTY = ScGlobal::nScreenPPTY * (double) aZoom;
+ boost::rational<long> aZoom( 1, 1 );
+ double nPPTX = ScGlobal::nScreenPPTX * boost::rational_cast<double>(aZoom) / GetOutputFactor(); // Factor is printer display ratio
+ double nPPTY = ScGlobal::nScreenPPTY * boost::rational_cast<double>(aZoom);
VirtualDevice aVirtDev;
// all sheets (for Excel import)
SCTAB nTabCount = aDocument.GetTableCount();
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index c1ac7036c9b4..88fc80417e9f 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -368,7 +368,7 @@ void ScDocShell::CancelAutoDBRange()
bool ScDocShell::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab )
{
ScSizeDeviceProvider aProv(this);
- Fraction aZoom(1,1);
+ boost::rational<long> aZoom(1,1);
sc::RowHeightContext aCxt(aProv.GetPPTX(), aProv.GetPPTY(), aZoom, aZoom, aProv.GetDevice());
bool bChange = aDocument.SetOptimalHeight(aCxt, nStartRow,nEndRow, nTab);
@@ -383,7 +383,7 @@ void ScDocShell::UpdateAllRowHeights( const ScMarkData* pTabMark )
// update automatic row heights
ScSizeDeviceProvider aProv(this);
- Fraction aZoom(1,1);
+ boost::rational<long> aZoom(1,1);
sc::RowHeightContext aCxt(aProv.GetPPTX(), aProv.GetPPTY(), aZoom, aZoom, aProv.GetDevice());
aDocument.UpdateAllRowHeights(aCxt, pTabMark);
}
diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index 3c92010345c7..f8e5dfc35da5 100644
--- a/sc/source/ui/drawfunc/fuins1.cxx
+++ b/sc/source/ui/drawfunc/fuins1.cxx
@@ -131,7 +131,7 @@ static void lcl_InsertGraphic( const Graphic& rGraphic,
MapMode aDestMap( MAP_100TH_MM );
if ( aSourceMap.GetMapUnit() == MAP_PIXEL && pDrawView )
{
- Fraction aScaleX, aScaleY;
+ boost::rational<long> aScaleX, aScaleY;
pDrawView->CalcNormScale( aScaleX, aScaleY );
aDestMap.SetScaleX(aScaleX);
aDestMap.SetScaleY(aScaleY);
diff --git a/sc/source/ui/inc/dpcontrol.hxx b/sc/source/ui/inc/dpcontrol.hxx
index e574f672429b..461c1100fca8 100644
--- a/sc/source/ui/inc/dpcontrol.hxx
+++ b/sc/source/ui/inc/dpcontrol.hxx
@@ -22,7 +22,7 @@
#include <rtl/ustring.hxx>
#include <tools/gen.hxx>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
class OutputDevice;
class Point;
@@ -37,7 +37,7 @@ class ScDocument;
class ScDPFieldButton
{
public:
- ScDPFieldButton(OutputDevice* pOutDev, const StyleSettings* pStyle, const Fraction* pZoomX = NULL, const Fraction* pZoomY = NULL,
+ ScDPFieldButton(OutputDevice* pOutDev, const StyleSettings* pStyle, const boost::rational<long>* pZoomX = NULL, const boost::rational<long>* pZoomY = NULL,
ScDocument* pDoc = NULL);
~ScDPFieldButton();
@@ -58,9 +58,9 @@ private:
private:
Point maPos;
Size maSize;
- OUString maText;
- Fraction maZoomX;
- Fraction maZoomY;
+ OUString maText;
+ boost::rational<long> maZoomX;
+ boost::rational<long> maZoomY;
ScDocument* mpDoc;
OutputDevice* mpOutDev;
const StyleSettings* mpStyle;
diff --git a/sc/source/ui/inc/drawutil.hxx b/sc/source/ui/inc/drawutil.hxx
index 6a011ae290e2..740ee0380ada 100644
--- a/sc/source/ui/inc/drawutil.hxx
+++ b/sc/source/ui/inc/drawutil.hxx
@@ -22,7 +22,7 @@
#include "address.hxx"
-class Fraction;
+namespace boost { template<typename T> class rational; }
class OutputDevice;
class ScDocument;
@@ -31,9 +31,9 @@ class ScDrawUtil
public:
static void CalcScale( ScDocument* pDoc, SCTAB nTab,
SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
- OutputDevice* pDev, const Fraction& rZoomX, const Fraction& rZoomY,
+ OutputDevice* pDev, const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY,
double nPPTX, double nPPTY,
- Fraction& rScaleX, Fraction& rScaleY );
+ boost::rational<long>& rScaleX, boost::rational<long>& rScaleY );
};
#endif
diff --git a/sc/source/ui/inc/drawview.hxx b/sc/source/ui/inc/drawview.hxx
index d19cb263a746..923af0f9a0fd 100644
--- a/sc/source/ui/inc/drawview.hxx
+++ b/sc/source/ui/inc/drawview.hxx
@@ -37,8 +37,8 @@ class ScDrawView: public FmFormView
OutputDevice* pDev; //! needed ?
ScDocument* pDoc;
SCTAB nTab;
- Fraction aScaleX; // Factor for Drawing-MapMode
- Fraction aScaleY;
+ boost::rational<long> aScaleX; // Factor for Drawing-MapMode
+ boost::rational<long> aScaleY;
SdrDropMarkerOverlay* pDropMarker;
SdrObject* pDropMarkObj;
bool bInConstruct;
@@ -94,12 +94,12 @@ public:
void DoCut();
void DoCopy();
- void GetScale( Fraction& rFractX, Fraction& rFractY ) const;
+ void GetScale( boost::rational<long>& rFractX, boost::rational<long>& rFractY ) const;
void RecalcScale();
void UpdateWorkArea();
SCTAB GetTab() const { return nTab; }
- void CalcNormScale( Fraction& rFractX, Fraction& rFractY ) const;
+ void CalcNormScale( boost::rational<long>& rFractX, boost::rational<long>& rFractY ) const;
void SetPageAnchored();
void SetCellAnchored();
diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx
index 65ea47c3c927..dd8752a5c52d 100644
--- a/sc/source/ui/inc/inputhdl.hxx
+++ b/sc/source/ui/inc/inputhdl.hxx
@@ -24,7 +24,7 @@
#include "address.hxx"
#include "typedstrdata.hxx"
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
#include <tools/gen.hxx>
#include <tools/link.hxx>
#include <vcl/vclevent.hxx>
@@ -99,11 +99,11 @@ private:
bool bCellHasPercentFormat:1;
bool bLastIsSymbol:1;
bool mbDocumentDisposing:1;
- sal_uLong nValidation;
+ sal_uLong nValidation;
SvxCellHorJustify eAttrAdjust;
- Fraction aScaleX; // for ref MapMode
- Fraction aScaleY;
+ boost::rational<long> aScaleX; // for ref MapMode
+ boost::rational<long> aScaleY;
ScTabViewShell* pRefViewSh;
ScTabViewShell* pActiveViewSh;
@@ -209,7 +209,7 @@ public:
void ShowTip( const OUString& rText ); // at Cursor
void ShowTipBelow( const OUString& rText );
- void SetRefScale( const Fraction& rX, const Fraction& rY );
+ void SetRefScale( const boost::rational<long>& rX, const boost::rational<long>& rY );
void UpdateRefDevice();
EditView* GetActiveView();
diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx
index 8a9649848ba4..dd42cd8fe737 100644
--- a/sc/source/ui/inc/output.hxx
+++ b/sc/source/ui/inc/output.hxx
@@ -23,7 +23,7 @@
#include "address.hxx"
#include "cellvalue.hxx"
#include <tools/color.hxx>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
@@ -164,8 +164,8 @@ private:
ScOutputType eType; // Screen/Printer ...
double mnPPTX; // Pixel per Twips
double mnPPTY;
- Fraction aZoomX;
- Fraction aZoomY;
+ boost::rational<long> aZoomX;
+ boost::rational<long> aZoomY;
SdrObject* pEditObj; // Omit when painting
@@ -262,8 +262,8 @@ public:
SCTAB nNewTab, long nNewScrX, long nNewScrY,
SCCOL nNewX1, SCROW nNewY1, SCCOL nNewX2, SCROW nNewY2,
double nPixelPerTwipsX, double nPixelPerTwipsY,
- const Fraction* pZoomX = NULL,
- const Fraction* pZoomY = NULL );
+ const boost::rational<long>* pZoomX = NULL,
+ const boost::rational<long>* pZoomY = NULL );
~ScOutputData();
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 0bc4751487c4..1cbb87afec6a 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -298,7 +298,7 @@ public:
* @param bSameTabButMoved true if the same sheet as before is activated.
*/
void TabChanged( bool bSameTabButMoved = false );
- void SetZoom( const Fraction& rNewX, const Fraction& rNewY, bool bAll );
+ void SetZoom( const boost::rational<long>& rNewX, const boost::rational<long>& rNewY, bool bAll );
SC_DLLPUBLIC void RefreshZoom();
void SetPagebreakMode( bool bSet );
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 9020c2184c84..053a1e9053e6 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -208,7 +208,7 @@ protected:
virtual void InnerResizePixel( const Point &rOfs, const Size &rSize ) SAL_OVERRIDE; // neu
virtual void OuterResizePixel( const Point &rOfs, const Size &rSize ) SAL_OVERRIDE;
- virtual void SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ) SAL_OVERRIDE;
+ virtual void SetZoomFactor( const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY ) SAL_OVERRIDE;
virtual void QueryObjAreaPixel( Rectangle& rRect ) const SAL_OVERRIDE;
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index 515bc67a4f75..1505f4dd0ab8 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -109,10 +109,10 @@ class ScViewDataTable // per-sheet data
friend class ScViewData;
private:
SvxZoomType eZoomType; // selected zoom type (normal view)
- Fraction aZoomX; // selected zoom X
- Fraction aZoomY; // selected zoom Y (displayed)
- Fraction aPageZoomX; // zoom in page break preview mode
- Fraction aPageZoomY;
+ boost::rational<long> aZoomX; // selected zoom X
+ boost::rational<long> aZoomY; // selected zoom Y (displayed)
+ boost::rational<long> aPageZoomX; // zoom in page break preview mode
+ boost::rational<long> aPageZoomY;
long nTPosX[2]; // MapMode - Offset (Twips)
long nTPosY[2];
@@ -174,10 +174,10 @@ private:
MapMode aLogicMode; // skalierter 1/100mm-MapMode
SvxZoomType eDefZoomType; // default zoom and type for missing TabData
- Fraction aDefZoomX;
- Fraction aDefZoomY;
- Fraction aDefPageZoomX; // zoom in page break preview mode
- Fraction aDefPageZoomY;
+ boost::rational<long> aDefZoomX;
+ boost::rational<long> aDefZoomY;
+ boost::rational<long> aDefPageZoomX; // zoom in page break preview mode
+ boost::rational<long> aDefPageZoomY;
ScRefType eRefType;
@@ -305,15 +305,15 @@ public:
void SetZoomType( SvxZoomType eNew, bool bAll );
void SetZoomType( SvxZoomType eNew, std::vector< SCTAB >& tabs );
- void SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vector< SCTAB >& tabs );
- void SetZoom( const Fraction& rNewX, const Fraction& rNewY, bool bAll );
+ void SetZoom( const boost::rational<long>& rNewX, const boost::rational<long>& rNewY, std::vector< SCTAB >& tabs );
+ void SetZoom( const boost::rational<long>& rNewX, const boost::rational<long>& rNewY, bool bAll );
void RefreshZoom();
void SetSelCtrlMouseClick( bool bTmp ) { bSelCtrlMouseClick = bTmp; }
SvxZoomType GetZoomType() const { return pThisTab->eZoomType; }
- const Fraction& GetZoomX() const { return bPagebreak ? pThisTab->aPageZoomX : pThisTab->aZoomX; }
- const Fraction& GetZoomY() const { return bPagebreak ? pThisTab->aPageZoomY : pThisTab->aZoomY; }
+ const boost::rational<long>& GetZoomX() const { return bPagebreak ? pThisTab->aPageZoomX : pThisTab->aZoomX; }
+ const boost::rational<long>& GetZoomY() const { return bPagebreak ? pThisTab->aPageZoomY : pThisTab->aZoomY; }
void SetShowGrid( bool bShow );
bool GetShowGrid() const { return pThisTab->bShowGrid; }
@@ -446,7 +446,7 @@ public:
void SetScreen( const Rectangle& rVisArea );
void SetScreenPos( const Point& rVisAreaStart );
- void UpdateScreenZoom( const Fraction& rNewX, const Fraction& rNewY );
+ void UpdateScreenZoom( const boost::rational<long>& rNewX, const boost::rational<long>& rNewY );
Size GetScrSize() const { return aScrSize; }
diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx
index 2e244ec1a9be..23bb99345fda 100644
--- a/sc/source/ui/undo/undobase.cxx
+++ b/sc/source/ui/undo/undobase.cxx
@@ -258,8 +258,8 @@ bool ScBlockUndo::AdjustHeight()
ScDocument& rDoc = pDocShell->GetDocument();
VirtualDevice aVirtDev;
- Fraction aZoomX( 1, 1 );
- Fraction aZoomY = aZoomX;
+ boost::rational<long> aZoomX( 1, 1 );
+ boost::rational<long> aZoomY = aZoomX;
double nPPTX, nPPTY;
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
@@ -356,8 +356,8 @@ void ScMultiBlockUndo::AdjustHeight()
ScDocument& rDoc = pDocShell->GetDocument();
VirtualDevice aVirtDev;
- Fraction aZoomX( 1, 1 );
- Fraction aZoomY = aZoomX;
+ boost::rational<long> aZoomX( 1, 1 );
+ boost::rational<long> aZoomY = aZoomX;
double nPPTX, nPPTY;
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index 6b8c8cfd38c7..49e2280f7362 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -847,8 +847,8 @@ void ScUndoAutoFormat::Redo()
if (bSize)
{
VirtualDevice aVirtDev;
- Fraction aZoomX(1,1);
- Fraction aZoomY = aZoomX;
+ boost::rational<long> aZoomX(1,1);
+ boost::rational<long> aZoomY = aZoomX;
double nPPTX,nPPTY;
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
diff --git a/sc/source/ui/undo/undostyl.cxx b/sc/source/ui/undo/undostyl.cxx
index d84d55abd4c2..01bfc89a1705 100644
--- a/sc/source/ui/undo/undostyl.cxx
+++ b/sc/source/ui/undo/undostyl.cxx
@@ -110,7 +110,7 @@ static void lcl_DocStyleChanged( ScDocument* pDoc, SfxStyleSheetBase* pStyle, bo
Point aLogic = aVDev.LogicToPixel( Point(1000,1000), MAP_TWIP );
double nPPTX = aLogic.X() / 1000.0;
double nPPTY = aLogic.Y() / 1000.0;
- Fraction aZoom(1,1);
+ boost::rational<long> aZoom(1,1);
pDoc->StyleSheetChanged( pStyle, bRemoved, &aVDev, nPPTX, nPPTY, aZoom, aZoom );
ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index f553e5153923..314dddb7ef79 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1283,17 +1283,13 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec
// Scale and move the target rectangle from aLocationMM to aLocationPixel,
// to get the target rectangle in pixels.
- Fraction aScaleX( aLocationPixel.GetWidth(), aLocationMM.GetWidth() );
- Fraction aScaleY( aLocationPixel.GetHeight(), aLocationMM.GetHeight() );
-
- long nX1 = aLocationPixel.Left() + (long)
- ( Fraction( aTargetRect.Left() - aLocationMM.Left(), 1 ) * aScaleX );
- long nX2 = aLocationPixel.Left() + (long)
- ( Fraction( aTargetRect.Right() - aLocationMM.Left(), 1 ) * aScaleX );
- long nY1 = aLocationPixel.Top() + (long)
- ( Fraction( aTargetRect.Top() - aLocationMM.Top(), 1 ) * aScaleY );
- long nY2 = aLocationPixel.Top() + (long)
- ( Fraction( aTargetRect.Bottom() - aLocationMM.Top(), 1 ) * aScaleY );
+ boost::rational<long> aScaleX( aLocationPixel.GetWidth(), aLocationMM.GetWidth() );
+ boost::rational<long> aScaleY( aLocationPixel.GetHeight(), aLocationMM.GetHeight() );
+
+ long nX1 = aLocationPixel.Left() + boost::rational_cast<long>( (aTargetRect.Left() - aLocationMM.Left()) * aScaleX );
+ long nX2 = aLocationPixel.Left() + boost::rational_cast<long>( (aTargetRect.Right() - aLocationMM.Left()) * aScaleX );
+ long nY1 = aLocationPixel.Top() + boost::rational_cast<long>( (aTargetRect.Top() - aLocationMM.Top()) * aScaleY );
+ long nY2 = aLocationPixel.Top() + boost::rational_cast<long>( (aTargetRect.Bottom() - aLocationMM.Top()) * aScaleY );
if ( nX1 > aLocationPixel.Right() ) nX1 = aLocationPixel.Right();
if ( nX2 > aLocationPixel.Right() ) nX2 = aLocationPixel.Right();
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index d06f68bd1115..0817ec8ae23a 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -758,7 +758,7 @@ void SAL_CALL ScStyleFamilyObj::removeByName( const OUString& aName )
Point aLogic = aVDev.LogicToPixel( Point(1000,1000), MAP_TWIP );
double nPPTX = aLogic.X() / 1000.0;
double nPPTY = aLogic.Y() / 1000.0;
- Fraction aZoom(1,1);
+ boost::rational<long> aZoom(1,1);
rDoc.StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom );
pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
pDocShell->SetDocumentModified();
@@ -1100,7 +1100,7 @@ void SAL_CALL ScStyleObj::setParentStyle( const OUString& rParentStyle )
Point aLogic = aVDev.LogicToPixel( Point(1000,1000), MAP_TWIP );
double nPPTX = aLogic.X() / 1000.0;
double nPPTY = aLogic.Y() / 1000.0;
- Fraction aZoom(1,1);
+ boost::rational<long> aZoom(1,1);
rDoc.StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom );
pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
@@ -1464,7 +1464,7 @@ void SAL_CALL ScStyleObj::setAllPropertiesToDefault()
Point aLogic = aVDev.LogicToPixel( Point(1000,1000), MAP_TWIP );
double nPPTX = aLogic.X() / 1000.0;
double nPPTY = aLogic.Y() / 1000.0;
- Fraction aZoom(1,1);
+ boost::rational<long> aZoom(1,1);
rDoc.StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom );
pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
@@ -1843,7 +1843,7 @@ void ScStyleObj::SetOnePropertyValue( const OUString& rPropertyName, const SfxIt
Point aLogic = aVDev.LogicToPixel( Point(1000,1000), MAP_TWIP );
double nPPTX = aLogic.X() / 1000.0;
double nPPTY = aLogic.Y() / 1000.0;
- Fraction aZoom(1,1);
+ boost::rational<long> aZoom(1,1);
rDoc.StyleSheetChanged( pStyle, false, &aVDev, nPPTX, nPPTY, aZoom, aZoom );
pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index 4fa327f198f7..04c4f08c45ae 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -1446,8 +1446,8 @@ sal_Int16 ScTabViewObj::GetZoom(void) const
ScTabViewShell* pViewSh = GetViewShell();
if (pViewSh)
{
- const Fraction& rZoomY = pViewSh->GetViewData().GetZoomY(); // Y wird angezeigt
- return (sal_Int16)(( rZoomY.GetNumerator() * 100 ) / rZoomY.GetDenominator());
+ const boost::rational<long>& rZoomY = pViewSh->GetViewData().GetZoomY(); // Y wird angezeigt
+ return (sal_Int16)(( rZoomY.numerator() * 100 ) / rZoomY.denominator());
}
return 0;
}
@@ -1468,7 +1468,7 @@ void ScTabViewObj::SetZoom(sal_Int16 nZoom)
pScMod->SetAppOptions( aNewOpt );
}
}
- Fraction aFract( nZoom, 100 );
+ boost::rational<long> aFract( nZoom, 100 );
pViewSh->SetZoom( aFract, aFract, true );
pViewSh->PaintGrid();
pViewSh->PaintTop();
diff --git a/sc/source/ui/vba/excelvbahelper.cxx b/sc/source/ui/vba/excelvbahelper.cxx
index 6a745588fc16..3771b6fcd3c9 100644
--- a/sc/source/ui/vba/excelvbahelper.cxx
+++ b/sc/source/ui/vba/excelvbahelper.cxx
@@ -97,7 +97,7 @@ getUnoSheetModuleObj( const uno::Reference< table::XCellRange >& xRange ) throw
void implSetZoom( const uno::Reference< frame::XModel >& xModel, sal_Int16 nZoom, std::vector< SCTAB >& nTabs )
{
ScTabViewShell* pViewSh = excel::getBestViewShell( xModel );
- Fraction aFract( nZoom, 100 );
+ boost::rational<long> aFract( nZoom, 100 );
pViewSh->GetViewData().SetZoom( aFract, aFract, nTabs );
pViewSh->RefreshZoom();
}
diff --git a/sc/source/ui/view/drawutil.cxx b/sc/source/ui/view/drawutil.cxx
index 668337aac0da..21840f50ffaf 100644
--- a/sc/source/ui/view/drawutil.cxx
+++ b/sc/source/ui/view/drawutil.cxx
@@ -27,9 +27,9 @@
void ScDrawUtil::CalcScale( ScDocument* pDoc, SCTAB nTab,
SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
OutputDevice* pDev,
- const Fraction& rZoomX, const Fraction& rZoomY,
+ const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY,
double nPPTX, double nPPTY,
- Fraction& rScaleX, Fraction& rScaleY )
+ boost::rational<long>& rScaleX, boost::rational<long>& rScaleY )
{
long nPixelX = 0;
long nTwipsX = 0;
@@ -63,27 +63,27 @@ void ScDrawUtil::CalcScale( ScDocument* pDoc, SCTAB nTab,
// because ReduceInaccurate is called later anyway.
if ( aPixelLog.X() && nTwipsX )
- rScaleX = Fraction( ((double)aPixelLog.X()) *
- ((double)rZoomX.GetNumerator()) /
+ rScaleX = rational_FromDouble( ((double)aPixelLog.X()) *
+ ((double)rZoomX.numerator()) /
((double)nTwipsX) /
((double)HMM_PER_TWIPS) /
- ((double)rZoomX.GetDenominator()) );
+ ((double)rZoomX.denominator()) );
else
- rScaleX = Fraction( 1, 1 );
+ rScaleX = boost::rational<long>( 1, 1 );
if ( aPixelLog.Y() && nTwipsY )
- rScaleY = Fraction( ((double)aPixelLog.Y()) *
- ((double)rZoomY.GetNumerator()) /
+ rScaleY = rational_FromDouble( ((double)aPixelLog.Y()) *
+ ((double)rZoomY.numerator()) /
((double)nTwipsY) /
((double)HMM_PER_TWIPS) /
- ((double)rZoomY.GetDenominator()) );
+ ((double)rZoomY.denominator()) );
else
- rScaleY = Fraction( 1, 1 );
+ rScaleY = boost::rational<long>( 1, 1 );
// 25 bits of accuracy are needed to always hit the right part of
// cells in the last rows (was 17 before 1M rows).
- rScaleX.ReduceInaccurate( 25 );
- rScaleY.ReduceInaccurate( 25 );
+ rational_ReduceInaccurate(rScaleX, 25);
+ rational_ReduceInaccurate(rScaleY, 25);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index 08a3565d28ca..6a8add5ccc4e 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -437,7 +437,7 @@ uno::Reference<datatransfer::XTransferable> ScDrawView::CopyToTransferable()
// Korrektur fuer 100% berechnen, unabhaengig von momentanen Einstellungen
-void ScDrawView::CalcNormScale( Fraction& rFractX, Fraction& rFractY ) const
+void ScDrawView::CalcNormScale( boost::rational<long>& rFractX, boost::rational<long>& rFractY ) const
{
double nPPTX = ScGlobal::nScreenPPTX;
double nPPTY = ScGlobal::nScreenPPTY;
@@ -453,7 +453,7 @@ void ScDrawView::CalcNormScale( Fraction& rFractX, Fraction& rFractY ) const
if (nEndRow<20)
nEndRow = 1000;
- Fraction aZoom(1,1);
+ boost::rational<long> aZoom(1,1);
ScDrawUtil::CalcScale( pDoc, nTab, 0,0, nEndCol,nEndRow, pDev, aZoom,aZoom,
nPPTX, nPPTY, rFractX,rFractY );
}
@@ -513,7 +513,7 @@ void ScDrawView::SetMarkedOriginalSize()
{
// Pixel-Korrektur beruecksichtigen, damit Bitmap auf dem Bildschirm stimmt
- Fraction aNormScaleX, aNormScaleY;
+ boost::rational<long> aNormScaleX, aNormScaleY;
CalcNormScale( aNormScaleX, aNormScaleY );
aDestMap.SetScaleX(aNormScaleX);
aDestMap.SetScaleY(aNormScaleY);
@@ -535,8 +535,8 @@ void ScDrawView::SetMarkedOriginalSize()
Rectangle aDrawRect = pObj->GetLogicRect();
pUndoGroup->AddAction( new SdrUndoGeoObj( *pObj ) );
- pObj->Resize( aDrawRect.TopLeft(), Fraction( aOriginalSize.Width(), aDrawRect.GetWidth() ),
- Fraction( aOriginalSize.Height(), aDrawRect.GetHeight() ) );
+ pObj->Resize( aDrawRect.TopLeft(), boost::rational<long>( aOriginalSize.Width(), aDrawRect.GetWidth() ),
+ boost::rational<long>( aOriginalSize.Height(), aDrawRect.GetHeight() ) );
++nDone;
}
}
diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index 718091033af3..00e31a2910d0 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -286,7 +286,7 @@ void ScDrawView::DoCut()
EndUndo();
}
-void ScDrawView::GetScale( Fraction& rFractX, Fraction& rFractY ) const
+void ScDrawView::GetScale( boost::rational<long>& rFractX, boost::rational<long>& rFractY ) const
{
rFractX = aScaleX;
rFractY = aScaleY;
@@ -296,8 +296,8 @@ void ScDrawView::RecalcScale()
{
double nPPTX;
double nPPTY;
- Fraction aZoomX(1,1);
- Fraction aZoomY(1,1);
+ boost::rational<long> aZoomX(1,1);
+ boost::rational<long> aZoomY(1,1);
if (pViewData)
{
@@ -614,8 +614,8 @@ void ScDrawView::UpdateUserViewOptions()
SetSnapEnabled( rGrid.GetUseGridSnap() );
SetGridSnap( rGrid.GetUseGridSnap() );
- Fraction aFractX( rGrid.GetFldDrawX(), rGrid.GetFldDivisionX() + 1 );
- Fraction aFractY( rGrid.GetFldDrawY(), rGrid.GetFldDivisionY() + 1 );
+ boost::rational<long> aFractX( rGrid.GetFldDrawX(), rGrid.GetFldDivisionX() + 1 );
+ boost::rational<long> aFractY( rGrid.GetFldDrawY(), rGrid.GetFldDivisionY() + 1 );
SetSnapGridWidth( aFractX, aFractY );
SetGridCoarse( Size( rGrid.GetFldDrawX(), rGrid.GetFldDrawY() ) );
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index e0d5b7a604e1..219adb2f3977 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4625,8 +4625,8 @@ void ScGridWindow::UpdateFormulas()
ScTableInfo aTabInfo;
rDoc.FillInfo( aTabInfo, nX1, nY1, nX2, nY2, nTab, nPPTX, nPPTY, false, false );
- Fraction aZoomX = pViewData->GetZoomX();
- Fraction aZoomY = pViewData->GetZoomY();
+ boost::rational<long> aZoomX = pViewData->GetZoomX();
+ boost::rational<long> aZoomY = pViewData->GetZoomY();
ScOutputData aOutputData( this, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab,
nScrX, nScrY, nX1, nY1, nX2, nY2, nPPTX, nPPTY,
&aZoomX, &aZoomY );
diff --git a/sc/source/ui/view/gridwin3.cxx b/sc/source/ui/view/gridwin3.cxx
index e9ac6ca2054a..9cbaa2a9139b 100644
--- a/sc/source/ui/view/gridwin3.cxx
+++ b/sc/source/ui/view/gridwin3.cxx
@@ -247,8 +247,8 @@ MapMode ScGridWindow::GetDrawMapMode( bool bForce )
ScDrawView* pDrView = pViewData->GetView()->GetScDrawView();
if ( pDrView || bForce )
{
- Fraction aScaleX;
- Fraction aScaleY;
+ boost::rational<long> aScaleX;
+ boost::rational<long> aScaleY;
if (pDrView)
pDrView->GetScale( aScaleX, aScaleY );
else
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 0991b7e5bed5..56f35ecb4496 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -77,7 +77,7 @@ static void lcl_LimitRect( Rectangle& rRect, const Rectangle& rVisible )
static void lcl_DrawOneFrame( OutputDevice* pDev, const Rectangle& rInnerPixel,
const OUString& rTitle, const Color& rColor, bool bTextBelow,
- double nPPTX, double nPPTY, const Fraction& rZoomY,
+ double nPPTX, double nPPTY, const boost::rational<long>& rZoomY,
ScDocument* pDoc, ScViewData* pButtonViewData, bool bLayoutRTL )
{
// pButtonViewData wird nur benutzt, um die Button-Groesse zu setzen,
@@ -132,8 +132,8 @@ static void lcl_DrawOneFrame( OutputDevice* pDev, const Rectangle& rInnerPixel,
ScDDComboBoxButton aComboButton((vcl::Window*)pDev);
aComboButton.SetOptSizePixel();
- long nBWidth = ( aComboButton.GetSizePixel().Width() * rZoomY.GetNumerator() )
- / rZoomY.GetDenominator();
+ long nBWidth = ( aComboButton.GetSizePixel().Width() * rZoomY.numerator() )
+ / rZoomY.denominator();
long nBHeight = nVer + aTextSize.Height() + 1;
Size aButSize( nBWidth, nBHeight );
long nButtonPos = bLayoutRTL ? aOuter.Left() : aOuter.Right()-nBWidth+1;
@@ -470,8 +470,8 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
nPPTX, nPPTY, false, bFormulaMode,
&pViewData->GetMarkData() );
- Fraction aZoomX = pViewData->GetZoomX();
- Fraction aZoomY = pViewData->GetZoomY();
+ boost::rational<long> aZoomX = pViewData->GetZoomX();
+ boost::rational<long> aZoomY = pViewData->GetZoomY();
ScOutputData aOutputData( this, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab,
nScrX, nScrY, nX1, nY1, nX2, nY2, nPPTX, nPPTY,
&aZoomX, &aZoomY );
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 1e94298dc046..617288e69ef2 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -145,7 +145,7 @@ ScOutputData::ScOutputData( OutputDevice* pNewDev, ScOutputType eNewType,
SCTAB nNewTab, long nNewScrX, long nNewScrY,
SCCOL nNewX1, SCROW nNewY1, SCCOL nNewX2, SCROW nNewY2,
double nPixelPerTwipsX, double nPixelPerTwipsY,
- const Fraction* pZoomX, const Fraction* pZoomY ) :
+ const boost::rational<long>* pZoomX, const boost::rational<long>* pZoomY ) :
mpDev( pNewDev ),
mpRefDevice( pNewDev ), // default is output device
pFmtDevice( pNewDev ), // default is output device
@@ -193,11 +193,11 @@ ScOutputData::ScOutputData( OutputDevice* pNewDev, ScOutputType eNewType,
if (pZoomX)
aZoomX = *pZoomX;
else
- aZoomX = Fraction(1,1);
+ aZoomX = boost::rational<long>(1,1);
if (pZoomY)
aZoomY = *pZoomY;
else
- aZoomY = Fraction(1,1);
+ aZoomY = boost::rational<long>(1,1);
nVisX1 = nX1;
nVisY1 = nY1;
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 9f7e48ff2276..a5a9af577aae 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -231,7 +231,7 @@ void ScDrawStringsVars::SetShrinkScale( long nScale, sal_uInt8 nScript )
// call GetFont with a modified fraction, use only the height
- Fraction aFraction( nScale, 100 );
+ boost::rational<long> aFraction( nScale, 100 );
if ( !bPixelToLogic )
aFraction *= pOutput->aZoomY;
vcl::Font aTmpFont;
@@ -810,12 +810,12 @@ double ScOutputData::GetStretch()
if ( mpRefDevice == pFmtDevice )
{
MapMode aOld = mpRefDevice->GetMapMode();
- return ((double)aOld.GetScaleY()) / ((double)aOld.GetScaleX()) * ((double)aZoomY) / ((double)aZoomX);
+ return boost::rational_cast<double>(aOld.GetScaleY()) / boost::rational_cast<double>(aOld.GetScaleX()) * boost::rational_cast<double>(this->aZoomY) / boost::rational_cast<double>(this->aZoomX);
}
else
{
// when formatting for printer, device map mode has already been taken care of
- return ((double)aZoomY) / ((double)aZoomX);
+ return boost::rational_cast<double>(this->aZoomY) / boost::rational_cast<double>(this->aZoomX);
}
}
@@ -2787,7 +2787,7 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam)
// #i85342# screen display and formatting for printer,
// use same GetEditArea call as in ScViewData::SetEditEngine
- Fraction aFract(1,1);
+ boost::rational<long> aFract(1,1);
Rectangle aUtilRect = ScEditUtil( mpDoc, rParam.mnCellX, rParam.mnCellY, nTab, Point(0,0), pFmtDevice,
HMM_PER_TWIPS, HMM_PER_TWIPS, aFract, aFract ).GetEditArea( rParam.mpPattern, false );
aLogicSize.Width() = aUtilRect.GetWidth();
@@ -3809,7 +3809,7 @@ void ScOutputData::DrawEditStacked(DrawEditParam& rParam)
// #i85342# screen display and formatting for printer,
// use same GetEditArea call as in ScViewData::SetEditEngine
- Fraction aFract(1,1);
+ boost::rational<long> aFract(1,1);
Rectangle aUtilRect = ScEditUtil( mpDoc, rParam.mnCellX, rParam.mnCellY, nTab, Point(0,0), pFmtDevice,
HMM_PER_TWIPS, HMM_PER_TWIPS, aFract, aFract ).GetEditArea( rParam.mpPattern, false );
aLogicSize.Width() = aUtilRect.GetWidth();
@@ -4165,7 +4165,7 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam)
// #i85342# screen display and formatting for printer,
// use same GetEditArea call as in ScViewData::SetEditEngine
- Fraction aFract(1,1);
+ boost::rational<long> aFract(1,1);
Rectangle aUtilRect = ScEditUtil( mpDoc, rParam.mnCellX, rParam.mnCellY, nTab, Point(0,0), pFmtDevice,
HMM_PER_TWIPS, HMM_PER_TWIPS, aFract, aFract ).GetEditArea( rParam.mpPattern, false );
aLogicSize.Width() = aUtilRect.GetWidth();
diff --git a/sc/source/ui/view/overlayobject.cxx b/sc/source/ui/view/overlayobject.cxx
index 778e44f0dfe0..1e2fe00972fd 100644
--- a/sc/source/ui/view/overlayobject.cxx
+++ b/sc/source/ui/view/overlayobject.cxx
@@ -20,7 +20,6 @@
#include "overlayobject.hxx"
#include <vcl/outdev.hxx>
#include <vcl/lineinfo.hxx>
-#include <tools/fract.hxx>
#include <basegfx/range/b2drange.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index e7cad9911d72..e7b50e8993ee 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -344,8 +344,8 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation )
UpdateDrawView(); // Spreedsheet eventually changes
}
- Fraction aPreviewZoom( nZoom, 100 );
- Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
+ boost::rational<long> aPreviewZoom( nZoom, 100 );
+ boost::rational<long> aHorPrevZoom( long( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom );
bool bDoPrint = ( pFillLocation == NULL );
@@ -732,8 +732,8 @@ void ScPreview::SetZoom(sal_uInt16 nNewZoom)
// apply new MapMode and call UpdateScrollBars to update aOffset
- Fraction aPreviewZoom( nZoom, 100 );
- Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
+ boost::rational<long> aPreviewZoom( nZoom, 100 );
+ boost::rational<long> aHorPrevZoom( long( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom );
SetMapMode( aMMMode );
@@ -961,8 +961,8 @@ void ScPreview::DataChanged( const DataChangedEvent& rDCEvt )
void ScPreview::MouseButtonDown( const MouseEvent& rMEvt )
{
- Fraction aPreviewZoom( nZoom, 100 );
- Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
+ boost::rational<long> aPreviewZoom( nZoom, 100 );
+ boost::rational<long> aHorPrevZoom( long( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom );
aButtonDownChangePoint = PixelToLogic( rMEvt.GetPosPixel(),aMMMode );
@@ -1044,8 +1044,8 @@ void ScPreview::MouseButtonDown( const MouseEvent& rMEvt )
void ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
{
- Fraction aPreviewZoom( nZoom, 100 );
- Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
+ boost::rational<long> aPreviewZoom( nZoom, 100 );
+ boost::rational<long> aHorPrevZoom( long( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom );
aButtonUpPt = PixelToLogic( rMEvt.GetPosPixel(),aMMMode );
@@ -1294,8 +1294,8 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
void ScPreview::MouseMove( const MouseEvent& rMEvt )
{
- Fraction aPreviewZoom( nZoom, 100 );
- Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
+ boost::rational<long> aPreviewZoom( nZoom, 100 );
+ boost::rational<long> aHorPrevZoom( long( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom );
Point aMouseMovePoint = PixelToLogic( rMEvt.GetPosPixel(), aMMMode );
@@ -1540,8 +1540,8 @@ void ScPreview::SwitchView()
void ScPreview::DragMove( long nDragMovePos, sal_uInt16 nFlags )
{
- Fraction aPreviewZoom( nZoom, 100 );
- Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
+ boost::rational<long> aPreviewZoom( nZoom, 100 );
+ boost::rational<long> aHorPrevZoom( long( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 );
MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom );
SetMapMode( aMMMode );
long nPos = nDragMovePos;
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index bb379604e695..0e2bda3c4421 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -1593,7 +1593,7 @@ void ScPrintFunc::PrintArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
if ( !pPrinter )
{
OutputDevice* pRefDev = pDoc->GetPrinter(); // use the printer also for Preview
- Fraction aPrintFrac( nZoom, 100 ); // without nManualZoom
+ boost::rational<long> aPrintFrac( nZoom, 100 ); // without nManualZoom
// MapMode, as it would arrive at the printer:
pRefDev->SetMapMode( MapMode( MAP_100TH_MM, Point(), aPrintFrac, aPrintFrac ) );
@@ -2543,13 +2543,13 @@ void ScPrintFunc::InitModes() // set MapModes from nZoom etc.
long nEffZoom = nZoom * (long) nManualZoom;
nScaleX = nScaleY = HMM_PER_TWIPS; // output in 1/100 mm
- Fraction aZoomFract( nEffZoom,10000 );
- Fraction aHorFract = aZoomFract;
+ boost::rational<long> aZoomFract( nEffZoom,10000 );
+ boost::rational<long> aHorFract = aZoomFract;
if ( !pPrinter && !bIsRender ) // adjust scale for preview
{
double nFact = pDocShell->GetOutputFactor();
- aHorFract = Fraction( (long)( nEffZoom / nFact ), 10000 );
+ aHorFract = boost::rational<long>( long( nEffZoom / nFact ), 10000 );
}
aLogicMode = MapMode( MAP_100TH_MM, Point(), aHorFract, aZoomFract );
@@ -2557,7 +2557,7 @@ void ScPrintFunc::InitModes() // set MapModes from nZoom etc.
Point aLogicOfs( -aOffset.X(), -aOffset.Y() );
aOffsetMode = MapMode( MAP_100TH_MM, aLogicOfs, aHorFract, aZoomFract );
- Point aTwipsOfs( (long) ( -aOffset.X() / nScaleX + 0.5 ), (long) ( -aOffset.Y() / nScaleY + 0.5 ) );
+ Point aTwipsOfs( long( -aOffset.X() / nScaleX + 0.5 ), long( -aOffset.Y() / nScaleY + 0.5 ) );
aTwipMode = MapMode( MAP_TWIP, aTwipsOfs, aHorFract, aZoomFract );
}
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 9150af64bee9..6802dd0e7bf7 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -697,11 +697,11 @@ void ScTabView::UpdateVarZoom()
if ( eZoomType != SVX_ZOOM_PERCENT && !bInZoomUpdate )
{
bInZoomUpdate = true;
- const Fraction& rOldX = GetViewData().GetZoomX();
- const Fraction& rOldY = GetViewData().GetZoomY();
- long nOldPercent = ( rOldY.GetNumerator() * 100 ) / rOldY.GetDenominator();
+ const boost::rational<long>& rOldX = GetViewData().GetZoomX();
+ const boost::rational<long>& rOldY = GetViewData().GetZoomY();
+ long nOldPercent = ( rOldY.numerator() * 100 ) / rOldY.denominator();
sal_uInt16 nNewZoom = CalcZoom( eZoomType, (sal_uInt16)nOldPercent );
- Fraction aNew( nNewZoom, 100 );
+ boost::rational<long> aNew( nNewZoom, 100 );
if ( aNew != rOldX || aNew != rOldY )
{
@@ -924,8 +924,8 @@ bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos )
// for ole inplace editing, the scale is defined by the visarea and client size
// and can't be changed directly
- const Fraction& rOldY = aViewData.GetZoomY();
- long nOld = (long)(( rOldY.GetNumerator() * 100 ) / rOldY.GetDenominator());
+ const boost::rational<long>& rOldY = aViewData.GetZoomY();
+ long nOld = long(( rOldY.numerator() * 100 ) / rOldY.denominator());
long nNew = nOld;
if ( pData->GetMode() == COMMAND_WHEEL_ZOOM_SCALE )
{
@@ -943,7 +943,7 @@ bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos )
bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom();
SetZoomType( SVX_ZOOM_PERCENT, bSyncZoom );
- Fraction aFract( nNew, 100 );
+ boost::rational<long> aFract( nNew, 100 );
SetZoom( aFract, aFract, bSyncZoom );
PaintGrid();
PaintTop();
diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index c79d356065ae..e19348adeed2 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -1111,7 +1111,7 @@ static bool lcl_FitsInWindow( double fScaleX, double fScaleY, sal_uInt16 nZoom,
SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
SCCOL nFixPosX, SCROW nFixPosY )
{
- double fZoomFactor = (double)Fraction(nZoom,100);
+ double fZoomFactor = boost::rational_cast<double>(boost::rational<long>(nZoom, 100));
fScaleX *= fZoomFactor;
fScaleY *= fZoomFactor;
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 028a5ff6cce9..749f542747d4 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2337,8 +2337,8 @@ void ScTabView::RecalcPPT()
// call view SetZoom (including draw scale, split update etc)
// and paint only if values changed
- Fraction aZoomX = aViewData.GetZoomX();
- Fraction aZoomY = aViewData.GetZoomY();
+ boost::rational<long> aZoomX = aViewData.GetZoomX();
+ boost::rational<long> aZoomY = aViewData.GetZoomY();
SetZoom( aZoomX, aZoomY, false );
PaintGrid();
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index 4f263d61a450..e5acb09e0b92 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -370,7 +370,7 @@ void ScTabView::SetZoomType( SvxZoomType eNew, bool bAll )
aViewData.SetZoomType( eNew, bAll );
}
-void ScTabView::SetZoom( const Fraction& rNewX, const Fraction& rNewY, bool bAll )
+void ScTabView::SetZoom( const boost::rational<long>& rNewX, const boost::rational<long>& rNewY, bool bAll )
{
aViewData.SetZoom( rNewX, rNewY, bAll );
if (pDrawView)
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index d32a366b4880..571532633499 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -627,9 +627,9 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom();
SvxZoomType eOldZoomType = GetZoomType();
SvxZoomType eNewZoomType = eOldZoomType;
- const Fraction& rOldY = GetViewData().GetZoomY(); // Y wird angezeigt
- sal_uInt16 nOldZoom = (sal_uInt16)(( rOldY.GetNumerator() * 100 )
- / rOldY.GetDenominator());
+ const boost::rational<long>& rOldY = GetViewData().GetZoomY(); // Y wird angezeigt
+ sal_uInt16 nOldZoom = (sal_uInt16)(( rOldY.numerator() * 100 )
+ / rOldY.denominator());
sal_uInt16 nZoom = nOldZoom;
bool bCancel = false;
@@ -720,7 +720,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
aNewOpt.SetZoomType( GetZoomType() );
pScMod->SetAppOptions( aNewOpt );
}
- Fraction aFract( nZoom, 100 );
+ boost::rational<long> aFract( nZoom, 100 );
SetZoom( aFract, aFract, bSyncZoom );
PaintGrid();
PaintTop();
@@ -749,7 +749,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
aNewOpt.SetZoomType( GetZoomType() );
pScMod->SetAppOptions( aNewOpt );
}
- Fraction aFract( nCurrentZoom,100 );
+ boost::rational<long> aFract( nCurrentZoom,100 );
SetZoom( aFract, aFract, bSyncZoom );
PaintGrid();
PaintTop();
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index f04e93174755..b3c558d9ece0 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -333,8 +333,8 @@ void ScTabViewShell::UpdateOleZoom()
{
vcl::Window* pWin = GetActiveWin();
Size aWinHMM = pWin->PixelToLogic( pWin->GetOutputSizePixel(), MAP_100TH_MM );
- SetZoomFactor( Fraction( aWinHMM.Width(),aObjSize.Width() ),
- Fraction( aWinHMM.Height(),aObjSize.Height() ) );
+ SetZoomFactor( boost::rational<long>( aWinHMM.Width(),aObjSize.Width() ),
+ boost::rational<long>( aWinHMM.Height(),aObjSize.Height() ) );
}
}
}
@@ -362,8 +362,8 @@ void ScTabViewShell::InnerResizePixel( const Point &rOfs, const Size &rSize )
if ( aObjSize.Width() > 0 && aObjSize.Height() > 0 )
{
Size aLogicSize = GetWindow()->PixelToLogic( aSize, MAP_100TH_MM );
- SfxViewShell::SetZoomFactor( Fraction( aLogicSize.Width(),aObjSize.Width() ),
- Fraction( aLogicSize.Height(),aObjSize.Height() ) );
+ SfxViewShell::SetZoomFactor( boost::rational<long>( aLogicSize.Width(),aObjSize.Width() ),
+ boost::rational<long>( aLogicSize.Height(),aObjSize.Height() ) );
}
Point aPos( rOfs );
@@ -401,19 +401,19 @@ void ScTabViewShell::OuterResizePixel( const Point &rOfs, const Size &rSize )
ForceMove();
}
-void ScTabViewShell::SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY )
+void ScTabViewShell::SetZoomFactor( const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY )
{
// fuer OLE...
- Fraction aFrac20( 1,5 );
- Fraction aFrac400( 4,1 );
+ boost::rational<long> aFrac20( 1,5 );
+ boost::rational<long> aFrac400( 4,1 );
- Fraction aNewX( rZoomX );
+ boost::rational<long> aNewX( rZoomX );
if ( aNewX < aFrac20 )
aNewX = aFrac20;
if ( aNewX > aFrac400 )
aNewX = aFrac400;
- Fraction aNewY( rZoomY );
+ boost::rational<long> aNewY( rZoomY );
if ( aNewY < aFrac20 )
aNewY = aFrac20;
if ( aNewY > aFrac400 )
@@ -1727,7 +1727,7 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame,
}
else
{
- Fraction aFract( rAppOpt.GetZoom(), 100 );
+ boost::rational<long> aFract( rAppOpt.GetZoom(), 100 );
SetZoom( aFract, aFract, true );
SetZoomType( rAppOpt.GetZoomType(), true );
}
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index adde73054bbb..5c2727a50667 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -287,9 +287,8 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
rSet.DisableItem( nWhich );
else
{
- const Fraction& rOldY = GetViewData().GetZoomY();
- sal_uInt16 nZoom = (sal_uInt16)(( rOldY.GetNumerator() * 100 )
- / rOldY.GetDenominator());
+ const boost::rational<long>& rOldY = GetViewData().GetZoomY();
+ sal_uInt16 nZoom = (sal_uInt16)(( rOldY.numerator() * 100 ) / rOldY.denominator());
rSet.Put( SvxZoomItem( SVX_ZOOM_PERCENT, nZoom, nWhich ) );
}
break;
@@ -300,8 +299,8 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
rSet.DisableItem( nWhich );
else
{
- const Fraction& rOldY = GetViewData().GetZoomY();
- sal_uInt16 nCurrentZoom = (sal_uInt16)(( rOldY.GetNumerator() * 100 ) / rOldY.GetDenominator());
+ const boost::rational<long>& rOldY = GetViewData().GetZoomY();
+ sal_uInt16 nCurrentZoom = (sal_uInt16)(( rOldY.numerator() * 100 ) / rOldY.denominator());
if( nCurrentZoom )
{
diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx
index 5e635b01fca9..e010c86f07ac 100644
--- a/sc/source/ui/view/tabvwshb.cxx
+++ b/sc/source/ui/view/tabvwshb.cxx
@@ -85,10 +85,10 @@ void ScTabViewShell::ConnectObject( SdrOle2Obj* pObj )
Size aOleSize = pObj->GetOrigObjSize();
- Fraction aScaleWidth (aDrawSize.Width(), aOleSize.Width() );
- Fraction aScaleHeight(aDrawSize.Height(), aOleSize.Height() );
- aScaleWidth.ReduceInaccurate(10); // kompatibel zum SdrOle2Obj
- aScaleHeight.ReduceInaccurate(10);
+ boost::rational<long> aScaleWidth (aDrawSize.Width(), aOleSize.Width() );
+ boost::rational<long> aScaleHeight(aDrawSize.Height(), aOleSize.Height() );
+ rational_ReduceInaccurate(aScaleWidth, 10); // kompatibel zum SdrOle2Obj
+ rational_ReduceInaccurate(aScaleHeight, 10);
pClient->SetSizeScale(aScaleWidth,aScaleHeight);
// sichtbarer Ausschnitt wird nur inplace veraendert!
@@ -145,17 +145,17 @@ bool ScTabViewShell::ActivateObject( SdrOle2Obj* pObj, long nVerb )
awt::Size aSz( aOleSize.Width(), aOleSize.Height() );
xObj->setVisualAreaSize( pClient->GetAspect(), aSz );
}
- Fraction aOne( 1, 1 );
+ boost::rational<long> aOne( 1, 1 );
pClient->SetSizeScale( aOne, aOne );
}
else
{
// calculate scale from client and VisArea size
- Fraction aScaleWidth (aDrawSize.Width(), aOleSize.Width() );
- Fraction aScaleHeight(aDrawSize.Height(), aOleSize.Height() );
- aScaleWidth.ReduceInaccurate(10); // kompatibel zum SdrOle2Obj
- aScaleHeight.ReduceInaccurate(10);
+ boost::rational<long> aScaleWidth (aDrawSize.Width(), aOleSize.Width() );
+ boost::rational<long> aScaleHeight(aDrawSize.Height(), aOleSize.Height() );
+ rational_ReduceInaccurate(aScaleWidth, 10); // kompatibel zum SdrOle2Obj
+ rational_ReduceInaccurate(aScaleHeight, 10);
pClient->SetSizeScale(aScaleWidth,aScaleHeight);
}
diff --git a/sc/source/ui/view/tabvwshh.cxx b/sc/source/ui/view/tabvwshh.cxx
index e427e1fae490..46503dae69a7 100644
--- a/sc/source/ui/view/tabvwshh.cxx
+++ b/sc/source/ui/view/tabvwshh.cxx
@@ -121,12 +121,12 @@ void ScTabViewShell::ExecuteObject( SfxRequest& rReq )
pDrView->MoveMarkedObj( Size( 0, nNewVal - aRect.Top() ) );
else if ( nSlotId == SID_OBJECT_WIDTH )
pDrView->ResizeMarkedObj( aRect.TopLeft(),
- Fraction( nNewVal, aRect.GetWidth() ),
- Fraction( 1, 1 ) );
+ boost::rational<long>( nNewVal, aRect.GetWidth() ),
+ boost::rational<long>( 1, 1 ) );
else // if ( nSlotId == SID_OBJECT_HEIGHT )
pDrView->ResizeMarkedObj( aRect.TopLeft(),
- Fraction( 1, 1 ),
- Fraction( nNewVal, aRect.GetHeight() ) );
+ boost::rational<long>( 1, 1 ),
+ boost::rational<long>( nNewVal, aRect.GetHeight() ) );
bDone = true;
}
}
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index af08c7080b74..1dd2d255a0d7 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -144,8 +144,8 @@ void ScViewDataTable::WriteUserDataSequence(uno::Sequence <beans::PropertyValue>
pSettings[SC_POSITION_BOTTOM].Name = OUString(SC_POSITIONBOTTOM);
pSettings[SC_POSITION_BOTTOM].Value <<= sal_Int32(nPosY[SC_SPLIT_BOTTOM]);
- sal_Int32 nZoomValue ((aZoomY.GetNumerator() * 100) / aZoomY.GetDenominator());
- sal_Int32 nPageZoomValue ((aPageZoomY.GetNumerator() * 100) / aPageZoomY.GetDenominator());
+ sal_Int32 nZoomValue ((aZoomY.numerator() * 100) / aZoomY.denominator());
+ sal_Int32 nPageZoomValue ((aPageZoomY.numerator() * 100) / aPageZoomY.denominator());
pSettings[SC_TABLE_ZOOM_TYPE].Name = OUString(SC_ZOOMTYPE);
pSettings[SC_TABLE_ZOOM_TYPE].Value <<= sal_Int16(eZoomType);
pSettings[SC_TABLE_ZOOM_VALUE].Name = OUString(SC_ZOOMVALUE);
@@ -248,14 +248,14 @@ void ScViewDataTable::ReadUserDataSequence(const uno::Sequence <beans::PropertyV
else if (sName.equalsAscii(SC_ZOOMVALUE) )
{
aSettings[i].Value >>= nTemp32;
- Fraction aZoom(nTemp32, 100);
+ boost::rational<long> aZoom(nTemp32, 100);
aZoomX = aZoomY = aZoom;
rHasZoom = true;
}
else if (sName.equalsAscii(SC_PAGEVIEWZOOMVALUE) )
{
aSettings[i].Value >>= nTemp32;
- Fraction aZoom(nTemp32, 100);
+ boost::rational<long> aZoom(nTemp32, 100);
aPageZoomX = aPageZoomY = aZoom;
rHasZoom = true;
}
@@ -616,21 +616,21 @@ void ScViewData::SetZoomType( SvxZoomType eNew, bool bAll )
SetZoomType( eNew, vTabs );
}
-void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vector< SCTAB >& tabs )
+void ScViewData::SetZoom( const boost::rational<long>& rNewX, const boost::rational<long>& rNewY, std::vector< SCTAB >& tabs )
{
bool bAll = ( tabs.empty() );
if ( !bAll ) // create associated table data
CreateTabData( tabs );
- Fraction aFrac20( 1,5 );
- Fraction aFrac400( 4,1 );
+ boost::rational<long> aFrac20( 1,5 );
+ boost::rational<long> aFrac400( 4,1 );
- Fraction aValidX = rNewX;
+ boost::rational<long> aValidX = rNewX;
if (aValidX<aFrac20)
aValidX = aFrac20;
if (aValidX>aFrac400)
aValidX = aFrac400;
- Fraction aValidY = rNewY;
+ boost::rational<long> aValidY = rNewY;
if (aValidY<aFrac20)
aValidY = aFrac20;
if (aValidY>aFrac400)
@@ -690,7 +690,7 @@ void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vec
RefreshZoom();
}
-void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, bool bAll )
+void ScViewData::SetZoom( const boost::rational<long>& rNewX, const boost::rational<long>& rNewY, bool bAll )
{
std::vector< SCTAB > vTabs;
if ( !bAll ) // get selected tabs
@@ -1033,7 +1033,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
// if text is formatted for printer, use the exact same paper width
// (and same line breaks) as for output.
- Fraction aFract(1,1);
+ boost::rational<long> aFract(1,1);
Rectangle aUtilRect = ScEditUtil( pDoc,nNewX,nNewY,nTabNo, Point(0,0), pWin,
HMM_PER_TWIPS, HMM_PER_TWIPS, aFract, aFract ).GetEditArea( pPattern, false );
aPaperSize.Width() = aUtilRect.GetWidth();
@@ -2120,31 +2120,31 @@ bool ScViewData::IsMinimized()
return pView->IsMinimized();
}
-void ScViewData::UpdateScreenZoom( const Fraction& rNewX, const Fraction& rNewY )
+void ScViewData::UpdateScreenZoom( const boost::rational<long>& rNewX, const boost::rational<long>& rNewY )
{
- Fraction aOldX = GetZoomX();
- Fraction aOldY = GetZoomY();
+ boost::rational<long> aOldX = GetZoomX();
+ boost::rational<long> aOldY = GetZoomY();
SetZoom( rNewX, rNewY, false );
- Fraction aWidth = GetZoomX();
- aWidth *= Fraction( aScrSize.Width(),1 );
+ boost::rational<long> aWidth = GetZoomX();
+ aWidth *= aScrSize.Width();
aWidth /= aOldX;
- Fraction aHeight = GetZoomY();
- aHeight *= Fraction( aScrSize.Height(),1 );
+ boost::rational<long> aHeight = GetZoomY();
+ aHeight *= aScrSize.Height();
aHeight /= aOldY;
- aScrSize.Width() = (long) aWidth;
- aScrSize.Height() = (long) aHeight;
+ aScrSize.Width() = boost::rational_cast<long>(aWidth);
+ aScrSize.Height() = boost::rational_cast<long>(aHeight);
}
void ScViewData::CalcPPT()
{
- nPPTX = ScGlobal::nScreenPPTX * (double) GetZoomX();
+ nPPTX = ScGlobal::nScreenPPTX * boost::rational_cast<double>(this->GetZoomX());
if (pDocShell)
nPPTX = nPPTX / pDocShell->GetOutputFactor(); // Faktor ist Drucker zu Bildschirm
- nPPTY = ScGlobal::nScreenPPTY * (double) GetZoomY();
+ nPPTY = ScGlobal::nScreenPPTY * boost::rational_cast<double>(this->GetZoomY());
// if detective objects are present,
// try to adjust horizontal scale so the most common column width has minimal rounding errors,
@@ -2192,9 +2192,9 @@ void ScViewData::WriteUserData(OUString& rData)
// PosX[links]/PosX[rechts]/PosY[oben]/PosY[unten]
// wenn Zeilen groesser 8192, "+" statt "/"
- sal_uInt16 nZoom = (sal_uInt16)((pThisTab->aZoomY.GetNumerator() * 100) / pThisTab->aZoomY.GetDenominator());
+ sal_uInt16 nZoom = (sal_uInt16)((pThisTab->aZoomY.numerator() * 100) / pThisTab->aZoomY.denominator());
rData = OUString::number( nZoom ) + "/";
- nZoom = (sal_uInt16)((pThisTab->aPageZoomY.GetNumerator() * 100) / pThisTab->aPageZoomY.GetDenominator());
+ nZoom = (sal_uInt16)((pThisTab->aPageZoomY.numerator() * 100) / pThisTab->aPageZoomY.denominator());
rData += OUString::number( nZoom ) + "/";
if (bPagebreak)
rData += "1";
@@ -2259,15 +2259,15 @@ void ScViewData::ReadUserData(const OUString& rData)
// nicht pro Tabelle:
SCTAB nTabStart = 2;
- Fraction aZoomX, aZoomY, aPageZoomX, aPageZoomY; // evaluate (all sheets?)
+ boost::rational<long> aZoomX, aZoomY, aPageZoomX, aPageZoomY; // evaluate (all sheets?)
OUString aZoomStr = rData.getToken(0, ';'); // Zoom/PageZoom/Modus
sal_uInt16 nNormZoom = sal::static_int_cast<sal_uInt16>(aZoomStr.getToken(0,'/').toInt32());
if ( nNormZoom >= MINZOOM && nNormZoom <= MAXZOOM )
- aZoomX = aZoomY = Fraction( nNormZoom, 100 ); // "normal" zoom (always)
+ aZoomX = aZoomY = boost::rational<long>( nNormZoom, 100 ); // "normal" zoom (always)
sal_uInt16 nPageZoom = sal::static_int_cast<sal_uInt16>(aZoomStr.getToken(1,'/').toInt32());
if ( nPageZoom >= MINZOOM && nPageZoom <= MAXZOOM )
- aPageZoomX = aPageZoomY = Fraction( nPageZoom, 100 ); // Pagebreak-zoom, if set
+ aPageZoomX = aPageZoomY = boost::rational<long>( nPageZoom, 100 ); // Pagebreak-zoom, if set
sal_Unicode cMode = aZoomStr.getToken(2,'/')[0]; // 0 or "0"/"1"
SetPagebreakMode( cMode == '1' );
// SetPagebreakMode muss immer gerufen werden wegen CalcPPT / RecalcPixPos()
@@ -2447,8 +2447,8 @@ void ScViewData::WriteExtOptions( ScExtDocOptions& rDocOpt ) const
// view mode and zoom
rTabSett.mbPageMode = bPagebreak;
- rTabSett.mnNormalZoom = static_cast< long >( pViewTab->aZoomY * Fraction( 100.0 ) );
- rTabSett.mnPageZoom = static_cast< long >( pViewTab->aPageZoomY * Fraction( 100.0 ) );
+ rTabSett.mnNormalZoom = boost::rational_cast<long>(pViewTab->aZoomY * rational_FromDouble(100.));
+ rTabSett.mnPageZoom = boost::rational_cast<long>(pViewTab->aPageZoomY * rational_FromDouble(100.));
}
}
}
@@ -2579,9 +2579,9 @@ void ScViewData::ReadExtOptions( const ScExtDocOptions& rDocOpt )
// zoom for each sheet
if( rTabSett.mnNormalZoom )
- rViewTab.aZoomX = rViewTab.aZoomY = Fraction( rTabSett.mnNormalZoom, 100L );
+ rViewTab.aZoomX = rViewTab.aZoomY = boost::rational<long>( rTabSett.mnNormalZoom, 100L );
if( rTabSett.mnPageZoom )
- rViewTab.aPageZoomX = rViewTab.aPageZoomY = Fraction( rTabSett.mnPageZoom, 100L );
+ rViewTab.aPageZoomX = rViewTab.aPageZoomY = boost::rational<long>( rTabSett.mnPageZoom, 100L );
rViewTab.bShowGrid = rTabSett.mbShowGrid;
@@ -2599,9 +2599,9 @@ void ScViewData::ReadExtOptions( const ScExtDocOptions& rDocOpt )
// view mode and default zoom (for new sheets) from current sheet
if( rTabSett.mnNormalZoom )
- aDefZoomX = aDefZoomY = Fraction( rTabSett.mnNormalZoom, 100L );
+ aDefZoomX = aDefZoomY = boost::rational<long>( rTabSett.mnNormalZoom, 100L );
if( rTabSett.mnPageZoom )
- aDefPageZoomX = aDefPageZoomY = Fraction( rTabSett.mnPageZoom, 100L );
+ aDefPageZoomX = aDefPageZoomY = boost::rational<long>( rTabSett.mnPageZoom, 100L );
/* #i46820# set pagebreak mode via SetPagebreakMode(), this will
update map modes that are needed to draw text correctly. */
SetPagebreakMode( rTabSett.mbPageMode );
@@ -2662,8 +2662,8 @@ void ScViewData::WriteUserDataSequence(uno::Sequence <beans::PropertyValue>& rSe
pSettings[SC_ACTIVE_TABLE].Value <<= sName;
pSettings[SC_HORIZONTAL_SCROLL_BAR_WIDTH].Name = OUString(SC_HORIZONTALSCROLLBARWIDTH);
pSettings[SC_HORIZONTAL_SCROLL_BAR_WIDTH].Value <<= sal_Int32(pView->GetTabBarWidth());
- sal_Int32 nZoomValue ((pThisTab->aZoomY.GetNumerator() * 100) / pThisTab->aZoomY.GetDenominator());
- sal_Int32 nPageZoomValue ((pThisTab->aPageZoomY.GetNumerator() * 100) / pThisTab->aPageZoomY.GetDenominator());
+ sal_Int32 nZoomValue ((pThisTab->aZoomY.numerator() * 100) / pThisTab->aZoomY.denominator());
+ sal_Int32 nPageZoomValue ((pThisTab->aPageZoomY.numerator() * 100) / pThisTab->aPageZoomY.denominator());
pSettings[SC_ZOOM_TYPE].Name = OUString(SC_ZOOMTYPE);
pSettings[SC_ZOOM_TYPE].Value <<= sal_Int16(pThisTab->eZoomType);
pSettings[SC_ZOOM_VALUE].Name = OUString(SC_ZOOMVALUE);
@@ -2787,7 +2787,7 @@ void ScViewData::ReadUserDataSequence(const uno::Sequence <beans::PropertyValue>
{
if (rSettings[i].Value >>= nTemp32)
{
- Fraction aZoom(nTemp32, 100);
+ boost::rational<long> aZoom(nTemp32, 100);
aDefZoomX = aDefZoomY = aZoom;
}
}
@@ -2795,7 +2795,7 @@ void ScViewData::ReadUserDataSequence(const uno::Sequence <beans::PropertyValue>
{
if (rSettings[i].Value >>= nTemp32)
{
- Fraction aZoom(nTemp32, 100);
+ boost::rational<long> aZoom(nTemp32, 100);
aDefPageZoomX = aDefPageZoomY = aZoom;
}
}
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 1f395fc4aad6..4a69e92182b0 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -114,15 +114,15 @@ bool ScViewFunc::AdjustBlockHeight( bool bPaint, ScMarkData* pMarkData )
double nPPTX = GetViewData().GetPPTX();
double nPPTY = GetViewData().GetPPTY();
- Fraction aZoomX = GetViewData().GetZoomX();
- Fraction aZoomY = GetViewData().GetZoomY();
+ boost::rational<long> aZoomX = GetViewData().GetZoomX();
+ boost::rational<long> aZoomY = GetViewData().GetZoomY();
ScSizeDeviceProvider aProv(pDocSh);
if (aProv.IsPrinter())
{
nPPTX = aProv.GetPPTX();
nPPTY = aProv.GetPPTY();
- aZoomX = aZoomY = Fraction( 1, 1 );
+ aZoomX = aZoomY = boost::rational<long>( 1, 1 );
}
sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, aProv.GetDevice());
@@ -163,8 +163,8 @@ bool ScViewFunc::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, bool bPaint )
SCTAB nTab = GetViewData().GetTabNo();
double nPPTX = GetViewData().GetPPTX();
double nPPTY = GetViewData().GetPPTY();
- Fraction aZoomX = GetViewData().GetZoomX();
- Fraction aZoomY = GetViewData().GetZoomY();
+ boost::rational<long> aZoomX = GetViewData().GetZoomX();
+ boost::rational<long> aZoomY = GetViewData().GetZoomY();
sal_uInt16 nOldPixel = 0;
if (nStartRow == nEndRow)
nOldPixel = (sal_uInt16) (rDoc.GetRowHeight(nStartRow,nTab) * nPPTY);
@@ -174,7 +174,7 @@ bool ScViewFunc::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, bool bPaint )
{
nPPTX = aProv.GetPPTX();
nPPTY = aProv.GetPPTY();
- aZoomX = aZoomY = Fraction( 1, 1 );
+ aZoomX = aZoomY = boost::rational<long>( 1, 1 );
}
sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, aProv.GetDevice());
bool bChanged = rDoc.SetOptimalHeight(aCxt, nStartRow, nEndRow, nTab);
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index b937eb3bf121..1e27dd1e9be1 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -420,7 +420,7 @@ bool ScViewFunc::PasteGraphic( const Point& rPos, const Graphic& rGraphic,
if (aSourceMap.GetMapUnit() == MAP_PIXEL)
{
// consider pixel correction, so bitmap fits to screen
- Fraction aScaleX, aScaleY;
+ boost::rational<long> aScaleX, aScaleY;
pScDrawView->CalcNormScale( aScaleX, aScaleY );
aDestMap.SetScaleX(aScaleX);
aDestMap.SetScaleY(aScaleY);
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index f1ab1ebd8dba..3ed06d2db3de 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -228,15 +228,15 @@ sal_uInt16 ScViewFunc::GetOptimalColWidth( SCCOL nCol, SCTAB nTab, bool bFormula
double nPPTX = GetViewData().GetPPTX();
double nPPTY = GetViewData().GetPPTY();
- Fraction aZoomX = GetViewData().GetZoomX();
- Fraction aZoomY = GetViewData().GetZoomY();
+ boost::rational<long> aZoomX = GetViewData().GetZoomX();
+ boost::rational<long> aZoomY = GetViewData().GetZoomY();
ScSizeDeviceProvider aProv(pDocSh);
if (aProv.IsPrinter())
{
nPPTX = aProv.GetPPTX();
nPPTY = aProv.GetPPTY();
- aZoomX = aZoomY = Fraction( 1, 1 );
+ aZoomX = aZoomY = boost::rational<long>( 1, 1 );
}
sal_uInt16 nTwips = rDoc.GetOptimalColWidth( nCol, nTab, aProv.GetDevice(),
@@ -2031,15 +2031,15 @@ void ScViewFunc::SetWidthOrHeight(
double nPPTX = GetViewData().GetPPTX();
double nPPTY = GetViewData().GetPPTY();
- Fraction aZoomX = GetViewData().GetZoomX();
- Fraction aZoomY = GetViewData().GetZoomY();
+ boost::rational<long> aZoomX = GetViewData().GetZoomX();
+ boost::rational<long> aZoomY = GetViewData().GetZoomY();
ScSizeDeviceProvider aProv(pDocSh);
if (aProv.IsPrinter())
{
nPPTX = aProv.GetPPTX();
nPPTY = aProv.GetPPTY();
- aZoomX = aZoomY = Fraction( 1, 1 );
+ aZoomX = aZoomY = boost::rational<long>( 1, 1 );
}
sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, aProv.GetDevice());
@@ -2265,15 +2265,15 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal )
{
double nPPTX = GetViewData().GetPPTX();
double nPPTY = GetViewData().GetPPTY();
- Fraction aZoomX = GetViewData().GetZoomX();
- Fraction aZoomY = GetViewData().GetZoomY();
+ boost::rational<long> aZoomX = GetViewData().GetZoomX();
+ boost::rational<long> aZoomY = GetViewData().GetZoomY();
ScSizeDeviceProvider aProv(pDocSh);
if (aProv.IsPrinter())
{
nPPTX = aProv.GetPPTX();
nPPTY = aProv.GetPPTY();
- aZoomX = aZoomY = Fraction( 1, 1 );
+ aZoomX = aZoomY = boost::rational<long>( 1, 1 );
}
long nPixel = rDoc.GetNeededSize( nCol, nRow, nTab, aProv.GetDevice(),
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index 772364fdb345..39cded4e3e74 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -192,12 +192,12 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh)
// Allow UI scale only for draw documents.
if( eType == DOCUMENT_TYPE_DRAW )
- SetUIUnit( (FieldUnit)pOptions->GetMetric(), Fraction( nX, nY ) ); // user-defined
+ SetUIUnit( (FieldUnit)pOptions->GetMetric(), boost::rational<long>( nX, nY ) ); // user-defined
else
- SetUIUnit( (FieldUnit)pOptions->GetMetric(), Fraction( 1, 1 ) ); // default
+ SetUIUnit( (FieldUnit)pOptions->GetMetric(), boost::rational<long>( 1, 1 ) ); // default
SetScaleUnit(MAP_100TH_MM);
- SetScaleFraction(Fraction(1, 1));
+ SetScaleFraction(boost::rational<long>(1, 1));
SetDefaultFontHeight(847); // 24p
pItemPool->SetDefaultMetric(SFX_MAPUNIT_100TH_MM);
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 75e41fb8b085..1e96f6f0aa68 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -1843,8 +1843,8 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderR
long nOldWidth = GetWdt() - GetLftBorder() - GetRgtBorder();
long nOldHeight = GetHgt() - GetUppBorder() - GetLwrBorder();
- Fraction aFractX = Fraction(aNewPageSize.Width(), nOldWidth);
- Fraction aFractY = Fraction(aNewPageSize.Height(), nOldHeight);
+ boost::rational<long> aFractX( aNewPageSize.Width(), nOldWidth );
+ boost::rational<long> aFractY( aNewPageSize.Height(), nOldHeight );
const size_t nObjCnt = (mbScaleObjects ? GetObjCount() : 0);
@@ -1902,14 +1902,14 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderR
SvxFontHeightItem& rOldHgt = (SvxFontHeightItem&) rSet.Get(EE_CHAR_FONTHEIGHT);
sal_uLong nFontHeight = rOldHgt.GetHeight();
- nFontHeight = long(nFontHeight * (double) aFractY);
+ nFontHeight = long(nFontHeight * boost::rational_cast<double>(aFractY));
rSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT));
if( SfxItemState::DEFAULT == rSet.GetItemState( EE_CHAR_FONTHEIGHT_CJK ) )
{
rOldHgt = (SvxFontHeightItem&) rSet.Get(EE_CHAR_FONTHEIGHT_CJK);
nFontHeight = rOldHgt.GetHeight();
- nFontHeight = long(nFontHeight * (double) aFractY);
+ nFontHeight = long(nFontHeight * boost::rational_cast<double>(aFractY));
rSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CJK));
}
@@ -1917,7 +1917,7 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderR
{
rOldHgt = (SvxFontHeightItem&) rSet.Get(EE_CHAR_FONTHEIGHT_CTL);
nFontHeight = rOldHgt.GetHeight();
- nFontHeight = long(nFontHeight * (double) aFractY);
+ nFontHeight = long(nFontHeight * boost::rational_cast<double>(aFractY));
rSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CTL));
}
@@ -1941,14 +1941,14 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderR
SvxFontHeightItem& rOldHgt = (SvxFontHeightItem&) aTempSet.Get(EE_CHAR_FONTHEIGHT);
sal_uLong nFontHeight = rOldHgt.GetHeight();
- nFontHeight = long(nFontHeight * (double) aFractY);
+ nFontHeight = long(nFontHeight * boost::rational_cast<double>(aFractY));
aTempSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT));
if( SfxItemState::DEFAULT == aTempSet.GetItemState( EE_CHAR_FONTHEIGHT_CJK ) )
{
rOldHgt = (SvxFontHeightItem&) aTempSet.Get(EE_CHAR_FONTHEIGHT_CJK);
nFontHeight = rOldHgt.GetHeight();
- nFontHeight = long(nFontHeight * (double) aFractY);
+ nFontHeight = long(nFontHeight * boost::rational_cast<double>(aFractY));
aTempSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CJK));
}
@@ -1956,7 +1956,7 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderR
{
rOldHgt = (SvxFontHeightItem&) aTempSet.Get(EE_CHAR_FONTHEIGHT_CTL);
nFontHeight = rOldHgt.GetHeight();
- nFontHeight = long(nFontHeight * (double) aFractY);
+ nFontHeight = long(nFontHeight * boost::rational_cast<double>(aFractY));
aTempSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CTL));
}
@@ -2018,7 +2018,7 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderR
// use more modern method to scale the text height
sal_uInt32 nFontHeight = ((SvxFontHeightItem&)pObj->GetMergedItem(nWhich)).GetHeight();
- sal_uInt32 nNewFontHeight = sal_uInt32((double)nFontHeight * (double)aFractY);
+ sal_uInt32 nNewFontHeight = sal_uInt32((double)nFontHeight * boost::rational_cast<double>(aFractY));
pObj->SetMergedItem(SvxFontHeightItem(nNewFontHeight, 100, nWhich));
}
@@ -2034,8 +2034,8 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderR
// corrected scaling; only distances may be scaled
// use aTopLeft as original TopLeft
- aNewPos.X() = long((aTopLeft.X() - GetLftBorder()) * (double)aFractX) + nLeft;
- aNewPos.Y() = long((aTopLeft.Y() - GetUppBorder()) * (double)aFractY) + nUpper;
+ aNewPos.X() = long((aTopLeft.X() - GetLftBorder()) * boost::rational_cast<double>(aFractX)) + nLeft;
+ aNewPos.Y() = long((aTopLeft.Y() - GetUppBorder()) * boost::rational_cast<double>(aFractY)) + nUpper;
Size aVec(aNewPos.X() - aTopLeft.X(), aNewPos.Y() - aTopLeft.Y());
diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx
index 082b67a89655..d05ed1149d3b 100644
--- a/sd/source/filter/eppt/eppt.cxx
+++ b/sd/source/filter/eppt/eppt.cxx
@@ -1095,7 +1095,7 @@ void ImplExportComments( uno::Reference< drawing::XDrawPage > xPage, SvMemoryStr
uno::Reference< office::XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement() );
geometry::RealPoint2D aRealPoint2D( xAnnotation->getPosition() );
- MapMode aMapDest( MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ) );
+ MapMode aMapDest( MAP_INCH, Point(), boost::rational<long>( 1, 576 ), boost::rational<long>( 1, 576 ) );
Point aPoint( OutputDevice::LogicToLogic( Point( static_cast< sal_Int32 >( aRealPoint2D.X * 100.0 ),
static_cast< sal_Int32 >( aRealPoint2D.Y * 100.0 ) ), MAP_100TH_MM, aMapDest ) );
diff --git a/sd/source/filter/eppt/epptbase.hxx b/sd/source/filter/eppt/epptbase.hxx
index 00eb6a1a3de8..9529d58a3ea1 100644
--- a/sd/source/filter/eppt/epptbase.hxx
+++ b/sd/source/filter/eppt/epptbase.hxx
@@ -347,7 +347,7 @@ protected:
sal_uInt32 mnPages; ///< number of Slides ( w/o master pages & notes & handout )
sal_uInt32 mnMasterPages;
- Fraction maFraction;
+ boost::rational<long> maFraction;
MapMode maMapModeSrc;
MapMode maMapModeDest;
::com::sun::star::awt::Size maDestPageSize;
diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx
index b2c25b55eb27..8e56d350e884 100644
--- a/sd/source/filter/eppt/pptx-text.cxx
+++ b/sd/source/filter/eppt/pptx-text.cxx
@@ -652,7 +652,7 @@ ParagraphObj::ParagraphObj(const ::com::sun::star::uno::Reference< ::com::sun::s
, SOParagraph()
, mvPortions()
, maMapModeSrc(MAP_100TH_MM)
- , maMapModeDest(MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ))
+ , maMapModeDest(MAP_INCH, Point(), boost::rational<long>( 1, 576 ), boost::rational<long>( 1, 576 ))
, mnTextSize(0)
, mbFirstParagraph(false)
, mbLastParagraph(false)
@@ -682,7 +682,7 @@ ParagraphObj::ParagraphObj(::com::sun::star::uno::Reference< ::com::sun::star::t
, SOParagraph()
, mvPortions()
, maMapModeSrc(MAP_100TH_MM)
- , maMapModeDest(MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ))
+ , maMapModeDest(MAP_INCH, Point(), boost::rational<long>( 1, 576 ), boost::rational<long>( 1, 576 ))
, mnTextSize(0)
, mbIsBullet(false)
, mbFirstParagraph( aParaFlags.bFirstParagraph )
diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx
index e5676c4d105f..a93091e8c56c 100644
--- a/sd/source/ui/animations/motionpathtag.cxx
+++ b/sd/source/ui/animations/motionpathtag.cxx
@@ -181,7 +181,7 @@ bool PathDragResize::EndSdrDrag(bool /*bCopy*/)
{
const Point aRef( DragStat().Ref1() );
basegfx::B2DHomMatrix aTrans(basegfx::tools::createTranslateB2DHomMatrix(-aRef.X(), -aRef.Y()));
- aTrans.scale(double(aXFact), double(aYFact));
+ aTrans.scale(boost::rational_cast<double>(aXFact), boost::rational_cast<double>(aYFact));
aTrans.translate(aRef.X(), aRef.Y());
basegfx::B2DPolyPolygon aDragPoly(pPathObj->GetPathPoly());
aDragPoly.transform(aTrans);
diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx
index 47063aad5fc8..19125096c0e1 100644
--- a/sd/source/ui/annotations/annotationwindow.cxx
+++ b/sd/source/ui/annotations/annotationwindow.cxx
@@ -376,7 +376,7 @@ void AnnotationWindow::Rescale()
{
vcl::Font aFont( mpMeta->GetSettings().GetStyleSettings().GetFieldFont() );
sal_Int32 nHeight = aFont.GetHeight();
- nHeight = nHeight * aMode.GetScaleY().GetNumerator() / aMode.GetScaleY().GetDenominator();
+ nHeight = nHeight * aMode.GetScaleY().numerator() / aMode.GetScaleY().denominator();
aFont.SetHeight( nHeight );
mpMeta->SetControlFont( aFont );
}
diff --git a/sd/source/ui/app/optsitem.cxx b/sd/source/ui/app/optsitem.cxx
index dca7ba140995..73db89fa54b9 100644
--- a/sd/source/ui/app/optsitem.cxx
+++ b/sd/source/ui/app/optsitem.cxx
@@ -1126,8 +1126,8 @@ SdOptionsGridItem::SdOptionsGridItem( sal_uInt16 _nWhich, SdOptions* pOpts, ::sd
SetFldDrawY( pView->GetGridCoarse().Height() );
SetFldDivisionX( pView->GetGridFine().Width() ? ( GetFldDrawX() / pView->GetGridFine().Width() - 1 ) : 0 );
SetFldDivisionY( pView->GetGridFine().Height() ? ( GetFldDrawY() / pView->GetGridFine().Height() - 1 ) : 0 );
- SetFldSnapX( long(pView->GetSnapGridWidthX()) );
- SetFldSnapY( long(pView->GetSnapGridWidthY()) );
+ SetFldSnapX( boost::rational_cast<long>(pView->GetSnapGridWidthX()) );
+ SetFldSnapY( boost::rational_cast<long>(pView->GetSnapGridWidthY()) );
SetUseGridSnap( pView->IsGridSnap() );
SetGridVisible( pView->IsGridVisible() );
}
diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx
index 2c83b2d5102e..8db6f17d7f52 100644
--- a/sd/source/ui/app/sdmod2.cxx
+++ b/sd/source/ui/app/sdmod2.cxx
@@ -502,9 +502,9 @@ SfxItemSet* SdModule::CreateItemSet( sal_uInt16 nSlot )
if(pFrameView)
{
- const Fraction& rFraction = pDoc->GetUIScale();
- nX=rFraction.GetNumerator();
- nY=rFraction.GetDenominator();
+ const boost::rational<long>& rFraction = pDoc->GetUIScale();
+ nX=rFraction.numerator();
+ nY=rFraction.denominator();
}
else
{
@@ -595,7 +595,7 @@ void SdModule::ApplyItemSet( sal_uInt16 nSlot, const SfxItemSet& rSet )
// Apply to document only if doc type match
if( pDocSh && pDoc && eDocType == pDoc->GetDocumentType() )
{
- pDoc->SetUIScale( Fraction( nX, nY ) );
+ pDoc->SetUIScale( boost::rational<long>( nX, nY ) );
if( pViewShell )
pViewShell->SetRuler( pViewShell->HasRuler() );
}
diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx
index 019103ef4efb..2e9764b49efa 100644
--- a/sd/source/ui/dlg/animobjs.cxx
+++ b/sd/source/ui/dlg/animobjs.cxx
@@ -89,8 +89,8 @@ void SdDisplay::Paint( const Rectangle& )
Point aPt;
Size aSize = GetOutputSize();
Size aBmpSize = aBitmapEx.GetBitmap().GetSizePixel();
- aBmpSize.Width() = (long) ( (double) aBmpSize.Width() * (double) aScale );
- aBmpSize.Height() = (long) ( (double) aBmpSize.Height() * (double) aScale );
+ aBmpSize.Width() = (long) ( (double) aBmpSize.Width() * boost::rational_cast<double>(this->aScale) );
+ aBmpSize.Height() = (long) ( (double) aBmpSize.Height() * boost::rational_cast<double>(this->aScale) );
if( aBmpSize.Width() < aSize.Width() )
aPt.X() = ( aSize.Width() - aBmpSize.Width() ) / 2;
@@ -100,7 +100,7 @@ void SdDisplay::Paint( const Rectangle& )
aBitmapEx.Draw( this, aPt, aBmpSize );
}
-void SdDisplay::SetScale( const Fraction& rFrac )
+void SdDisplay::SetScale( const boost::rational<long>& rFrac )
{
aScale = rFrac;
}
@@ -468,7 +468,7 @@ IMPL_LINK( AnimationWindow, ClickRemoveBitmapHdl, void *, pBtn )
}
// calculate and set zoom for DisplayWin
- Fraction aFrac( GetScale() );
+ boost::rational<long> aFrac( GetScale() );
aCtlDisplay.SetScale( aFrac );
UpdateControl();
@@ -643,9 +643,9 @@ void AnimationWindow::WaitInEffect( sal_uLong nMilliSeconds, sal_uLong nTime,
}
}
-Fraction AnimationWindow::GetScale()
+boost::rational<long> AnimationWindow::GetScale()
{
- Fraction aFrac;
+ boost::rational<long> aFrac;
size_t const nCount = m_FrameList.size();
if (nCount > 0)
{
@@ -662,7 +662,7 @@ Fraction AnimationWindow::GetScale()
aBmpSize.Width() += 10;
aBmpSize.Height() += 10;
- aFrac = Fraction( std::min( (double)aDisplaySize.Width() / (double)aBmpSize.Width(),
+ aFrac = rational_FromDouble( std::min( (double)aDisplaySize.Width() / (double)aBmpSize.Width(),
(double)aDisplaySize.Height() / (double)aBmpSize.Height() ) );
}
return( aFrac );
@@ -733,7 +733,7 @@ void AnimationWindow::Resize()
aGrpAnimation.SetPosPixel( aGrpAnimation.GetPosPixel() + aPt );
// calculate and set zoom for DisplayWin
- Fraction aFrac( GetScale() );
+ boost::rational<long> aFrac( GetScale() );
aCtlDisplay.SetScale( aFrac );
aBtnFirst.Show();
@@ -963,7 +963,7 @@ void AnimationWindow::AddObj (::sd::View& rView )
}
// calculate and set zoom for DisplayWin
- Fraction aFrac( GetScale() );
+ boost::rational<long> aFrac( GetScale() );
aCtlDisplay.SetScale( aFrac );
UpdateControl();
diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx
index 56e865215205..c55915884881 100644
--- a/sd/source/ui/dlg/copydlg.cxx
+++ b/sd/source/ui/dlg/copydlg.cxx
@@ -128,12 +128,12 @@ void CopyDlg::Reset()
long nMoveX = 500L;
if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_MOVE_X, true, &pPoolItem ) )
nMoveX = ( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() );
- SetMetricValue( *m_pMtrFldMoveX, Fraction(nMoveX) / maUIScale, SFX_MAPUNIT_100TH_MM);
+ SetMetricValue( *m_pMtrFldMoveX, boost::rational_cast<long>(nMoveX / maUIScale), SFX_MAPUNIT_100TH_MM);
long nMoveY = 500L;
if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_MOVE_Y, true, &pPoolItem ) )
nMoveY = ( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() );
- SetMetricValue( *m_pMtrFldMoveY, Fraction(nMoveY) / maUIScale, SFX_MAPUNIT_100TH_MM);
+ SetMetricValue( *m_pMtrFldMoveY, boost::rational_cast<long>(nMoveY / maUIScale), SFX_MAPUNIT_100TH_MM);
if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_ANGLE, true, &pPoolItem ) )
m_pMtrFldAngle->SetValue( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() );
@@ -143,12 +143,12 @@ void CopyDlg::Reset()
long nWidth = 0L;
if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_WIDTH, true, &pPoolItem ) )
nWidth = ( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() );
- SetMetricValue( *m_pMtrFldWidth, Fraction(nWidth) / maUIScale, SFX_MAPUNIT_100TH_MM);
+ SetMetricValue( *m_pMtrFldWidth, boost::rational_cast<long>(nWidth / maUIScale), SFX_MAPUNIT_100TH_MM);
long nHeight = 0L;
if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_HEIGHT, true, &pPoolItem ) )
nHeight = ( ( ( const SfxInt32Item* ) pPoolItem )->GetValue() );
- SetMetricValue( *m_pMtrFldHeight, Fraction(nHeight) / maUIScale, SFX_MAPUNIT_100TH_MM);
+ SetMetricValue( *m_pMtrFldHeight, boost::rational_cast<long>(nHeight / maUIScale), SFX_MAPUNIT_100TH_MM);
if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_START_COLOR, true, &pPoolItem ) )
{
@@ -199,10 +199,10 @@ void CopyDlg::Reset()
*/
void CopyDlg::GetAttr( SfxItemSet& rOutAttrs )
{
- long nMoveX = Fraction( GetCoreValue( *m_pMtrFldMoveX, SFX_MAPUNIT_100TH_MM) ) * maUIScale;
- long nMoveY = Fraction( GetCoreValue( *m_pMtrFldMoveY, SFX_MAPUNIT_100TH_MM) ) * maUIScale;
- long nHeight = Fraction( GetCoreValue( *m_pMtrFldHeight, SFX_MAPUNIT_100TH_MM) ) * maUIScale;
- long nWidth = Fraction( GetCoreValue( *m_pMtrFldWidth, SFX_MAPUNIT_100TH_MM) ) * maUIScale;
+ long nMoveX = boost::rational_cast<long>(GetCoreValue(*m_pMtrFldMoveX, SFX_MAPUNIT_100TH_MM) * maUIScale);
+ long nMoveY = boost::rational_cast<long>(GetCoreValue(*m_pMtrFldMoveY, SFX_MAPUNIT_100TH_MM) * maUIScale);
+ long nHeight = boost::rational_cast<long>(GetCoreValue(*m_pMtrFldHeight, SFX_MAPUNIT_100TH_MM) * maUIScale);
+ long nWidth = boost::rational_cast<long>(GetCoreValue(*m_pMtrFldWidth, SFX_MAPUNIT_100TH_MM) * maUIScale);
rOutAttrs.Put( SfxUInt16Item( ATTR_COPY_NUMBER, (sal_uInt16) m_pNumFldCopies->GetValue() ) );
rOutAttrs.Put( SfxInt32Item( ATTR_COPY_MOVE_X, nMoveX ) );
@@ -249,10 +249,8 @@ IMPL_LINK_NOARG(CopyDlg, SetViewData)
{
Rectangle aRect = mpView->GetAllMarkedRect();
- SetMetricValue( *m_pMtrFldMoveX, Fraction( aRect.GetWidth() ) /
- maUIScale, SFX_MAPUNIT_100TH_MM);
- SetMetricValue( *m_pMtrFldMoveY, Fraction( aRect.GetHeight() ) /
- maUIScale, SFX_MAPUNIT_100TH_MM);
+ SetMetricValue( *m_pMtrFldMoveX, boost::rational_cast<long>(aRect.GetWidth() / maUIScale), SFX_MAPUNIT_100TH_MM);
+ SetMetricValue( *m_pMtrFldMoveY, boost::rational_cast<long>(aRect.GetHeight() / maUIScale), SFX_MAPUNIT_100TH_MM);
// sets color attribute
const SfxPoolItem* pPoolItem = NULL;
@@ -273,13 +271,13 @@ IMPL_LINK_NOARG(CopyDlg, SetDefault)
m_pNumFldCopies->SetValue( 1L );
long nValue = 500L;
- SetMetricValue( *m_pMtrFldMoveX, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM);
- SetMetricValue( *m_pMtrFldMoveY, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM);
+ SetMetricValue( *m_pMtrFldMoveX, boost::rational_cast<long>(nValue / maUIScale), SFX_MAPUNIT_100TH_MM);
+ SetMetricValue( *m_pMtrFldMoveY, boost::rational_cast<long>(nValue / maUIScale), SFX_MAPUNIT_100TH_MM);
nValue = 0L;
m_pMtrFldAngle->SetValue( nValue );
- SetMetricValue( *m_pMtrFldWidth, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM);
- SetMetricValue( *m_pMtrFldHeight, Fraction(nValue) / maUIScale, SFX_MAPUNIT_100TH_MM);
+ SetMetricValue( *m_pMtrFldWidth, boost::rational_cast<long>(nValue / maUIScale), SFX_MAPUNIT_100TH_MM);
+ SetMetricValue( *m_pMtrFldHeight, boost::rational_cast<long>(nValue / maUIScale), SFX_MAPUNIT_100TH_MM);
// set color attribute
const SfxPoolItem* pPoolItem = NULL;
diff --git a/sd/source/ui/dlg/dlgsnap.cxx b/sd/source/ui/dlg/dlgsnap.cxx
index ee8548f07c6a..b4565165da7f 100644
--- a/sd/source/ui/dlg/dlgsnap.cxx
+++ b/sd/source/ui/dlg/dlgsnap.cxx
@@ -78,33 +78,33 @@ SdSnapLineDlg::SdSnapLineDlg(
SetMetricValue( *m_pMtrFldX, aLeftTop.X(), ePoolUnit );
long nValue = static_cast<long>(m_pMtrFldX->GetValue());
- nValue = Fraction( nValue ) / aUIScale;
+ nValue = boost::rational_cast<long>(nValue / aUIScale);
m_pMtrFldX->SetMin( nValue );
m_pMtrFldX->SetFirst( nValue );
SetMetricValue( *m_pMtrFldX, aRightBottom.X(), ePoolUnit );
nValue = static_cast<long>(m_pMtrFldX->GetValue());
- nValue = Fraction( nValue ) / aUIScale;
+ nValue = boost::rational_cast<long>(nValue / aUIScale);
m_pMtrFldX->SetMax( nValue );
m_pMtrFldX->SetLast( nValue );
SetMetricValue( *m_pMtrFldY, aLeftTop.Y(), ePoolUnit );
nValue = static_cast<long>(m_pMtrFldY->GetValue());
- nValue = Fraction( nValue ) / aUIScale;
+ nValue = boost::rational_cast<long>(nValue / aUIScale);
m_pMtrFldY->SetMin( nValue );
m_pMtrFldY->SetFirst( nValue );
SetMetricValue( *m_pMtrFldY, aRightBottom.Y(), ePoolUnit );
nValue = static_cast<long>(m_pMtrFldY->GetValue());
- nValue = Fraction( nValue ) / aUIScale;
+ nValue = boost::rational_cast<long>(nValue / aUIScale);
m_pMtrFldY->SetMax( nValue );
m_pMtrFldY->SetLast( nValue );
// set values
nXValue = ((const SfxInt32Item&) rInAttrs.Get(ATTR_SNAPLINE_X)).GetValue();
nYValue = ((const SfxInt32Item&) rInAttrs.Get(ATTR_SNAPLINE_Y)).GetValue();
- nXValue = Fraction(nXValue) / aUIScale;
- nYValue = Fraction(nYValue) / aUIScale;
+ nXValue = boost::rational_cast<long>(nXValue / aUIScale);
+ nYValue = boost::rational_cast<long>(nYValue / aUIScale);
SetMetricValue( *m_pMtrFldX, nXValue, SFX_MAPUNIT_100TH_MM);
SetMetricValue( *m_pMtrFldY, nYValue, SFX_MAPUNIT_100TH_MM);
@@ -135,8 +135,8 @@ void SdSnapLineDlg::GetAttr(SfxItemSet& rOutAttrs)
else if ( m_pRbVert->IsChecked() ) eKind = SK_VERTICAL;
else eKind = SK_POINT;
- nXValue = Fraction( GetCoreValue( *m_pMtrFldX, SFX_MAPUNIT_100TH_MM) ) * aUIScale;
- nYValue = Fraction( GetCoreValue( *m_pMtrFldY, SFX_MAPUNIT_100TH_MM) ) * aUIScale;
+ nXValue = boost::rational_cast<long>(GetCoreValue(*m_pMtrFldX, SFX_MAPUNIT_100TH_MM) * aUIScale);
+ nYValue = boost::rational_cast<long>(GetCoreValue(*m_pMtrFldY, SFX_MAPUNIT_100TH_MM) * aUIScale);
rOutAttrs.Put(SfxAllEnumItem(ATTR_SNAPLINE_KIND, (sal_uInt16)eKind));
rOutAttrs.Put(SfxUInt32Item(ATTR_SNAPLINE_X, nXValue));
diff --git a/sd/source/ui/dlg/docprev.cxx b/sd/source/ui/dlg/docprev.cxx
index e6501b00e7b7..a6f2fa7787ae 100644
--- a/sd/source/ui/dlg/docprev.cxx
+++ b/sd/source/ui/dlg/docprev.cxx
@@ -237,7 +237,7 @@ void SdDocPreviewWin::updateViewSettings()
VirtualDevice aVDev;
- const Fraction aFrac( pDoc->GetScaleFraction() );
+ const boost::rational<long> aFrac( pDoc->GetScaleFraction() );
const MapMode aMap( pDoc->GetScaleUnit(), Point(), aFrac, aFrac );
aVDev.SetMapMode( aMap );
diff --git a/sd/source/ui/dlg/vectdlg.cxx b/sd/source/ui/dlg/vectdlg.cxx
index ee7c184e5b37..ecb5a2966cbc 100644
--- a/sd/source/ui/dlg/vectdlg.cxx
+++ b/sd/source/ui/dlg/vectdlg.cxx
@@ -113,7 +113,7 @@ void SdVectorizeDlg::InitPreviewBmp()
m_pBmpWin->SetGraphic( aPreviewBmp );
}
-Bitmap SdVectorizeDlg::GetPreparedBitmap( Bitmap& rBmp, Fraction& rScale )
+Bitmap SdVectorizeDlg::GetPreparedBitmap( Bitmap& rBmp, boost::rational<long>& rScale )
{
Bitmap aNew( rBmp );
const Size aSizePix( aNew.GetSizePixel() );
@@ -121,11 +121,11 @@ Bitmap SdVectorizeDlg::GetPreparedBitmap( Bitmap& rBmp, Fraction& rScale )
if( aSizePix.Width() > VECTORIZE_MAX_EXTENT || aSizePix.Height() > VECTORIZE_MAX_EXTENT )
{
const Rectangle aRect( GetRect( Size( VECTORIZE_MAX_EXTENT, VECTORIZE_MAX_EXTENT ), aSizePix ) );
- rScale = Fraction( aSizePix.Width(), aRect.GetWidth() );
+ rScale = boost::rational<long>( aSizePix.Width(), aRect.GetWidth() );
aNew.Scale( aRect.GetSize() );
}
else
- rScale = Fraction( 1, 1 );
+ rScale = boost::rational<long>( 1, 1 );
aNew.ReduceColors( (sal_uInt16) m_pNmLayers->GetValue(), BMP_REDUCE_SIMPLE );
@@ -137,7 +137,7 @@ void SdVectorizeDlg::Calculate( Bitmap& rBmp, GDIMetaFile& rMtf )
mpDocSh->SetWaitCursor( true );
m_pPrgs->SetValue( 0 );
- Fraction aScale;
+ boost::rational<long> aScale;
Bitmap aTmp( GetPreparedBitmap( rBmp, aScale ) );
if( !!aTmp )
diff --git a/sd/source/ui/docshell/docshel2.cxx b/sd/source/ui/docshell/docshel2.cxx
index c0bf1fcf8b34..923e70b407f2 100644
--- a/sd/source/ui/docshell/docshel2.cxx
+++ b/sd/source/ui/docshell/docshel2.cxx
@@ -199,7 +199,7 @@ Bitmap DrawDocShell::GetPagePreviewBitmap(SdPage* pPage, sal_uInt16 nMaxEdgePixe
const Size aPixSize( aVDev.LogicToPixel( aSize ) );
const sal_uLong nMaxEdgePix = std::max( aPixSize.Width(), aPixSize.Height() );
- Fraction aFrac( nMaxEdgePixel, nMaxEdgePix );
+ boost::rational<long> aFrac( nMaxEdgePixel, nMaxEdgePix );
aMapMode.SetScaleX( aFrac );
aMapMode.SetScaleY( aFrac );
@@ -207,7 +207,7 @@ Bitmap DrawDocShell::GetPagePreviewBitmap(SdPage* pPage, sal_uInt16 nMaxEdgePixe
aVDev.SetOutputSize( aSize );
// that we also get the dark lines at the right and bottom page margin
- aFrac = Fraction( nMaxEdgePixel - 1, nMaxEdgePix );
+ aFrac = boost::rational<long>( nMaxEdgePixel - 1, nMaxEdgePix );
aMapMode.SetScaleX( aFrac );
aMapMode.SetScaleY( aFrac );
aVDev.SetMapMode( aMapMode );
diff --git a/sd/source/ui/docshell/sdclient.cxx b/sd/source/ui/docshell/sdclient.cxx
index 768ec5d94a72..0976289fb672 100644
--- a/sd/source/ui/docshell/sdclient.cxx
+++ b/sd/source/ui/docshell/sdclient.cxx
@@ -169,8 +169,8 @@ void Client::ViewChanged()
Size aSize = pSdrOle2Obj->GetOrigObjSize( &aMap100 );
aVisArea.SetSize( aSize );
- Size aScaledSize( static_cast< long >( GetScaleWidth() * Fraction( aVisArea.GetWidth() ) ),
- static_cast< long >( GetScaleHeight() * Fraction( aVisArea.GetHeight() ) ) );
+ Size aScaledSize( boost::rational_cast<long>(GetScaleWidth() * aVisArea.GetWidth()),
+ boost::rational_cast<long>(GetScaleHeight() * aVisArea.GetHeight()) );
// react to the change if the difference is bigger than one pixel
Size aPixelDiff =
diff --git a/sd/source/ui/func/fucopy.cxx b/sd/source/ui/func/fucopy.cxx
index 03477a588620..e1d0b57f76b2 100644
--- a/sd/source/ui/func/fucopy.cxx
+++ b/sd/source/ui/func/fucopy.cxx
@@ -235,8 +235,8 @@ void FuCopy::DoExecute( SfxRequest& rReq )
}
}
- Fraction aWidth( aRect.Right() - aRect.Left() + lWidth, aRect.Right() - aRect.Left() );
- Fraction aHeight( aRect.Bottom() - aRect.Top() + lHeight, aRect.Bottom() - aRect.Top() );
+ boost::rational<long> aWidth( aRect.Right() - aRect.Left() + lWidth, aRect.Right() - aRect.Left() );
+ boost::rational<long> aHeight( aRect.Bottom() - aRect.Top() + lHeight, aRect.Bottom() - aRect.Top() );
if( mpView->IsResizeAllowed() )
mpView->ResizeAllMarked( aRect.TopLeft(), aWidth, aHeight );
diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
index 42fbabe36d6a..8ffedbdf7569 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -408,7 +408,7 @@ protected:
virtual SvxRuler* CreateVRuler(::sd::Window* pWin) SAL_OVERRIDE;
virtual void UpdateHRuler() SAL_OVERRIDE;
virtual void UpdateVRuler() SAL_OVERRIDE;
- virtual void SetZoomFactor(const Fraction& rZoomX, const Fraction& rZoomY) SAL_OVERRIDE;
+ virtual void SetZoomFactor(const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY) SAL_OVERRIDE;
void SetupPage( Size &rSize, long nLeft, long nRight, long nUpper, long nLower,
bool bSize, bool bMargin, bool bScaleAll );
diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx
index 74e2bd254227..18e3cd43be3c 100644
--- a/sd/source/ui/inc/ViewShell.hxx
+++ b/sd/source/ui/inc/ViewShell.hxx
@@ -537,8 +537,8 @@ protected:
virtual void Activate(bool IsMDIActivate) SAL_OVERRIDE;
virtual void Deactivate(bool IsMDIActivate) SAL_OVERRIDE;
- virtual void SetZoomFactor( const Fraction &rZoomX,
- const Fraction &rZoomY );
+ virtual void SetZoomFactor( const boost::rational<long>& rZoomX,
+ const boost::rational<long>& rZoomY );
/**
This must be called after the ctor, but before anything else.
diff --git a/sd/source/ui/inc/ViewShellBase.hxx b/sd/source/ui/inc/ViewShellBase.hxx
index af33977a8e33..c744a3d3a085 100644
--- a/sd/source/ui/inc/ViewShellBase.hxx
+++ b/sd/source/ui/inc/ViewShellBase.hxx
@@ -161,8 +161,8 @@ public:
virtual void Activate (bool IsMDIActivate) SAL_OVERRIDE;
virtual void Deactivate (bool IsMDIActivate) SAL_OVERRIDE;
virtual void SetZoomFactor (
- const Fraction &rZoomX,
- const Fraction &rZoomY) SAL_OVERRIDE;
+ const boost::rational<long>& rZoomX,
+ const boost::rational<long>& rZoomY) SAL_OVERRIDE;
virtual bool PrepareClose (bool bUI = true) SAL_OVERRIDE;
virtual void WriteUserData (OUString&, bool bBrowse = false) SAL_OVERRIDE;
virtual void ReadUserData (const OUString&, bool bBrowse = false) SAL_OVERRIDE;
diff --git a/sd/source/ui/inc/animobjs.hxx b/sd/source/ui/inc/animobjs.hxx
index 9e720ad04260..2178f829108c 100644
--- a/sd/source/ui/inc/animobjs.hxx
+++ b/sd/source/ui/inc/animobjs.hxx
@@ -61,7 +61,7 @@ class SdDisplay : public Control
{
private:
BitmapEx aBitmapEx;
- Fraction aScale;
+ boost::rational<long> aScale;
public:
SdDisplay( vcl::Window* pWin, SdResId Id );
@@ -70,7 +70,7 @@ public:
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
void SetBitmapEx( BitmapEx* pBmpEx );
- void SetScale( const Fraction& rFrac );
+ void SetScale( const boost::rational<long>& rFrac );
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
};
@@ -155,7 +155,7 @@ private:
void ResetAttrs();
void WaitInEffect( sal_uLong nMilliSeconds, sal_uLong nTime,
SfxProgress* pStbMgr ) const;
- Fraction GetScale();
+ boost::rational<long> GetScale();
};
/**
diff --git a/sd/source/ui/inc/copydlg.hxx b/sd/source/ui/inc/copydlg.hxx
index 7994e0c1c08b..f62bf44f3b39 100644
--- a/sd/source/ui/inc/copydlg.hxx
+++ b/sd/source/ui/inc/copydlg.hxx
@@ -64,7 +64,7 @@ private:
const SfxItemSet& mrOutAttrs;
XColorListRef mpColorList;
- Fraction maUIScale;
+ boost::rational<long> maUIScale;
::sd::View* mpView;
DECL_LINK( SelectColorHdl, void * );
diff --git a/sd/source/ui/inc/dlgsnap.hxx b/sd/source/ui/inc/dlgsnap.hxx
index ab431c856be3..befaa538ceba 100644
--- a/sd/source/ui/inc/dlgsnap.hxx
+++ b/sd/source/ui/inc/dlgsnap.hxx
@@ -25,7 +25,7 @@
#include <vcl/field.hxx>
#include <vcl/group.hxx>
#include <vcl/layout.hxx>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
#include <vcl/dialog.hxx>
#include "sdenumdef.hxx"
/************************************************************************/
@@ -53,7 +53,7 @@ private:
long nXValue;
long nYValue;
FieldUnit eUIUnit;
- Fraction aUIScale;
+ boost::rational<long> aUIScale;
DECL_LINK( ClickHdl, Button * );
diff --git a/sd/source/ui/inc/vectdlg.hxx b/sd/source/ui/inc/vectdlg.hxx
index 153343dae933..6107c7ed99a1 100644
--- a/sd/source/ui/inc/vectdlg.hxx
+++ b/sd/source/ui/inc/vectdlg.hxx
@@ -67,7 +67,7 @@ class SdVectorizeDlg : public ModalDialog
void UpdatePreviewMtf();
Rectangle GetRect( const Size& rDispSize, const Size& rBmpSize ) const;
- Bitmap GetPreparedBitmap( Bitmap& rBmp, Fraction& rScale );
+ Bitmap GetPreparedBitmap( Bitmap& rBmp, boost::rational<long>& rScale );
void Calculate( Bitmap& rBmp, GDIMetaFile& rMtf );
void AddTile( BitmapReadAccess* pRAcc, GDIMetaFile& rMtf,
long nPosX, long nPosY, long nWidth, long nHeight );
diff --git a/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx b/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx
index 381bac6868f7..b6555cc5ac89 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx
@@ -24,7 +24,7 @@
#include "view/SlsPageObjectLayouter.hxx"
#include "view/SlsTheme.hxx"
#include <sal/types.h>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
#include <vcl/mapmod.hxx>
#include <vector>
#include <utility>
@@ -114,7 +114,7 @@ public:
/** Return the scale factor that can be set at the map mode of the
output window.
*/
- Fraction GetScaleFactor (void) const;
+ boost::rational<long> GetScaleFactor (void) const;
Size GetPageObjectSize (void) const;
diff --git a/sd/source/ui/tools/PreviewRenderer.cxx b/sd/source/ui/tools/PreviewRenderer.cxx
index 4de09a10c1a6..3113433ff3b9 100644
--- a/sd/source/ui/tools/PreviewRenderer.cxx
+++ b/sd/source/ui/tools/PreviewRenderer.cxx
@@ -383,9 +383,9 @@ void PreviewRenderer::SetupOutputSize (
{
const sal_Int32 nFrameWidth (mbHasFrame ? snFrameWidth : 0);
aMapMode.SetScaleX(
- Fraction(rFramePixelSize.Width()-2*nFrameWidth-1, aPageModelSize.Width()));
+ boost::rational<long>(rFramePixelSize.Width()-2*nFrameWidth-1, aPageModelSize.Width()));
aMapMode.SetScaleY(
- Fraction(rFramePixelSize.Height()-2*nFrameWidth-1, aPageModelSize.Height()));
+ boost::rational<long>(rFramePixelSize.Height()-2*nFrameWidth-1, aPageModelSize.Height()));
aMapMode.SetOrigin(mpPreviewDevice->PixelToLogic(Point(nFrameWidth,nFrameWidth),aMapMode));
}
else
diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
index 1a9c67f62b68..fc81e5383bb2 100644
--- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx
+++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
@@ -677,7 +677,7 @@ throw (UnknownPropertyException, PropertyVetoException,
sal_Int32 nValue = 0;
if( *pValues >>= nValue )
{
- Fraction aFract( nValue, pDoc->GetUIScale().GetDenominator() );
+ boost::rational<long> aFract( nValue, pDoc->GetUIScale().denominator() );
pDoc->SetUIScale( aFract );
bOk = true;
bChanged = true;
@@ -689,7 +689,7 @@ throw (UnknownPropertyException, PropertyVetoException,
sal_Int32 nValue = 0;
if( *pValues >>= nValue )
{
- Fraction aFract( pDoc->GetUIScale().GetNumerator(), nValue );
+ boost::rational<long> aFract( pDoc->GetUIScale().numerator(), nValue );
pDoc->SetUIScale( aFract );
bOk = true;
bChanged = true;
@@ -1091,10 +1091,10 @@ throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
}
break;
case HANDLE_SCALE_NUM:
- *pValue <<= (sal_Int32)pDoc->GetUIScale().GetNumerator();
+ *pValue <<= (sal_Int32)pDoc->GetUIScale().numerator();
break;
case HANDLE_SCALE_DOM:
- *pValue <<= (sal_Int32)pDoc->GetUIScale().GetDenominator();
+ *pValue <<= (sal_Int32)pDoc->GetUIScale().denominator();
break;
case HANDLE_TABSTOP:
*pValue <<= (sal_Int32)pDoc->GetDefaultTabulator();
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 291733159378..16fe7c1eca44 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2226,10 +2226,10 @@ void SdXImpressDocument::paintTile( VirtualDevice& rDevice,
// that VirtualDevices use a DPI of 96.
// We specifically calculate these scales first as we're still
// in TWIPs, and might as well minimise the number of conversions.
- Fraction scaleX = Fraction( nOutputWidth, 96 ) * Fraction(1440L) /
- Fraction( nTileWidth);
- Fraction scaleY = Fraction( nOutputHeight, 96 ) * Fraction(1440L) /
- Fraction( nTileHeight);
+ boost::rational<long> scaleX = boost::rational<long>( nOutputWidth, 96 ) * boost::rational<long>(1440L) /
+ boost::rational<long>( nTileWidth );
+ boost::rational<long> scaleY = boost::rational<long>( nOutputHeight, 96 ) * boost::rational<long>(1440L) /
+ boost::rational<long>( nTileHeight );
// svx seems to be the only component that works natively in
// 100th mm rather than TWIP. It makes most sense just to
diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
index f61224fa1aef..5af3c448ed7d 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -1608,8 +1608,8 @@ private:
{
MapMode aMap (rInfo.maMap);
Point aPageOfs (rInfo.mpPrinter->GetPageOffset() );
- aMap.SetScaleX(Fraction(1,2));
- aMap.SetScaleY(Fraction(1,2));
+ aMap.SetScaleX(boost::rational<long>(1,2));
+ aMap.SetScaleY(boost::rational<long>(1,2));
mpPrinter->SetMapMode(aMap);
Rectangle aOutRect(aPageOfs, rInfo.mpPrinter->GetOutputSize());
@@ -1803,11 +1803,11 @@ private:
const double fHorz = (double) aPrintSize.Width() / aPageSize.Width();
const double fVert = (double) aPrintSize.Height() / aPageSize.Height();
- Fraction aFract;
+ boost::rational<long> aFract;
if ( fHorz < fVert )
- aFract = Fraction(aPrintSize.Width(), aPageSize.Width());
+ aFract = boost::rational<long>(aPrintSize.Width(), aPageSize.Width());
else
- aFract = Fraction(aPrintSize.Height(), aPageSize.Height());
+ aFract = boost::rational<long>(aPrintSize.Height(), aPageSize.Height());
aMap.SetScaleX(aFract);
aMap.SetScaleY(aFract);
@@ -1931,11 +1931,11 @@ private:
const double fHorz ((double) rInfo.maPrintSize.Width() / aPageSize.Width());
const double fVert ((double) rInfo.maPrintSize.Height() / aPageSize.Height());
- Fraction aFract;
+ boost::rational<long> aFract;
if (fHorz < fVert)
- aFract = Fraction(rInfo.maPrintSize.Width(), aPageSize.Width());
+ aFract = boost::rational<long>(rInfo.maPrintSize.Width(), aPageSize.Width());
else
- aFract = Fraction(rInfo.maPrintSize.Height(), aPageSize.Height());
+ aFract = boost::rational<long>(rInfo.maPrintSize.Height(), aPageSize.Height());
aMap.SetScaleX(aFract);
aMap.SetScaleY(aFract);
@@ -2013,8 +2013,8 @@ private:
}
MapMode aMap (rInfo.maMap);
- aMap.SetScaleX( Fraction( aPageSize_2.Width(), rInfo.maPageSize.Width() ) );
- aMap.SetScaleY( Fraction( aPageSize_2.Height(), rInfo.maPageSize.Height() ) );
+ aMap.SetScaleX( boost::rational<long>( aPageSize_2.Width(), rInfo.maPageSize.Width() ) );
+ aMap.SetScaleY( boost::rational<long>( aPageSize_2.Height(), rInfo.maPageSize.Height() ) );
// calculate adjusted print size
const Size aAdjustedPrintSize (OutputDevice::LogicToLogic(
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index 723a6d814ed7..a5d7527c4c00 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -453,8 +453,8 @@ void ViewShellBase::InnerResizePixel (const Point& rOrigin, const Size &rSize)
aSize.Height() -= (aBorder.Top() + aBorder.Bottom());
Size aObjSizePixel = mpImpl->mpViewWindow->LogicToPixel( aObjSize, MAP_100TH_MM );
SfxViewShell::SetZoomFactor(
- Fraction( aSize.Width(), std::max( aObjSizePixel.Width(), (long int)1 ) ),
- Fraction( aSize.Height(), std::max( aObjSizePixel.Height(), (long int)1) ) );
+ boost::rational<long>( aSize.Width(), std::max( aObjSizePixel.Width(), (long int)1 ) ),
+ boost::rational<long>( aSize.Height(), std::max( aObjSizePixel.Height(), (long int)1) ) );
}
mpImpl->ResizePixel(rOrigin, rSize, false);
@@ -735,8 +735,8 @@ void ViewShellBase::Deactivate (bool bIsMDIActivate)
}
void ViewShellBase::SetZoomFactor (
- const Fraction &rZoomX,
- const Fraction &rZoomY)
+ const boost::rational<long>& rZoomX,
+ const boost::rational<long>& rZoomY)
{
SfxViewShell::SetZoomFactor (rZoomX, rZoomY);
// Forward call to main sub shell.
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index 484bf2fda768..588cc5088b31 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -500,7 +500,7 @@ SvxRuler* DrawViewShell::CreateHRuler (::sd::Window* pWin, bool bIsFirst)
// ... and also set DefTab at the ruler
pRuler->SetDefTabDist( GetDoc()->GetDefaultTabulator() ); // new
- Fraction aUIScale(pWin->GetMapMode().GetScaleX());
+ boost::rational<long> aUIScale(pWin->GetMapMode().GetScaleX());
aUIScale *= GetDoc()->GetUIScale();
pRuler->SetZoom(aUIScale);
@@ -529,7 +529,7 @@ SvxRuler* DrawViewShell::CreateVRuler(::sd::Window* pWin)
pRuler->SetUnit( FieldUnit( nMetric ) );
- Fraction aUIScale(pWin->GetMapMode().GetScaleY());
+ boost::rational<long> aUIScale(pWin->GetMapMode().GetScaleY());
aUIScale *= GetDoc()->GetUIScale();
pRuler->SetZoom(aUIScale);
diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx
index 95b19f3f582c..e76fae8a5676 100644
--- a/sd/source/ui/view/drviews5.cxx
+++ b/sd/source/ui/view/drviews5.cxx
@@ -440,7 +440,7 @@ void DrawViewShell::Paint(const Rectangle& rRect, ::sd::Window* pWin)
/**
* adjust zoom factor for InPlace
*/
-void DrawViewShell::SetZoomFactor(const Fraction& rZoomX, const Fraction& rZoomY)
+void DrawViewShell::SetZoomFactor(const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY)
{
ViewShell::SetZoomFactor(rZoomX, rZoomY);
mbZoomOnPage = false;
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index 53c73ed65f6e..741bfe06a2a3 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -644,9 +644,9 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet)
{
Point aPos = GetActiveWindow()->PixelToLogic(maMousePos);
pPageView->LogicToPagePos(aPos);
- Fraction aUIScale(GetDoc()->GetUIScale());
- aPos.X() = Fraction(aPos.X()) / aUIScale;
- aPos.Y() = Fraction(aPos.Y()) / aUIScale;
+ boost::rational<long> aUIScale(GetDoc()->GetUIScale());
+ aPos.X() = boost::rational_cast<long>(aPos.X() / aUIScale);
+ aPos.Y() = boost::rational_cast<long>(aPos.Y() / aUIScale);
// position- and size items
if ( mpDrawView->IsAction() )
@@ -660,12 +660,12 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet)
{
pPageView->LogicToPagePos(aRect);
aPos = aRect.TopLeft();
- aPos.X() = Fraction(aPos.X()) / aUIScale;
- aPos.Y() = Fraction(aPos.Y()) / aUIScale;
+ aPos.X() = boost::rational_cast<long>(aPos.X() / aUIScale);
+ aPos.Y() = boost::rational_cast<long>(aPos.Y() / aUIScale);
rSet.Put( SfxPointItem( SID_ATTR_POSITION, aPos) );
Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() );
- aSize.Height() = Fraction(aSize.Height()) / aUIScale;
- aSize.Width() = Fraction(aSize.Width()) / aUIScale;
+ aSize.Height() = boost::rational_cast<long>(aSize.Height() / aUIScale);
+ aSize.Width() = boost::rational_cast<long>(aSize.Width() / aUIScale);
rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize) );
}
}
@@ -678,13 +678,13 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet)
// Show the position of the selected shape(s)
Point aShapePosition (aRect.TopLeft());
- aShapePosition.X() = Fraction(aShapePosition.X()) / aUIScale;
- aShapePosition.Y() = Fraction(aShapePosition.Y()) / aUIScale;
+ aShapePosition.X() = boost::rational_cast<long>(aShapePosition.X() / aUIScale);
+ aShapePosition.Y() = boost::rational_cast<long>(aShapePosition.Y() / aUIScale);
rSet.Put (SfxPointItem(SID_ATTR_POSITION, aShapePosition));
Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() );
- aSize.Height() = Fraction(aSize.Height()) / aUIScale;
- aSize.Width() = Fraction(aSize.Width()) / aUIScale;
+ aSize.Height() = boost::rational_cast<long>(aSize.Height() / aUIScale);
+ aSize.Width() = boost::rational_cast<long>(aSize.Width() / aUIScale);
rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize) );
}
else
diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx
index 8ce1f57dad2b..470866dffd38 100644
--- a/sd/source/ui/view/frmview.cxx
+++ b/sd/source/ui/view/frmview.cxx
@@ -202,7 +202,7 @@ FrameView::FrameView(SdDrawDocument* pDrawDoc, FrameView* pFrameView /* = NULK *
maVisibleLayers.SetAll();
maPrintableLayers.SetAll();
SetGridCoarse( Size( 1000, 1000 ) );
- SetSnapGridWidth(Fraction(1000, 1), Fraction(1000, 1));
+ SetSnapGridWidth(boost::rational<long>(1000, 1), boost::rational<long>(1000, 1));
SetActiveLayer( SD_RESSTR(STR_LAYER_LAYOUT) );
mbNoColors = true;
mbNoAttribs = false;
@@ -302,8 +302,8 @@ void FrameView::Update(SdOptions* pOptions)
SetGridCoarse( Size( pOptions->GetFldDrawX(), pOptions->GetFldDrawY() ) );
SetGridFine( Size( pOptions->GetFldDivisionX(), pOptions->GetFldDivisionY() ) );
- Fraction aFractX(pOptions->GetFldDrawX(), pOptions->GetFldDrawX() / ( pOptions->GetFldDivisionX() ? pOptions->GetFldDivisionX() : 1 ));
- Fraction aFractY(pOptions->GetFldDrawY(), pOptions->GetFldDrawY() / ( pOptions->GetFldDivisionY() ? pOptions->GetFldDivisionY() : 1 ));
+ boost::rational<long> aFractX(pOptions->GetFldDrawX(), pOptions->GetFldDrawX() / ( pOptions->GetFldDivisionX() ? pOptions->GetFldDivisionX() : 1 ));
+ boost::rational<long> aFractY(pOptions->GetFldDrawY(), pOptions->GetFldDrawY() / ( pOptions->GetFldDivisionY() ? pOptions->GetFldDivisionY() : 1 ));
SetSnapGridWidth(aFractX, aFractY);
SetQuickEdit(pOptions->IsQuickEdit());
@@ -464,10 +464,10 @@ void FrameView::WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com:
aUserData.addValue( sUNO_View_GridCoarseHeight, makeAny( (sal_Int32)GetGridCoarse().Height() ) );
aUserData.addValue( sUNO_View_GridFineWidth, makeAny( (sal_Int32)GetGridFine().Width() ) );
aUserData.addValue( sUNO_View_GridFineHeight, makeAny( (sal_Int32)GetGridFine().Height() ) );
- aUserData.addValue( sUNO_View_GridSnapWidthXNumerator, makeAny( (sal_Int32)GetSnapGridWidthX().GetNumerator() ) );
- aUserData.addValue( sUNO_View_GridSnapWidthXDenominator, makeAny( (sal_Int32)GetSnapGridWidthX().GetDenominator() ) );
- aUserData.addValue( sUNO_View_GridSnapWidthYNumerator, makeAny( (sal_Int32)GetSnapGridWidthY().GetNumerator() ) );
- aUserData.addValue( sUNO_View_GridSnapWidthYDenominator, makeAny( (sal_Int32)GetSnapGridWidthY().GetDenominator() ) );
+ aUserData.addValue( sUNO_View_GridSnapWidthXNumerator, makeAny( (sal_Int32)GetSnapGridWidthX().numerator() ) );
+ aUserData.addValue( sUNO_View_GridSnapWidthXDenominator, makeAny( (sal_Int32)GetSnapGridWidthX().denominator() ) );
+ aUserData.addValue( sUNO_View_GridSnapWidthYNumerator, makeAny( (sal_Int32)GetSnapGridWidthY().numerator() ) );
+ aUserData.addValue( sUNO_View_GridSnapWidthYDenominator, makeAny( (sal_Int32)GetSnapGridWidthY().denominator() ) );
aUserData.addValue( sUNO_View_IsAngleSnapEnabled, makeAny( IsAngleSnapEnabled() ) );
aUserData.addValue( sUNO_View_SnapAngle, makeAny( (sal_Int32)GetSnapAngle() ) );
@@ -561,11 +561,11 @@ void FrameView::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < :
sal_Int16 nInt16 = 0;
OUString aString;
- sal_Int32 aSnapGridWidthXNum = GetSnapGridWidthX().GetNumerator();
- sal_Int32 aSnapGridWidthXDom = GetSnapGridWidthX().GetDenominator();
+ sal_Int32 aSnapGridWidthXNum = GetSnapGridWidthX().numerator();
+ sal_Int32 aSnapGridWidthXDom = GetSnapGridWidthX().denominator();
- sal_Int32 aSnapGridWidthYNum = GetSnapGridWidthY().GetNumerator();
- sal_Int32 aSnapGridWidthYDom = GetSnapGridWidthY().GetDenominator();
+ sal_Int32 aSnapGridWidthYNum = GetSnapGridWidthY().numerator();
+ sal_Int32 aSnapGridWidthYDom = GetSnapGridWidthY().denominator();
const com::sun::star::beans::PropertyValue *pValue = rSequence.getConstArray();
for (sal_Int16 i = 0 ; i < nLength; i++, pValue++ )
@@ -916,8 +916,8 @@ void FrameView::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < :
default: SetViewShEditModeOnLoad(EM_PAGE); break;
}
- const Fraction aSnapGridWidthX( aSnapGridWidthXNum, aSnapGridWidthXDom );
- const Fraction aSnapGridWidthY( aSnapGridWidthYNum, aSnapGridWidthYDom );
+ const boost::rational<long> aSnapGridWidthX( aSnapGridWidthXNum, aSnapGridWidthXDom );
+ const boost::rational<long> aSnapGridWidthY( aSnapGridWidthYNum, aSnapGridWidthYDom );
SetSnapGridWidth( aSnapGridWidthX, aSnapGridWidthY );
}
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index 3a4fc537f2c6..3a25f39be01d 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -876,8 +876,8 @@ void View::SetMarkedOriginalSize()
Rectangle aDrawRect( pObj->GetLogicRect() );
pUndoGroup->AddAction( mrDoc.GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) );
- pObj->Resize( aDrawRect.TopLeft(), Fraction( aOleSize.Width(), aDrawRect.GetWidth() ),
- Fraction( aOleSize.Height(), aDrawRect.GetHeight() ) );
+ pObj->Resize( aDrawRect.TopLeft(), boost::rational<long>( aOleSize.Width(), aDrawRect.GetWidth() ),
+ boost::rational<long>( aOleSize.Height(), aDrawRect.GetHeight() ) );
}
}
}
@@ -938,10 +938,10 @@ void View::DoConnect(SdrOle2Obj* pObj)
MapMode aMapMode( mrDoc.GetScaleUnit() );
Size aObjAreaSize = pObj->GetOrigObjSize( &aMapMode );
- Fraction aScaleWidth (aDrawSize.Width(), aObjAreaSize.Width() );
- Fraction aScaleHeight(aDrawSize.Height(), aObjAreaSize.Height() );
- aScaleWidth.ReduceInaccurate(10); // compatible to SdrOle2Obj
- aScaleHeight.ReduceInaccurate(10);
+ boost::rational<long> aScaleWidth (aDrawSize.Width(), aObjAreaSize.Width() );
+ boost::rational<long> aScaleHeight(aDrawSize.Height(), aObjAreaSize.Height() );
+ rational_ReduceInaccurate(aScaleWidth, 10); // compatible to SdrOle2Obj
+ rational_ReduceInaccurate(aScaleHeight, 10);
pSdClient->SetSizeScale(aScaleWidth, aScaleHeight);
// visible area is only changed in-place!
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index c620601d1d0f..3524a77565d2 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -703,8 +703,8 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
Rectangle aObjRect( pNewObj->GetCurrentBoundRect() );
Size aObjSize( aObjRect.GetSize() );
- Fraction aScaleWidth( aPickObjSize.Width(), aObjSize.Width() );
- Fraction aScaleHeight( aPickObjSize.Height(), aObjSize.Height() );
+ boost::rational<long> aScaleWidth( aPickObjSize.Width(), aObjSize.Width() );
+ boost::rational<long> aScaleHeight( aPickObjSize.Height(), aObjSize.Height() );
pNewObj->NbcResize( aObjRect.TopLeft(), aScaleWidth, aScaleHeight );
aVec -= aObjRect.TopLeft();
diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
index 4e02e56ecfee..a1cb0f2c6740 100644
--- a/sd/source/ui/view/sdview4.cxx
+++ b/sd/source/ui/view/sdview4.cxx
@@ -227,8 +227,8 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
Rectangle aObjRect(pNewGrafObj->GetCurrentBoundRect());
Size aObjSize(aObjRect.GetSize());
- Fraction aScaleWidth(aPickObjSize.Width(), aObjSize.Width());
- Fraction aScaleHeight(aPickObjSize.Height(), aObjSize.Height());
+ boost::rational<long> aScaleWidth(aPickObjSize.Width(), aObjSize.Width());
+ boost::rational<long> aScaleHeight(aPickObjSize.Height(), aObjSize.Height());
pNewGrafObj->NbcResize(aObjRect.TopLeft(), aScaleWidth, aScaleHeight);
Point aVec = aPickObjRect.TopLeft() - aObjRect.TopLeft();
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index b9af542b4354..6b83b61c829c 100644
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -179,10 +179,10 @@ void Window::SetMaxZoom (long int nMax)
long Window::GetZoom (void) const
{
- if( GetMapMode().GetScaleX().GetDenominator() )
+ if( GetMapMode().GetScaleX().denominator() )
{
- return GetMapMode().GetScaleX().GetNumerator() * 100L
- / GetMapMode().GetScaleX().GetDenominator();
+ return GetMapMode().GetScaleX().numerator() * 100L
+ / GetMapMode().GetScaleX().denominator();
}
else
{
@@ -318,8 +318,8 @@ long Window::SetZoomFactor(long nZoom)
// Set the zoom factor at the window's map mode.
MapMode aMap(GetMapMode());
- aMap.SetScaleX(Fraction(nZoom, 100));
- aMap.SetScaleY(Fraction(nZoom, 100));
+ aMap.SetScaleX(boost::rational<long>(nZoom, 100));
+ aMap.SetScaleY(boost::rational<long>(nZoom, 100));
SetMapMode(aMap);
// invalidate previous size - it was relative to the old scaling
diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx
index 7401fdffadc5..a7ba45ecbe6b 100644
--- a/sd/source/ui/view/viewshe2.cxx
+++ b/sd/source/ui/view/viewshe2.cxx
@@ -332,7 +332,7 @@ void ViewShell::Scroll(long nScrollX, long nScrollY)
*/
void ViewShell::SetZoom(long nZoom)
{
- Fraction aUIScale(nZoom, 100);
+ boost::rational<long> aUIScale(nZoom, 100);
aUIScale *= GetDoc()->GetUIScale();
if (mpHorizontalRuler.get() != NULL)
@@ -399,7 +399,7 @@ void ViewShell::ScrollCenter()
void ViewShell::SetZoomRect(const Rectangle& rZoomRect)
{
long nZoom = GetActiveWindow()->SetZoomRect(rZoomRect);
- Fraction aUIScale(nZoom, 100);
+ boost::rational<long> aUIScale(nZoom, 100);
aUIScale *= GetDoc()->GetUIScale();
Point aPos = GetActiveWindow()->GetWinViewPos();
@@ -651,9 +651,9 @@ void ViewShell::SetPageSizeAndBorder(PageKind ePageKind, const Size& rNewSize,
/**
* Set zoom factor for InPlace
*/
-void ViewShell::SetZoomFactor(const Fraction& rZoomX, const Fraction&)
+void ViewShell::SetZoomFactor(const boost::rational<long>& rZoomX, const boost::rational<long>&)
{
- long nZoom = (long)((double) rZoomX * 100);
+ long nZoom = (long)(boost::rational_cast<double>(rZoomX) * 100);
SetZoom(nZoom);
}
@@ -870,10 +870,10 @@ bool ViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb)
if( pObj->IsChart() ) //charts never should be stretched see #i84323# for example
aObjAreaSize = aDrawSize;
- Fraction aScaleWidth (aDrawSize.Width(), aObjAreaSize.Width() );
- Fraction aScaleHeight(aDrawSize.Height(), aObjAreaSize.Height() );
- aScaleWidth.ReduceInaccurate(10); // kompatibel zum SdrOle2Obj
- aScaleHeight.ReduceInaccurate(10);
+ boost::rational<long> aScaleWidth (aDrawSize.Width(), aObjAreaSize.Width() );
+ boost::rational<long> aScaleHeight(aDrawSize.Height(), aObjAreaSize.Height() );
+ rational_ReduceInaccurate(aScaleWidth, 10); // kompatibel zum SdrOle2Obj
+ rational_ReduceInaccurate(aScaleHeight, 10);
pSdClient->SetSizeScale(aScaleWidth, aScaleHeight);
// visible section is only changed in-place!
diff --git a/sfx2/inc/pch/precompiled_sfx.hxx b/sfx2/inc/pch/precompiled_sfx.hxx
index f941479d2f8b..00300da4534d 100644
--- a/sfx2/inc/pch/precompiled_sfx.hxx
+++ b/sfx2/inc/pch/precompiled_sfx.hxx
@@ -687,7 +687,7 @@
#include <tools/datetime.hxx>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
#include <tools/gen.hxx>
#include <tools/helpers.hxx>
#include <tools/inetmime.hxx>
diff --git a/sfx2/source/doc/objembed.cxx b/sfx2/source/doc/objembed.cxx
index 1ce7b6717fdb..d491b702f9d4 100644
--- a/sfx2/source/doc/objembed.cxx
+++ b/sfx2/source/doc/objembed.cxx
@@ -180,8 +180,8 @@ void SfxObjectShell::DoDraw( OutputDevice* pDev,
aSize = pDev->LogicToLogic( aSize, &aWilliMode, &aMod );
if( aSize.Width() && aSize.Height() )
{
- Fraction aXF( rSize.Width(), aSize.Width() );
- Fraction aYF( rSize.Height(), aSize.Height() );
+ boost::rational<long> aXF( rSize.Width(), aSize.Width() );
+ boost::rational<long> aYF( rSize.Height(), aSize.Height() );
DoDraw_Impl( pDev, rObjPos, aXF, aYF, rSetup, nAspect );
}
@@ -190,8 +190,8 @@ void SfxObjectShell::DoDraw( OutputDevice* pDev,
void SfxObjectShell::DoDraw_Impl( OutputDevice* pDev,
const Point & rViewPos,
- const Fraction & rScaleX,
- const Fraction & rScaleY,
+ const boost::rational<long>& rScaleX,
+ const boost::rational<long>& rScaleY,
const JobSetup & rSetup,
sal_uInt16 nAspect )
{
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index ef03157900e2..ea49352d9f11 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -56,7 +56,7 @@
#include <toolkit/awt/vclxwindow.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <toolkit/helper/convert.hxx>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
#include <tools/gen.hxx>
#include <svl/rectitem.hxx>
#include <svtools/soerr.hxx>
@@ -99,8 +99,8 @@ class SfxInPlaceClient_Impl : public ::cppu::WeakImplHelper5< embed::XEmbeddedCl
public:
Timer m_aTimer; // activation timeout, starts after object connection
Rectangle m_aObjArea; // area of object in coordinate system of the container (without scaling)
- Fraction m_aScaleWidth; // scaling that was applied to the object when it was not active
- Fraction m_aScaleHeight;
+ boost::rational<long> m_aScaleWidth; // scaling that was applied to the object when it was not active
+ boost::rational<long> m_aScaleHeight;
SfxInPlaceClient* m_pClient;
sal_Int64 m_nAspect; // ViewAspect that is assigned from the container
Rectangle m_aLastObjAreaPixel; // area of object in coordinate system of the container (without scaling)
@@ -427,8 +427,8 @@ awt::Rectangle SAL_CALL SfxInPlaceClient_Impl::getPlacement()
// apply scaling to object area and convert to pixels
Rectangle aRealObjArea( m_aObjArea );
- aRealObjArea.SetSize( Size( Fraction( aRealObjArea.GetWidth() ) * m_aScaleWidth,
- Fraction( aRealObjArea.GetHeight() ) * m_aScaleHeight ) );
+ aRealObjArea.SetSize( Size( boost::rational_cast<long>( aRealObjArea.GetWidth() * m_aScaleWidth ),
+ boost::rational_cast<long>( aRealObjArea.GetHeight() * m_aScaleHeight ) ) );
aRealObjArea = m_pClient->GetEditWin()->LogicToPixel( aRealObjArea );
return AWTRectangle( aRealObjArea );
@@ -444,8 +444,8 @@ awt::Rectangle SAL_CALL SfxInPlaceClient_Impl::getClipRectangle()
// currently(?) same as placement
Rectangle aRealObjArea( m_aObjArea );
- aRealObjArea.SetSize( Size( Fraction( aRealObjArea.GetWidth() ) * m_aScaleWidth,
- Fraction( aRealObjArea.GetHeight() ) * m_aScaleHeight ) );
+ aRealObjArea.SetSize( Size( boost::rational_cast<long>( aRealObjArea.GetWidth() * m_aScaleWidth ),
+ boost::rational_cast<long>( aRealObjArea.GetHeight() * m_aScaleHeight ) ) );
aRealObjArea = m_pClient->GetEditWin()->LogicToPixel( aRealObjArea );
return AWTRectangle( aRealObjArea );
@@ -507,8 +507,8 @@ void SAL_CALL SfxInPlaceClient_Impl::changedPlacement( const awt::Rectangle& aPo
SfxBooleanFlagGuard aGuard( m_bResizeNoScale, true );
// new size of the object area without scaling
- Size aNewObjSize( Fraction( aNewLogicRect.GetWidth() ) / m_aScaleWidth,
- Fraction( aNewLogicRect.GetHeight() ) / m_aScaleHeight );
+ Size aNewObjSize( boost::rational_cast<long>( aNewLogicRect.GetWidth() / m_aScaleWidth ),
+ boost::rational_cast<long>( aNewLogicRect.GetHeight() / m_aScaleHeight ) );
// now remove scaling from new placement and keep this a the new object area
aNewLogicRect.SetSize( aNewObjSize );
@@ -615,7 +615,7 @@ SfxInPlaceClient::SfxInPlaceClient( SfxViewShell* pViewShell, vcl::Window *pDraw
m_pImp->acquire();
m_pImp->m_pClient = this;
m_pImp->m_nAspect = nAspect;
- m_pImp->m_aScaleWidth = m_pImp->m_aScaleHeight = Fraction(1,1);
+ m_pImp->m_aScaleWidth = m_pImp->m_aScaleHeight = boost::rational<long>(1);
m_pImp->m_xClient = static_cast< embed::XEmbeddedClient* >( m_pImp );
pViewShell->NewIPClient_Impl(this);
m_pImp->m_aTimer.SetTimeout( SFX_CLIENTACTIVATE_TIMEOUT );
@@ -754,13 +754,13 @@ Rectangle SfxInPlaceClient::GetObjArea() const
Rectangle SfxInPlaceClient::GetScaledObjArea() const
{
Rectangle aRealObjArea( m_pImp->m_aObjArea );
- aRealObjArea.SetSize( Size( Fraction( aRealObjArea.GetWidth() ) * m_pImp->m_aScaleWidth,
- Fraction( aRealObjArea.GetHeight() ) * m_pImp->m_aScaleHeight ) );
+ aRealObjArea.SetSize( Size( boost::rational_cast<long>( aRealObjArea.GetWidth() * m_pImp->m_aScaleWidth ),
+ boost::rational_cast<long>( aRealObjArea.GetHeight() * m_pImp->m_aScaleHeight ) ) );
return aRealObjArea;
}
-void SfxInPlaceClient::SetSizeScale( const Fraction & rScaleWidth, const Fraction & rScaleHeight )
+void SfxInPlaceClient::SetSizeScale( const boost::rational<long>& rScaleWidth, const boost::rational<long>& rScaleHeight )
{
if ( m_pImp->m_aScaleWidth != rScaleWidth || m_pImp->m_aScaleHeight != rScaleHeight )
{
@@ -776,7 +776,7 @@ void SfxInPlaceClient::SetSizeScale( const Fraction & rScaleWidth, const Fractio
}
-bool SfxInPlaceClient::SetObjAreaAndScale( const Rectangle& rArea, const Fraction& rScaleWidth, const Fraction& rScaleHeight )
+bool SfxInPlaceClient::SetObjAreaAndScale( const Rectangle& rArea, const boost::rational<long>& rScaleWidth, const boost::rational<long>& rScaleHeight )
{
if( rArea != m_pImp->m_aObjArea || m_pImp->m_aScaleWidth != rScaleWidth || m_pImp->m_aScaleHeight != rScaleHeight )
{
@@ -794,13 +794,13 @@ bool SfxInPlaceClient::SetObjAreaAndScale( const Rectangle& rArea, const Fractio
}
-const Fraction& SfxInPlaceClient::GetScaleWidth() const
+const boost::rational<long>& SfxInPlaceClient::GetScaleWidth() const
{
return m_pImp->m_aScaleWidth;
}
-const Fraction& SfxInPlaceClient::GetScaleHeight() const
+const boost::rational<long>& SfxInPlaceClient::GetScaleHeight() const
{
return m_pImp->m_aScaleHeight;
}
@@ -812,8 +812,8 @@ void SfxInPlaceClient::Invalidate()
// the object area is provided in logical coordinates of the window but without scaling applied
Rectangle aRealObjArea( m_pImp->m_aObjArea );
- aRealObjArea.SetSize( Size( Fraction( aRealObjArea.GetWidth() ) * m_pImp->m_aScaleWidth,
- Fraction( aRealObjArea.GetHeight() ) * m_pImp->m_aScaleHeight ) );
+ aRealObjArea.SetSize( Size( boost::rational_cast<long>( aRealObjArea.GetWidth() * m_pImp->m_aScaleWidth ),
+ boost::rational_cast<long>( aRealObjArea.GetHeight() * m_pImp->m_aScaleHeight ) ) );
m_pEditWin->Invalidate( aRealObjArea );
ViewChanged();
@@ -955,8 +955,8 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb )
Rectangle aScaledArea = GetScaledObjArea();
m_pImp->m_aObjArea.SetSize( aNewSize );
- m_pImp->m_aScaleWidth = Fraction( aScaledArea.GetWidth(), aNewSize.Width() );
- m_pImp->m_aScaleHeight = Fraction( aScaledArea.GetHeight(), aNewSize.Height() );
+ m_pImp->m_aScaleWidth = boost::rational<long>( aScaledArea.GetWidth(), aNewSize.Width() );
+ m_pImp->m_aScaleHeight = boost::rational<long>( aScaledArea.GetHeight(), aNewSize.Height() );
}
}
catch (uno::Exception const& e)
diff --git a/sfx2/source/view/viewfrm2.cxx b/sfx2/source/view/viewfrm2.cxx
index 404a8b8ca1ff..60bee868f016 100644
--- a/sfx2/source/view/viewfrm2.cxx
+++ b/sfx2/source/view/viewfrm2.cxx
@@ -385,7 +385,7 @@ void SfxViewFrame::INetState_Impl( SfxItemSet &rItemSet )
rItemSet.DisableItem( SID_CREATELINK );
}
-void SfxViewFrame::SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY )
+void SfxViewFrame::SetZoomFactor( const boost::rational<long>& rZoomX, const boost::rational<long>& rZoomY )
{
GetViewShell()->SetZoomFactor( rZoomX, rZoomY );
}
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 35b947e5ee81..e82def5003f4 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -853,8 +853,8 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet )
-void SfxViewShell::SetZoomFactor( const Fraction &rZoomX,
- const Fraction &rZoomY )
+void SfxViewShell::SetZoomFactor( const boost::rational<long>& rZoomX,
+ const boost::rational<long>& rZoomY )
{
DBG_ASSERT( GetWindow(), "no window" );
MapMode aMap( GetWindow()->GetMapMode() );
diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index 220e30d2ffc9..93ed6210fcb4 100644
--- a/starmath/inc/node.hxx
+++ b/starmath/inc/node.hxx
@@ -134,8 +134,8 @@ public:
SmFace & GetFont() { return aFace; };
void SetFont(const SmFace &rFace);
- void SetFontSize(const Fraction &rRelSize, sal_uInt16 nType);
- void SetSize(const Fraction &rScale);
+ void SetFontSize(const boost::rational<long> &rRelSize, sal_uInt16 nType);
+ void SetSize(const boost::rational<long> &rScale);
virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell);
virtual void PrepareAttributes();
@@ -1240,18 +1240,18 @@ public:
class SmFontNode : public SmStructureNode
{
sal_uInt16 nSizeType;
- Fraction aFontSize;
+ boost::rational<long> aFontSize;
public:
SmFontNode(const SmToken &rNodeToken)
: SmStructureNode(NFONT, rNodeToken)
{
nSizeType = FNTSIZ_MULTIPLY;
- aFontSize = Fraction(1L);
+ aFontSize = boost::rational<long>(1L);
}
- void SetSizeParameter(const Fraction &rValue, sal_uInt16 nType);
- const Fraction & GetSizeParameter() const {return aFontSize;}
+ void SetSizeParameter(const boost::rational<long> &rValue, sal_uInt16 nType);
+ const boost::rational<long> & GetSizeParameter() const {return aFontSize;}
const sal_uInt16& GetSizeType() const {return nSizeType;}
virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell) SAL_OVERRIDE;
diff --git a/starmath/inc/pch/precompiled_sm.hxx b/starmath/inc/pch/precompiled_sm.hxx
index 0f75800fa407..db4b7509f2f4 100644
--- a/starmath/inc/pch/precompiled_sm.hxx
+++ b/starmath/inc/pch/precompiled_sm.hxx
@@ -162,7 +162,7 @@
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/color.hxx>
#include <tools/diagnose_ex.h>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
#include <tools/gen.hxx>
#include <tools/globname.hxx>
#include <tools/mapunit.hxx>
diff --git a/starmath/inc/utility.hxx b/starmath/inc/utility.hxx
index 304c10c7e841..8cb9254004f8 100644
--- a/starmath/inc/utility.hxx
+++ b/starmath/inc/utility.hxx
@@ -23,7 +23,7 @@
#include <vcl/fixed.hxx>
#include <vcl/combobox.hxx>
#include <vcl/lstbox.hxx>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
#include <deque>
@@ -41,28 +41,28 @@ inline long SmPtsTo100th_mm(long nNumPts)
}
-inline long SmPtsTo100th_mm(const Fraction &rNumPts)
- // as above but with argument 'rNumPts' as 'Fraction'
+inline long SmPtsTo100th_mm(const boost::rational<long> &rNumPts)
+ // as above but with argument 'rNumPts' as 'boost::rational<long>'
{
- Fraction aTmp (254000L, 7227L);
- return aTmp *= rNumPts;
+ boost::rational<long> aTmp (254000L, 7227L);
+ return boost::rational_cast<long>(aTmp * rNumPts);
}
-inline Fraction Sm100th_mmToPts(long nNum100th_mm)
+inline boost::rational<long> Sm100th_mmToPts(long nNum100th_mm)
// returns the length (in points) that corresponds to the length
// 'nNum100th_mm' (in 100th of mm).
{
SAL_WARN_IF( nNum100th_mm < 0, "starmath", "Ooops..." );
- Fraction aTmp (7227L, 254000L);
- return aTmp *= Fraction(nNum100th_mm);
+ boost::rational<long> aTmp (7227L, 254000L);
+ return aTmp *= boost::rational<long>(nNum100th_mm);
}
-inline long SmRoundFraction(const Fraction &rFrac)
+inline long SmRoundFraction(const boost::rational<long> &rFrac)
{
- SAL_WARN_IF( rFrac <= Fraction(), "starmath", "Ooops..." );
- return (rFrac.GetNumerator() + rFrac.GetDenominator() / 2) / rFrac.GetDenominator();
+ SAL_WARN_IF( rFrac <= boost::rational<long>(), "starmath", "Ooops..." );
+ return (rFrac.numerator() + rFrac.denominator() / 2) / rFrac.denominator();
}
@@ -109,7 +109,7 @@ public:
SmFace & operator = (const SmFace &rFace);
};
-SmFace & operator *= (SmFace &rFace, const Fraction &rFrac);
+SmFace & operator *= (SmFace &rFace, const boost::rational<long> &rFrac);
diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx
index 6b7939e99076..215ac5479025 100644
--- a/starmath/inc/view.hxx
+++ b/starmath/inc/view.hxx
@@ -272,7 +272,7 @@ protected:
virtual void InnerResizePixel(const Point &rOfs, const Size &rSize) SAL_OVERRIDE;
virtual void OuterResizePixel(const Point &rOfs, const Size &rSize) SAL_OVERRIDE;
virtual void QueryObjAreaPixel( Rectangle& rRect ) const SAL_OVERRIDE;
- virtual void SetZoomFactor( const Fraction &rX, const Fraction &rY ) SAL_OVERRIDE;
+ virtual void SetZoomFactor( const boost::rational<long> &rX, const boost::rational<long> &rY ) SAL_OVERRIDE;
public:
TYPEINFO_OVERRIDE();
diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx
index 4668e93a5905..059a1d1c00c7 100644
--- a/starmath/source/ElementsDockingWindow.cxx
+++ b/starmath/source/ElementsDockingWindow.cxx
@@ -449,7 +449,7 @@ void SmElementsControl::addElement(const OUString& aElementVisual, const OUStrin
SmNodePointer pNode(SmParser().ParseExpression(aElementVisual));
pNode->Prepare(maFormat, *mpDocShell);
- pNode->SetSize(Fraction(10,8));
+ pNode->SetSize(boost::rational<long>(10,8));
pNode->Arrange(*this, maFormat);
Size aSizePixel = LogicToPixel(Size(pNode->GetWidth(), pNode->GetHeight()), MAP_100TH_MM);
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index c55190b31059..a8183ed7388b 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -1344,24 +1344,24 @@ void SmXMLExport::ExportFont(const SmNode *pNode, int nLevel)
case TSIZE:
{
const SmFontNode *pFontNode = static_cast<const SmFontNode *>(pNode);
- const Fraction &aFrac = pFontNode->GetSizeParameter();
+ const boost::rational<long>& aFrac = pFontNode->GetSizeParameter();
OUStringBuffer sStrBuf;
switch(pFontNode->GetSizeType())
{
case FNTSIZ_MULTIPLY:
::sax::Converter::convertDouble(sStrBuf,
- static_cast<double>(aFrac*Fraction(100.00)));
+ boost::rational_cast<double>(aFrac * rational_FromDouble(100.0)));
sStrBuf.append('%');
break;
case FNTSIZ_DIVIDE:
::sax::Converter::convertDouble(sStrBuf,
- static_cast<double>(Fraction(100.00)/aFrac));
+ boost::rational_cast<double>(rational_FromDouble(100.0) / aFrac));
sStrBuf.append('%');
break;
case FNTSIZ_ABSOLUT:
::sax::Converter::convertDouble(sStrBuf,
- static_cast<double>(aFrac));
+ boost::rational_cast<double>(aFrac));
sStrBuf.append(
GetXMLToken(XML_UNIT_PT));
break;
@@ -1373,7 +1373,7 @@ void SmXMLExport::ExportFont(const SmNode *pNode, int nLevel)
//value specified in points.
//Must fix StarMath to retain the original pt values
- Fraction aTemp = Sm100th_mmToPts(pFontNode->GetFont().
+ boost::rational<long> aTemp = Sm100th_mmToPts(pFontNode->GetFont().
GetSize().Height());
if (pFontNode->GetSizeType() == FNTSIZ_MINUS)
@@ -1381,7 +1381,7 @@ void SmXMLExport::ExportFont(const SmNode *pNode, int nLevel)
else
aTemp+=aFrac;
- double mytest = static_cast<double>(aTemp);
+ double mytest = static_cast<double>(boost::rational_cast<double>(aTemp));
mytest = ::rtl::math::round(mytest,1);
::sax::Converter::convertDouble(sStrBuf,mytest);
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index 0ea7bc2ee384..1f5a07824d0c 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -724,14 +724,14 @@ void SmXMLContext_Helper::ApplyAttrs()
.GetMM100UnitConverter().GetXMLMeasureUnit())
{
if (nFontSize < 100.00)
- pFontNode->SetSizeParameter(Fraction(100.00/nFontSize),
+ pFontNode->SetSizeParameter(rational_FromDouble(100.00/nFontSize),
FNTSIZ_DIVIDE);
else
- pFontNode->SetSizeParameter(Fraction(nFontSize/100.00),
+ pFontNode->SetSizeParameter(rational_FromDouble(nFontSize/100.00),
FNTSIZ_MULTIPLY);
}
else
- pFontNode->SetSizeParameter(Fraction(nFontSize),FNTSIZ_ABSOLUT);
+ pFontNode->SetSizeParameter(rational_FromDouble(nFontSize),FNTSIZ_ABSOLUT);
pFontNode->SetSubNodes(0,lcl_popOrZero(rNodeStack));
rNodeStack.push(pFontNode);
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 184b01283c03..0b7af71cb03c 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -30,7 +30,7 @@
#include <comphelper/string.hxx>
#include <tools/color.hxx>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
#include <tools/gen.hxx>
#include <vcl/outdev.hxx>
@@ -165,16 +165,16 @@ void SmNode::SetFont(const SmFace &rFace)
}
-void SmNode::SetFontSize(const Fraction &rSize, sal_uInt16 nType)
+void SmNode::SetFontSize(const boost::rational<long>& rSize, sal_uInt16 nType)
//! 'rSize' is in units of pts
{
Size aFntSize;
if (!(Flags() & FLG_SIZE))
{
- Fraction aVal (SmPtsTo100th_mm(rSize.GetNumerator()),
- rSize.GetDenominator());
- long nHeight = (long)aVal;
+ boost::rational<long> aVal (SmPtsTo100th_mm(rSize.numerator()),
+ rSize.denominator());
+ long nHeight = boost::rational_cast<long>(aVal);
aFntSize = GetFont().GetSize();
aFntSize.Width() = 0;
@@ -193,12 +193,12 @@ void SmNode::SetFontSize(const Fraction &rSize, sal_uInt16 nType)
break;
case FNTSIZ_MULTIPLY:
- aFntSize.Height() = (long) (Fraction(aFntSize.Height()) * rSize);
+ aFntSize.Height() = boost::rational_cast<long>(aFntSize.Height() * rSize);
break;
case FNTSIZ_DIVIDE:
- if (rSize != Fraction(0L))
- aFntSize.Height() = (long) (Fraction(aFntSize.Height()) / rSize);
+ if (rSize != boost::rational<long>(0L))
+ aFntSize.Height() = boost::rational_cast<long>(aFntSize.Height() / rSize);
break;
default:
break;
@@ -220,7 +220,7 @@ void SmNode::SetFontSize(const Fraction &rSize, sal_uInt16 nType)
}
-void SmNode::SetSize(const Fraction &rSize)
+void SmNode::SetSize(const boost::rational<long>& rSize)
{
GetFont() *= rSize;
@@ -906,7 +906,7 @@ void SmUnHorNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
OSL_ENSURE(pOper, "Sm: NULL pointer");
OSL_ENSURE(pBody, "Sm: NULL pointer");
- pOper->SetSize(Fraction (rFormat.GetRelSize(SIZ_OPERATOR), 100));
+ pOper->SetSize(boost::rational<long> (rFormat.GetRelSize(SIZ_OPERATOR), 100));
pOper->Arrange(rDev, rFormat);
pBody->Arrange(rDev, rFormat);
@@ -1003,7 +1003,7 @@ void SmRootNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
pRootSym->MoveTo(aPos);
if (pExtra)
- { pExtra->SetSize(Fraction(rFormat.GetRelSize(SIZ_INDEX), 100));
+ { pExtra->SetSize(boost::rational<long>(rFormat.GetRelSize(SIZ_INDEX), 100));
pExtra->Arrange(rDev, rFormat);
aPos = GetExtraPos(*pRootSym, *pExtra);
@@ -1097,7 +1097,7 @@ void SmBinHorNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
OSL_ENSURE(pOper != NULL, "Sm: NULL pointer");
OSL_ENSURE(pRight != NULL, "Sm: NULL pointer");
- pOper->SetSize(Fraction (rFormat.GetRelSize(SIZ_OPERATOR), 100));
+ pOper->SetSize(boost::rational<long> (rFormat.GetRelSize(SIZ_OPERATOR), 100));
pLeft ->Arrange(rDev, rFormat);
pOper ->Arrange(rDev, rFormat);
@@ -1139,7 +1139,7 @@ void SmBinVerNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
bool bIsTextmode = rFormat.IsTextmode();
if (bIsTextmode)
{
- Fraction aFraction(rFormat.GetRelSize(SIZ_INDEX), 100);
+ boost::rational<long> aFraction(rFormat.GetRelSize(SIZ_INDEX), 100);
pNum ->SetSize(aFraction);
pLine ->SetSize(aFraction);
pDenom->SetSize(aFraction);
@@ -1502,7 +1502,7 @@ void SmSubSupNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
{
sal_uInt16 nIndex = (eSubSup == CSUB || eSubSup == CSUP) ?
SIZ_LIMITS : SIZ_INDEX;
- Fraction aFraction ( rFormat.GetRelSize(nIndex), 100 );
+ boost::rational<long> aFraction ( rFormat.GetRelSize(nIndex), 100 );
pSubSup->SetSize(aFraction);
}
@@ -1833,9 +1833,9 @@ void SmVerticalBraceNode::Arrange(const OutputDevice &rDev, const SmFormat &rFor
pBody->Arrange(aTmpDev, rFormat);
// size is the same as for limits for this part
- pScript->SetSize( Fraction( rFormat.GetRelSize(SIZ_LIMITS), 100 ) );
+ pScript->SetSize( boost::rational<long>( rFormat.GetRelSize(SIZ_LIMITS), 100 ) );
// braces are a bit taller than usually
- pBrace ->SetSize( Fraction(3, 2) );
+ pBrace ->SetSize( boost::rational<long>(3, 2) );
long nItalicWidth = pBody->GetItalicWidth();
if (nItalicWidth > 0)
@@ -1929,7 +1929,7 @@ void SmOperNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
OSL_ENSURE(pBody, "Sm: missing subnode");
SmNode *pSymbol = GetSymbol();
- pSymbol->SetSize(Fraction(CalcSymbolHeight(*pSymbol, rFormat),
+ pSymbol->SetSize(boost::rational<long>(CalcSymbolHeight(*pSymbol, rFormat),
pSymbol->GetFont().GetSize().Height()));
pBody->Arrange(rDev, rFormat);
@@ -2062,7 +2062,7 @@ void SmFontNode::CreateTextFromNode(OUString &rText)
break;
}
rText += ::rtl::math::doubleToUString(
- static_cast<double>(aFontSize),
+ static_cast<double>(boost::rational_cast<double>(this->aFontSize)),
rtl_math_StringFormat_Automatic,
rtl_math_DecimalPlaces_Max, '.', true);
rText += " ";
@@ -2174,7 +2174,7 @@ void SmFontNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
}
-void SmFontNode::SetSizeParameter(const Fraction& rValue, sal_uInt16 Type)
+void SmFontNode::SetSizeParameter(const boost::rational<long>& rValue, sal_uInt16 Type)
{
nSizeType = Type;
aFontSize = rValue;
@@ -2367,7 +2367,7 @@ void SmTextNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
sal_uInt16 nSizeDesc = GetFontDesc() == FNT_FUNCTION ?
SIZ_FUNCTION : SIZ_TEXT;
- GetFont() *= Fraction (rFormat.GetRelSize(nSizeDesc), 100);
+ GetFont() *= boost::rational<long> (rFormat.GetRelSize(nSizeDesc), 100);
SmTmpDevice aTmpDev ((OutputDevice &) rDev, true);
aTmpDev.SetFont(GetFont());
@@ -2729,7 +2729,7 @@ void SmMathSymbolNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat
PrepareAttributes();
- GetFont() *= Fraction (rFormat.GetRelSize(SIZ_TEXT), 100);
+ GetFont() *= boost::rational<long> (rFormat.GetRelSize(SIZ_TEXT), 100);
SmTmpDevice aTmpDev ((OutputDevice &) rDev, true);
aTmpDev.SetFont(GetFont());
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index b7373f122434..54254bb20fd0 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -1947,7 +1947,7 @@ void SmParser::FontSize()
}
// get number argument
- Fraction aValue( 1L );
+ boost::rational<long> aValue( 1L );
if (lcl_IsNumber( m_aCurToken.aText ))
{
double fTmp = OUString(m_aCurToken.aText).toDouble();
@@ -1960,16 +1960,16 @@ void SmParser::FontSize()
//!! (for example in SmNode::SetFontSize the font size calculated
//!! may become 0 because of this!!! Happens e.g. for ftmp = 2.9 with Linux
//!! or ftmp = 1.11111111111111111... (11/9) on every platform.)
- if (aValue.GetDenominator() > 1000)
+ if (aValue.denominator() > 1000)
{
- long nNum = aValue.GetNumerator();
- long nDenom = aValue.GetDenominator();
+ long nNum = aValue.numerator();
+ long nDenom = aValue.denominator();
while (nDenom > 1000)
{
nNum /= 10;
nDenom /= 10;
}
- aValue = Fraction( nNum, nDenom );
+ aValue = boost::rational<long>( nNum, nDenom );
}
}
}
diff --git a/starmath/source/utility.cxx b/starmath/source/utility.cxx
index 47fad4ebb097..a47df4a62a9b 100644
--- a/starmath/source/utility.cxx
+++ b/starmath/source/utility.cxx
@@ -284,14 +284,14 @@ SmFace & SmFace::operator = (const SmFace &rFace)
}
-SmFace & operator *= (SmFace &rFace, const Fraction &rFrac)
+SmFace & operator *= (SmFace &rFace, const boost::rational<long>& rFrac)
// scales the width and height of 'rFace' by 'rFrac' and returns a
// reference to 'rFace'.
// It's main use is to make scaling fonts look easier.
{ const Size &rFaceSize = rFace.GetSize();
- rFace.SetSize(Size(Fraction(rFaceSize.Width()) *= rFrac,
- Fraction(rFaceSize.Height()) *= rFrac));
+ rFace.SetSize(Size(rFaceSize.Width() * boost::rational_cast<long>(rFrac),
+ rFaceSize.Height() * boost::rational_cast<long>(rFrac)));
return rFace;
}
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index edf81eace9f7..c023365333a1 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -103,7 +103,7 @@ SmGraphicWindow::SmGraphicWindow(SmViewShell* pShell):
// resource) and will be shown by the sfx framework.
Hide();
- const Fraction aFraction (1,1);
+ const boost::rational<long> aFraction (1,1);
SetMapMode( MapMode(MAP_100TH_MM, Point(), aFraction, aFraction));
ApplyColorConfigValues( SM_MOD()->GetColorConfig() );
@@ -613,7 +613,7 @@ IMPL_LINK_INLINE_END( SmGraphicWindow, MenuSelectHdl, Menu *, pMenu )
void SmGraphicWindow::SetZoom(sal_uInt16 Factor)
{
nZoom = std::min(std::max((sal_uInt16) Factor, (sal_uInt16) MINZOOM), (sal_uInt16) MAXZOOM);
- Fraction aFraction (nZoom, 100);
+ boost::rational<long> aFraction (nZoom, 100);
SetMapMode( MapMode(MAP_100TH_MM, Point(), aFraction, aFraction) );
SetTotalSize();
SmViewShell *pViewSh = GetView();
@@ -960,8 +960,8 @@ void SmViewShell::InnerResizePixel(const Point &rOfs, const Size &rSize)
if ( aObjSize.Width() > 0 && aObjSize.Height() > 0 )
{
Size aProvidedSize = GetWindow()->PixelToLogic( rSize, MAP_100TH_MM );
- SfxViewShell::SetZoomFactor( Fraction( aProvidedSize.Width(), aObjSize.Width() ),
- Fraction( aProvidedSize.Height(), aObjSize.Height() ) );
+ SfxViewShell::SetZoomFactor( boost::rational<long>( aProvidedSize.Width(), aObjSize.Width() ),
+ boost::rational<long>( aProvidedSize.Height(), aObjSize.Height() ) );
}
SetBorderPixel( SvBorder() );
@@ -986,10 +986,10 @@ void SmViewShell::QueryObjAreaPixel( Rectangle& rRect ) const
}
-void SmViewShell::SetZoomFactor( const Fraction &rX, const Fraction &rY )
+void SmViewShell::SetZoomFactor( const boost::rational<long>& rX, const boost::rational<long>& rY )
{
- const Fraction &rFrac = rX < rY ? rX : rY;
- GetGraphicWindow().SetZoom( (sal_uInt16) long(rFrac * Fraction( 100, 1 )) );
+ const boost::rational<long>& rFrac = rX < rY ? rX : rY;
+ GetGraphicWindow().SetZoom( (sal_uInt16) boost::rational_cast<long>(rFrac * 100) );
//To avoid rounding errors base class regulates crooked values too
//if necessary
@@ -1284,9 +1284,9 @@ void SmViewShell::Impl_Print(
Size OutputSize (rOutDev.LogicToPixel(Size(aOutRect.GetWidth(),
aOutRect.GetHeight()), MapMode(MAP_100TH_MM)));
Size GraphicSize (rOutDev.LogicToPixel(aSize, MapMode(MAP_100TH_MM)));
- sal_uInt16 nZ = (sal_uInt16) std::min((long)Fraction(OutputSize.Width() * 100L, GraphicSize.Width()),
- (long)Fraction(OutputSize.Height() * 100L, GraphicSize.Height()));
- Fraction aFraction ((sal_uInt16) std::max ((sal_uInt16) MINZOOM, std::min((sal_uInt16) MAXZOOM, (sal_uInt16) (nZ - 10))), (sal_uInt16) 100);
+ sal_uInt16 nZ = (sal_uInt16) std::min( boost::rational_cast<long>( boost::rational<long>(OutputSize.Width() * 100L, GraphicSize.Width()) ),
+ boost::rational_cast<long>( boost::rational<long>(OutputSize.Height() * 100L, GraphicSize.Height()) ) );
+ boost::rational<long> aFraction ((sal_uInt16) std::max ((sal_uInt16) MINZOOM, std::min((sal_uInt16) MAXZOOM, (sal_uInt16) (nZ - 10))), (sal_uInt16) 100);
OutputMapMode = MapMode(MAP_100TH_MM, aZeroPoint, aFraction, aFraction);
}
@@ -1296,7 +1296,7 @@ void SmViewShell::Impl_Print(
case PRINT_SIZE_ZOOMED:
{
- Fraction aFraction( nZoomFactor, 100 );
+ boost::rational<long> aFraction( nZoomFactor, 100 );
OutputMapMode = MapMode(MAP_100TH_MM, aZeroPoint, aFraction, aFraction);
break;
@@ -1788,8 +1788,8 @@ void SmViewShell::Execute(SfxRequest& rReq)
Size OutputSize(pPrinter->LogicToPixel(Size(OutputRect.GetWidth(),
OutputRect.GetHeight()), aMap));
Size GraphicSize(pPrinter->LogicToPixel(GetDoc()->GetSize(), aMap));
- sal_uInt16 nZ = (sal_uInt16) std::min((long)Fraction(OutputSize.Width() * 100L, GraphicSize.Width()),
- (long)Fraction(OutputSize.Height() * 100L, GraphicSize.Height()));
+ sal_uInt16 nZ = (sal_uInt16) std::min( boost::rational_cast<long>( boost::rational<long>(OutputSize.Width() * 100L, GraphicSize.Width())),
+ boost::rational_cast<long>( boost::rational<long>(OutputSize.Height() * 100L, GraphicSize.Height()) ) );
aGraphic.SetZoom (nZ);
break;
}
diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx
index 7c64241e7172..d0882b231fdf 100644
--- a/starmath/source/visitors.cxx
+++ b/starmath/source/visitors.cxx
@@ -2313,7 +2313,7 @@ void SmNodeToTextVisitor::Visit( SmFontNode* pNode )
break;
}
Append( ::rtl::math::doubleToUString(
- static_cast<double>( pNode->GetSizeParameter( ) ),
+ boost::rational_cast<double>(pNode->GetSizeParameter()),
rtl_math_StringFormat_Automatic,
rtl_math_DecimalPlaces_Max, '.', true ) );
Append( " " );
diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx
index bb4b392942d4..e69a4e0f8450 100644
--- a/svtools/source/brwbox/brwbox1.cxx
+++ b/svtools/source/brwbox/brwbox1.cxx
@@ -2423,10 +2423,10 @@ long BrowseBox::CalcReverseZoom(long nVal)
{
if (IsZoom())
{
- const Fraction& rZoom = GetZoom();
+ const boost::rational<long>& rZoom = GetZoom();
double n = (double)nVal;
- n *= (double)rZoom.GetDenominator();
- n /= (double)rZoom.GetNumerator();
+ n *= (double)rZoom.denominator();
+ n /= (double)rZoom.numerator();
nVal = n>0 ? (long)(n + 0.5) : -(long)(-n + 0.5);
}
diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx
index fe822bb3c618..d4c0e7d46f4e 100644
--- a/svtools/source/brwbox/brwbox2.cxx
+++ b/svtools/source/brwbox/brwbox2.cxx
@@ -549,7 +549,7 @@ void BrowseBox::Resize()
// resized - which is done in UpdateScrollbars)
sal_uLong nSBSize = GetSettings().GetStyleSettings().GetScrollBarSize();
if (IsZoom())
- nSBSize = (sal_uLong)(nSBSize * (double)GetZoom());
+ nSBSize = (sal_uLong)(nSBSize * boost::rational_cast<double>(GetZoom()));
DoHideCursor( "Resize" );
sal_uInt16 nOldVisibleRows = 0;
@@ -1136,7 +1136,7 @@ void BrowseBox::UpdateScrollbars()
// the size of the corner window (and the width of the VSB/height of the HSB)
sal_uLong nCornerSize = GetSettings().GetStyleSettings().GetScrollBarSize();
if (IsZoom())
- nCornerSize = (sal_uLong)(nCornerSize * (double)GetZoom());
+ nCornerSize = (sal_uLong)(nCornerSize * boost::rational_cast<double>(GetZoom()));
bool bNeedsVScroll = false;
long nMaxRows = 0;
diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx
index 91bff8b52be8..e8ac1d0e6d3b 100644
--- a/svtools/source/brwbox/datwin.cxx
+++ b/svtools/source/brwbox/datwin.cxx
@@ -104,7 +104,7 @@ void ButtonFrame::Draw( OutputDevice& rDev )
BrowserColumn::BrowserColumn( sal_uInt16 nItemId, const class Image &rImage,
- const OUString& rTitle, sal_uLong nWidthPixel, const Fraction& rCurrentZoom )
+ const OUString& rTitle, sal_uLong nWidthPixel, const boost::rational<long>& rCurrentZoom )
: _nId( nItemId ),
_nWidth( nWidthPixel ),
_aImage( rImage ),
@@ -112,8 +112,8 @@ BrowserColumn::BrowserColumn( sal_uInt16 nItemId, const class Image &rImage,
_bFrozen( false )
{
double n = (double)_nWidth;
- n *= (double)rCurrentZoom.GetDenominator();
- n /= (double)rCurrentZoom.GetNumerator();
+ n *= (double)rCurrentZoom.denominator();
+ n /= (double)rCurrentZoom.numerator();
_nOriginalWidth = n>0 ? (long)(n+0.5) : -(long)(-n+0.5);
}
@@ -123,12 +123,12 @@ BrowserColumn::~BrowserColumn()
-void BrowserColumn::SetWidth(sal_uLong nNewWidthPixel, const Fraction& rCurrentZoom)
+void BrowserColumn::SetWidth(sal_uLong nNewWidthPixel, const boost::rational<long>& rCurrentZoom)
{
_nWidth = nNewWidthPixel;
double n = (double)_nWidth;
- n *= (double)rCurrentZoom.GetDenominator();
- n /= (double)rCurrentZoom.GetNumerator();
+ n *= (double)rCurrentZoom.denominator();
+ n /= (double)rCurrentZoom.numerator();
_nOriginalWidth = n>0 ? (long)(n+0.5) : -(long)(-n+0.5);
}
@@ -174,11 +174,11 @@ void BrowserColumn::Draw( BrowseBox& rBox, OutputDevice& rDev, const Point& rPos
-void BrowserColumn::ZoomChanged(const Fraction& rNewZoom)
+void BrowserColumn::ZoomChanged(const boost::rational<long>& rNewZoom)
{
double n = (double)_nOriginalWidth;
- n *= (double)rNewZoom.GetNumerator();
- n /= (double)rNewZoom.GetDenominator();
+ n *= (double)rNewZoom.numerator();
+ n /= (double)rNewZoom.denominator();
_nWidth = n>0 ? (long)(n+0.5) : -(long)(-n+0.5);
}
diff --git a/svtools/source/brwbox/datwin.hxx b/svtools/source/brwbox/datwin.hxx
index bff17665e392..1bbe57a684d9 100644
--- a/svtools/source/brwbox/datwin.hxx
+++ b/svtools/source/brwbox/datwin.hxx
@@ -76,7 +76,7 @@ class BrowserColumn
public:
BrowserColumn( sal_uInt16 nItemId, const Image &rImage,
- const OUString& rTitle, sal_uLong nWidthPixel, const Fraction& rCurrentZoom );
+ const OUString& rTitle, sal_uLong nWidthPixel, const boost::rational<long>& rCurrentZoom );
virtual ~BrowserColumn();
sal_uInt16 GetId() const { return _nId; }
@@ -91,8 +91,8 @@ public:
virtual void Draw( BrowseBox& rBox, OutputDevice& rDev,
const Point& rPos, bool bCurs );
- void SetWidth(sal_uLong nNewWidthPixel, const Fraction& rCurrentZoom);
- void ZoomChanged(const Fraction& rNewZoom);
+ void SetWidth(sal_uLong nNewWidthPixel, const boost::rational<long>& rCurrentZoom);
+ void ZoomChanged(const boost::rational<long>& rNewZoom);
};
diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx
index 4308379d6012..587174e88491 100644
--- a/svtools/source/control/ctrltool.cxx
+++ b/svtools/source/control/ctrltool.cxx
@@ -737,7 +737,7 @@ const sal_IntPtr* FontList::GetSizeAry( const vcl::FontInfo& rInfo ) const
return aStdSizeAry;
MapMode aOldMapMode = pDevice->GetMapMode();
- MapMode aMap( MAP_10TH_INCH, Point(), Fraction( 1, 72 ), Fraction( 1, 72 ) );
+ MapMode aMap( MAP_10TH_INCH, Point(), boost::rational<long>( 1, 72 ), boost::rational<long>( 1, 72 ) );
pDevice->SetMapMode( aMap );
sal_uInt16 i;
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index 6dfce365f415..a74ce2d4fcae 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -256,7 +256,7 @@ void Ruler::ImplInit( WinBits nWinBits )
// Initialize Units
mnUnitIndex = RULER_UNIT_CM;
meUnit = FUNIT_CM;
- maZoom = Fraction( 1, 1 );
+ maZoom = boost::rational<long>( 1, 1 );
meSourceUnit = MAP_100TH_MM;
// Recalculate border widths
@@ -2478,9 +2478,9 @@ void Ruler::SetUnit( FieldUnit eNewUnit )
}
}
-void Ruler::SetZoom( const Fraction& rNewZoom )
+void Ruler::SetZoom( const boost::rational<long>& rNewZoom )
{
- DBG_ASSERT( rNewZoom.GetNumerator(), "Ruler::SetZoom() with scale 0 is not allowed" );
+ DBG_ASSERT( rNewZoom.numerator(), "Ruler::SetZoom() with scale 0 is not allowed" );
if ( maZoom != rNewZoom )
{
diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx
index 78ee4385a2e4..808a4205d37f 100644
--- a/svtools/source/filter/exportdialog.cxx
+++ b/svtools/source/filter/exportdialog.cxx
@@ -1017,7 +1017,7 @@ IMPL_LINK_NOARG(ExportDialog, UpdateHdlMtfSizeX)
}
else
{
- Fraction aFract( 1, 100 );
+ boost::rational<long> aFract( 1, 100 );
sal_Int32 nWidth = mpMfSizeX->GetValue();
sal_Int32 nHeight= static_cast< sal_Int32 >( nWidth * fRatio );
const Size aSource( static_cast< sal_Int32 >( nWidth ), static_cast< sal_Int32 >( nHeight ) );
@@ -1051,7 +1051,7 @@ IMPL_LINK_NOARG(ExportDialog, UpdateHdlMtfSizeY)
}
else
{
- Fraction aFract( 1, 100 );
+ boost::rational<long> aFract( 1, 100 );
sal_Int32 nHeight= mpMfSizeY->GetValue();
sal_Int32 nWidth = static_cast< sal_Int32 >( nHeight * fRatio );
const Size aSource( static_cast< sal_Int32 >( nWidth ), static_cast< sal_Int32 >( nHeight ) );
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index 8a6497eab841..be4baa30e6ea 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -887,7 +887,7 @@ Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMo
}
else
{
- aMtf.Scale( Fraction( rDestSize.Width(), aSrcSize.Width() ), Fraction( rDestSize.Height(), aSrcSize.Height() ) );
+ aMtf.Scale( boost::rational<long>( rDestSize.Width(), aSrcSize.Width() ), boost::rational<long>( rDestSize.Height(), aSrcSize.Height() ) );
aMtf.SetPrefMapMode( rDestMap );
}
diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx
index 705021afe3fb..967724923ed8 100644
--- a/svtools/source/misc/imap.cxx
+++ b/svtools/source/misc/imap.cxx
@@ -35,8 +35,8 @@
#include <boost/scoped_ptr.hpp>
-#define SCALEPOINT(aPT,aFracX,aFracY) (aPT).X()=((aPT).X()*(aFracX).GetNumerator())/(aFracX).GetDenominator(); \
- (aPT).Y()=((aPT).Y()*(aFracY).GetNumerator())/(aFracY).GetDenominator();
+#define SCALEPOINT(aPT,aFracX,aFracY) (aPT).X()=((aPT).X()*(aFracX).numerator())/(aFracX).denominator(); \
+ (aPT).Y()=((aPT).Y()*(aFracY).numerator())/(aFracY).denominator();
/******************************************************************************/
@@ -226,16 +226,13 @@ Rectangle IMapRectangleObject::GetRectangle( bool bPixelCoords ) const
return aNewRect;
}
-void IMapRectangleObject::Scale( const Fraction& rFracX, const Fraction& rFracY )
+void IMapRectangleObject::Scale( const boost::rational<long>& rFracX, const boost::rational<long>& rFracY )
{
Point aTL( aRect.TopLeft() );
Point aBR( aRect.BottomRight() );
- if ( rFracX.GetDenominator() && rFracY.GetDenominator() )
- {
- SCALEPOINT( aTL, rFracX, rFracY );
- SCALEPOINT( aBR, rFracX, rFracY );
- }
+ SCALEPOINT( aTL, rFracX, rFracY );
+ SCALEPOINT( aBR, rFracX, rFracY );
aRect = Rectangle( aTL, aBR );
}
@@ -371,19 +368,16 @@ Rectangle IMapCircleObject::GetBoundRect() const
Size( nWidth, nWidth ) );
}
-void IMapCircleObject::Scale( const Fraction& rFracX, const Fraction& rFracY )
+void IMapCircleObject::Scale( const boost::rational<long>& rFracX, const boost::rational<long>& rFracY )
{
- Fraction aAverage( rFracX );
+ boost::rational<long> aAverage( rFracX );
aAverage += rFracY;
- aAverage *= Fraction( 1, 2 );
+ aAverage *= boost::rational<long>( 1, 2 );
- if ( rFracX.GetDenominator() && rFracY.GetDenominator() )
- {
- SCALEPOINT( aCenter, rFracX, rFracY );
- }
+ SCALEPOINT( aCenter, rFracX, rFracY );
- nRadius = ( nRadius * aAverage.GetNumerator() ) / aAverage.GetDenominator();
+ nRadius = ( nRadius * aAverage.numerator() ) / aAverage.denominator();
}
bool IMapCircleObject::IsEqual( const IMapCircleObject& rEqObj )
@@ -493,7 +487,7 @@ void IMapPolygonObject::SetExtraEllipse( const Rectangle& rEllipse )
}
}
-void IMapPolygonObject::Scale( const Fraction& rFracX, const Fraction& rFracY )
+void IMapPolygonObject::Scale( const boost::rational<long>& rFracX, const boost::rational<long>& rFracY )
{
sal_uInt16 nCount = aPoly.GetSize();
@@ -501,10 +495,7 @@ void IMapPolygonObject::Scale( const Fraction& rFracX, const Fraction& rFracY )
{
Point aScaledPt( aPoly[ i ] );
- if ( rFracX.GetDenominator() && rFracY.GetDenominator() )
- {
- SCALEPOINT( aScaledPt, rFracX, rFracY );
- }
+ SCALEPOINT( aScaledPt, rFracX, rFracY );
aPoly[ i ] = aScaledPt;
}
@@ -514,11 +505,8 @@ void IMapPolygonObject::Scale( const Fraction& rFracX, const Fraction& rFracY )
Point aTL( aEllipse.TopLeft() );
Point aBR( aEllipse.BottomRight() );
- if ( rFracX.GetDenominator() && rFracY.GetDenominator() )
- {
- SCALEPOINT( aTL, rFracX, rFracY );
- SCALEPOINT( aBR, rFracX, rFracY );
- }
+ SCALEPOINT( aTL, rFracX, rFracY );
+ SCALEPOINT( aBR, rFracX, rFracY );
aEllipse = Rectangle( aTL, aBR );
}
@@ -824,7 +812,7 @@ IMapObject* ImageMap::GetHitIMapObject( const Size& rTotalSize,
return( pObj ? ( pObj->IsActive() ? pObj : NULL ) : NULL );
}
-void ImageMap::Scale( const Fraction& rFracX, const Fraction& rFracY )
+void ImageMap::Scale( const boost::rational<long>& rFracX, const boost::rational<long>& rFracY )
{
size_t nCount = maList.size();
diff --git a/svx/inc/pch/precompiled_svxcore.hxx b/svx/inc/pch/precompiled_svxcore.hxx
index 9bb07229cfbd..7b90cbe617ec 100644
--- a/svx/inc/pch/precompiled_svxcore.hxx
+++ b/svx/inc/pch/precompiled_svxcore.hxx
@@ -737,7 +737,7 @@
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
#include <tools/fldunit.hxx>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
#include <tools/gen.hxx>
#include <tools/globname.hxx>
#include <tools/helpers.hxx>
diff --git a/svx/inc/sdr/properties/itemsettools.hxx b/svx/inc/sdr/properties/itemsettools.hxx
index d930e176b24b..ef365727b087 100644
--- a/svx/inc/sdr/properties/itemsettools.hxx
+++ b/svx/inc/sdr/properties/itemsettools.hxx
@@ -28,7 +28,7 @@
class SdrObject;
class SfxItemSet;
class Rectangle;
-class Fraction;
+namespace boost { template<class T> class rational; }
// class to remember broadcast start positions
@@ -57,7 +57,7 @@ namespace sdr
{
namespace properties
{
- void ScaleItemSet(SfxItemSet& rSet, const Fraction& rScale);
+ void ScaleItemSet(SfxItemSet& rSet, const boost::rational<long>& rScale);
} // end of namespace properties
} // end of namespace sdr
diff --git a/svx/inc/svdoopengl.hxx b/svx/inc/svdoopengl.hxx
index e30baeacfd0a..30fd2c86abb5 100644
--- a/svx/inc/svdoopengl.hxx
+++ b/svx/inc/svdoopengl.hxx
@@ -32,7 +32,7 @@ public:
OpenGLContext* getOpenGLContext() { return mpContext;}
- 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;
void setRenderer(IOpenGLRenderer* pRenderer);
IOpenGLRenderer* getRenderer();
diff --git a/svx/inc/sxmsitm.hxx b/svx/inc/sxmsitm.hxx
index 8843e4b37c40..b262b02362bd 100644
--- a/svx/inc/sxmsitm.hxx
+++ b/svx/inc/sxmsitm.hxx
@@ -27,8 +27,8 @@
// Instead, we multiply them with each other.
class SdrMeasureScaleItem: public SdrScaleItem {
public:
- SdrMeasureScaleItem() : SdrScaleItem(SDRATTR_MEASURESCALE,Fraction(1,1)) {}
- SdrMeasureScaleItem(const Fraction& rFr): SdrScaleItem(SDRATTR_MEASURESCALE,rFr) {}
+ SdrMeasureScaleItem() : SdrScaleItem(SDRATTR_MEASURESCALE,boost::rational<long>(1,1)) {}
+ SdrMeasureScaleItem(const boost::rational<long>& rFr): SdrScaleItem(SDRATTR_MEASURESCALE,rFr) {}
SdrMeasureScaleItem(SvStream& rIn) : SdrScaleItem(SDRATTR_MEASURESCALE,rIn) {}
};
diff --git a/svx/inc/sxreaitm.hxx b/svx/inc/sxreaitm.hxx
index 46a063ef739a..0f9a216fc359 100644
--- a/svx/inc/sxreaitm.hxx
+++ b/svx/inc/sxreaitm.hxx
@@ -25,15 +25,15 @@
class SdrResizeXAllItem: public SdrFractionItem {
public:
- SdrResizeXAllItem(): SdrFractionItem(SDRATTR_RESIZEXALL,Fraction(1,1)) {}
- SdrResizeXAllItem(const Fraction& rFact): SdrFractionItem(SDRATTR_RESIZEXALL,rFact) {}
+ SdrResizeXAllItem(): SdrFractionItem(SDRATTR_RESIZEXALL,boost::rational<long>(1,1)) {}
+ SdrResizeXAllItem(const boost::rational<long>& rFact): SdrFractionItem(SDRATTR_RESIZEXALL,rFact) {}
SdrResizeXAllItem(SvStream& rIn): SdrFractionItem(SDRATTR_RESIZEXALL,rIn) {}
};
class SdrResizeYAllItem: public SdrFractionItem {
public:
- SdrResizeYAllItem(): SdrFractionItem(SDRATTR_RESIZEYALL,Fraction(1,1)) {}
- SdrResizeYAllItem(const Fraction& rFact): SdrFractionItem(SDRATTR_RESIZEYALL,rFact) {}
+ SdrResizeYAllItem(): SdrFractionItem(SDRATTR_RESIZEYALL,boost::rational<long>(1,1)) {}
+ SdrResizeYAllItem(const boost::rational<long>& rFact): SdrFractionItem(SDRATTR_RESIZEYALL,rFact) {}
SdrResizeYAllItem(SvStream& rIn): SdrFractionItem(SDRATTR_RESIZEYALL,rIn) {}
};
diff --git a/svx/inc/sxreoitm.hxx b/svx/inc/sxreoitm.hxx
index 4bb14b982325..fe935cf3b5c2 100644
--- a/svx/inc/sxreoitm.hxx
+++ b/svx/inc/sxreoitm.hxx
@@ -25,15 +25,15 @@
class SdrResizeXOneItem: public SdrFractionItem {
public:
- SdrResizeXOneItem(): SdrFractionItem(SDRATTR_RESIZEXONE,Fraction(1,1)) {}
- SdrResizeXOneItem(const Fraction& rFact): SdrFractionItem(SDRATTR_RESIZEXONE,rFact) {}
+ SdrResizeXOneItem(): SdrFractionItem(SDRATTR_RESIZEXONE,boost::rational<long>(1,1)) {}
+ SdrResizeXOneItem(const boost::rational<long>& rFact): SdrFractionItem(SDRATTR_RESIZEXONE,rFact) {}
SdrResizeXOneItem(SvStream& rIn): SdrFractionItem(SDRATTR_RESIZEXONE,rIn) {}
};
class SdrResizeYOneItem: public SdrFractionItem {
public:
- SdrResizeYOneItem(): SdrFractionItem(SDRATTR_RESIZEYONE,Fraction(1,1)) {}
- SdrResizeYOneItem(const Fraction& rFact): SdrFractionItem(SDRATTR_RESIZEYONE,rFact) {}
+ SdrResizeYOneItem(): SdrFractionItem(SDRATTR_RESIZEYONE,boost::rational<long>(1,1)) {}
+ SdrResizeYOneItem(const boost::rational<long>& rFact): SdrFractionItem(SDRATTR_RESIZEYONE,rFact) {}
SdrResizeYOneItem(SvStream& rIn): SdrFractionItem(SDRATTR_RESIZEYONE,rIn) {}
};
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx
index 92967399c1da..0a810de128d1 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx
@@ -262,11 +262,11 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
if ( pModel )
{
fMap = 1.0;
- Fraction aFraction( pModel->GetScaleFraction() );
- if ( ( aFraction.GetNumerator() ) != 1 || ( aFraction.GetDenominator() != 1 ) )
+ boost::rational<long> aFraction( pModel->GetScaleFraction() );
+ if ( ( aFraction.numerator() ) != 1 || ( aFraction.denominator() != 1 ) )
{
- fMap *= aFraction.GetNumerator();
- fMap /= aFraction.GetDenominator();
+ fMap *= aFraction.numerator();
+ fMap /= aFraction.denominator();
pMap = &fMap;
}
if ( pModel->GetScaleUnit() != MAP_100TH_MM )
diff --git a/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx b/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx
index 4f546e1b1c0c..661af54f66e8 100644
--- a/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx
@@ -19,7 +19,7 @@
#include "svx/EnhancedCustomShape2d.hxx"
#include <rtl/ustring.hxx>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
// Makes parser a static resource,
// we're synchronized externally.
@@ -116,19 +116,19 @@ public:
virtual EnhancedCustomShapeParameter fillNode( std::vector< EnhancedCustomShapeEquation >& rEquations, ExpressionNode* /* pOptionalArg */, sal_uInt32 /* nFlags */ ) SAL_OVERRIDE
{
EnhancedCustomShapeParameter aRet;
- Fraction aFract( maValue );
- if ( aFract.GetDenominator() == 1 )
+ boost::rational<long> aFract( maValue );
+ if ( aFract.denominator() == 1 )
{
aRet.Type = EnhancedCustomShapeParameterType::NORMAL;
- aRet.Value <<= (sal_Int32)aFract.GetNumerator();
+ aRet.Value <<= (sal_Int32)aFract.numerator();
}
else
{
EnhancedCustomShapeEquation aEquation;
aEquation.nOperation = 1;
aEquation.nPara[ 0 ] = 1;
- aEquation.nPara[ 1 ] = (sal_Int16)aFract.GetNumerator();
- aEquation.nPara[ 2 ] = (sal_Int16)aFract.GetDenominator();
+ aEquation.nPara[ 1 ] = (sal_Int16)aFract.numerator();
+ aEquation.nPara[ 2 ] = (sal_Int16)aFract.denominator();
aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
aRet.Value <<= (sal_Int32)rEquations.size();
rEquations.push_back( aEquation );
diff --git a/svx/source/dialog/connctrl.cxx b/svx/source/dialog/connctrl.cxx
index a2c56212eec2..97454dc46219 100644
--- a/svx/source/dialog/connctrl.cxx
+++ b/svx/source/dialog/connctrl.cxx
@@ -113,9 +113,9 @@ void SvxXConnectionPreview::AdaptSize()
aNewSize.Height()= (long) ( (double) nWidth / fRectWH );
}
- Fraction aFrac1( aWinSize.Width(), aRect.GetWidth() );
- Fraction aFrac2( aWinSize.Height(), aRect.GetHeight() );
- Fraction aMinFrac( aFrac1 <= aFrac2 ? aFrac1 : aFrac2 );
+ boost::rational<long> aFrac1( aWinSize.Width(), aRect.GetWidth() );
+ boost::rational<long> aFrac2( aWinSize.Height(), aRect.GetHeight() );
+ boost::rational<long> aMinFrac( aFrac1 <= aFrac2 ? aFrac1 : aFrac2 );
// Implement MapMode
aDisplayMap.SetScaleX( aMinFrac );
@@ -261,29 +261,29 @@ void SvxXConnectionPreview::MouseButtonDown( const MouseEvent& rMEvt )
if( bZoomIn || bZoomOut )
{
MapMode aMapMode = GetMapMode();
- Fraction aXFrac = aMapMode.GetScaleX();
- Fraction aYFrac = aMapMode.GetScaleY();
- boost::scoped_ptr<Fraction> pMultFrac;
+ boost::rational<long> aXFrac = aMapMode.GetScaleX();
+ boost::rational<long> aYFrac = aMapMode.GetScaleY();
+ boost::scoped_ptr<boost::rational<long>> pMultFrac;
if( bZoomIn )
{
if( bCtrl )
- pMultFrac.reset(new Fraction( 3, 2 ));
+ pMultFrac.reset(new boost::rational<long>( 3, 2 ));
else
- pMultFrac.reset(new Fraction( 11, 10 ));
+ pMultFrac.reset(new boost::rational<long>( 11, 10 ));
}
else
{
if( bCtrl )
- pMultFrac.reset(new Fraction( 2, 3 ));
+ pMultFrac.reset(new boost::rational<long>( 2, 3 ));
else
- pMultFrac.reset(new Fraction( 10, 11 ));
+ pMultFrac.reset(new boost::rational<long>( 10, 11 ));
}
aXFrac *= *pMultFrac;
aYFrac *= *pMultFrac;
- if( (double)aXFrac > 0.001 && (double)aXFrac < 1000.0 &&
- (double)aYFrac > 0.001 && (double)aYFrac < 1000.0 )
+ if( boost::rational_cast<double>(aXFrac) > 0.001 && boost::rational_cast<double>(aXFrac) < 1000.0 &&
+ boost::rational_cast<double>(aYFrac) > 0.001 && boost::rational_cast<double>(aYFrac) < 1000.0 )
{
aMapMode.SetScaleX( aXFrac );
aMapMode.SetScaleY( aYFrac );
@@ -292,8 +292,8 @@ void SvxXConnectionPreview::MouseButtonDown( const MouseEvent& rMEvt )
Size aOutSize( GetOutputSize() );
Point aPt( aMapMode.GetOrigin() );
- long nX = (long)( ( (double)aOutSize.Width() - ( (double)aOutSize.Width() * (double)*pMultFrac ) ) / 2.0 + 0.5 );
- long nY = (long)( ( (double)aOutSize.Height() - ( (double)aOutSize.Height() * (double)*pMultFrac ) ) / 2.0 + 0.5 );
+ long nX = (long)( ( (double)aOutSize.Width() - ( (double)aOutSize.Width() * boost::rational_cast<double>(* pMultFrac) ) ) / 2.0 + 0.5 );
+ long nY = (long)( ( (double)aOutSize.Height() - ( (double)aOutSize.Height() * boost::rational_cast<double>(* pMultFrac) ) ) / 2.0 + 0.5 );
aPt.X() += nX;
aPt.Y() += nY;
diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx
index 0c590d3becce..59f402538299 100644
--- a/svx/source/dialog/graphctl.cxx
+++ b/svx/source/dialog/graphctl.cxx
@@ -128,7 +128,7 @@ void GraphCtrl::InitSdrModel()
pModel = new SdrModel;
pModel->GetItemPool().FreezeIdRanges();
pModel->SetScaleUnit( aMap100.GetMapUnit() );
- pModel->SetScaleFraction( Fraction( 1, 1 ) );
+ pModel->SetScaleFraction( boost::rational<long>( 1, 1 ) );
pModel->SetDefaultFontHeight( 500 );
pPage = new SdrPage( *pModel );
@@ -225,8 +225,8 @@ void GraphCtrl::Resize()
aNewPos.Y() = ( nHeight - aNewSize.Height() ) >> 1;
// Implementing MapMode for Engine
- aDisplayMap.SetScaleX( Fraction( aNewSize.Width(), aGraphSize.Width() ) );
- aDisplayMap.SetScaleY( Fraction( aNewSize.Height(), aGraphSize.Height() ) );
+ aDisplayMap.SetScaleX( boost::rational<long>( aNewSize.Width(), aGraphSize.Width() ) );
+ aDisplayMap.SetScaleY( boost::rational<long>( aNewSize.Height(), aGraphSize.Height() ) );
aDisplayMap.SetOrigin( LogicToLogic( aNewPos, aMap100, aDisplayMap ) );
SetMapMode( aDisplayMap );
diff --git a/svx/source/dialog/measctrl.cxx b/svx/source/dialog/measctrl.cxx
index 8810a874ba91..8206ea373637 100644
--- a/svx/source/dialog/measctrl.cxx
+++ b/svx/source/dialog/measctrl.cxx
@@ -34,8 +34,8 @@ SvxXMeasurePreview::SvxXMeasurePreview( vcl::Window* pParent, WinBits nStyle)
// Scale: 1:2
MapMode aMapMode = GetMapMode();
- aMapMode.SetScaleX( Fraction( 1, 2 ) );
- aMapMode.SetScaleY( Fraction( 1, 2 ) );
+ aMapMode.SetScaleX( boost::rational<long>( 1, 2 ) );
+ aMapMode.SetScaleY( boost::rational<long>( 1, 2 ) );
SetMapMode( aMapMode );
Size aSize = GetOutputSize();
@@ -109,29 +109,29 @@ void SvxXMeasurePreview::MouseButtonDown( const MouseEvent& rMEvt )
if( bZoomIn || bZoomOut )
{
MapMode aMapMode = GetMapMode();
- Fraction aXFrac = aMapMode.GetScaleX();
- Fraction aYFrac = aMapMode.GetScaleY();
- boost::scoped_ptr<Fraction> pMultFrac;
+ boost::rational<long> aXFrac = aMapMode.GetScaleX();
+ boost::rational<long> aYFrac = aMapMode.GetScaleY();
+ boost::scoped_ptr<boost::rational<long>> pMultFrac;
if( bZoomIn )
{
if( bCtrl )
- pMultFrac.reset(new Fraction( 3, 2 ));
+ pMultFrac.reset(new boost::rational<long>( 3, 2 ));
else
- pMultFrac.reset(new Fraction( 11, 10 ));
+ pMultFrac.reset(new boost::rational<long>( 11, 10 ));
}
else
{
if( bCtrl )
- pMultFrac.reset(new Fraction( 2, 3 ));
+ pMultFrac.reset(new boost::rational<long>( 2, 3 ));
else
- pMultFrac.reset(new Fraction( 10, 11 ));
+ pMultFrac.reset(new boost::rational<long>( 10, 11 ));
}
aXFrac *= *pMultFrac;
aYFrac *= *pMultFrac;
- if( (double)aXFrac > 0.001 && (double)aXFrac < 1000.0 &&
- (double)aYFrac > 0.001 && (double)aYFrac < 1000.0 )
+ if( boost::rational_cast<double>(aXFrac) > 0.001 && boost::rational_cast<double>(aXFrac) < 1000.0 &&
+ boost::rational_cast<double>(aYFrac) > 0.001 && boost::rational_cast<double>(aYFrac) < 1000.0 )
{
aMapMode.SetScaleX( aXFrac );
aMapMode.SetScaleY( aYFrac );
@@ -140,8 +140,8 @@ void SvxXMeasurePreview::MouseButtonDown( const MouseEvent& rMEvt )
Size aOutSize( GetOutputSize() );
Point aPt( aMapMode.GetOrigin() );
- long nX = (long)( ( (double)aOutSize.Width() - ( (double)aOutSize.Width() * (double)*pMultFrac ) ) / 2.0 + 0.5 );
- long nY = (long)( ( (double)aOutSize.Height() - ( (double)aOutSize.Height() * (double)*pMultFrac ) ) / 2.0 + 0.5 );
+ long nX = (long)( ( (double)aOutSize.Width() - ( (double)aOutSize.Width() * boost::rational_cast<double>(* pMultFrac) ) ) / 2.0 + 0.5 );
+ long nY = (long)( ( (double)aOutSize.Height() - ( (double)aOutSize.Height() * boost::rational_cast<double>(* pMultFrac) ) ) / 2.0 + 0.5 );
aPt.X() += nX;
aPt.Y() += nY;
diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx
index fa7b9befa814..7aa7e8b167ed 100644
--- a/svx/source/dialog/pagectrl.cxx
+++ b/svx/source/dialog/pagectrl.cxx
@@ -102,8 +102,8 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxPageWindow(vcl::Win
void SvxPageWindow::Paint(const Rectangle&)
{
- Fraction aXScale(aWinSize.Width(),std::max((long)(aSize.Width() * 2 + aSize.Width() / 8),1L));
- Fraction aYScale(aWinSize.Height(),std::max(aSize.Height(),1L));
+ boost::rational<long> aXScale(aWinSize.Width(),std::max((long)(aSize.Width() * 2 + aSize.Width() / 8),1L));
+ boost::rational<long> aYScale(aWinSize.Height(),std::max(aSize.Height(),1L));
MapMode aMapMode(GetMapMode());
if(aYScale < aXScale)
@@ -126,9 +126,9 @@ void SvxPageWindow::Paint(const Rectangle&)
if (aSize.Width() > aSize.Height())
{
// Draw Landscape page of the same size
- Fraction aX = aMapMode.GetScaleX();
- Fraction aY = aMapMode.GetScaleY();
- Fraction a2(1.5);
+ boost::rational<long> aX = aMapMode.GetScaleX();
+ boost::rational<long> aY = aMapMode.GetScaleY();
+ boost::rational<long> a2(1.5);
aX *= a2;
aY *= a2;
aMapMode.SetScaleX(aX);
diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx
index 06eac9c647d7..998d9d80dbbc 100644
--- a/svx/source/engine3d/obj3d.cxx
+++ b/svx/source/engine3d/obj3d.cxx
@@ -322,7 +322,7 @@ void E3dObject::SetModel(SdrModel* pNewModel)
// resize object, used from old 2d interfaces, e.g. in Move/Scale dialog (F4)
-void E3dObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+void E3dObject::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact)
{
// Movement in X, Y in the eye coordinate system
E3dScene* pScene = GetScene();
@@ -345,8 +345,8 @@ void E3dObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fracti
aScaleCenter3D = aInverseViewToEye * aScaleCenter3D;
// Get scale factors
- double fScaleX(xFact);
- double fScaleY(yFact);
+ double fScaleX(boost::rational_cast<double>(xFact));
+ double fScaleY(boost::rational_cast<double>(yFact));
// build transform
basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx
index 9d5336f02c8c..54c582bd2392 100644
--- a/svx/source/engine3d/scene3d.cxx
+++ b/svx/source/engine3d/scene3d.cxx
@@ -323,8 +323,8 @@ void E3dScene::NbcMove(const Size& rSize)
NbcSetSnapRect(aNewSnapRect);
}
-void E3dScene::NbcResize(const Point& rRef, const Fraction& rXFact,
- const Fraction& rYFact)
+void E3dScene::NbcResize(const Point& rRef, const boost::rational<long>& rXFact,
+ const boost::rational<long>& rYFact)
{
Rectangle aNewSnapRect = GetSnapRect();
ResizeRect(aNewSnapRect, rRef, rXFact, rYFact);
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index d9e92c3be61f..317e2d1069b8 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -736,7 +736,7 @@ void DbGridControl::NavigationBar::StateChanged( StateChangedType nType )
case STATE_CHANGE_ZOOM:
{
- Fraction aZoom = GetZoom();
+ boost::rational<long> aZoom = GetZoom();
// not all of these controls need to know the new zoom, but to be sure ...
vcl::Font aFont( GetSettings().GetStyleSettings().GetFieldFont() );
diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx
index 653feff1774a..212c9de8123d 100644
--- a/svx/source/form/fmvwimp.cxx
+++ b/svx/source/form/fmvwimp.cxx
@@ -1450,8 +1450,8 @@ SdrObject* FmXFormView::implCreateXFormsControl( const ::svx::OXFormsDescriptor
const sal_uInt16 nObjID = OBJ_FM_BUTTON;
::Size controlSize(4000, 500);
FmFormObj *pControl = static_cast<FmFormObj*>(SdrObjFactory::MakeNewObject( FmFormInventor, nObjID, NULL, NULL ));
- controlSize.Width() = Fraction(controlSize.Width(), 1) * eTargetMode.GetScaleX();
- controlSize.Height() = Fraction(controlSize.Height(), 1) * eTargetMode.GetScaleY();
+ controlSize.Width() = boost::rational_cast<long>(controlSize.Width() * eTargetMode.GetScaleX());
+ controlSize.Height() = boost::rational_cast<long>(controlSize.Height() * eTargetMode.GetScaleY());
::Point controlPos( OutputDevice::LogicToLogic( ::Point( controlSize.Width(), 0 ), eSourceMode, eTargetMode ) );
::Rectangle controlRect( controlPos, OutputDevice::LogicToLogic( controlSize, eSourceMode, eTargetMode ) );
pControl->SetLogicRect(controlRect);
@@ -1541,8 +1541,8 @@ bool FmXFormView::createControlLabelPair( OutputDevice& _rOutDev, sal_Int32 _nXO
aRealSize.Height()= aDefSize.Height();
// adjust to scaling of the target device (#53523#)
- aRealSize.Width() = long(Fraction(aRealSize.Width(), 1) * eTargetMode.GetScaleX());
- aRealSize.Height() = long(Fraction(aRealSize.Height(), 1) * eTargetMode.GetScaleY());
+ aRealSize.Width() = boost::rational_cast<long>(aRealSize.Width() * eTargetMode.GetScaleX());
+ aRealSize.Height() = boost::rational_cast<long>(aRealSize.Height() * eTargetMode.GetScaleY());
// for boolean fields, we do not create a label, but just a checkbox
bool bNeedLabel = ( _nControlObjectID != OBJ_FM_CHECKBOX );
@@ -1608,8 +1608,8 @@ bool FmXFormView::createControlLabelPair( OutputDevice& _rOutDev, sal_Int32 _nXO
if ( OBJ_FM_IMAGECONTROL == _nControlObjectID )
aControlSize = aDefImageSize;
- aControlSize.Width() = long(Fraction(aControlSize.Width(), 1) * eTargetMode.GetScaleX());
- aControlSize.Height() = long(Fraction(aControlSize.Height(), 1) * eTargetMode.GetScaleY());
+ aControlSize.Width() = boost::rational_cast<long>(aControlSize.Width() * eTargetMode.GetScaleX());
+ aControlSize.Height() = boost::rational_cast<long>(aControlSize.Height() * eTargetMode.GetScaleY());
pControl->SetLogicRect( ::Rectangle(
OutputDevice::LogicToLogic( ::Point( aRealSize.Width() + _nXOffsetMM, _nYOffsetMM ), eSourceMode, eTargetMode ),
diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
index 096da89be126..a87b44850ca0 100644
--- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
@@ -279,9 +279,9 @@ namespace sdr { namespace contact {
::basegfx::B2DVector aZoom( 1, 1 );
if ( pWindow )
{
- const Fraction& rZoom( pWindow->GetZoom() );
- aZoom.setX( (double)rZoom );
- aZoom.setY( (double)rZoom );
+ const boost::rational<long>& rZoom( pWindow->GetZoom() );
+ aZoom.setX( boost::rational_cast<double>(rZoom) );
+ aZoom.setY( boost::rational_cast<double>(rZoom) );
}
return aZoom;
}
@@ -867,8 +867,8 @@ namespace sdr { namespace contact {
::basegfx::B2DHomMatrix aScaleNormalization;
MapMode aCurrentDeviceMapMode( rPageViewDevice.GetMapMode() );
- aScaleNormalization.set( 0, 0, (double)aCurrentDeviceMapMode.GetScaleX() );
- aScaleNormalization.set( 1, 1, (double)aCurrentDeviceMapMode.GetScaleY() );
+ aScaleNormalization.set( 0, 0, boost::rational_cast<double>(aCurrentDeviceMapMode.GetScaleX()) );
+ aScaleNormalization.set( 1, 1, boost::rational_cast<double>(aCurrentDeviceMapMode.GetScaleY()) );
m_aZoomLevelNormalization *= aScaleNormalization;
#if OSL_DEBUG_LEVEL > 1
diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx
index 78c6895208f0..21738416f926 100644
--- a/svx/source/sdr/properties/attributeproperties.cxx
+++ b/svx/source/sdr/properties/attributeproperties.cxx
@@ -318,7 +318,7 @@ namespace sdr
MapUnit aOldUnit(pOldModel->GetScaleUnit());
MapUnit aNewUnit(pNewModel->GetScaleUnit());
bool bScaleUnitChanged(aNewUnit != aOldUnit);
- Fraction aMetricFactor;
+ boost::rational<long> aMetricFactor;
if(bScaleUnitChanged)
{
diff --git a/svx/source/sdr/properties/defaultproperties.cxx b/svx/source/sdr/properties/defaultproperties.cxx
index c6f09bd5bb7f..08ff3d349397 100644
--- a/svx/source/sdr/properties/defaultproperties.cxx
+++ b/svx/source/sdr/properties/defaultproperties.cxx
@@ -211,7 +211,7 @@ namespace sdr
{
}
- void DefaultProperties::Scale(const Fraction& rScale)
+ void DefaultProperties::Scale(const boost::rational<long>& rScale)
{
if(mpItemSet)
{
diff --git a/svx/source/sdr/properties/itemsettools.cxx b/svx/source/sdr/properties/itemsettools.cxx
index 835f23552c64..e7826272fa2f 100644
--- a/svx/source/sdr/properties/itemsettools.cxx
+++ b/svx/source/sdr/properties/itemsettools.cxx
@@ -93,15 +93,10 @@ namespace sdr
{
namespace properties
{
- void ScaleItemSet(SfxItemSet& rSet, const Fraction& rScale)
+ void ScaleItemSet(SfxItemSet& rSet, const boost::rational<long>& rScale)
{
- sal_Int32 nMul(rScale.GetNumerator());
- sal_Int32 nDiv(rScale.GetDenominator());
-
- if(!rScale.IsValid() || !nDiv)
- {
- return;
- }
+ sal_Int32 nMul(rScale.numerator());
+ sal_Int32 nDiv(rScale.denominator());
SfxWhichIter aIter(rSet);
sal_uInt16 nWhich(aIter.FirstWhich());
diff --git a/svx/source/sdr/properties/properties.cxx b/svx/source/sdr/properties/properties.cxx
index 16af145d4946..5865948e405f 100644
--- a/svx/source/sdr/properties/properties.cxx
+++ b/svx/source/sdr/properties/properties.cxx
@@ -74,7 +74,7 @@ namespace sdr
ClearObjectItem(nWhich);
}
- void BaseProperties::Scale(const Fraction& /*rScale*/)
+ void BaseProperties::Scale(const boost::rational<long>& /*rScale*/)
{
// default implementation does nothing; overload where
// an ItemSet is implemented.
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index 0ef3d8ec540f..2e1346de8355 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -508,7 +508,7 @@ IMPL_LINK( PosSizePropertyPanel, AngleModifiedHdl, void *, EMPTYARG )
sal_Int64 nTmp = dTmp*100;
// #i123993# Need to take UIScale into account when executing rotations
- const double fUIScale(mpView && mpView->GetModel() ? double(mpView->GetModel()->GetUIScale()) : 1.0);
+ const double fUIScale(mpView && mpView->GetModel() ? boost::rational_cast<double>(mpView->GetModel()->GetUIScale()) : 1.0);
SfxInt32Item aAngleItem( SID_ATTR_TRANSFORM_ANGLE,(sal_uInt32) nTmp);
SfxInt32Item aRotXItem( SID_ATTR_TRANSFORM_ROT_X, basegfx::fround(mlRotX * fUIScale));
SfxInt32Item aRotYItem( SID_ATTR_TRANSFORM_ROT_Y, basegfx::fround(mlRotY * fUIScale));
@@ -526,7 +526,7 @@ IMPL_LINK( PosSizePropertyPanel, RotationHdl, void *, EMPTYARG )
sal_Int32 nTmp = mpDial->GetRotation();
// #i123993# Need to take UIScale into account when executing rotations
- const double fUIScale(mpView && mpView->GetModel() ? double(mpView->GetModel()->GetUIScale()) : 1.0);
+ const double fUIScale(mpView && mpView->GetModel() ? boost::rational_cast<double>(mpView->GetModel()->GetUIScale()) : 1.0);
SfxInt32Item aAngleItem( SID_ATTR_TRANSFORM_ANGLE,(sal_uInt32) nTmp);
SfxInt32Item aRotXItem( SID_ATTR_TRANSFORM_ROT_X, basegfx::fround(mlRotX * fUIScale));
SfxInt32Item aRotYItem( SID_ATTR_TRANSFORM_ROT_Y, basegfx::fround(mlRotY * fUIScale));
@@ -604,7 +604,7 @@ void PosSizePropertyPanel::NotifyItemUpdate(
{
long mlOldWidth1 = pWidthItem->GetValue();
- mlOldWidth1 = Fraction( mlOldWidth1 ) / maUIScale;
+ mlOldWidth1 = boost::rational_cast<long>(mlOldWidth1 / maUIScale);
SetFieldUnit( *mpMtrWidth, meDlgUnit, true );
SetMetricValue( *mpMtrWidth, mlOldWidth1, mePoolUnit );
mlOldWidth = mlOldWidth1;
@@ -624,7 +624,7 @@ void PosSizePropertyPanel::NotifyItemUpdate(
{
long mlOldHeight1 = pHeightItem->GetValue();
- mlOldHeight1 = Fraction( mlOldHeight1 ) / maUIScale;
+ mlOldHeight1 = boost::rational_cast<long>(mlOldHeight1 / maUIScale);
SetFieldUnit( *mpMtrHeight, meDlgUnit, true );
SetMetricValue( *mpMtrHeight, mlOldHeight1, mePoolUnit );
mlOldHeight = mlOldHeight1;
@@ -643,7 +643,7 @@ void PosSizePropertyPanel::NotifyItemUpdate(
if(pItem)
{
long nTmp = pItem->GetValue();
- nTmp = Fraction( nTmp ) / maUIScale;
+ nTmp = boost::rational_cast<long>(nTmp / maUIScale);
SetFieldUnit( *mpMtrPosX, meDlgUnit, true );
SetMetricValue( *mpMtrPosX, nTmp, mePoolUnit );
break;
@@ -661,7 +661,7 @@ void PosSizePropertyPanel::NotifyItemUpdate(
if(pItem)
{
long nTmp = pItem->GetValue();
- nTmp = Fraction( nTmp ) / maUIScale;
+ nTmp = boost::rational_cast<long>(nTmp / maUIScale);
SetFieldUnit( *mpMtrPosY, meDlgUnit, true );
SetMetricValue( *mpMtrPosY, nTmp, mePoolUnit );
break;
@@ -679,7 +679,7 @@ void PosSizePropertyPanel::NotifyItemUpdate(
if(pItem)
{
mlRotX = pItem->GetValue();
- mlRotX = Fraction( mlRotX ) / maUIScale;
+ mlRotX = boost::rational_cast<long>(mlRotX / maUIScale);
}
}
break;
@@ -692,7 +692,7 @@ void PosSizePropertyPanel::NotifyItemUpdate(
if(pItem)
{
mlRotY = pItem->GetValue();
- mlRotY = Fraction( mlRotY ) / maUIScale;
+ mlRotY = boost::rational_cast<long>(mlRotY / maUIScale);
}
}
break;
@@ -898,19 +898,19 @@ void PosSizePropertyPanel::executeSize()
{
if ( mpMtrWidth->IsValueModified() || mpMtrHeight->IsValueModified())
{
- Fraction aUIScale = mpView->GetModel()->GetUIScale();
+ boost::rational<long> aUIScale = mpView->GetModel()->GetUIScale();
// get Width
double nWidth = (double)mpMtrWidth->GetValue( meDlgUnit );
nWidth = MetricField::ConvertDoubleValue( nWidth, mpMtrWidth->GetBaseValue(), mpMtrWidth->GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM );
- long lWidth = (long)(nWidth * (double)aUIScale);
+ long lWidth = (long)(nWidth * boost::rational_cast<double>(aUIScale));
lWidth = OutputDevice::LogicToLogic( lWidth, MAP_100TH_MM, (MapUnit)mePoolUnit );
lWidth = (long)mpMtrWidth->Denormalize( lWidth );
// get Height
double nHeight = (double)mpMtrHeight->GetValue( meDlgUnit );
nHeight = MetricField::ConvertDoubleValue( nHeight, mpMtrHeight->GetBaseValue(), mpMtrHeight->GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM );
- long lHeight = (long)(nHeight * (double)aUIScale);
+ long lHeight = (long)(nHeight * boost::rational_cast<double>(aUIScale));
lHeight = OutputDevice::LogicToLogic( lHeight, MAP_100TH_MM, (MapUnit)mePoolUnit );
lHeight = (long)mpMtrWidth->Denormalize( lHeight );
@@ -953,11 +953,11 @@ void PosSizePropertyPanel::executePosX()
maRect = mpView->GetAllMarkedRect();
aRect = mpView->GetAllMarkedRect();
- Fraction aUIScale = mpView->GetModel()->GetUIScale();
+ boost::rational<long> aUIScale = mpView->GetModel()->GetUIScale();
lX += maAnchorPos.X();
- lX = Fraction( lX ) * aUIScale;
+ lX = boost::rational_cast<long>(lX * aUIScale);
lY += maAnchorPos.Y();
- lY = Fraction( lY ) * aUIScale;
+ lY = boost::rational_cast<long>(lY * aUIScale);
SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,(sal_uInt32) lX);
SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,(sal_uInt32) lY);
@@ -980,11 +980,11 @@ void PosSizePropertyPanel::executePosY()
maRect = mpView->GetAllMarkedRect();
aRect = mpView->GetAllMarkedRect();
- Fraction aUIScale = mpView->GetModel()->GetUIScale();
+ boost::rational<long> aUIScale = mpView->GetModel()->GetUIScale();
lX += maAnchorPos.X();
- lX = Fraction( lX ) * aUIScale;
+ lX = boost::rational_cast<long>(lX * aUIScale);
lY += maAnchorPos.Y();
- lY = Fraction( lY ) * aUIScale;
+ lY = boost::rational_cast<long>(lY * aUIScale);
SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,(sal_uInt32) lX);
SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,(sal_uInt32) lY);
@@ -1158,7 +1158,7 @@ void PosSizePropertyPanel::DisableControls()
void PosSizePropertyPanel::UpdateUIScale()
{
- const Fraction aUIScale (mpView->GetModel()->GetUIScale());
+ const boost::rational<long> aUIScale (mpView->GetModel()->GetUIScale());
if (maUIScale != aUIScale)
{
// UI scale has changed.
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
index 8983c23deac6..b5718ef54b69 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
@@ -102,7 +102,7 @@ private:
Point maAnchorPos; //anchor position
long mlRotX;
long mlRotY;
- Fraction maUIScale;
+ boost::rational<long> maUIScale;
SfxMapUnit mePoolUnit;
FieldUnit meDlgUnit;
diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx
index 1e012d96bac3..216107aa9930 100644
--- a/svx/source/svdraw/svdattr.cxx
+++ b/svx/source/svdraw/svdattr.cxx
@@ -630,7 +630,7 @@ SdrFractionItem::SdrFractionItem(sal_uInt16 nId, SvStream& rIn):
sal_Int32 nMul,nDiv;
rIn.ReadInt32( nMul );
rIn.ReadInt32( nDiv );
- nValue=Fraction(nMul,nDiv);
+ nValue=boost::rational<long>(nMul,nDiv);
}
bool SdrFractionItem::operator==(const SfxPoolItem& rCmp) const
@@ -643,19 +643,12 @@ bool SdrFractionItem::GetPresentation(
SfxItemPresentation ePresentation, SfxMapUnit /*eCoreMetric*/,
SfxMapUnit /*ePresentationMetric*/, OUString &rText, const IntlWrapper *) const
{
- if(nValue.IsValid())
- {
- sal_Int32 nDiv = nValue.GetDenominator();
- rText = OUString::number(nValue.GetNumerator());
+ sal_Int32 nDiv = nValue.denominator();
+ rText = OUString::number(nValue.numerator());
- if(nDiv != 1)
- {
- rText = rText + "/" + OUString::number(nDiv);
- }
- }
- else
+ if(nDiv != 1)
{
- rText = "?";
+ rText = rText + "/" + OUString::number(nDiv);
}
if(ePresentation == SFX_ITEM_PRESENTATION_COMPLETE)
@@ -679,8 +672,8 @@ SfxPoolItem* SdrFractionItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
SvStream& SdrFractionItem::Store(SvStream& rOut, sal_uInt16 /*nItemVers*/) const
{
- rOut.WriteInt32( nValue.GetNumerator() );
- rOut.WriteInt32( nValue.GetDenominator() );
+ rOut.WriteInt32( nValue.numerator() );
+ rOut.WriteInt32( nValue.denominator() );
return rOut;
}
@@ -699,16 +692,9 @@ bool SdrScaleItem::GetPresentation(
SfxItemPresentation ePresentation, SfxMapUnit /*eCoreMetric*/,
SfxMapUnit /*ePresentationMetric*/, OUString &rText, const IntlWrapper *) const
{
- if(GetValue().IsValid())
- {
- sal_Int32 nDiv = GetValue().GetDenominator();
+ sal_Int32 nDiv = GetValue().denominator();
- rText = OUString::number(GetValue().GetNumerator()) + ":" + OUString::number(nDiv);
- }
- else
- {
- rText = "?";
- }
+ rText = OUString::number(GetValue().numerator()) + ":" + OUString::number(nDiv);
if(ePresentation == SFX_ITEM_PRESENTATION_COMPLETE)
{
diff --git a/svx/source/svdraw/svddrag.cxx b/svx/source/svdraw/svddrag.cxx
index 3c0f109954b0..fda560eb2a43 100644
--- a/svx/source/svdraw/svddrag.cxx
+++ b/svx/source/svdraw/svddrag.cxx
@@ -106,22 +106,22 @@ bool SdrDragStat::CheckMinMoved(const Point& rPnt)
return bMinMoved;
}
-Fraction SdrDragStat::GetXFact() const
+boost::rational<long> SdrDragStat::GetXFact() const
{
long nMul=GetNow().X()-aRef1.X();
long nDiv=GetPrev().X()-aRef1.X();
if (nDiv==0) nDiv=1;
if (bHorFixed) { nMul=1; nDiv=1; }
- return Fraction(nMul,nDiv);
+ return boost::rational<long>(nMul,nDiv);
}
-Fraction SdrDragStat::GetYFact() const
+boost::rational<long> SdrDragStat::GetYFact() const
{
long nMul=GetNow().Y()-aRef1.Y();
long nDiv=GetPrev().Y()-aRef1.Y();
if (nDiv==0) nDiv=1;
if (bVerFixed) { nMul=1; nDiv=1; }
- return Fraction(nMul,nDiv);
+ return boost::rational<long>(nMul,nDiv);
}
void SdrDragStat::TakeCreateRect(Rectangle& rRect) const
diff --git a/svx/source/svdraw/svddrgm1.hxx b/svx/source/svdraw/svddrgm1.hxx
index 972c17de91ac..7b038800b5e2 100644
--- a/svx/source/svdraw/svddrgm1.hxx
+++ b/svx/source/svdraw/svddrgm1.hxx
@@ -74,7 +74,7 @@ public:
class SdrDragShear : public SdrDragMethod
{
private:
- Fraction aFact;
+ boost::rational<long> aFact;
long nWink0;
long nWink;
double nTan;
@@ -151,7 +151,7 @@ private:
Point aMarkCenter;
Point aCenter;
Point aStart;
- Fraction aFact;
+ boost::rational<long> aFact;
Point aRad;
bool bContortionAllowed;
bool bNoContortionAllowed;
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index 9c92001b56af..a5b671cbd38a 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -1779,7 +1779,7 @@ SdrDragResize::SdrDragResize(SdrDragView& rNewView)
void SdrDragResize::TakeSdrDragComment(OUString& rStr) const
{
ImpTakeDescriptionStr(STR_DragMethResize, rStr);
- Fraction aFact1(1,1);
+ boost::rational<long> aFact1(1,1);
Point aStart(DragStat().GetStart());
Point aRef(DragStat().GetRef1());
sal_Int32 nXDiv(aStart.X() - aRef.X());
@@ -1878,7 +1878,7 @@ basegfx::B2DHomMatrix SdrDragResize::getCurrentTransformation()
{
basegfx::B2DHomMatrix aRetval(basegfx::tools::createTranslateB2DHomMatrix(
-DragStat().Ref1().X(), -DragStat().Ref1().Y()));
- aRetval.scale(aXFact, aYFact);
+ aRetval.scale(boost::rational_cast<double>(aXFact), boost::rational_cast<double>(aYFact));
aRetval.translate(DragStat().Ref1().X(), DragStat().Ref1().Y());
return aRetval;
@@ -1889,7 +1889,7 @@ void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt)
Point aPnt(GetSnapPos(rNoSnapPnt));
Point aStart(DragStat().GetStart());
Point aRef(DragStat().GetRef1());
- Fraction aMaxFact(0x7FFFFFFF,1);
+ boost::rational<long> aMaxFact(0x7FFFFFFF,1);
Rectangle aLR(getSdrDragView().GetWorkArea());
bool bWorkArea=!aLR.IsEmpty();
bool bDragLimit=IsDragLimit();
@@ -1920,7 +1920,7 @@ void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt)
if (aRef.X()>aSR.Left())
{
- Fraction aMax(aRef.X()-aLR.Left(),aRef.X()-aSR.Left());
+ boost::rational<long> aMax(aRef.X()-aLR.Left(),aRef.X()-aSR.Left());
if (aMax<aMaxFact)
aMaxFact=aMax;
@@ -1928,7 +1928,7 @@ void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt)
if (aRef.X()<aSR.Right())
{
- Fraction aMax(aLR.Right()-aRef.X(),aSR.Right()-aRef.X());
+ boost::rational<long> aMax(aLR.Right()-aRef.X(),aSR.Right()-aRef.X());
if (aMax<aMaxFact)
aMaxFact=aMax;
@@ -1936,7 +1936,7 @@ void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt)
if (aRef.Y()>aSR.Top())
{
- Fraction aMax(aRef.Y()-aLR.Top(),aRef.Y()-aSR.Top());
+ boost::rational<long> aMax(aRef.Y()-aLR.Top(),aRef.Y()-aSR.Top());
if (aMax<aMaxFact)
aMaxFact=aMax;
@@ -1944,7 +1944,7 @@ void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt)
if (aRef.Y()<aSR.Bottom())
{
- Fraction aMax(aLR.Bottom()-aRef.Y(),aSR.Bottom()-aRef.Y());
+ boost::rational<long> aMax(aLR.Bottom()-aRef.Y(),aSR.Bottom()-aRef.Y());
if (aMax<aMaxFact)
aMaxFact=aMax;
@@ -1979,7 +1979,7 @@ void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt)
if (bOrtho)
{
- if ((Fraction(nXMul,nXDiv)>Fraction(nYMul,nYDiv)) !=getSdrDragView().IsBigOrtho())
+ if ((boost::rational<long>(nXMul,nXDiv)>boost::rational<long>(nYMul,nYDiv)) !=getSdrDragView().IsBigOrtho())
{
nXMul=nYMul;
nXDiv=nYDiv;
@@ -2027,8 +2027,8 @@ void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt)
}
}
- Fraction aNeuXFact(nXMul,nXDiv);
- Fraction aNeuYFact(nYMul,nYDiv);
+ boost::rational<long> aNeuXFact(nXMul,nXDiv);
+ boost::rational<long> aNeuYFact(nYMul,nYDiv);
if (bOrtho)
{
@@ -2046,10 +2046,10 @@ void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt)
}
if (bXNeg)
- aNeuXFact=Fraction(-aNeuXFact.GetNumerator(),aNeuXFact.GetDenominator());
+ aNeuXFact=boost::rational<long>(-aNeuXFact.numerator(),aNeuXFact.denominator());
if (bYNeg)
- aNeuYFact=Fraction(-aNeuYFact.GetNumerator(),aNeuYFact.GetDenominator());
+ aNeuYFact=boost::rational<long>(-aNeuYFact.numerator(),aNeuYFact.denominator());
if (DragStat().CheckMinMoved(aPnt))
{
@@ -2317,12 +2317,12 @@ basegfx::B2DHomMatrix SdrDragShear::getCurrentTransformation()
{
if (bVertical)
{
- aRetval.scale(aFact, 1.0);
+ aRetval.scale(boost::rational_cast<double>(aFact), 1.0);
aRetval.shearY(-nTan);
}
else
{
- aRetval.scale(1.0, aFact);
+ aRetval.scale(1.0, boost::rational_cast<double>(aFact));
aRetval.shearX(-nTan);
}
}
@@ -2344,7 +2344,7 @@ void SdrDragShear::MoveSdrDrag(const Point& rPnt)
Point aP0(DragStat().GetStart());
Point aPnt(rPnt);
- Fraction aNeuFact(1,1);
+ boost::rational<long> aNeuFact(1,1);
// if angle snapping not activated, snap to raster (except when using slant)
if (nSA==0 && !bSlant)
@@ -2389,11 +2389,11 @@ void SdrDragShear::MoveSdrDrag(const Point& rPnt)
if (bVertical)
{
- aNeuFact=Fraction(aPt2.X()-aRef.X(),aP0.X()-aRef.X());
+ aNeuFact=boost::rational<long>(aPt2.X()-aRef.X(),aP0.X()-aRef.X());
}
else
{
- aNeuFact=Fraction(aPt2.Y()-aRef.Y(),aP0.Y()-aRef.Y());
+ aNeuFact=boost::rational<long>(aPt2.Y()-aRef.Y(),aP0.Y()-aRef.Y());
}
}
}
@@ -2451,11 +2451,11 @@ void SdrDragShear::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
{
if (bVertical)
{
- rTarget.Resize(DragStat().GetRef1(),aFact,Fraction(1,1));
+ rTarget.Resize(DragStat().GetRef1(),aFact,boost::rational<long>(1,1));
}
else
{
- rTarget.Resize(DragStat().GetRef1(),Fraction(1,1),aFact);
+ rTarget.Resize(DragStat().GetRef1(),boost::rational<long>(1,1),aFact);
}
}
@@ -2469,7 +2469,7 @@ bool SdrDragShear::EndSdrDrag(bool bCopy)
{
Hide();
- if (bResize && aFact==Fraction(1,1))
+ if (bResize && aFact==boost::rational<long>(1,1))
bResize=false;
if (nWink!=0 || bResize)
@@ -2489,11 +2489,11 @@ bool SdrDragShear::EndSdrDrag(bool bCopy)
{
if (bVertical)
{
- getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),aFact,Fraction(1,1),bCopy);
+ getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),aFact,boost::rational<long>(1,1),bCopy);
}
else
{
- getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),Fraction(1,1),aFact,bCopy);
+ getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),boost::rational<long>(1,1),aFact,bCopy);
}
bCopy=false;
@@ -3016,7 +3016,7 @@ void SdrDragCrook::_MovAllPoints(basegfx::B2DPolyPolygon& rTarget)
if (bResize)
{
- Fraction aFact1(1,1);
+ boost::rational<long> aFact1(1,1);
if (bVertical)
{
@@ -3108,7 +3108,7 @@ void SdrDragCrook::_MovCrookPoint(Point& rPnt, Point* pC1, Point* pC2)
if (bResize)
{
- Fraction aFact1(1,1);
+ boost::rational<long> aFact1(1,1);
if (bVert)
{
@@ -3184,7 +3184,7 @@ void SdrDragCrook::MoveSdrDrag(const Point& rPnt)
else
bAtCenter=true;
- Fraction aNeuFact(1,1);
+ boost::rational<long> aNeuFact(1,1);
long dx1=aPnt.X()-aNeuCenter.X();
long dy1=aPnt.Y()-aNeuCenter.Y();
bValid=bVertical ? dx1!=0 : dy1!=0;
@@ -3254,7 +3254,7 @@ void SdrDragCrook::MoveSdrDrag(const Point& rPnt)
if (bAtCenter)
nMul*=2;
- aNeuFact=Fraction(nMul,nMarkSize);
+ aNeuFact=boost::rational<long>(nMul,nMarkSize);
nWink=nPntWink;
}
else
@@ -3287,7 +3287,7 @@ void SdrDragCrook::MoveSdrDrag(const Point& rPnt)
nMul = std::abs(nMul);
}
- aNeuFact=Fraction(nMul,nDiv);
+ aNeuFact=boost::rational<long>(nMul,nDiv);
}
if (aNeuCenter!=aCenter || bNeuContortion!=bContortion || aNeuFact!=aFact ||
@@ -3301,7 +3301,7 @@ void SdrDragCrook::MoveSdrDrag(const Point& rPnt)
aCenter=aNeuCenter;
aFact=aNeuFact;
aRad=Point(nNeuRad,nNeuRad);
- bResize=aFact!=Fraction(1,1) && aFact.GetDenominator()!=0 && aFact.IsValid();
+ bResize=aFact!=boost::rational<long>(1,1);
DragStat().NextMove(aPnt);
Show();
}
@@ -3310,14 +3310,14 @@ void SdrDragCrook::MoveSdrDrag(const Point& rPnt)
void SdrDragCrook::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
{
- const bool bDoResize(aFact!=Fraction(1,1));
+ const bool bDoResize(aFact!=boost::rational<long>(1,1));
const bool bDoCrook(aCenter!=aMarkCenter && aRad.X()!=0 && aRad.Y()!=0);
if (bDoCrook || bDoResize)
{
if (bDoResize)
{
- Fraction aFact1(1,1);
+ boost::rational<long> aFact1(1,1);
if (bContortion)
{
@@ -3370,7 +3370,7 @@ bool SdrDragCrook::EndSdrDrag(bool bCopy)
{
Hide();
- if (bResize && aFact==Fraction(1,1))
+ if (bResize && aFact==boost::rational<long>(1,1))
bResize=false;
const bool bUndo = getSdrDragView().IsUndoEnabled();
@@ -3392,7 +3392,7 @@ bool SdrDragCrook::EndSdrDrag(bool bCopy)
if (bResize)
{
- Fraction aFact1(1,1);
+ boost::rational<long> aFact1(1,1);
if (bContortion)
{
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index 500633aa3ca1..d0a34a13cf08 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -212,7 +212,7 @@ void SdrEditView::MoveMarkedObj(const Size& rSiz, bool bCopy)
EndUndo();
}
-void SdrEditView::ResizeMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy)
+void SdrEditView::ResizeMarkedObj(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bCopy)
{
const bool bUndo = IsUndoEnabled();
if( bUndo )
@@ -245,8 +245,8 @@ void SdrEditView::ResizeMarkedObj(const Point& rRef, const Fraction& xFact, cons
EndUndo();
}
void SdrEditView::ResizeMultMarkedObj(const Point& rRef,
- const Fraction& xFact,
- const Fraction& yFact,
+ const boost::rational<long>& xFact,
+ const boost::rational<long>& yFact,
const bool bCopy,
const bool bWdh,
const bool bHgt)
@@ -276,7 +276,7 @@ void SdrEditView::ResizeMultMarkedObj(const Point& rRef,
AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
}
- Fraction aFrac(1,1);
+ boost::rational<long> aFrac(1,1);
if (bWdh && bHgt)
pO->Resize(rRef, xFact, yFact);
else if (bWdh)
@@ -755,12 +755,12 @@ void SdrEditView::SetNotPersistAttrToMarked(const SfxItemSet& rAttr, bool /*bRep
SetMarkedObjRect(aRect);
}
if (rAttr.GetItemState(SDRATTR_RESIZEXALL,true,&pPoolItem)==SfxItemState::SET) {
- Fraction aXFact=((const SdrResizeXAllItem*)pPoolItem)->GetValue();
- ResizeMarkedObj(aAllSnapRect.TopLeft(),aXFact,Fraction(1,1));
+ boost::rational<long> aXFact=((const SdrResizeXAllItem*)pPoolItem)->GetValue();
+ ResizeMarkedObj(aAllSnapRect.TopLeft(),aXFact,boost::rational<long>(1,1));
}
if (rAttr.GetItemState(SDRATTR_RESIZEYALL,true,&pPoolItem)==SfxItemState::SET) {
- Fraction aYFact=((const SdrResizeYAllItem*)pPoolItem)->GetValue();
- ResizeMarkedObj(aAllSnapRect.TopLeft(),Fraction(1,1),aYFact);
+ boost::rational<long> aYFact=((const SdrResizeYAllItem*)pPoolItem)->GetValue();
+ ResizeMarkedObj(aAllSnapRect.TopLeft(),boost::rational<long>(1,1),aYFact);
}
if (rAttr.GetItemState(SDRATTR_ROTATEALL,true,&pPoolItem)==SfxItemState::SET) {
long nAngle=((const SdrRotateAllItem*)pPoolItem)->GetValue();
@@ -1608,8 +1608,8 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr)
// change size and height
if (bChgSiz && (bResizeFreeAllowed || bResizePropAllowed)) {
- Fraction aWdt(nSizX,aRect.Right()-aRect.Left());
- Fraction aHgt(nSizY,aRect.Bottom()-aRect.Top());
+ boost::rational<long> aWdt(nSizX,aRect.Right()-aRect.Left());
+ boost::rational<long> aHgt(nSizY,aRect.Bottom()-aRect.Top());
Point aRef(ImpGetPoint(aRect,eSizePoint));
if(GetSdrPageView())
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index c98757922408..5b6a1f4dfcc0 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -241,18 +241,18 @@ size_t ImpSdrGDIMetaFileImport::DoImport(
mbMov = maOfs.X()!=0 || maOfs.Y()!=0;
mbSize = false;
- maScaleX = Fraction( 1, 1 );
- maScaleY = Fraction( 1, 1 );
+ maScaleX = boost::rational<long>( 1, 1 );
+ maScaleY = boost::rational<long>( 1, 1 );
if(aMtfSize.Width() != (maScaleRect.GetWidth() - 1))
{
- maScaleX = Fraction(maScaleRect.GetWidth() - 1, aMtfSize.Width());
+ maScaleX = boost::rational<long>(maScaleRect.GetWidth() - 1, aMtfSize.Width());
mbSize = true;
}
if(aMtfSize.Height() != (maScaleRect.GetHeight() - 1))
{
- maScaleY = Fraction(maScaleRect.GetHeight() - 1, aMtfSize.Height());
+ maScaleY = boost::rational<long>(maScaleRect.GetHeight() - 1, aMtfSize.Height());
mbSize = true;
}
diff --git a/svx/source/svdraw/svdfmtf.hxx b/svx/source/svdraw/svdfmtf.hxx
index 16e2dddcc5ce..d394e97463b3 100644
--- a/svx/source/svdraw/svdfmtf.hxx
+++ b/svx/source/svdraw/svdfmtf.hxx
@@ -63,8 +63,8 @@ protected:
Point maOfs;
double mfScaleX;
double mfScaleY;
- Fraction maScaleX;
- Fraction maScaleY;
+ boost::rational<long> maScaleX;
+ boost::rational<long> maScaleY;
bool mbFntDirty;
diff --git a/svx/source/svdraw/svdglev.cxx b/svx/source/svdraw/svdglev.cxx
index e6947d92b9f5..279c84631190 100644
--- a/svx/source/svdraw/svdglev.cxx
+++ b/svx/source/svdraw/svdglev.cxx
@@ -378,10 +378,10 @@ void SdrGlueEditView::MoveMarkedGluePoints(const Size& rSiz, bool bCopy)
static void ImpResize(Point& rPt, const void* p1, const void* p2, const void* p3, const void* /*p4*/, const void* /*p5*/)
{
- ResizePoint(rPt,*(const Point*)p1,*(const Fraction*)p2,*(const Fraction*)p3);
+ ResizePoint(rPt,*(const Point*)p1,*(const boost::rational<long>*)p2,*(const boost::rational<long>*)p3);
}
-void SdrGlueEditView::ResizeMarkedGluePoints(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy)
+void SdrGlueEditView::ResizeMarkedGluePoints(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bCopy)
{
ForceUndirtyMrkPnt();
OUString aStr(ImpGetResStr(STR_EditResize));
diff --git a/svx/source/svdraw/svdibrow.cxx b/svx/source/svdraw/svdibrow.cxx
index e8a03aa36850..be76208d988e 100644
--- a/svx/source/svdraw/svdibrow.cxx
+++ b/svx/source/svdraw/svdibrow.cxx
@@ -1217,7 +1217,7 @@ IMPL_LINK(SdrItemBrowser,ChangedHdl,_SdrItemBrowserControl*,pBrowse)
case ITEM_FRACTION: {
if (!bPairX) nLongX=1;
if (!bPairY) nLongY=1;
- ((SdrFractionItem*)pNewItem)->SetValue(Fraction(nLongX,nLongY));
+ ((SdrFractionItem*)pNewItem)->SetValue(boost::rational<long>(nLongX,nLongY));
} break;
case ITEM_XCOLOR: break;
case ITEM_COLOR: break;
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index c197fa7f0dd4..e7171b1c3961 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -113,7 +113,7 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe
aObjUnit=SdrEngineDefaults::GetMapFraction();
eObjUnit=SdrEngineDefaults::GetMapUnit();
eUIUnit=FUNIT_MM;
- aUIScale=Fraction(1,1);
+ aUIScale=boost::rational<long>(1,1);
nUIUnitKomma=0;
bUIOnlyKomma=false;
pLayerAdmin=NULL;
@@ -927,9 +927,9 @@ void SdrModel::SetDefaultTabulator(sal_uInt16 nVal)
void SdrModel::ImpSetUIUnit()
{
- if(0 == aUIScale.GetNumerator() || 0 == aUIScale.GetDenominator())
+ if(0 == aUIScale.numerator())
{
- aUIScale = Fraction(1,1);
+ aUIScale = boost::rational<long>(1,1);
}
// set start values
@@ -1015,17 +1015,17 @@ void SdrModel::ImpSetUIUnit()
// may need to be changed in the future, too
if(1 != nMul || 1 != nDiv)
{
- const Fraction aTemp(static_cast< long >(nMul), static_cast< long >(nDiv));
- nMul = aTemp.GetNumerator();
- nDiv = aTemp.GetDenominator();
+ const boost::rational<long> aTemp(static_cast< long >(nMul), static_cast< long >(nDiv));
+ nMul = aTemp.numerator();
+ nDiv = aTemp.denominator();
}
// #i89872# take Unit of Measurement into account
- if(1 != aUIScale.GetDenominator() || 1 != aUIScale.GetNumerator())
+ if(1 != aUIScale.denominator() || 1 != aUIScale.numerator())
{
// divide by UIScale
- nMul *= aUIScale.GetDenominator();
- nDiv *= aUIScale.GetNumerator();
+ nMul *= aUIScale.denominator();
+ nDiv *= aUIScale.numerator();
}
// shorten trailing zeros for dividend
@@ -1043,12 +1043,12 @@ void SdrModel::ImpSetUIUnit()
}
// end preparations, set member values
- aUIUnitFact = Fraction(sal_Int32(nMul), sal_Int32(nDiv));
+ aUIUnitFact = boost::rational<long>(sal_Int32(nMul), sal_Int32(nDiv));
bUIOnlyKomma = (nMul == nDiv);
TakeUnitStr(eUIUnit, aUIUnitStr);
}
-void SdrModel::SetScaleUnit(MapUnit eMap, const Fraction& rFrac)
+void SdrModel::SetScaleUnit(MapUnit eMap, const boost::rational<long>& rFrac)
{
if (eObjUnit!=eMap || aObjUnit!=rFrac) {
eObjUnit=eMap;
@@ -1073,7 +1073,7 @@ void SdrModel::SetScaleUnit(MapUnit eMap)
}
}
-void SdrModel::SetScaleFraction(const Fraction& rFrac)
+void SdrModel::SetScaleFraction(const boost::rational<long>& rFrac)
{
if (aObjUnit!=rFrac) {
aObjUnit=rFrac;
@@ -1093,7 +1093,7 @@ void SdrModel::SetUIUnit(FieldUnit eUnit)
}
}
-void SdrModel::SetUIScale(const Fraction& rScale)
+void SdrModel::SetUIScale(const boost::rational<long>& rScale)
{
if (aUIScale!=rScale) {
aUIScale=rScale;
@@ -1102,7 +1102,7 @@ void SdrModel::SetUIScale(const Fraction& rScale)
}
}
-void SdrModel::SetUIUnit(FieldUnit eUnit, const Fraction& rScale)
+void SdrModel::SetUIUnit(FieldUnit eUnit, const boost::rational<long>& rScale)
{
if (eUIUnit!=eUnit || aUIScale!=rScale) {
eUIUnit=eUnit;
@@ -1193,7 +1193,7 @@ void SdrModel::TakeMetricStr(long nVal, OUString& rStr, bool bNoUnitChars, sal_I
const bool bNegative(nVal < 0L);
SvtSysLocale aSysLoc;
const LocaleDataWrapper& rLoc(aSysLoc.GetLocaleData());
- double fLocalValue(double(nVal) * double(aUIUnitFact));
+ double fLocalValue(double(nVal) * boost::rational_cast<double>(aUIUnitFact));
if(bNegative)
{
@@ -1333,10 +1333,10 @@ void SdrModel::TakeWinkStr(long nWink, OUString& rStr, bool bNoDegChar) const
rStr = aBuf.makeStringAndClear();
}
-void SdrModel::TakePercentStr(const Fraction& rVal, OUString& rStr, bool bNoPercentChar) const
+void SdrModel::TakePercentStr(const boost::rational<long>& rVal, OUString& rStr, bool bNoPercentChar) const
{
- sal_Int32 nMul(rVal.GetNumerator());
- sal_Int32 nDiv(rVal.GetDenominator());
+ sal_Int32 nMul(rVal.numerator());
+ sal_Int32 nDiv(rVal.denominator());
bool bNeg(nMul < 0);
if(nDiv < 0)
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 687ed35740e4..858772c5ec14 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -1564,15 +1564,15 @@ void SdrObjCustomShape::NbcMove( const Size& rSiz )
mpLastShadowGeometry->NbcMove( rSiz );
}
}
-void SdrObjCustomShape::Resize( const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative )
+void SdrObjCustomShape::Resize( const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bUnsetRelative )
{
SdrTextObj::Resize( rRef, xFact, yFact, bUnsetRelative );
}
-void SdrObjCustomShape::NbcResize( const Point& rRef, const Fraction& rxFact, const Fraction& ryFact )
+void SdrObjCustomShape::NbcResize( const Point& rRef, const boost::rational<long>& rxFact, const boost::rational<long>& ryFact )
{
- Fraction xFact( rxFact );
- Fraction yFact( ryFact );
+ boost::rational<long> xFact( rxFact );
+ boost::rational<long> yFact( ryFact );
// taking care of handles that should not been changed
Rectangle aOld( aRect );
@@ -1580,16 +1580,16 @@ void SdrObjCustomShape::NbcResize( const Point& rRef, const Fraction& rxFact, co
SdrTextObj::NbcResize( rRef, xFact, yFact );
- if ( ( xFact.GetNumerator() != xFact.GetDenominator() )
- || ( yFact.GetNumerator()!= yFact.GetDenominator() ) )
+ if ( ( xFact.numerator() != xFact.denominator() )
+ || ( yFact.numerator()!= yFact.denominator() ) )
{
- if ( ( ( xFact.GetNumerator() < 0 ) && ( xFact.GetDenominator() > 0 ) ) ||
- ( ( xFact.GetNumerator() > 0 ) && ( xFact.GetDenominator() < 0 ) ) )
+ if ( ( ( xFact.numerator() < 0 ) && ( xFact.denominator() > 0 ) ) ||
+ ( ( xFact.numerator() > 0 ) && ( xFact.denominator() < 0 ) ) )
{
SetMirroredX( IsMirroredX() == false );
}
- if ( ( ( yFact.GetNumerator() < 0 ) && ( yFact.GetDenominator() > 0 ) ) ||
- ( ( yFact.GetNumerator() > 0 ) && ( yFact.GetDenominator() < 0 ) ) )
+ if ( ( ( yFact.numerator() < 0 ) && ( yFact.denominator() > 0 ) ) ||
+ ( ( yFact.numerator() > 0 ) && ( yFact.denominator() < 0 ) ) )
{
SetMirroredY( IsMirroredY() == false );
}
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index a7c12191e318..c98acb0570b6 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -1338,12 +1338,12 @@ Rectangle SdrObject::ImpDragCalcRect(const SdrDragStat& rDrag) const
nYMul=std::abs(nYMul);
nXDiv=std::abs(nXDiv);
nYDiv=std::abs(nYDiv);
- Fraction aXFact(nXMul,nXDiv); // fractions for canceling
- Fraction aYFact(nYMul,nYDiv); // and for comparing
- nXMul=aXFact.GetNumerator();
- nYMul=aYFact.GetNumerator();
- nXDiv=aXFact.GetDenominator();
- nYDiv=aYFact.GetDenominator();
+ boost::rational<long> aXFact(nXMul,nXDiv); // fractions for canceling
+ boost::rational<long> aYFact(nYMul,nYDiv); // and for comparing
+ nXMul=aXFact.numerator();
+ nYMul=aYFact.numerator();
+ nXDiv=aXFact.denominator();
+ nYDiv=aYFact.denominator();
if (bEcke) { // corner point handles
bool bUseX=(aXFact<aYFact) != bBigOrtho;
if (bUseX) {
@@ -1495,10 +1495,10 @@ void SdrObject::NbcMove(const Size& rSiz)
SetRectsDirty();
}
-void SdrObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+void SdrObject::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact)
{
- bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
- bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
+ bool bXMirr = xFact.numerator() < 0;
+ bool bYMirr = yFact.numerator() < 0;
if (bXMirr || bYMirr) {
Point aRef1(GetSnapRect().Center());
if (bXMirr) {
@@ -1593,9 +1593,9 @@ void SdrObject::Move(const Size& rSiz)
}
}
-void SdrObject::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative)
+void SdrObject::Resize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bUnsetRelative)
{
- if (xFact.GetNumerator()!=xFact.GetDenominator() || yFact.GetNumerator()!=yFact.GetDenominator()) {
+ if (xFact.numerator()!=xFact.denominator() || yFact.numerator()!=yFact.denominator()) {
if (bUnsetRelative)
{
mnRelativeWidth.reset( );
@@ -2262,15 +2262,15 @@ void SdrObject::NbcApplyNotPersistAttr(const SfxItemSet& rAttr)
if (aNewLogic!=rLogic) {
NbcSetLogicRect(aNewLogic);
}
- Fraction aResizeX(1,1);
- Fraction aResizeY(1,1);
+ boost::rational<long> aResizeX(1,1);
+ boost::rational<long> aResizeY(1,1);
if (rAttr.GetItemState(SDRATTR_RESIZEXONE,true,&pPoolItem)==SfxItemState::SET) {
aResizeX*=((const SdrResizeXOneItem*)pPoolItem)->GetValue();
}
if (rAttr.GetItemState(SDRATTR_RESIZEYONE,true,&pPoolItem)==SfxItemState::SET) {
aResizeY*=((const SdrResizeYOneItem*)pPoolItem)->GetValue();
}
- if (aResizeX!=Fraction(1,1) || aResizeY!=Fraction(1,1)) {
+ if (aResizeX!=boost::rational<long>(1,1) || aResizeY!=boost::rational<long>(1,1)) {
NbcResize(aRef1,aResizeX,aResizeY);
}
}
diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx
index 583222a1cab2..85f7502f9d33 100644
--- a/svx/source/svdraw/svdocapt.cxx
+++ b/svx/source/svdraw/svdocapt.cxx
@@ -608,7 +608,7 @@ void SdrCaptionObj::NbcMove(const Size& rSiz)
SetTailPos(GetFixedTailPos());
}
-void SdrCaptionObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+void SdrCaptionObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact)
{
SdrRectObj::NbcResize(rRef,xFact,yFact);
ResizePoly(aTailPoly,rRef,xFact,yFact);
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index db836dd721e0..81a9c413a95b 100644
--- a/svx/source/svdraw/svdocirc.cxx
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -811,15 +811,15 @@ void SdrCircObj::NbcMove(const Size& aSiz)
SetRectsDirty(true);
}
-void SdrCircObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+void SdrCircObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact)
{
long nWink0=aGeo.nDrehWink;
bool bNoShearRota=(aGeo.nDrehWink==0 && aGeo.nShearWink==0);
SdrTextObj::NbcResize(rRef,xFact,yFact);
bNoShearRota|=(aGeo.nDrehWink==0 && aGeo.nShearWink==0);
if (meCircleKind!=OBJ_CIRC) {
- bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
- bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
+ bool bXMirr = xFact.numerator() < 0;
+ bool bYMirr = yFact.numerator() < 0;
if (bXMirr || bYMirr) {
// At bXMirr!=bYMirr we should actually swap both line ends.
// That, however, is pretty bad (because of forced "hard" formatting).
@@ -1031,7 +1031,7 @@ void SdrCircObj::NbcSetSnapRect(const Rectangle& rRect)
long nHgt0=aSR0.Bottom()-aSR0.Top();
long nWdt1=rRect.Right()-rRect.Left();
long nHgt1=rRect.Bottom()-rRect.Top();
- NbcResize(maSnapRect.TopLeft(),Fraction(nWdt1,nWdt0),Fraction(nHgt1,nHgt0));
+ NbcResize(maSnapRect.TopLeft(),boost::rational<long>(nWdt1,nWdt0),boost::rational<long>(nHgt1,nHgt0));
NbcMove(Size(rRect.Left()-aSR0.Left(),rRect.Top()-aSR0.Top()));
} else {
aRect=rRect;
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index a743cc3ce901..c73a6d167f73 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -2244,8 +2244,8 @@ void SdrEdgeObj::NbcSetSnapRect(const Rectangle& rRect)
long nDivY = aOld.Bottom() - aOld.Top();
if ( nDivX == 0 ) { nMulX = 1; nDivX = 1; }
if ( nDivY == 0 ) { nMulY = 1; nDivY = 1; }
- Fraction aX(nMulX, nDivX);
- Fraction aY(nMulY, nDivY);
+ boost::rational<long> aX(nMulX, nDivX);
+ boost::rational<long> aY(nMulY, nDivY);
NbcResize(aOld.TopLeft(), aX, aY);
NbcMove(Size(rRect.Left() - aOld.Left(), rRect.Top() - aOld.Top()));
}
@@ -2258,7 +2258,7 @@ void SdrEdgeObj::NbcMove(const Size& rSiz)
MoveXPoly(*pEdgeTrack,rSiz);
}
-void SdrEdgeObj::NbcResize(const Point& rRefPnt, const Fraction& aXFact, const Fraction& aYFact)
+void SdrEdgeObj::NbcResize(const Point& rRefPnt, const boost::rational<long>& aXFact, const boost::rational<long>& aYFact)
{
SdrTextObj::NbcResize(rRefPnt,aXFact,aXFact);
ResizeXPoly(*pEdgeTrack,rRefPnt,aXFact,aYFact);
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 8c6a4892435b..b101d0311bff 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -897,12 +897,12 @@ SdrHdl* SdrGrafObj::GetHdl(sal_uInt32 nHdlNum) const
return SdrRectObj::GetHdl( nHdlNum + 1L );
}
-void SdrGrafObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+void SdrGrafObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact)
{
SdrRectObj::NbcResize( rRef, xFact, yFact );
- bool bMirrX = xFact.GetNumerator() < 0;
- bool bMirrY = yFact.GetNumerator() < 0;
+ bool bMirrX = xFact.numerator() < 0;
+ bool bMirrY = yFact.numerator() < 0;
if( bMirrX != bMirrY )
bMirrored = !bMirrored;
diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx
index 87634138df20..dd79cc445854 100644
--- a/svx/source/svdraw/svdogrp.cxx
+++ b/svx/source/svdraw/svdogrp.cxx
@@ -403,8 +403,8 @@ void SdrObjGroup::NbcSetSnapRect(const Rectangle& rRect)
if (nDivX==0) { nMulX=1; nDivX=1; }
if (nDivY==0) { nMulY=1; nDivY=1; }
if (nMulX!=nDivX || nMulY!=nDivY) {
- Fraction aX(nMulX,nDivX);
- Fraction aY(nMulY,nDivY);
+ boost::rational<long> aX(nMulX,nDivX);
+ boost::rational<long> aY(nMulY,nDivY);
NbcResize(aOld.TopLeft(),aX,aY);
}
if (rRect.Left()!=aOld.Left() || rRect.Top()!=aOld.Top()) {
@@ -436,10 +436,10 @@ void SdrObjGroup::NbcMove(const Size& rSiz)
}
-void SdrObjGroup::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+void SdrObjGroup::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact)
{
- bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
- bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
+ bool bXMirr = xFact.numerator() < 0;
+ bool bYMirr = yFact.numerator() < 0;
if (bXMirr || bYMirr) {
Point aRef1(GetSnapRect().Center());
if (bXMirr) {
@@ -538,8 +538,8 @@ void SdrObjGroup::SetSnapRect(const Rectangle& rRect)
if (nDivX==0) { nMulX=1; nDivX=1; }
if (nDivY==0) { nMulY=1; nDivY=1; }
if (nMulX!=nDivX || nMulY!=nDivY) {
- Fraction aX(nMulX,nDivX);
- Fraction aY(nMulY,nDivY);
+ boost::rational<long> aX(nMulX,nDivX);
+ boost::rational<long> aY(nMulY,nDivY);
Resize(aOld.TopLeft(),aX,aY);
}
if (rRect.Left()!=aOld.Left() || rRect.Top()!=aOld.Top()) {
@@ -587,11 +587,11 @@ void SdrObjGroup::Move(const Size& rSiz)
}
-void SdrObjGroup::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative)
+void SdrObjGroup::Resize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bUnsetRelative)
{
- if (xFact.GetNumerator()!=xFact.GetDenominator() || yFact.GetNumerator()!=yFact.GetDenominator()) {
- bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
- bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
+ if (xFact.numerator()!=xFact.denominator() || yFact.numerator()!=yFact.denominator()) {
+ bool bXMirr = xFact.numerator() < 0;
+ bool bYMirr = yFact.numerator() < 0;
if (bXMirr || bYMirr) {
Point aRef1(GetSnapRect().Center());
if (bXMirr) {
diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx
index 007c97350afa..dd3998b21d72 100644
--- a/svx/source/svdraw/svdomeas.cxx
+++ b/svx/source/svdraw/svdomeas.cxx
@@ -80,7 +80,7 @@ SdrMeasureObjGeoData::~SdrMeasureObjGeoData() {}
OUString SdrMeasureObj::TakeRepresentation(SdrMeasureFieldKind eMeasureFieldKind) const
{
OUString aStr;
- Fraction aMeasureScale(1, 1);
+ boost::rational<long> aMeasureScale(1, 1);
bool bTextRota90(false);
bool bShowUnit(false);
FieldUnit eMeasureUnit(FUNIT_NONE);
@@ -105,7 +105,7 @@ OUString SdrMeasureObj::TakeRepresentation(SdrMeasureFieldKind eMeasureFieldKind
eMeasureUnit = eModUIUnit;
sal_Int32 nLen(GetLen(aPt2 - aPt1));
- Fraction aFact(1,1);
+ boost::rational<long> aFact(1,1);
if(eMeasureUnit != eModUIUnit)
{
@@ -113,27 +113,21 @@ OUString SdrMeasureObj::TakeRepresentation(SdrMeasureFieldKind eMeasureFieldKind
aFact *= GetMapFactor(eModUIUnit, eMeasureUnit).X();
}
- if(aMeasureScale.GetNumerator() != aMeasureScale.GetDenominator())
+ if(aMeasureScale.numerator() != aMeasureScale.denominator())
{
aFact *= aMeasureScale;
}
- if(aFact.GetNumerator() != aFact.GetDenominator())
+ if(aFact.numerator() != aFact.denominator())
{
// scale via BigInt, to avoid overruns
- nLen = BigMulDiv(nLen, aFact.GetNumerator(), aFact.GetDenominator());
+ nLen = BigMulDiv(nLen, aFact.numerator(), aFact.denominator());
}
OUString aTmp;
pModel->TakeMetricStr(nLen, aTmp, true, nNumDigits);
aStr = aTmp;
- if(!aFact.IsValid())
- {
- aStr = "";
- aStr += "?";
- }
-
sal_Unicode cDec(SvtSysLocale().GetLocaleData().getNumDecimalSep()[0]);
if(aStr.indexOf(cDec) != -1)
@@ -281,7 +275,7 @@ struct ImpMeasureRec : public SdrDragStatUserData
bool bTextUpsideDown;
long nMeasureOverhang;
FieldUnit eMeasureUnit;
- Fraction aMeasureScale;
+ boost::rational<long> aMeasureScale;
bool bShowUnit;
OUString aFormatString;
bool bTextAutoAngle;
@@ -1035,7 +1029,7 @@ void SdrMeasureObj::NbcMove(const Size& rSiz)
MovePoint(aPt2,rSiz);
}
-void SdrMeasureObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+void SdrMeasureObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact)
{
SdrTextObj::NbcResize(rRef,xFact,yFact);
ResizePoint(aPt1,rRef,xFact,yFact);
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index df431560a8d2..cb9dd89ffc04 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -114,22 +114,22 @@ class SdrLightEmbeddedClient_Impl : public ::cppu::WeakImplHelper5
uno::Reference< awt::XWindow > m_xWindow;
SdrOle2Obj* mpObj;
- Fraction m_aScaleWidth;
- Fraction m_aScaleHeight;
+ boost::rational<long> m_aScaleWidth;
+ boost::rational<long> m_aScaleHeight;
public:
SdrLightEmbeddedClient_Impl( SdrOle2Obj* pObj );
void Release();
- void SetSizeScale( const Fraction& aScaleWidth, const Fraction& aScaleHeight )
+ void SetSizeScale( const boost::rational<long>& aScaleWidth, const boost::rational<long>& aScaleHeight )
{
m_aScaleWidth = aScaleWidth;
m_aScaleHeight = aScaleHeight;
}
- Fraction GetScaleWidth() const { return m_aScaleWidth; }
- Fraction GetScaleHeight() const { return m_aScaleHeight; }
+ boost::rational<long> GetScaleWidth() const { return m_aScaleWidth; }
+ boost::rational<long> GetScaleHeight() const { return m_aScaleHeight; }
void setWindow(const uno::Reference< awt::XWindow >& _xWindow);
@@ -177,8 +177,8 @@ Rectangle SdrLightEmbeddedClient_Impl::impl_getScaledRect_nothrow() const
{
Rectangle aLogicRect( mpObj->GetLogicRect() );
// apply scaling to object area and convert to pixels
- aLogicRect.SetSize( Size( Fraction( aLogicRect.GetWidth() ) * m_aScaleWidth,
- Fraction( aLogicRect.GetHeight() ) * m_aScaleHeight ) );
+ aLogicRect.SetSize( Size( boost::rational_cast<long>(aLogicRect.GetWidth() * m_aScaleWidth),
+ boost::rational_cast<long>(aLogicRect.GetHeight() * m_aScaleHeight) ) );
return aLogicRect;
}
@@ -262,8 +262,8 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::notifyEvent( const document::EventObj
aVisArea.SetSize( Size( aSz.Width, aSz.Height ) );
aVisArea = OutputDevice::LogicToLogic( aVisArea, aObjMapUnit, aContainerMapUnit );
- Size aScaledSize( static_cast< long >( m_aScaleWidth * Fraction( aVisArea.GetWidth() ) ),
- static_cast< long >( m_aScaleHeight * Fraction( aVisArea.GetHeight() ) ) );
+ Size aScaledSize( boost::rational_cast<long>( m_aScaleWidth * aVisArea.GetWidth() ),
+ boost::rational_cast<long>( m_aScaleHeight * aVisArea.GetHeight() ) );
Rectangle aLogicRect( mpObj->GetLogicRect() );
// react to the change if the difference is bigger than one pixel
@@ -548,8 +548,8 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::changedPlacement( const awt::Rectangl
//SfxBooleanFlagGuard aGuard( m_bResizeNoScale, true );
// new size of the object area without scaling
- Size aNewObjSize( Fraction( aNewLogicRect.GetWidth() ) / m_aScaleWidth,
- Fraction( aNewLogicRect.GetHeight() ) / m_aScaleHeight );
+ Size aNewObjSize( boost::rational_cast<long>(aNewLogicRect.GetWidth() / m_aScaleWidth),
+ boost::rational_cast<long>(aNewLogicRect.GetHeight() / m_aScaleHeight) );
// now remove scaling from new placement and keep this a the new object area
aNewLogicRect.SetSize( aNewObjSize );
@@ -1762,8 +1762,8 @@ void SdrOle2Obj::ImpSetVisAreaSize()
|| mpImpl->mxObjRef->getCurrentState() == embed::EmbedStates::INPLACE_ACTIVE
)
{
- Fraction aScaleWidth;
- Fraction aScaleHeight;
+ boost::rational<long> aScaleWidth;
+ boost::rational<long> aScaleHeight;
if ( pClient )
{
aScaleWidth = pClient->GetScaleWidth();
@@ -1781,8 +1781,8 @@ void SdrOle2Obj::ImpSetVisAreaSize()
// objects' visual area. The scaling will not change, but it might exist already and must
// be used in calculations
MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( mpImpl->mxObjRef->getMapUnit( GetAspect() ) );
- Size aVisSize( (long)( Fraction( aRect.GetWidth() ) / aScaleWidth ),
- (long)( Fraction( aRect.GetHeight() ) / aScaleHeight ) );
+ Size aVisSize( boost::rational_cast<long>(aRect.GetWidth() / aScaleWidth),
+ boost::rational_cast<long>(aRect.GetHeight() / aScaleHeight) );
aVisSize = OutputDevice::LogicToLogic( aVisSize, pModel->GetScaleUnit(), aMapUnit);
awt::Size aSz;
@@ -1798,8 +1798,8 @@ void SdrOle2Obj::ImpSetVisAreaSize()
{}
Rectangle aAcceptedVisArea;
- aAcceptedVisArea.SetSize( Size( (long)( Fraction( long( aSz.Width ) ) * aScaleWidth ),
- (long)( Fraction( long( aSz.Height ) ) * aScaleHeight ) ) );
+ aAcceptedVisArea.SetSize( Size( boost::rational_cast<long>(long(aSz.Width) * aScaleWidth),
+ boost::rational_cast<long>(long(aSz.Height) * aScaleHeight) ) );
if (aVisSize != aAcceptedVisArea.GetSize())
{
// server changed VisArea to its liking and the VisArea is different than the suggested one
@@ -1826,8 +1826,8 @@ void SdrOle2Obj::ImpSetVisAreaSize()
{
// The object isn't active and does not want to resize itself so the changed object area size
// will be reflected in a changed object scaling
- Fraction aScaleWidth;
- Fraction aScaleHeight;
+ boost::rational<long> aScaleWidth;
+ boost::rational<long> aScaleHeight;
Size aObjAreaSize;
if ( CalculateNewScaling( aScaleWidth, aScaleHeight, aObjAreaSize ) )
{
@@ -1865,7 +1865,7 @@ void SdrOle2Obj::ImpSetVisAreaSize()
-void SdrOle2Obj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+void SdrOle2Obj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact)
{
if( pModel && !pModel->isLocked() )
{
@@ -2211,7 +2211,7 @@ uno::Reference< frame::XModel > SdrOle2Obj::GetParentXModel() const
}
-bool SdrOle2Obj::CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHeight, Size& aObjAreaSize )
+bool SdrOle2Obj::CalculateNewScaling( boost::rational<long>& aScaleWidth, boost::rational<long>& aScaleHeight, Size& aObjAreaSize )
{
// TODO/LEAN: to avoid rounding errors scaling always uses the VisArea.
// If we don't cache it for own objects also we must load the object here
@@ -2222,8 +2222,8 @@ bool SdrOle2Obj::CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHei
aObjAreaSize = mpImpl->mxObjRef.GetSize( &aMapMode );
Size aSize = aRect.GetSize();
- aScaleWidth = Fraction(aSize.Width(), aObjAreaSize.Width() );
- aScaleHeight = Fraction(aSize.Height(), aObjAreaSize.Height() );
+ aScaleWidth = boost::rational<long>(aSize.Width(), aObjAreaSize.Width() );
+ aScaleHeight = boost::rational<long>(aSize.Height(), aObjAreaSize.Height() );
// reduce to 10 binary digits
Kuerzen(aScaleHeight, 10);
@@ -2243,8 +2243,8 @@ bool SdrOle2Obj::AddOwnLightClient()
if ( mpImpl->mxObjRef.is() && mpImpl->pLightClient )
{
- Fraction aScaleWidth;
- Fraction aScaleHeight;
+ boost::rational<long> aScaleWidth;
+ boost::rational<long> aScaleHeight;
Size aObjAreaSize;
if ( CalculateNewScaling( aScaleWidth, aScaleHeight, aObjAreaSize ) )
{
diff --git a/svx/source/svdraw/svdoopengl.cxx b/svx/source/svdraw/svdoopengl.cxx
index 1b3398359c83..b1e8e8f0e945 100644
--- a/svx/source/svdraw/svdoopengl.cxx
+++ b/svx/source/svdraw/svdoopengl.cxx
@@ -35,7 +35,7 @@ sdr::contact::ViewContact* SdrOpenGLObj::CreateObjectSpecificViewContact()
}
-void SdrOpenGLObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+void SdrOpenGLObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact)
{
SdrObject::NbcResize(rRef, xFact, yFact);
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index 702493ea69c9..7a20ab068ce2 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -2352,11 +2352,11 @@ void SdrPathObj::NbcMove(const Size& rSiz)
SdrTextObj::NbcMove(rSiz);
}
-void SdrPathObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+void SdrPathObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact)
{
basegfx::B2DHomMatrix aTrans(basegfx::tools::createTranslateB2DHomMatrix(-rRef.X(), -rRef.Y()));
aTrans = basegfx::tools::createScaleTranslateB2DHomMatrix(
- double(xFact), double(yFact), rRef.X(), rRef.Y()) * aTrans;
+ boost::rational_cast<double>(xFact), boost::rational_cast<double>(yFact), rRef.X(), rRef.Y()) * aTrans;
maPathPolygon.transform(aTrans);
// #i19871# first modify locally, then call parent (to get correct SnapRect with GluePoints)
@@ -2454,8 +2454,8 @@ void SdrPathObj::NbcSetSnapRect(const Rectangle& rRect)
long nDivY = aOld.Bottom() - aOld.Top();
if ( nDivX == 0 ) { nMulX = 1; nDivX = 1; }
if ( nDivY == 0 ) { nMulY = 1; nDivY = 1; }
- Fraction aX(nMulX,nDivX);
- Fraction aY(nMulY,nDivY);
+ boost::rational<long> aX(nMulX,nDivX);
+ boost::rational<long> aY(nMulY,nDivY);
NbcResize(aOld.TopLeft(), aX, aY);
NbcMove(Size(rRect.Left() - aOld.Left(), rRect.Top() - aOld.Top()));
}
diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx
index 387f57910cde..75385b40e995 100644
--- a/svx/source/svdraw/svdorect.cxx
+++ b/svx/source/svdraw/svdorect.cxx
@@ -494,7 +494,7 @@ void SdrRectObj::NbcMove(const Size& rSiz)
SetXPolyDirty();
}
-void SdrRectObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+void SdrRectObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact)
{
SdrTextObj::NbcResize(rRef,xFact,yFact);
SetXPolyDirty();
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 011418d57844..bdf85d0e5c69 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -871,7 +871,7 @@ OutlinerParaObject* SdrTextObj::GetEditOutlinerParaObject() const
return pPara;
}
-void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextSize, const Size& rShapeSize, Fraction& rFitXKorreg) const
+void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextSize, const Size& rShapeSize, boost::rational<long>& rFitXKorreg) const
{
OutputDevice* pOut = rOutliner.GetRefDevice();
bool bNoStretching(false);
@@ -963,7 +963,7 @@ void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextS
nLoopCount++;
Size aSiz(rOutliner.CalcTextSize());
long nXDiff=aSiz.Width()-nWantWdt;
- rFitXKorreg=Fraction(nWantWdt,aSiz.Width());
+ rFitXKorreg=boost::rational<long>(nWantWdt,aSiz.Width());
if (((nXDiff>=nXTolMi || !bChkX) && nXDiff<=nXTolPl) || nXDiff==nXDiff0) {
bNoMoreLoop = true;
} else {
@@ -1245,7 +1245,7 @@ void SdrTextObj::ImpSetupDrawOutlinerForPaint( bool bContourFrame,
Rectangle& rTextRect,
Rectangle& rAnchorRect,
Rectangle& rPaintRect,
- Fraction& rFitXKorreg ) const
+ boost::rational<long>& rFitXKorreg ) const
{
if (!bContourFrame)
{
@@ -1349,7 +1349,7 @@ void SdrTextObj::UpdateOutlinerFormatting( SdrOutliner& rOutl, Rectangle& rPaint
{
Rectangle aTextRect;
Rectangle aAnchorRect;
- Fraction aFitXKorreg(1,1);
+ boost::rational<long> aFitXKorreg(1,1);
bool bContourFrame=IsContourTextFrame();
@@ -1837,7 +1837,7 @@ GDIMetaFile* SdrTextObj::GetTextScrollMetaFileAndRectangle(
Rectangle aTextRect;
Rectangle aAnchorRect;
Rectangle aPaintRect;
- Fraction aFitXKorreg(1,1);
+ boost::rational<long> aFitXKorreg(1,1);
bool bContourFrame(IsContourTextFrame());
// get outliner set up. To avoid getting a somehow rotated MetaFile,
diff --git a/svx/source/svdraw/svdotxdr.cxx b/svx/source/svdraw/svdotxdr.cxx
index dd00cee48de7..d7d563157c8d 100644
--- a/svx/source/svdraw/svdotxdr.cxx
+++ b/svx/source/svdraw/svdotxdr.cxx
@@ -104,12 +104,12 @@ Rectangle SdrTextObj::ImpDragCalcRect(const SdrDragStat& rDrag) const
nYMul=std::abs(nYMul);
nXDiv=std::abs(nXDiv);
nYDiv=std::abs(nYDiv);
- Fraction aXFact(nXMul,nXDiv); // fractions for canceling
- Fraction aYFact(nYMul,nYDiv); // and for comparing
- nXMul=aXFact.GetNumerator();
- nYMul=aYFact.GetNumerator();
- nXDiv=aXFact.GetDenominator();
- nYDiv=aYFact.GetDenominator();
+ boost::rational<long> aXFact(nXMul,nXDiv); // fractions for canceling
+ boost::rational<long> aYFact(nYMul,nYDiv); // and for comparing
+ nXMul=aXFact.numerator();
+ nYMul=aYFact.numerator();
+ nXDiv=aXFact.denominator();
+ nYDiv=aYFact.denominator();
if (bEcke) { // corner point handles
bool bUseX=(aXFact<aYFact) != bBigOrtho;
if (bUseX) {
diff --git a/svx/source/svdraw/svdotxed.cxx b/svx/source/svdraw/svdotxed.cxx
index 4c7754ed074d..1f5693854f57 100644
--- a/svx/source/svdraw/svdotxed.cxx
+++ b/svx/source/svdraw/svdotxed.cxx
@@ -95,7 +95,7 @@ bool SdrTextObj::BegTextEdit(SdrOutliner& rOutl)
Rectangle aTextRect;
TakeTextRect(rOutl, aTextRect, false,
&aAnchorRect);
- Fraction aFitXKorreg(1,1);
+ boost::rational<long> aFitXKorreg(1,1);
ImpSetCharStretching(rOutl,aTextRect.GetSize(),aAnchorRect.GetSize(),aFitXKorreg);
}
else if (IsAutoFit())
diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx
index e4da47df32eb..b627d591fbed 100644
--- a/svx/source/svdraw/svdotxtr.cxx
+++ b/svx/source/svdraw/svdotxtr.cxx
@@ -48,7 +48,7 @@ void SdrTextObj::NbcSetSnapRect(const Rectangle& rRect)
long nHgt0=aSR0.Bottom()-aSR0.Top();
long nWdt1=rRect.Right()-rRect.Left();
long nHgt1=rRect.Bottom()-rRect.Top();
- SdrTextObj::NbcResize(maSnapRect.TopLeft(),Fraction(nWdt1,nWdt0),Fraction(nHgt1,nHgt0));
+ SdrTextObj::NbcResize(maSnapRect.TopLeft(),boost::rational<long>(nWdt1,nWdt0),boost::rational<long>(nHgt1,nHgt0));
SdrTextObj::NbcMove(Size(rRect.Left()-aSR0.Left(),rRect.Top()-aSR0.Top()));
} else {
long nHDist=GetTextLeftDistance()+GetTextRightDistance();
@@ -118,7 +118,7 @@ void SdrTextObj::NbcMove(const Size& rSiz)
SetRectsDirty(true);
}
-void SdrTextObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+void SdrTextObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact)
{
bool bNoShearMerk=aGeo.nShearWink==0;
bool bRota90Merk=bNoShearMerk && aGeo.nDrehWink % 9000 ==0;
@@ -126,8 +126,8 @@ void SdrTextObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract
long nVDist=GetTextUpperDistance()+GetTextLowerDistance();
long nTWdt0=aRect.GetWidth ()-1-nHDist; if (nTWdt0<0) nTWdt0=0;
long nTHgt0=aRect.GetHeight()-1-nVDist; if (nTHgt0<0) nTHgt0=0;
- bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
- bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
+ bool bXMirr = xFact.numerator() < 0;
+ bool bYMirr = yFact.numerator() < 0;
if (bXMirr || bYMirr) {
Point aRef1(GetSnapRect().Center());
if (bXMirr) {
diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx
index 3c5f21ede3c0..eceb1f3f9844 100644
--- a/svx/source/svdraw/svdouno.cxx
+++ b/svx/source/svdraw/svdouno.cxx
@@ -320,7 +320,7 @@ SdrUnoObj& SdrUnoObj::operator= (const SdrUnoObj& rObj)
return *this;
}
-void SdrUnoObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+void SdrUnoObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact)
{
SdrRectObj::NbcResize(rRef,xFact,yFact);
diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx
index 122e8a59477c..ae99c80b2e5c 100644
--- a/svx/source/svdraw/svdovirt.cxx
+++ b/svx/source/svdraw/svdovirt.cxx
@@ -355,7 +355,7 @@ void SdrVirtObj::NbcMove(const Size& rSiz)
SetRectsDirty();
}
-void SdrVirtObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+void SdrVirtObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact)
{
rRefObj.NbcResize(rRef-aAnchor,xFact,yFact);
SetRectsDirty();
@@ -392,9 +392,9 @@ void SdrVirtObj::Move(const Size& rSiz)
}
}
-void SdrVirtObj::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative)
+void SdrVirtObj::Resize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bUnsetRelative)
{
- if (xFact.GetNumerator()!=xFact.GetDenominator() || yFact.GetNumerator()!=yFact.GetDenominator()) {
+ if (xFact.numerator()!=xFact.denominator() || yFact.numerator()!=yFact.denominator()) {
Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
rRefObj.Resize(rRef-aAnchor,xFact,yFact, bUnsetRelative);
SetRectsDirty();
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index 4eb1b6d1981c..e7a713ec74f5 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -1149,11 +1149,11 @@ void SdrPaintView::MakeVisible(const Rectangle& rRect, vcl::Window& rWin)
{
bNewScale=true;
// set new MapMode (Size+Org) and invalidate everything
- Fraction aXFact(aNewSize.Width(),aActualSize.Width());
- Fraction aYFact(aNewSize.Height(),aActualSize.Height());
+ boost::rational<long> aXFact(aNewSize.Width(),aActualSize.Width());
+ boost::rational<long> aYFact(aNewSize.Height(),aActualSize.Height());
if (aYFact>aXFact) aXFact=aYFact;
aXFact*=aMap.GetScaleX();
- aXFact.ReduceInaccurate(10); // to avoid runovers and BigInt mapping
+ rational_ReduceInaccurate(aXFact, 10); // to avoid runovers and BigInt mapping
aMap.SetScaleX(aXFact);
aMap.SetScaleY(aYFact);
rWin.SetMapMode(aMap);
diff --git a/svx/source/svdraw/svdpoev.cxx b/svx/source/svdraw/svdpoev.cxx
index 2d9394db6b2c..8ee050116a7c 100644
--- a/svx/source/svdraw/svdpoev.cxx
+++ b/svx/source/svdraw/svdpoev.cxx
@@ -672,12 +672,12 @@ void SdrPolyEditView::MoveMarkedPoints(const Size& rSiz)
static void ImpResize(Point& rPt, Point* pC1, Point* pC2, const void* p1, const void* p2, const void* p3, const void* /*p4*/, const void* /*p5*/)
{
- ResizePoint(rPt,*(const Point*)p1,*(const Fraction*)p2,*(const Fraction*)p3);
- if (pC1!=NULL) ResizePoint(*pC1,*(const Point*)p1,*(const Fraction*)p2,*(const Fraction*)p3);
- if (pC2!=NULL) ResizePoint(*pC2,*(const Point*)p1,*(const Fraction*)p2,*(const Fraction*)p3);
+ ResizePoint(rPt,*(const Point*)p1,*(const boost::rational<long>*)p2,*(const boost::rational<long>*)p3);
+ if (pC1!=NULL) ResizePoint(*pC1,*(const Point*)p1,*(const boost::rational<long>*)p2,*(const boost::rational<long>*)p3);
+ if (pC2!=NULL) ResizePoint(*pC2,*(const Point*)p1,*(const boost::rational<long>*)p2,*(const boost::rational<long>*)p3);
}
-void SdrPolyEditView::ResizeMarkedPoints(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+void SdrPolyEditView::ResizeMarkedPoints(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact)
{
ForceUndirtyMrkPnt();
OUString aStr(ImpGetResStr(STR_EditResize));
diff --git a/svx/source/svdraw/svdsnpv.cxx b/svx/source/svdraw/svdsnpv.cxx
index 00a61b109137..c80176c79725 100644
--- a/svx/source/svdraw/svdsnpv.cxx
+++ b/svx/source/svdraw/svdsnpv.cxx
@@ -393,7 +393,7 @@ sal_uInt16 SdrSnapView::SnapPos(Point& rPnt, const SdrPageView* pPV) const
}
if(bGridSnap)
{
- double fSnapWidth = aSnapWdtX;
+ double fSnapWidth = boost::rational_cast<double>(aSnapWdtX);
if(dx == NOT_SNAPPED && fSnapWidth != 0.0)
{
double fx = (double)x;
@@ -408,7 +408,7 @@ sal_uInt16 SdrSnapView::SnapPos(Point& rPnt, const SdrPageView* pPV) const
x = (long)((double)x * fSnapWidth + (double)pPV->GetPageOrigin().X());
dx = 0;
}
- fSnapWidth = aSnapWdtY;
+ fSnapWidth = boost::rational_cast<double>(aSnapWdtY);
if(dy == NOT_SNAPPED && fSnapWidth)
{
double fy = (double)y;
diff --git a/svx/source/svdraw/svdtext.cxx b/svx/source/svdraw/svdtext.cxx
index ed99ae31008f..acd1546b1cad 100644
--- a/svx/source/svdraw/svdtext.cxx
+++ b/svx/source/svdraw/svdtext.cxx
@@ -153,12 +153,12 @@ void SdrText::SetModel( SdrModel* pNewModel )
mpOutlinerParaObject=0;
if (bScaleUnitChanged)
{
- Fraction aMetricFactor=GetMapFactor(aOldUnit,aNewUnit).X();
+ boost::rational<long> aMetricFactor=GetMapFactor(aOldUnit,aNewUnit).X();
if (bSetHgtItem)
{
// Now correct the frame attribute
- nOldFontHgt=BigMulDiv(nOldFontHgt,aMetricFactor.GetNumerator(),aMetricFactor.GetDenominator());
+ nOldFontHgt=BigMulDiv(nOldFontHgt,aMetricFactor.numerator(),aMetricFactor.denominator());
SetObjectItem(SvxFontHeightItem(nOldFontHgt, 100, EE_CHAR_FONTHEIGHT));
}
}
diff --git a/svx/source/svdraw/svdtrans.cxx b/svx/source/svdraw/svdtrans.cxx
index 10ea4007a055..442f3e71d532 100644
--- a/svx/source/svdraw/svdtrans.cxx
+++ b/svx/source/svdraw/svdtrans.cxx
@@ -32,46 +32,20 @@ void MoveXPoly(XPolygon& rPoly, const Size& S)
rPoly.Move(S.Width(),S.Height());
}
-void ResizeRect(Rectangle& rRect, const Point& rRef, const Fraction& rxFact, const Fraction& ryFact, bool bNoJustify)
+void ResizeRect(Rectangle& rRect, const Point& rRef, const boost::rational<long>& rxFact, const boost::rational<long>& ryFact, bool bNoJustify)
{
- Fraction xFact(rxFact);
- Fraction yFact(ryFact);
+ boost::rational<long> xFact(rxFact);
+ boost::rational<long> yFact(ryFact);
- {
- if (xFact.GetDenominator()==0) {
- long nWdt=rRect.Right()-rRect.Left();
- if (xFact.GetNumerator()>=0) { // catch divisions by zero
- xFact=Fraction(xFact.GetNumerator(),1);
- if (nWdt==0) rRect.Right()++;
- } else {
- xFact=Fraction(xFact.GetNumerator(),-1);
- if (nWdt==0) rRect.Left()--;
- }
- }
- rRect.Left() =rRef.X()+Round(((double)(rRect.Left() -rRef.X())*xFact.GetNumerator())/xFact.GetDenominator());
- rRect.Right() =rRef.X()+Round(((double)(rRect.Right() -rRef.X())*xFact.GetNumerator())/xFact.GetDenominator());
- }
- {
- if (yFact.GetDenominator()==0) {
- long nHgt=rRect.Bottom()-rRect.Top();
- if (yFact.GetNumerator()>=0) { // catch divisions by zero
- yFact=Fraction(yFact.GetNumerator(),1);
- if (nHgt==0) rRect.Bottom()++;
- } else {
- yFact=Fraction(yFact.GetNumerator(),-1);
- if (nHgt==0) rRect.Top()--;
- }
-
- yFact=Fraction(yFact.GetNumerator(),1); // catch divisions by zero
- }
- rRect.Top() =rRef.Y()+Round(((double)(rRect.Top() -rRef.Y())*yFact.GetNumerator())/yFact.GetDenominator());
- rRect.Bottom()=rRef.Y()+Round(((double)(rRect.Bottom()-rRef.Y())*yFact.GetNumerator())/yFact.GetDenominator());
- }
+ rRect.Left() =rRef.X()+Round(((double)(rRect.Left() -rRef.X())*xFact.numerator())/xFact.denominator());
+ rRect.Right() =rRef.X()+Round(((double)(rRect.Right() -rRef.X())*xFact.numerator())/xFact.denominator());
+ rRect.Top() =rRef.Y()+Round(((double)(rRect.Top() -rRef.Y())*yFact.numerator())/yFact.denominator());
+ rRect.Bottom()=rRef.Y()+Round(((double)(rRect.Bottom()-rRef.Y())*yFact.numerator())/yFact.denominator());
if (!bNoJustify) rRect.Justify();
}
-void ResizePoly(Polygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+void ResizePoly(Polygon& rPoly, const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact)
{
sal_uInt16 nAnz=rPoly.GetSize();
for (sal_uInt16 i=0; i<nAnz; i++) {
@@ -79,7 +53,7 @@ void ResizePoly(Polygon& rPoly, const Point& rRef, const Fraction& xFact, const
}
}
-void ResizeXPoly(XPolygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+void ResizeXPoly(XPolygon& rPoly, const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact)
{
sal_uInt16 nAnz=rPoly.GetPointCount();
for (sal_uInt16 i=0; i<nAnz; i++) {
@@ -596,10 +570,10 @@ long BigMulDiv(long nVal, long nMul, long nDiv)
return 0x7fffffff;
}
-void Kuerzen(Fraction& rF, unsigned nDigits)
+void Kuerzen(boost::rational<long>& rF, unsigned nDigits)
{
- sal_Int32 nMul=rF.GetNumerator();
- sal_Int32 nDiv=rF.GetDenominator();
+ sal_Int32 nMul=rF.numerator();
+ sal_Int32 nDiv=rF.denominator();
bool bNeg = false;
if (nMul<0) { nMul=-nMul; bNeg=!bNeg; }
if (nDiv<0) { nDiv=-nDiv; bNeg=!bNeg; }
@@ -625,7 +599,7 @@ void Kuerzen(Fraction& rF, unsigned nDigits)
return;
}
if (bNeg) nMul=-nMul;
- rF=Fraction(nMul,nDiv);
+ rF=boost::rational<long>(nMul,nDiv);
}
@@ -661,7 +635,7 @@ FrPair GetInchOrMM(MapUnit eU)
}
default: break;
}
- return Fraction(1,1);
+ return boost::rational<long>(1,1);
}
FrPair GetInchOrMM(FieldUnit eU)
@@ -680,7 +654,7 @@ FrPair GetInchOrMM(FieldUnit eU)
case FUNIT_MILE : return FrPair( 1,63360);
default: break;
}
- return Fraction(1,1);
+ return boost::rational<long>(1,1);
}
// Calculate the factor that we need to convert units from eS to eD.
@@ -694,8 +668,8 @@ FrPair GetMapFactor(MapUnit eS, MapUnit eD)
bool bSInch=IsInch(eS);
bool bDInch=IsInch(eD);
FrPair aRet(aD.X()/aS.X(),aD.Y()/aS.Y());
- if (bSInch && !bDInch) { aRet.X()*=Fraction(127,5); aRet.Y()*=Fraction(127,5); }
- if (!bSInch && bDInch) { aRet.X()*=Fraction(5,127); aRet.Y()*=Fraction(5,127); }
+ if (bSInch && !bDInch) { aRet.X()*=boost::rational<long>(127,5); aRet.Y()*=boost::rational<long>(127,5); }
+ if (!bSInch && bDInch) { aRet.X()*=boost::rational<long>(5,127); aRet.Y()*=boost::rational<long>(5,127); }
return aRet;
};
@@ -707,8 +681,8 @@ FrPair GetMapFactor(FieldUnit eS, FieldUnit eD)
bool bSInch=IsInch(eS);
bool bDInch=IsInch(eD);
FrPair aRet(aD.X()/aS.X(),aD.Y()/aS.Y());
- if (bSInch && !bDInch) { aRet.X()*=Fraction(127,5); aRet.Y()*=Fraction(127,5); }
- if (!bSInch && bDInch) { aRet.X()*=Fraction(5,127); aRet.Y()*=Fraction(5,127); }
+ if (bSInch && !bDInch) { aRet.X()*=boost::rational<long>(127,5); aRet.Y()*=boost::rational<long>(127,5); }
+ if (!bSInch && bDInch) { aRet.X()*=boost::rational<long>(5,127); aRet.Y()*=boost::rational<long>(5,127); }
return aRet;
};
@@ -789,7 +763,7 @@ void GetMeterOrInch(FieldUnit eFU, short& rnKomma, long& rnMul, long& rnDiv, boo
void SdrFormatter::Undirty()
{
- if (aScale.GetNumerator()==0 || aScale.GetDenominator()==0) aScale=Fraction(1,1);
+ if (aScale.numerator()==0) aScale=boost::rational<long>(1,1);
bool bSrcMetr,bSrcInch,bDstMetr,bDstInch;
long nMul1,nDiv1,nMul2,nDiv2;
short nKomma1,nKomma2;
@@ -818,9 +792,9 @@ void SdrFormatter::Undirty()
}
// temporary fraction for canceling
- Fraction aTempFract(nMul1,nDiv1);
- nMul1=aTempFract.GetNumerator();
- nDiv1=aTempFract.GetDenominator();
+ boost::rational<long> aTempFract(nMul1,nDiv1);
+ nMul1=aTempFract.numerator();
+ nDiv1=aTempFract.denominator();
nMul_=nMul1;
nDiv_=nDiv1;
diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx
index 981659fb2bc4..e3a50cd0135e 100644
--- a/svx/source/svdraw/svdview.cxx
+++ b/svx/source/svdraw/svdview.cxx
@@ -478,8 +478,8 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co
// account for FitToSize
bool bFitToSize(pTextObj->IsFitToSize());
if (bFitToSize) {
- Fraction aX(aTextRect.GetWidth()-1,aAnchor.GetWidth()-1);
- Fraction aY(aTextRect.GetHeight()-1,aAnchor.GetHeight()-1);
+ boost::rational<long> aX(aTextRect.GetWidth()-1,aAnchor.GetWidth()-1);
+ boost::rational<long> aY(aTextRect.GetHeight()-1,aAnchor.GetHeight()-1);
ResizePoint(aTemporaryTextRelativePosition,Point(),aX,aY);
}
// account for rotation
diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx
index fc4e732e4851..1b070a17f1f2 100644
--- a/svx/source/svdraw/svdxcgv.cxx
+++ b/svx/source/svdraw/svdxcgv.cxx
@@ -160,7 +160,7 @@ bool SdrExchangeView::Paste(const OUString& rStr, const Point& rPos, SdrObjList*
pObj->FitFrameToTextSize();
Size aSiz(pObj->GetLogicRect().GetSize());
MapUnit eMap=pMod->GetScaleUnit();
- Fraction aMap=pMod->GetScaleFraction();
+ boost::rational<long> aMap=pMod->GetScaleFraction();
ImpPasteObject(pObj,*pLst,aPos,aSiz,MapMode(eMap,Point(0,0),aMap,aMap),nOptions);
return true;
}
@@ -197,7 +197,7 @@ bool SdrExchangeView::Paste(SvStream& rInput, const OUString& rBaseURL, sal_uInt
pObj->FitFrameToTextSize();
Size aSiz(pObj->GetLogicRect().GetSize());
MapUnit eMap=pMod->GetScaleUnit();
- Fraction aMap=pMod->GetScaleFraction();
+ boost::rational<long> aMap=pMod->GetScaleFraction();
ImpPasteObject(pObj,*pLst,aPos,aSiz,MapMode(eMap,Point(0,0),aMap,aMap),nOptions);
// b4967543
@@ -267,7 +267,7 @@ bool SdrExchangeView::Paste(
MapUnit eSrcUnit=pSrcMod->GetScaleUnit();
MapUnit eDstUnit=pMod->GetScaleUnit();
bool bResize=eSrcUnit!=eDstUnit;
- Fraction xResize,yResize;
+ boost::rational<long> xResize,yResize;
Point aPt0;
if (bResize)
{
@@ -403,19 +403,19 @@ void SdrExchangeView::ImpPasteObject(SdrObject* pObj, SdrObjList& rLst, const Po
MapUnit eSrcMU=rMap.GetMapUnit();
MapUnit eDstMU=pMod->GetScaleUnit();
FrPair aMapFact(GetMapFactor(eSrcMU,eDstMU));
- Fraction aDstFr(pMod->GetScaleFraction());
- nSizX*=aMapFact.X().GetNumerator();
- nSizX*=rMap.GetScaleX().GetNumerator();
- nSizX*=aDstFr.GetDenominator();
- nSizX/=aMapFact.X().GetDenominator();
- nSizX/=rMap.GetScaleX().GetDenominator();
- nSizX/=aDstFr.GetNumerator();
- nSizY*=aMapFact.Y().GetNumerator();
- nSizY*=rMap.GetScaleY().GetNumerator();
- nSizX*=aDstFr.GetDenominator();
- nSizY/=aMapFact.Y().GetDenominator();
- nSizY/=rMap.GetScaleY().GetDenominator();
- nSizY/=aDstFr.GetNumerator();
+ boost::rational<long> aDstFr(pMod->GetScaleFraction());
+ nSizX*=aMapFact.X().numerator();
+ nSizX*=rMap.GetScaleX().numerator();
+ nSizX*=aDstFr.denominator();
+ nSizX/=aMapFact.X().denominator();
+ nSizX/=rMap.GetScaleX().denominator();
+ nSizX/=aDstFr.numerator();
+ nSizY*=aMapFact.Y().numerator();
+ nSizY*=rMap.GetScaleY().numerator();
+ nSizX*=aDstFr.denominator();
+ nSizY/=aMapFact.Y().denominator();
+ nSizY/=rMap.GetScaleY().denominator();
+ nSizY/=aDstFr.numerator();
long xs=nSizX;
long ys=nSizY;
Point aPos(rCenter.X()-xs/2,rCenter.Y()-ys/2);
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index 95dd3e673ad3..fb66230a3d00 100644
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -1965,7 +1965,7 @@ void SdrTableObj::NbcMove(const Size& rSiz)
-void SdrTableObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+void SdrTableObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact)
{
Rectangle aOldRect( maLogicRect );
ResizeRect(maLogicRect,rRef,xFact,yFact);
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index 6e9ab225d123..6155adc4913a 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -111,8 +111,8 @@ namespace {
Sequence< PropertyValue > maFilterData;
- Fraction maScaleX;
- Fraction maScaleY;
+ boost::rational<long> maScaleX;
+ boost::rational<long> maScaleY;
ExportSettings( SdrModel* pDoc );
};
@@ -407,7 +407,7 @@ VirtualDevice* GraphicExporter::CreatePageVDev( SdrPage* pPage, sal_uIntPtr nWid
// use scaling?
if( nWidthPixel )
{
- const Fraction aFrac( (long) nWidthPixel, pVDev->LogicToPixel( aPageSize, aMM ).Width() );
+ const boost::rational<long> aFrac( (long) nWidthPixel, pVDev->LogicToPixel( aPageSize, aMM ).Width() );
aMM.SetScaleX( aFrac );
@@ -417,7 +417,7 @@ VirtualDevice* GraphicExporter::CreatePageVDev( SdrPage* pPage, sal_uIntPtr nWid
if( nHeightPixel )
{
- const Fraction aFrac( (long) nHeightPixel, pVDev->LogicToPixel( aPageSize, aMM ).Height() );
+ const boost::rational<long> aFrac( (long) nHeightPixel, pVDev->LogicToPixel( aPageSize, aMM ).Height() );
if( nWidthPixel == 0 )
aMM.SetScaleX( aFrac );
@@ -577,25 +577,25 @@ void GraphicExporter::ParseSettings( const Sequence< PropertyValue >& aDescripto
{
sal_Int32 nVal = 1;
if( pDataValues->Value >>= nVal )
- rSettings.maScaleX = Fraction( nVal, rSettings.maScaleX.GetDenominator() );
+ rSettings.maScaleX = boost::rational<long>( nVal, rSettings.maScaleX.denominator() );
}
else if ( pDataValues->Name == "ScaleXDenominator" )
{
sal_Int32 nVal = 1;
if( pDataValues->Value >>= nVal )
- rSettings.maScaleX = Fraction( rSettings.maScaleX.GetNumerator(), nVal );
+ rSettings.maScaleX = boost::rational<long>( rSettings.maScaleX.numerator(), nVal );
}
else if ( pDataValues->Name == "ScaleYNumerator" )
{
sal_Int32 nVal = 1;
if( pDataValues->Value >>= nVal )
- rSettings.maScaleY = Fraction( nVal, rSettings.maScaleY.GetDenominator() );
+ rSettings.maScaleY = boost::rational<long>( nVal, rSettings.maScaleY.denominator() );
}
else if ( pDataValues->Name == "ScaleYDenominator" )
{
sal_Int32 nVal = 1;
if( pDataValues->Value >>= nVal )
- rSettings.maScaleY = Fraction( rSettings.maScaleY.GetNumerator(), nVal );
+ rSettings.maScaleY = boost::rational<long>( rSettings.maScaleY.numerator(), nVal );
}
pDataValues++;
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 5c283429e435..c3d17a585557 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -1219,8 +1219,8 @@ void SAL_CALL SvxShape::setSize( const awt::Size& rSize )
if(mpObj->GetObjInventor() == SdrInventor && mpObj->GetObjIdentifier() == OBJ_MEASURE )
{
- Fraction aWdt(aLocalSize.Width(),aRect.Right()-aRect.Left());
- Fraction aHgt(aLocalSize.Height(),aRect.Bottom()-aRect.Top());
+ boost::rational<long> aWdt(aLocalSize.Width(),aRect.Right()-aRect.Left());
+ boost::rational<long> aHgt(aLocalSize.Height(),aRect.Bottom()-aRect.Top());
Point aPt = mpObj->GetSnapRect().TopLeft();
mpObj->Resize(aPt,aWdt,aHgt);
}
diff --git a/sw/inc/accmap.hxx b/sw/inc/accmap.hxx
index 29dab399a691..e1a216d7ae3f 100644
--- a/sw/inc/accmap.hxx
+++ b/sw/inc/accmap.hxx
@@ -25,7 +25,7 @@
#include <osl/mutex.hxx>
#include <svx/IAccessibleViewForwarder.hxx>
#include <svx/IAccessibleParent.hxx>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
#include <svx/AccessibleControlShape.hxx>
#include <svx/AccessibleShape.hxx>
@@ -140,7 +140,7 @@ public:
::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessible> GetDocumentPreview(
const std::vector<PreviewPage*>& _rPreviewPages,
- const Fraction& _rScale,
+ const boost::rational<long>& _rScale,
const SwPageFrm* _pSelectedPageFrm,
const Size& _rPreviewWinSize );
@@ -249,7 +249,7 @@ public:
// update preview data (and fire events if necessary)
void UpdatePreview( const std::vector<PreviewPage*>& _rPreviewPages,
- const Fraction& _rScale,
+ const boost::rational<long>& _rScale,
const SwPageFrm* _pSelectedPageFrm,
const Size& _rPreviewWinSize );
diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx
index 9f5ef1fc3c01..270f95ab18c2 100644
--- a/sw/inc/dcontact.hxx
+++ b/sw/inc/dcontact.hxx
@@ -279,12 +279,12 @@ class SwDrawVirtObj : public SdrVirtObj
virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const SAL_OVERRIDE;
virtual SdrHdl* GetPlusHdl(const SdrHdl& rHdl, sal_uInt16 nPlNum) const;
virtual void NbcMove(const Size& rSiz) 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 NbcRotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE;
virtual void NbcMirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE;
virtual void NbcShear(const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE;
virtual void Move(const Size& rSiz) SAL_OVERRIDE;
- virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true) 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 Rotate(const Point& rRef, long nWink, double sn, double cs) SAL_OVERRIDE;
virtual void Mirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE;
virtual void Shear(const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE;
diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx
index 58ab7a802f64..a9a4fc79c6f3 100644
--- a/sw/inc/pagedesc.hxx
+++ b/sw/inc/pagedesc.hxx
@@ -19,7 +19,7 @@
#ifndef INCLUDED_SW_INC_PAGEDESC_HXX
#define INCLUDED_SW_INC_PAGEDESC_HXX
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
#include <tools/color.hxx>
#include "swdllapi.h"
#include <swtypes.hxx>
@@ -46,7 +46,7 @@ class SW_DLLPUBLIC SwPageFtnInfo
sal_uLong nLineWidth; ///< width of separator line
editeng::SvxBorderStyle eLineStyle; ///< Style of the separator line
Color aLineColor; ///< color of the separator line
- Fraction aWidth; ///< percentage width of the separator line.
+ boost::rational<long> aWidth; ///< percentage width of the separator line.
SwFtnAdj eAdj; ///< line adjustment.
SwTwips nTopDist; ///< distance between body and separator.
SwTwips nBottomDist; ///< distance between separator and first footnote
@@ -56,7 +56,7 @@ public:
sal_uLong GetLineWidth() const { return nLineWidth; }
const Color& GetLineColor() const { return aLineColor;}
editeng::SvxBorderStyle GetLineStyle() const { return eLineStyle; }
- const Fraction& GetWidth() const { return aWidth; }
+ const boost::rational<long>& GetWidth() const { return aWidth; }
SwFtnAdj GetAdj() const { return eAdj; }
SwTwips GetTopDist()const { return nTopDist; }
SwTwips GetBottomDist() const { return nBottomDist; }
@@ -65,7 +65,7 @@ public:
void SetLineWidth(sal_uLong nSet ) { nLineWidth = nSet; }
void SetLineStyle( editeng::SvxBorderStyle eSet ) { eLineStyle = eSet; }
void SetLineColor(const Color& rCol ) { aLineColor = rCol;}
- void SetWidth( const Fraction &rNew){ aWidth = rNew; }
+ void SetWidth( const boost::rational<long> &rNew){ aWidth = rNew; }
void SetAdj ( SwFtnAdj eNew ) { eAdj = eNew; }
void SetTopDist ( SwTwips nNew ) { nTopDist = nNew; }
void SetBottomDist( SwTwips nNew ) { nBottomDist = nNew; }
diff --git a/sw/inc/pagepreviewlayout.hxx b/sw/inc/pagepreviewlayout.hxx
index 8c01106fd179..90488a1354f7 100644
--- a/sw/inc/pagepreviewlayout.hxx
+++ b/sw/inc/pagepreviewlayout.hxx
@@ -32,7 +32,7 @@
class SwViewShell;
class SwRootFrm;
class SwPageFrm;
-class Fraction;
+namespace boost { template<typename T> class rational; }
struct PreviewPage;
/** page preview functionality in the writer
@@ -396,8 +396,8 @@ public:
@return Point, start position for new scale
*/
- Point GetPreviewStartPosForNewScale( const Fraction& _aNewScale,
- const Fraction& _aOldScale,
+ Point GetPreviewStartPosForNewScale( const boost::rational<long>& _aNewScale,
+ const boost::rational<long>& _aOldScale,
const Size& _aNewWinSize ) const;
/** determines, if page with given page number is visible in preview
diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx
index f6c74f92bf27..2516af70c6b2 100644
--- a/sw/inc/pch/precompiled_sw.hxx
+++ b/sw/inc/pch/precompiled_sw.hxx
@@ -1024,7 +1024,7 @@
#include <tools/diagnose_ex.h>
#include <tools/errinf.hxx>
#include <tools/fldunit.hxx>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
#include <tools/gen.hxx>
#include <tools/globname.hxx>
#include <tools/helpers.hxx>
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 64a70c94a67e..63661e303225 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;
- Fraction maScale;
+ boost::rational<long> maScale;
const SwPageFrm *mpSelPage;
@@ -630,7 +630,7 @@ public:
void Update( const SwAccessibleMap& rAccMap,
const std::vector<PreviewPage*>& _rPreviewPages,
- const Fraction& _rScale,
+ const boost::rational<long>& _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 Fraction& _rScale,
+ const boost::rational<long>& _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 Fraction& _rScale,
+ const boost::rational<long>& _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 Fraction& _rScale,
+ const boost::rational<long>& _rScale,
const SwPageFrm* _pSelectedPageFrm,
const Size& _rPreviewWinSize )
{
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 1ce8a372c978..f7987da558e6 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/fract.hxx>
+#include <tools/rational.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
- Fraction aTmp( nMyOldH );
- aTmp *= Fraction( nNewHeight, nOldHeight );
- aTmp += Fraction( 1, 2 ); // round up if needed
- nMyNewH = aTmp;
+ 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);
}
SwFrmSize eSize = ATT_MIN_SIZE;
diff --git a/sw/source/core/docnode/ndnotxt.cxx b/sw/source/core/docnode/ndnotxt.cxx
index 7a325c93cc94..6360b359e319 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() / ( (double)aGrfMap.GetScaleX() * aGrfPrefMapModeSize.Width() );
- nGrfDPIy = aGrfPixelSize.Height() / ( (double)aGrfMap.GetScaleY() * aGrfPrefMapModeSize.Height() );
+ nGrfDPIx = aGrfPixelSize.Width() / ( boost::rational_cast<double>(aGrfMap.GetScaleX()) * aGrfPrefMapModeSize.Width() );
+ nGrfDPIy = aGrfPixelSize.Height() / ( boost::rational_cast<double>(aGrfMap.GetScaleY()) * aGrfPrefMapModeSize.Height() );
}
else
{
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index d9c9af706e65..b9f1318f648e 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 Fraction& xFact, const Fraction& yFact)
+void SwDrawVirtObj::NbcResize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& 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 Fraction& xFact, const Fraction& yFact, bool bUnsetRelative)
+void SwDrawVirtObj::Resize(const Point& rRef, const boost::rational<long>& xFact, const boost::rational<long>& yFact, bool bUnsetRelative)
{
- if(xFact.GetNumerator() != xFact.GetDenominator() || yFact.GetNumerator() != yFact.GetDenominator())
+ if(xFact.numerator() != xFact.denominator() || yFact.numerator() != yFact.denominator())
{
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 caad92de8c9d..834bc65fc6e3 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 Fraction& xFact, const Fraction& yFact)
+ const boost::rational<long>& xFact, const boost::rational<long>& yFact)
{
ResizeRect( aOutRect, rRef, xFact, yFact );
@@ -843,7 +843,7 @@ void SwVirtFlyDrawObj::Move(const Size& rSiz)
}
void SwVirtFlyDrawObj::Resize(const Point& rRef,
- const Fraction& xFact, const Fraction& yFact, bool /*bUnsetRelative*/)
+ const boost::rational<long>& xFact, const boost::rational<long>& 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 3669a5902734..0cbcb5e97636 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() );
- Fraction aScaleWidth( aOldObjSize.Width(), aNewSize.Width() );
- Fraction aScaleHeight( aOldObjSize.Height(), aNewSize.Height());
+ boost::rational<long> aScaleWidth( aOldObjSize.Width(), aNewSize.Width() );
+ boost::rational<long> 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 280c6d45b7e1..d4cc181943f6 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;
- Fraction aScaleX( 1, 1 );
- Fraction aScaleY( 1, 1 );
+ boost::rational<long> aScaleX( 1, 1 );
+ boost::rational<long> 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 = Fraction( nGrfSize.Width(), nWidth );
+ aScaleX = boost::rational<long>( nGrfSize.Width(), nWidth );
bScale = true;
}
}
@@ -844,7 +844,7 @@ void SwGrfNode::ScaleImageMap()
if( nGrfSize.Height() != nHeight )
{
- aScaleY = Fraction( nGrfSize.Height(), nHeight );
+ aScaleY = boost::rational<long>( nGrfSize.Height(), nHeight );
bScale = true;
}
}
diff --git a/sw/source/core/inc/dflyobj.hxx b/sw/source/core/inc/dflyobj.hxx
index 058e64c13d8e..79e9f37471d7 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 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 Move (const Size& rSiz) SAL_OVERRIDE;
- virtual void Resize(const Point& rRef, const Fraction& xFact,
- const Fraction& yFact, bool bUnsetRelative = true) SAL_OVERRIDE;
+ virtual void Resize(const Point& rRef, const boost::rational<long>& xFact,
+ const boost::rational<long>& 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 66a652510944..ae86642f8d73 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;
-class Fraction;
+namespace boost { template<typename T> class rational; }
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 Fraction& _rScale,
+ const boost::rational<long>& _rScale,
const SwPageFrm* _pSelectedPageFrm,
const Size& _rPreviewWinSize );
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx
index 628ed1356d5b..58fa20cac362 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -655,13 +655,14 @@ const SwRect SwAnchoredDrawObject::GetObjBoundRect() const
nTargetHeight = aPageRect.GetHeight( ) * GetDrawObj( )->GetRelativeHeight( ).get( );
}
- if ( nTargetWidth != aCurrObjRect.GetWidth( ) || nTargetHeight != aCurrObjRect.GetHeight( ) )
+ if ( (nTargetWidth != aCurrObjRect.GetWidth( ) || nTargetHeight != aCurrObjRect.GetHeight( ))
+ && aCurrObjRect.GetWidth() != 0 && aCurrObjRect.GetHeight() != 0 )
{
SwDoc* pDoc = const_cast<SwDoc*>(GetPageFrm()->GetFmt()->GetDoc());
bool bModified = pDoc->getIDocumentState().IsModified();
const_cast< SdrObject* >( GetDrawObj() )->Resize( aCurrObjRect.TopLeft(),
- Fraction( nTargetWidth, aCurrObjRect.GetWidth() ),
- Fraction( nTargetHeight, aCurrObjRect.GetHeight() ), false );
+ boost::rational<long>( nTargetWidth, aCurrObjRect.GetWidth() ),
+ boost::rational<long>( 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 40131ecd2fe7..9299a2120abd 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -867,8 +867,8 @@ void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
if ( rOld.GetWidth() && rOld.GetHeight() )
{
- Fraction aScaleX( rOld.GetWidth(), rNew.GetWidth() );
- Fraction aScaleY( rOld.GetHeight(), rOld.GetHeight() );
+ boost::rational<long> aScaleX( rOld.GetWidth(), rNew.GetWidth() );
+ boost::rational<long> aScaleY( rOld.GetHeight(), rOld.GetHeight() );
aURL.GetMap()->Scale( aScaleX, aScaleY );
SwFrmFmt *pFmt = GetFmt();
pFmt->LockModify();
@@ -994,8 +994,8 @@ void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
rSz.GetWidth() != Frm().Width() )
{
SwFmtURL aURL( GetFmt()->GetURL() );
- Fraction aScaleX( Frm().Width(), rSz.GetWidth() );
- Fraction aScaleY( Frm().Height(), rSz.GetHeight() );
+ boost::rational<long> aScaleX( Frm().Width(), rSz.GetWidth() );
+ boost::rational<long> 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 be4fc5f80fd3..b2c9f8d0ebea 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 = rMap.GetScaleX();
- aScaleY = rMap.GetScaleY();
+ aScaleX = boost::rational_cast<double>(rMap.GetScaleX());
+ aScaleY = boost::rational_cast<double>(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 Fraction& rFracX = rMapMode.GetScaleX();
- const Fraction& rFracY = rMapMode.GetScaleY();
+ const boost::rational<long>& rFracX = rMapMode.GetScaleX();
+ const boost::rational<long>& rFracY = rMapMode.GetScaleY();
svx::frame::Style aL(rBoxItem.GetLeft());
- aL.SetPatternScale(rFracY);
+ aL.SetPatternScale(boost::rational_cast<double>(rFracY));
svx::frame::Style aR(rBoxItem.GetRight());
- aR.SetPatternScale(rFracY);
+ aR.SetPatternScale(boost::rational_cast<double>(rFracY));
svx::frame::Style aT(rBoxItem.GetTop());
- aT.SetPatternScale(rFracX);
+ aT.SetPatternScale(boost::rational_cast<double>(rFracX));
svx::frame::Style aB(rBoxItem.GetBottom());
- aB.SetPatternScale(rFracX);
+ aB.SetPatternScale(boost::rational_cast<double>(rFracX));
aR.MirrorSelf();
aB.MirrorSelf();
@@ -5576,8 +5576,7 @@ void SwFtnContFrm::PaintLine( const SwRect& rRect,
SWRECTFN( this )
SwTwips nPrtWidth = (Prt().*fnRect->fnGetWidth)();
- Fraction aFract( nPrtWidth, 1 );
- const SwTwips nWidth = (long)(aFract *= rInf.GetWidth());
+ const SwTwips nWidth = boost::rational_cast<long>(long(nPrtWidth) * 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 3784cdaad445..1213a06b0f23 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/fract.hxx>
+#include <tools/rational.hxx>
#include <scriptinfo.hxx>
#include "swrect.hxx"
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 0e88feb0f1ce..f3b648bc2af0 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -467,12 +467,10 @@ 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().IsValid() &&
- pOut->GetMapMode().GetScaleY().IsValid() &&
- pOut->GetMapMode().GetScaleX() == pOut->GetMapMode().GetScaleY() )
+ if( pOut->GetMapMode().GetScaleX() == pOut->GetMapMode().GetScaleY() )
{
- nTmp = ( 100 * pOut->GetMapMode().GetScaleX().GetNumerator() ) /
- pOut->GetMapMode().GetScaleX().GetDenominator();
+ nTmp = ( 100 * pOut->GetMapMode().GetScaleX().numerator() ) /
+ pOut->GetMapMode().GetScaleX().denominator();
}
else
nTmp = 0;
@@ -1133,7 +1131,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
if ( bDirectPrint )
{
- const Fraction aTmp( 1, 1 );
+ const boost::rational<long> 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 3e8004ab1776..4f2307c6e4c7 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 );
- Fraction aXScale( aWinSize.Width(), mnPreviewLayoutWidth );
- Fraction aYScale( aWinSize.Height(), mnPreviewLayoutHeight );
+ boost::rational<long> aXScale( aWinSize.Width(), mnPreviewLayoutWidth );
+ boost::rational<long> aYScale( aWinSize.Height(), mnPreviewLayoutHeight );
if( aXScale < aYScale )
aYScale = aXScale;
{
// adjust scaling for Drawing layer.
- aYScale *= Fraction( 1000, 1 );
- long nNewNuminator = aYScale.operator long();
+ aYScale *= boost::rational<long>( 1000, 1 );
+ long nNewNuminator = boost::rational_cast<long>(aYScale);
if( nNewNuminator < 1 )
nNewNuminator = 1;
- aYScale = Fraction( nNewNuminator, 1000 );
+ aYScale = boost::rational<long>( 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 Fraction& _aNewScale,
- const Fraction& _aOldScale,
+ const boost::rational<long>& _aNewScale,
+ const boost::rational<long>& _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 ed381b74d6a9..68725dbbda18 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 );
- Fraction aSnGrWdtX(rSz.Width(), pNewOpt->GetDivisionX() + 1);
- Fraction aSnGrWdtY(rSz.Height(), pNewOpt->GetDivisionY() + 1);
+ boost::rational<long> aSnGrWdtX(rSz.Width(), pNewOpt->GetDivisionX() + 1);
+ boost::rational<long> 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 Fraction& _rScale,
+ const boost::rational<long>& _rScale,
const SwPageFrm* _pSelectedPageFrm,
const Size& _rPreviewWinSize )
{
diff --git a/sw/source/core/view/viewpg.cxx b/sw/source/core/view/viewpg.cxx
index 601c710b54c1..2e086c4ede71 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() );
{
- Fraction aScX( aPrtSize.Width(), nMaxColSz );
- Fraction aScY( aPrtSize.Height(), nMaxRowSz );
+ boost::rational<long> aScX( aPrtSize.Width(), nMaxColSz );
+ boost::rational<long> aScY( aPrtSize.Height(), nMaxRowSz );
if( aScX < aScY )
aScY = aScX;
{
// Round percentages for Drawings so that these can paint their objects properly
- aScY *= Fraction( 1000, 1 );
- long nTmp = (long)aScY;
+ aScY *= boost::rational<long>( 1000, 1 );
+ long nTmp = boost::rational_cast<long>(aScY);
if( 1 < nTmp )
--nTmp;
else
nTmp = 1;
- aScY = Fraction( nTmp, 1000 );
+ aScY = boost::rational<long>( nTmp, 1000 );
}
aMapMode.SetScaleY( aScY );
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 0731c2b07298..d861c8d51cc8 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.
- Fraction scaleX = Fraction(contextWidth, 96) * Fraction(1440L) / Fraction(tileWidth);
- Fraction scaleY = Fraction(contextHeight, 96) * Fraction(1440L) / Fraction(tileHeight);
+ 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);
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() );
- Fraction aNewFactor( rOpt.GetZoom(), 100 );
+ boost::rational<long> 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 );
- Fraction aSnGrWdtX(rSz.Width(), rOpt.GetDivisionX() + 1);
- Fraction aSnGrWdtY(rSz.Height(), rOpt.GetDivisionY() + 1);
+ boost::rational<long> aSnGrWdtX(rSz.Width(), rOpt.GetDivisionX() + 1);
+ boost::rational<long> 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 231abcdcb7ec..4b38f181d0b8 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 Fraction aNewFactor( mpOpt->GetZoom(), 100 );
+ const boost::rational<long> 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 6a0d313b6316..17e207eed8b5 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;
- Fraction aScaleX(1, 1);
- Fraction aScaleY(1, 1);
+ boost::rational<long> aScaleX(1, 1);
+ boost::rational<long> 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 = Fraction(nWidth, rRealSize.Width());
+ aScaleX = boost::rational<long>(nWidth, rRealSize.Width());
bScale = true;
}
}
@@ -1154,7 +1154,7 @@ OUString lclWriteOutImap(SwHTMLWriter& rHTMLWrt, const SfxItemSet& rItemSet, con
if (rRealSize.Height() != nHeight)
{
- aScaleY = Fraction(nHeight, rRealSize.Height());
+ aScaleY = boost::rational<long>(nHeight, rRealSize.Height());
bScale = true;
}
}
diff --git a/sw/source/filter/writer/wrtswtbl.cxx b/sw/source/filter/writer/wrtswtbl.cxx
index cfa1781afff8..3285e1379636 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/fract.hxx>
+#include <tools/rational.hxx>
#include <wrtswtbl.hxx>
#include <swtable.hxx>
#include <frmfmt.hxx>
@@ -344,8 +344,7 @@ sal_uInt16 SwWriteTable::GetRelWidth( sal_uInt16 nCol, sal_uInt16 nColSpan ) con
{
long nWidth = GetRawWidth( nCol, nColSpan );
- return (sal_uInt16)(long)Fraction( nWidth*256 + GetBaseWidth()/2,
- GetBaseWidth() );
+ return (sal_uInt16) boost::rational_cast<long>(boost::rational<long>(nWidth * 256 + GetBaseWidth() / 2, GetBaseWidth()));
}
sal_uInt16 SwWriteTable::GetPrcWidth( sal_uInt16 nCol, sal_uInt16 nColSpan ) const
@@ -354,8 +353,7 @@ 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)(long)Fraction( nWidth*100 + GetBaseWidth()/2,
- GetBaseWidth() );
+ return (sal_uInt16) boost::rational_cast<long>(boost::rational<long>(nWidth * 100 + GetBaseWidth() / 2, GetBaseWidth()));
}
long SwWriteTable::GetAbsHeight(long nRawHeight, size_t const nRow,
diff --git a/sw/source/filter/ww1/w1filter.cxx b/sw/source/filter/ww1/w1filter.cxx
index 1ee058754799..937b4b260bc6 100644
--- a/sw/source/filter/ww1/w1filter.cxx
+++ b/sw/source/filter/ww1/w1filter.cxx
@@ -1878,8 +1878,8 @@ void Ww1Picture::Out(Ww1Shell& rOut, Ww1Manager& /*rMan*/)
aWMF.SetPrefMapMode(MapMode(MAP_100TH_MM));
Size aOldSiz(aWMF.GetPrefSize());
Size aNewSiz(pPic->mfp.xExtGet(), pPic->mfp.yExtGet());
- 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());
aWMF.Scale(aFracX, aFracY);
aWMF.SetPrefSize(aNewSiz);
pGraphic = new Graphic(aWMF);
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 2529b1a496fc..3b144fdab5b8 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6709,7 +6709,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 = double(rFtnInfo.GetWidth()) > 0;
+ bSeparator = boost::rational_cast<double>(rFtnInfo.GetWidth()) > 0;
}
if (bSeparator)
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index ba6aae0547b1..0d8e1d2c97cb 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 = double(rFtnInfo.GetWidth()) > 0;
+ bool bSeparator = boost::rational_cast<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 0fc558f546b1..aa0362d2191a 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();
- Fraction aMapPolyX(ww::nWrap100Percent, rOrigSize.Width());
- Fraction aMapPolyY(ww::nWrap100Percent, rOrigSize.Height());
- aPoly.Scale(aMapPolyX, aMapPolyY);
+ 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));
/*
a) stretch right bound by 15twips
@@ -678,15 +678,15 @@ namespace sw
See the import for details
*/
const Size &rSize = pNd->GetTwipSize();
- Fraction aMoveHack(ww::nWrap100Percent, rSize.Width());
- aMoveHack *= Fraction(15, 1);
- long nMove(aMoveHack);
+ boost::rational<long> aMoveHack(ww::nWrap100Percent, rSize.Width());
+ aMoveHack *= boost::rational<long>(15, 1);
+ long nMove(boost::rational_cast<long>(aMoveHack));
- Fraction aHackX(ww::nWrap100Percent + nMove,
+ boost::rational<long> aHackX(ww::nWrap100Percent + nMove,
ww::nWrap100Percent);
- Fraction aHackY(ww::nWrap100Percent - nMove,
+ boost::rational<long> aHackY(ww::nWrap100Percent - nMove,
ww::nWrap100Percent);
- aPoly.Scale(aHackX, aHackY);
+ aPoly.Scale(boost::rational_cast<double>(aHackX), boost::rational_cast<double>(aHackY));
aPoly.Move(-nMove, 0);
return aPoly;
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 1c2f3ff8bf32..1c5e838b1d19 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
- Fraction aFact(360, 1);
+ boost::rational<long> aFact(360, 1);
aFact /= GetMapFactor(MAP_100TH_MM, eMap).X();
// create little values
- aFact = Fraction(aFact.GetNumerator(), aFact.GetDenominator());
- mnEmuMul = aFact.GetNumerator();
- mnEmuDiv = aFact.GetDenominator();
+ aFact = boost::rational<long>(aFact.numerator(), aFact.denominator());
+ mnEmuMul = aFact.numerator();
+ mnEmuDiv = aFact.denominator();
SetHellLayerId(rWrt.pDoc->getIDocumentDrawModelAccess().GetHellId());
}
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 56324f571182..02abc6c6f2d1 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
*/
- Fraction aMoveHack(ww::nWrap100Percent, rSize.Width());
- aMoveHack *= Fraction(15, 1);
- long nMove(aMoveHack);
+ boost::rational<long> aMoveHack(ww::nWrap100Percent, rSize.Width());
+ aMoveHack *= boost::rational<long>(15, 1);
+ long nMove(boost::rational_cast<long>(aMoveHack));
aPoly.Move(nMove, 0);
- Fraction aHackX(ww::nWrap100Percent, ww::nWrap100Percent + nMove);
- Fraction aHackY(ww::nWrap100Percent, ww::nWrap100Percent - nMove);
- aPoly.Scale(aHackX, aHackY);
+ 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));
// Turn polygon back into units that match the graphic's
const Size &rOrigSize = pNd->GetGraphic().GetPrefSize();
- Fraction aMapPolyX(rOrigSize.Width(), ww::nWrap100Percent);
- Fraction aMapPolyY(rOrigSize.Height(), ww::nWrap100Percent);
- aPoly.Scale(aMapPolyX, aMapPolyY);
+ 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));
// #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 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;
}
diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx
index e81e2c34d6f4..0c5d52970705 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
- Fraction aTmp( 100, 1 );
+ boost::rational<long> aTmp( 100, 1 );
aTmp *= pFtnInfo->GetWidth();
- m_pLineLengthEdit->SetValue( static_cast<long>(aTmp) );
+ m_pLineLengthEdit->SetValue( boost::rational_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(Fraction( static_cast< long >(m_pLineLengthEdit->GetValue()), 100));
+ rFtnInfo.SetWidth(boost::rational<long>( 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 5daecba4624c..54366223c8d3 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -1909,32 +1909,32 @@ void SwPostItMgr::Rescale()
sal_Int32 SwPostItMgr::GetInitialAnchorDistance() const
{
- const Fraction& f( mpEditWin->GetMapMode().GetScaleY() );
- return POSTIT_INITIAL_ANCHOR_DISTANCE * f.GetNumerator() / f.GetDenominator();
+ const boost::rational<long>& f( mpEditWin->GetMapMode().GetScaleY() );
+ return POSTIT_INITIAL_ANCHOR_DISTANCE * f.numerator() / f.denominator();
}
sal_Int32 SwPostItMgr::GetSpaceBetween() const
{
- const Fraction& f( mpEditWin->GetMapMode().GetScaleY() );
- return ( POSTIT_SPACE_BETWEEN ) * f.GetNumerator() / f.GetDenominator();
+ const boost::rational<long>& f( mpEditWin->GetMapMode().GetScaleY() );
+ return ( POSTIT_SPACE_BETWEEN ) * f.numerator() / f.denominator();
}
sal_Int32 SwPostItMgr::GetScrollSize() const
{
- const Fraction& f( mpEditWin->GetMapMode().GetScaleY() );
- return ( POSTIT_SPACE_BETWEEN + POSTIT_MINIMUMSIZE_WITH_META ) * f.GetNumerator() / f.GetDenominator();
+ const boost::rational<long>& f( mpEditWin->GetMapMode().GetScaleY() );
+ return ( POSTIT_SPACE_BETWEEN + POSTIT_MINIMUMSIZE_WITH_META ) * f.numerator() / f.denominator();
}
sal_Int32 SwPostItMgr::GetMinimumSizeWithMeta() const
{
- const Fraction& f( mpEditWin->GetMapMode().GetScaleY() );
- return POSTIT_MINIMUMSIZE_WITH_META * f.GetNumerator() / f.GetDenominator();
+ const boost::rational<long>& f( mpEditWin->GetMapMode().GetScaleY() );
+ return POSTIT_MINIMUMSIZE_WITH_META * f.numerator() / f.denominator();
}
sal_Int32 SwPostItMgr::GetSidebarScrollerHeight() const
{
- const Fraction& f( mpEditWin->GetMapMode().GetScaleY() );
- return POSTIT_SCROLL_SIDEBAR_HEIGHT * f.GetNumerator() / f.GetDenominator();
+ const boost::rational<long>& f( mpEditWin->GetMapMode().GetScaleY() );
+ return POSTIT_SCROLL_SIDEBAR_HEIGHT * f.numerator() / f.denominator();
}
void SwPostItMgr::SetSpellChecking()
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index d3c1b0be7936..ba4c47437f42 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().GetNumerator() / aMode.GetScaleY().GetDenominator();
+ nHeight = nHeight * aMode.GetScaleY().numerator() / aMode.GetScaleY().denominator();
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().GetNumerator() / aMode.GetScaleY().GetDenominator();
+ nHeight = nHeight * aMode.GetScaleY().numerator() / aMode.GetScaleY().denominator();
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 Fraction& fx( GetMapMode().GetScaleX() );
- const Fraction& fy( GetMapMode().GetScaleY() );
+ const boost::rational<long>& fx( GetMapMode().GetScaleX() );
+ const boost::rational<long>& 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.GetNumerator()/fx.GetDenominator(),
- aPos.Y()+5*fy.GetNumerator()/fy.GetDenominator() ),
- Size( METABUTTON_WIDTH*4*fx.GetNumerator()/fx.GetDenominator(),
- METABUTTON_HEIGHT*fy.GetNumerator()/fy.GetDenominator() ) ) );
+ 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() ) ) );
}
else
{
aRectMetaButton = PixelToLogic(
- 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() ) ) );
+ 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() ) ) );
}
{
@@ -1208,17 +1208,17 @@ sal_Int32 SwSidebarWin::GetScrollbarWidth()
sal_Int32 SwSidebarWin::GetMetaButtonAreaWidth()
{
- const Fraction& f( GetMapMode().GetScaleX() );
+ const boost::rational<long>& f( GetMapMode().GetScaleX() );
if (IsPreview())
- return 3 * METABUTTON_AREA_WIDTH * f.GetNumerator() / f.GetDenominator();
+ return 3 * METABUTTON_AREA_WIDTH * f.numerator() / f.denominator();
else
- return METABUTTON_AREA_WIDTH * f.GetNumerator() / f.GetDenominator();
+ return METABUTTON_AREA_WIDTH * f.numerator() / f.denominator();
}
sal_Int32 SwSidebarWin::GetMetaHeight()
{
- const Fraction& f( GetMapMode().GetScaleY() );
- return POSTIT_META_HEIGHT * f.GetNumerator() / f.GetDenominator();
+ const boost::rational<long>& f( GetMapMode().GetScaleY() );
+ return POSTIT_META_HEIGHT * f.numerator() / f.denominator();
}
sal_Int32 SwSidebarWin::GetMinimumSizeWithMeta()
@@ -1228,8 +1228,8 @@ sal_Int32 SwSidebarWin::GetMinimumSizeWithMeta()
sal_Int32 SwSidebarWin::GetMinimumSizeWithoutMeta()
{
- const Fraction& f( GetMapMode().GetScaleY() );
- return POSTIT_MINIMUMSIZE_WITHOUT_META * f.GetNumerator() / f.GetDenominator();
+ const boost::rational<long>& f( GetMapMode().GetScaleY() );
+ return POSTIT_MINIMUMSIZE_WITHOUT_META * f.numerator() / f.denominator();
}
void SwSidebarWin::SetSpellChecking()
diff --git a/sw/source/uibase/frmdlg/colex.cxx b/sw/source/uibase/frmdlg/colex.cxx
index d11992e6ff82..2bdec9a95915 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();
- Fraction aScale( m_aWinSize.Height(), nHeight );
+ boost::rational<long> 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 162ef375eb3a..96eb7760ef9d 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;
- Fraction maScale;
+ boost::rational<long> maScale;
SwPagePreview& mrView;
bool mbCalcScaleForPreviewLayout;
Rectangle maPaintedPreviewDocRect;
diff --git a/sw/source/uibase/inc/view.hxx b/sw/source/uibase/inc/view.hxx
index e624560e071f..64040606ccf7 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 Fraction &rX, const Fraction & ) SAL_OVERRIDE;
+ virtual void SetZoomFactor( const boost::rational<long> &rX, const boost::rational<long> & ) 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 a3980162cfbb..1f7c255acb94 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.
- Fraction aNewScale( _nZoomFactor, 100 );
+ boost::rational<long> 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 71b57499ddb2..900bab9db0e7 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( Fraction( aLogRect.GetWidth() ) / GetScaleWidth(),
- Fraction( aLogRect.GetHeight() ) / GetScaleHeight() );
+ Size aNewObjSize( boost::rational_cast<long>(aLogRect.GetWidth() / GetScaleWidth()),
+ boost::rational_cast<long>(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() = Fraction( aVisSize.Width() ) * GetScaleWidth();
- aVisSize.Height()= Fraction( aVisSize.Height() ) * GetScaleHeight();
+ aVisSize.Width() = boost::rational_cast<long>(aVisSize.Width() * GetScaleWidth());
+ aVisSize.Height()= boost::rational_cast<long>(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 993b26bed8d7..1b93bc50cae4 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
- Fraction aZoomFract( aUsrPref.GetZoom(), 100 );
+ boost::rational<long> 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 bd16c2680e54..2082a43a5b41 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 Fraction aFrac( nFac, 100 );
+ const boost::rational<long> 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 742afb0b1172..90903289afb5 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( Fraction( aSize.Width(), aObjSizePixel.Width() ),
- Fraction( aSize.Height(), aObjSizePixel.Height() ) );
+ SfxViewShell::SetZoomFactor( boost::rational<long>( aSize.Width(), aObjSizePixel.Width() ),
+ boost::rational<long>( aSize.Height(), aObjSizePixel.Height() ) );
}
m_bInInnerResizePixel = true;
@@ -985,12 +985,10 @@ void SwView::InnerResizePixel( const Point &rOfst, const Size &rSize )
if( m_pHRuler->IsVisible() || m_pVRuler->IsVisible() )
{
- const Fraction& rFrac = GetEditWin().GetMapMode().GetScaleX();
- long nZoom = 100;
- if (rFrac.IsValid())
- nZoom = rFrac.GetNumerator() * 100L / rFrac.GetDenominator();
+ const boost::rational<long>& rFrac = GetEditWin().GetMapMode().GetScaleX();
+ long nZoom = rFrac.numerator() * 100L / rFrac.denominator();
- const Fraction aFrac( nZoom, 100 );
+ const boost::rational<long> aFrac( nZoom, 100 );
m_pVRuler->SetZoom( aFrac );
m_pHRuler->SetZoom( aFrac );
InvalidateRulerPos(); // Invalidate content.
@@ -1136,10 +1134,10 @@ void SwView::OuterResizePixel( const Point &rOfst, const Size &rSize )
}
}
-void SwView::SetZoomFactor( const Fraction &rX, const Fraction &rY )
+void SwView::SetZoomFactor( const boost::rational<long>& rX, const boost::rational<long>& rY )
{
- const Fraction &rFrac = rX < rY ? rX : rY;
- SetZoom( SVX_ZOOM_PERCENT, (short) long(rFrac * Fraction( 100, 1 )) );
+ const boost::rational<long>&rFrac = rX < rY ? rX : rY;
+ SetZoom( SVX_ZOOM_PERCENT, (short) boost::rational_cast<long>(rFrac * 100) );
// 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 2bd0c8b911b6..a15c23091ceb 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 :
{
- Fraction aTmp( 100, 1 );
+ boost::rational<long> aTmp( 100, 1 );
aTmp *= aFtnInfo.GetWidth();
- rVal <<= (sal_Int8)(long)aTmp;
+ rVal <<= (sal_Int8)boost::rational_cast<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(Fraction(nSet, 100));
+ aFtnInfo.SetWidth(boost::rational<long>(nSet, 100));
}
break;
case MID_LINE_ADJUST :
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index e7f78d121334..3a7ddf2860cf 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 );
- Fraction aScaleWidth( 1, 1 );
- Fraction aScaleHeight( 1, 1 );
+ boost::rational<long> aScaleWidth( 1, 1 );
+ boost::rational<long> aScaleHeight( 1, 1 );
bool bUseObjectSize = false;
@@ -777,8 +777,8 @@ void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
}
else
{
- aScaleWidth = Fraction( aObjArea.Width(), _aVisArea.Width() );
- aScaleHeight = Fraction( aObjArea.Height(), _aVisArea.Height());
+ aScaleWidth = boost::rational<long>( aObjArea.Width(), _aVisArea.Width() );
+ aScaleHeight = boost::rational<long>( aObjArea.Height(), _aVisArea.Height());
}
}
}
@@ -815,8 +815,8 @@ void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
}
else
{
- aArea.Width ( Fraction( aArea.Width() ) / pCli->GetScaleWidth() );
- aArea.Height( Fraction( aArea.Height() ) / pCli->GetScaleHeight());
+ aArea.Width ( boost::rational_cast<long>(aArea.Width() / pCli->GetScaleWidth()) );
+ aArea.Height( boost::rational_cast<long>(aArea.Height() / pCli->GetScaleHeight()) );
}
pCli->SetObjAreaAndScale( aArea.SVRect(), aScaleWidth, aScaleHeight );
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 94fe04a65af4..d892b9bdb81f 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -744,10 +744,10 @@ void SAL_CALL VCLXToolkit::disposing()
if ( addressOfMemoryBufferForSharedArrayWrapper != 0 ) {
#if defined(ANDROID)
ByteBufferWrapper *bbw = (ByteBufferWrapper *) (intptr_t) addressOfMemoryBufferForSharedArrayWrapper;
- pV->SetOutputSizePixelScaleOffsetAndBuffer( Size( Width, Height ), Fraction(ScaleNumerator, ScaleDenominator), Point( XOffset, YOffset), basebmp::RawMemorySharedArray( bbw->pointer(), *bbw ));
+ pV->SetOutputSizePixelScaleOffsetAndBuffer( Size( Width, Height ), boost::rational<long>(ScaleNumerator, ScaleDenominator), Point( XOffset, YOffset), basebmp::RawMemorySharedArray( bbw->pointer(), *bbw ));
#else
pV->SetOutputSizePixelScaleOffsetAndBuffer( Size( Width, Height ),
- Fraction(ScaleNumerator, ScaleDenominator), Point( XOffset, YOffset),
+ boost::rational<long>(ScaleNumerator, ScaleDenominator), Point( XOffset, YOffset),
basebmp::RawMemorySharedArray( reinterpret_cast<sal_uInt8*>( addressOfMemoryBufferForSharedArrayWrapper )));
#endif
} else {
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index f3376e74888f..8971e360f979 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -2330,7 +2330,7 @@ void VCLXWindow::setZoom( float fZoomX, float /*fZoomY*/ ) throw(::com::sun::sta
// 1.200000000047something. To prevent this, we convert explicitly to double, and round it.
double nZoom( fZoomX );
nZoom = ::rtl::math::round( nZoom, 4 );
- GetWindow()->SetZoom( Fraction( nZoom ) );
+ GetWindow()->SetZoom( rational_FromDouble( nZoom ) );
}
}
diff --git a/tools/CppunitTest_tools_test.mk b/tools/CppunitTest_tools_test.mk
index 48324de54c3c..e5fda5fc92b8 100644
--- a/tools/CppunitTest_tools_test.mk
+++ b/