Fraction->double in sc
Change-Id: I04f49ebe0b594e92631f42069cc2403b5c643317 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202738 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -67,7 +67,6 @@ class Sparkline;
|
||||
|
||||
}
|
||||
|
||||
class Fraction;
|
||||
class OutputDevice;
|
||||
class ScItemPoolCache;
|
||||
class SvtListener;
|
||||
|
||||
@@ -117,8 +117,6 @@ class SparklineList;
|
||||
class SheetViewManager;
|
||||
}
|
||||
|
||||
class Fraction;
|
||||
|
||||
class OutputDevice;
|
||||
class SdrObject;
|
||||
class SfxBroadcaster;
|
||||
|
||||
@@ -36,7 +36,6 @@ namespace vcl { class Font; }
|
||||
namespace model { class ComplexColor; }
|
||||
struct ScInterpreterContext;
|
||||
class OutputDevice;
|
||||
class Fraction;
|
||||
class ScStyleSheet;
|
||||
class SvNumberFormatter;
|
||||
class ScDocument;
|
||||
|
||||
@@ -3545,8 +3545,8 @@ void ScXMLExport::WriteShapes(const ScDocument& rDoc, const ScMyCell& rMyCell)
|
||||
// ObjData. We remember the transformations and restore them later.
|
||||
Point aMoveBy(0, 0);
|
||||
bool bNeedsRestorePosition = false;
|
||||
Fraction aScaleWidth(1, 1);
|
||||
Fraction aScaleHeight(1, 1);
|
||||
double fScaleWidth = 1.0;
|
||||
double fScaleHeight = 1.0;
|
||||
bool bNeedsRestoreSize = false;
|
||||
|
||||
// Determine top point of fictive snap rectangle ('Full' rectangle).
|
||||
@@ -3599,15 +3599,17 @@ void ScXMLExport::WriteShapes(const ScDocument& rDoc, const ScMyCell& rMyCell)
|
||||
if (aFullSnapRect != aActualSnapRect)
|
||||
{
|
||||
bNeedsRestoreSize = true;
|
||||
aScaleWidth
|
||||
= Fraction(aFullSnapRect.getOpenWidth(), aActualSnapRect.getOpenWidth());
|
||||
if (!aScaleWidth.IsValid())
|
||||
aScaleWidth = Fraction(1, 1);
|
||||
aScaleHeight
|
||||
= Fraction(aFullSnapRect.getOpenHeight(), aActualSnapRect.getOpenHeight());
|
||||
if (!aScaleHeight.IsValid())
|
||||
aScaleHeight = Fraction(1, 1);
|
||||
pObj->NbcResize(aFullTopPoint, double(aScaleWidth), double(aScaleHeight));
|
||||
if (aActualSnapRect.getOpenWidth() == 0)
|
||||
fScaleWidth = 1;
|
||||
else
|
||||
fScaleWidth
|
||||
= double(aFullSnapRect.getOpenWidth()) / aActualSnapRect.getOpenWidth();
|
||||
if (aActualSnapRect.getOpenHeight() == 0)
|
||||
fScaleHeight = 1;
|
||||
else
|
||||
fScaleHeight
|
||||
= double(aFullSnapRect.getOpenHeight()) / aActualSnapRect.getOpenHeight();
|
||||
pObj->NbcResize(aFullTopPoint, fScaleWidth, fScaleHeight);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3654,13 +3656,9 @@ void ScXMLExport::WriteShapes(const ScDocument& rDoc, const ScMyCell& rMyCell)
|
||||
|
||||
if (bNeedsRestoreSize)
|
||||
{
|
||||
Fraction aScaleWidthInvers(aScaleWidth.GetDenominator(), aScaleWidth.GetNumerator());
|
||||
if (!aScaleWidthInvers.IsValid())
|
||||
aScaleWidthInvers = Fraction(1, 1);
|
||||
Fraction aScaleHeightInvers(aScaleHeight.GetDenominator(), aScaleHeight.GetNumerator());
|
||||
if (!aScaleHeightInvers.IsValid())
|
||||
aScaleHeightInvers = Fraction(1, 1);
|
||||
pObj->NbcResize(aFullTopPoint, double(aScaleWidthInvers), double(aScaleHeightInvers));
|
||||
double fScaleWidthInvers = 1.0 / fScaleWidth;
|
||||
double fScaleHeightInvers = 1.0 / fScaleHeight;
|
||||
pObj->NbcResize(aFullTopPoint, fScaleWidthInvers, fScaleHeightInvers);
|
||||
}
|
||||
if (bNeedsRestorePosition)
|
||||
{
|
||||
|
||||
@@ -2378,25 +2378,25 @@ static void lcl_PDFExportBookmarkHelper(OutputDevice* pDev, ScDocument& rDoc,
|
||||
// to get the target rectangle in pixels.
|
||||
assert(aLocationPixel.GetWidth() != 0 && aLocationPixel.GetHeight() != 0);
|
||||
|
||||
Fraction aScaleX(aLocationPixel.GetWidth(), aLocationMM.GetWidth());
|
||||
Fraction aScaleY(aLocationPixel.GetHeight(), aLocationMM.GetHeight());
|
||||
double fScaleX = double(aLocationPixel.GetWidth()) / aLocationMM.GetWidth();
|
||||
double fScaleY = double(aLocationPixel.GetHeight()) / aLocationMM.GetHeight();
|
||||
|
||||
tools::Long nX1
|
||||
= aLocationPixel.Left()
|
||||
+ static_cast<tools::Long>(
|
||||
Fraction(aTargetRect.Left() - aLocationMM.Left(), 1) * aScaleX);
|
||||
(aTargetRect.Left() - aLocationMM.Left()) * fScaleX);
|
||||
tools::Long nX2
|
||||
= aLocationPixel.Left()
|
||||
+ static_cast<tools::Long>(
|
||||
Fraction(aTargetRect.Right() - aLocationMM.Left(), 1) * aScaleX);
|
||||
(aTargetRect.Right() - aLocationMM.Left()) * fScaleX);
|
||||
tools::Long nY1
|
||||
= aLocationPixel.Top()
|
||||
+ static_cast<tools::Long>(
|
||||
Fraction(aTargetRect.Top() - aLocationMM.Top(), 1) * aScaleY);
|
||||
(aTargetRect.Top() - aLocationMM.Top()) * fScaleY);
|
||||
tools::Long nY2
|
||||
= aLocationPixel.Top()
|
||||
+ static_cast<tools::Long>(
|
||||
Fraction(aTargetRect.Bottom() - aLocationMM.Top(), 1) * aScaleY);
|
||||
(aTargetRect.Bottom() - aLocationMM.Top()) * fScaleY);
|
||||
|
||||
if (nX1 > aLocationPixel.Right())
|
||||
nX1 = aLocationPixel.Right();
|
||||
|
||||
@@ -1345,7 +1345,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 = static_cast<double>(Fraction(nZoom,100));
|
||||
double fZoomFactor = nZoom / 100.0;
|
||||
fScaleX *= fZoomFactor;
|
||||
fScaleY *= fZoomFactor;
|
||||
|
||||
|
||||
@@ -3737,8 +3737,8 @@ void ScViewData::WriteExtOptions( ScExtDocOptions& rDocOpt ) const
|
||||
|
||||
// view mode and zoom
|
||||
rTabSett.mbPageMode = bPagebreak;
|
||||
rTabSett.mnNormalZoom = static_cast< tools::Long >( pViewTab->fZoomY * Fraction( 100.0 ) );
|
||||
rTabSett.mnPageZoom = static_cast< tools::Long >( pViewTab->fPageZoomY * Fraction( 100.0 ) );
|
||||
rTabSett.mnNormalZoom = static_cast< tools::Long >( pViewTab->fZoomY * 100.0 );
|
||||
rTabSett.mnPageZoom = static_cast< tools::Long >( pViewTab->fPageZoomY * 100.0 );
|
||||
rTabSett.moExportZoom = GetExportZoom();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user