summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2014-10-23 17:22:06 +0200
committerJan Holesovsky <kendy@collabora.com>2014-10-23 18:34:34 +0200
commit858c2a2977d5e4671959724ecd2a453837dadddf (patch)
treea61e303e6e27cef015c50b38b23fc574ce64fcef /starmath
parentff502f409fd73249a6a94c579d19905144aa5ba8 (diff)
Fraction: Revert "fdo#84854 it seems long is not enough on 32 bit"
This reverts commit 582ef22d3e8e30ffd58f092d37ffda30bd07bd9e. Conflicts: svx/source/svdraw/svdedtv1.cxx svx/source/svdraw/svdibrow.cxx sw/source/filter/ww1/w1filter.cxx Change-Id: I80abc7abdeddc267eaabc9f8ab49611bb3f8ae83
Diffstat (limited to 'starmath')
-rw-r--r--starmath/inc/node.hxx12
-rw-r--r--starmath/inc/utility.hxx18
-rw-r--r--starmath/inc/view.hxx2
-rw-r--r--starmath/source/ElementsDockingWindow.cxx2
-rw-r--r--starmath/source/mathmlexport.cxx4
-rw-r--r--starmath/source/node.cxx30
-rw-r--r--starmath/source/parse.cxx4
-rw-r--r--starmath/source/utility.cxx2
-rw-r--r--starmath/source/view.cxx24
9 files changed, 49 insertions, 49 deletions
diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index 10bd3eb9c22a..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 boost::rational<sal_Int64> &rRelSize, sal_uInt16 nType);
- void SetSize(const boost::rational<sal_Int64> &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;
- boost::rational<sal_Int64> aFontSize;
+ boost::rational<long> aFontSize;
public:
SmFontNode(const SmToken &rNodeToken)
: SmStructureNode(NFONT, rNodeToken)
{
nSizeType = FNTSIZ_MULTIPLY;
- aFontSize = boost::rational<sal_Int64>(1L);
+ aFontSize = boost::rational<long>(1L);
}
- void SetSizeParameter(const boost::rational<sal_Int64> &rValue, sal_uInt16 nType);
- const boost::rational<sal_Int64> & 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/utility.hxx b/starmath/inc/utility.hxx
index 4ef2b9ffa610..8cb9254004f8 100644
--- a/starmath/inc/utility.hxx
+++ b/starmath/inc/utility.hxx
@@ -41,27 +41,27 @@ inline long SmPtsTo100th_mm(long nNumPts)
}
-inline long SmPtsTo100th_mm(const boost::rational<sal_Int64> &rNumPts)
- // as above but with argument 'rNumPts' as 'boost::rational<sal_Int64>'
+inline long SmPtsTo100th_mm(const boost::rational<long> &rNumPts)
+ // as above but with argument 'rNumPts' as 'boost::rational<long>'
{
- boost::rational<sal_Int64> aTmp (254000L, 7227L);
+ boost::rational<long> aTmp (254000L, 7227L);
return boost::rational_cast<long>(aTmp * rNumPts);
}
-inline boost::rational<sal_Int64> 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..." );
- boost::rational<sal_Int64> aTmp (7227L, 254000L);
- return aTmp *= boost::rational<sal_Int64>(nNum100th_mm);
+ boost::rational<long> aTmp (7227L, 254000L);
+ return aTmp *= boost::rational<long>(nNum100th_mm);
}
-inline long SmRoundFraction(const boost::rational<sal_Int64> &rFrac)
+inline long SmRoundFraction(const boost::rational<long> &rFrac)
{
- SAL_WARN_IF( rFrac <= boost::rational<sal_Int64>(), "starmath", "Ooops..." );
+ 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 boost::rational<sal_Int64> &rFrac);
+SmFace & operator *= (SmFace &rFace, const boost::rational<long> &rFrac);
diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx
index a9f3bb3a703b..b23572e2d1e9 100644
--- a/starmath/inc/view.hxx
+++ b/starmath/inc/view.hxx
@@ -276,7 +276,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 boost::rational<sal_Int64> &rX, const boost::rational<sal_Int64> &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 829a04a55462..a488ad15502b 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(boost::rational<sal_Int64>(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 aaa494dfd3e5..a8183ed7388b 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -1344,7 +1344,7 @@ void SmXMLExport::ExportFont(const SmNode *pNode, int nLevel)
case TSIZE:
{
const SmFontNode *pFontNode = static_cast<const SmFontNode *>(pNode);
- const boost::rational<sal_Int64>& aFrac = pFontNode->GetSizeParameter();
+ const boost::rational<long>& aFrac = pFontNode->GetSizeParameter();
OUStringBuffer sStrBuf;
switch(pFontNode->GetSizeType())
@@ -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
- boost::rational<sal_Int64> aTemp = Sm100th_mmToPts(pFontNode->GetFont().
+ boost::rational<long> aTemp = Sm100th_mmToPts(pFontNode->GetFont().
GetSize().Height());
if (pFontNode->GetSizeType() == FNTSIZ_MINUS)
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index a2cd19d0fe32..dd1c51c4b4b9 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -165,14 +165,14 @@ void SmNode::SetFont(const SmFace &rFace)
}
-void SmNode::SetFontSize(const boost::rational<sal_Int64>& 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))
{
- boost::rational<sal_Int64> aVal (SmPtsTo100th_mm(rSize.numerator()),
+ boost::rational<long> aVal (SmPtsTo100th_mm(rSize.numerator()),
rSize.denominator());
long nHeight = boost::rational_cast<long>(aVal);
@@ -197,7 +197,7 @@ void SmNode::SetFontSize(const boost::rational<sal_Int64>& rSize, sal_uInt16 nTy
break;
case FNTSIZ_DIVIDE:
- if (rSize != boost::rational<sal_Int64>(0L))
+ if (rSize != boost::rational<long>(0L))
aFntSize.Height() = boost::rational_cast<long>(aFntSize.Height() / rSize);
break;
default:
@@ -220,7 +220,7 @@ void SmNode::SetFontSize(const boost::rational<sal_Int64>& rSize, sal_uInt16 nTy
}
-void SmNode::SetSize(const boost::rational<sal_Int64>& 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(boost::rational<sal_Int64> (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(boost::rational<sal_Int64>(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(boost::rational<sal_Int64> (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)
{
- boost::rational<sal_Int64> 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;
- boost::rational<sal_Int64> 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( boost::rational<sal_Int64>( rFormat.GetRelSize(SIZ_LIMITS), 100 ) );
+ pScript->SetSize( boost::rational<long>( rFormat.GetRelSize(SIZ_LIMITS), 100 ) );
// braces are a bit taller than usually
- pBrace ->SetSize( boost::rational<sal_Int64>(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(boost::rational<sal_Int64>(CalcSymbolHeight(*pSymbol, rFormat),
+ pSymbol->SetSize(boost::rational<long>(CalcSymbolHeight(*pSymbol, rFormat),
pSymbol->GetFont().GetSize().Height()));
pBody->Arrange(rDev, rFormat);
@@ -2174,7 +2174,7 @@ void SmFontNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
}
-void SmFontNode::SetSizeParameter(const boost::rational<sal_Int64>& 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() *= boost::rational<sal_Int64> (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() *= boost::rational<sal_Int64> (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 e83fccfcd101..54254bb20fd0 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -1947,7 +1947,7 @@ void SmParser::FontSize()
}
// get number argument
- boost::rational<sal_Int64> aValue( 1L );
+ boost::rational<long> aValue( 1L );
if (lcl_IsNumber( m_aCurToken.aText ))
{
double fTmp = OUString(m_aCurToken.aText).toDouble();
@@ -1969,7 +1969,7 @@ void SmParser::FontSize()
nNum /= 10;
nDenom /= 10;
}
- aValue = boost::rational<sal_Int64>( nNum, nDenom );
+ aValue = boost::rational<long>( nNum, nDenom );
}
}
}
diff --git a/starmath/source/utility.cxx b/starmath/source/utility.cxx
index 81f2abbb3023..a47df4a62a9b 100644
--- a/starmath/source/utility.cxx
+++ b/starmath/source/utility.cxx
@@ -284,7 +284,7 @@ SmFace & SmFace::operator = (const SmFace &rFace)
}
-SmFace & operator *= (SmFace &rFace, const boost::rational<sal_Int64>& 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.
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 865db90fdc64..55874794153a 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 boost::rational<sal_Int64> 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);
- boost::rational<sal_Int64> 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( boost::rational<sal_Int64>( aProvidedSize.Width(), aObjSize.Width() ),
- boost::rational<sal_Int64>( aProvidedSize.Height(), aObjSize.Height() ) );
+ SfxViewShell::SetZoomFactor( boost::rational<long>( aProvidedSize.Width(), aObjSize.Width() ),
+ boost::rational<long>( aProvidedSize.Height(), aObjSize.Height() ) );
}
SetBorderPixel( SvBorder() );
@@ -986,9 +986,9 @@ void SmViewShell::QueryObjAreaPixel( Rectangle& rRect ) const
}
-void SmViewShell::SetZoomFactor( const boost::rational<sal_Int64>& rX, const boost::rational<sal_Int64>& rY )
+void SmViewShell::SetZoomFactor( const boost::rational<long>& rX, const boost::rational<long>& rY )
{
- const boost::rational<sal_Int64>& rFrac = rX < rY ? rX : rY;
+ 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
@@ -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( boost::rational_cast<long>( boost::rational<sal_Int64>(OutputSize.Width() * 100L, GraphicSize.Width()) ),
- boost::rational_cast<long>( boost::rational<sal_Int64>(OutputSize.Height() * 100L, GraphicSize.Height()) ) );
- boost::rational<sal_Int64> 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:
{
- boost::rational<sal_Int64> 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( boost::rational_cast<long>( boost::rational<sal_Int64>(OutputSize.Width() * 100L, GraphicSize.Width())),
- boost::rational_cast<long>( boost::rational<sal_Int64>(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;
}