diff options
author | Noel <noelgrandin@gmail.com> | 2020-10-21 15:32:32 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-10-22 08:08:55 +0200 |
commit | d3158450293875051e04b0e13106ad4c112c8ba6 (patch) | |
tree | e47e91d847b62254c24372804b7cca4135e5e57e | |
parent | 7dc6fc32eb618da6defb8a9f330978fa019677b8 (diff) |
long->tools::Long in slideshow..starmath
Change-Id: I18f5b7c5da513d386f8ac848835b0410ebc7d95b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104629
Reviewed-by: Dante DM <dante19031999@gmail.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | slideshow/test/slidetest.cxx | 17 | ||||
-rw-r--r-- | smoketest/libtest.cxx | 5 | ||||
-rw-r--r-- | sot/source/sdstor/stg.cxx | 2 | ||||
-rw-r--r-- | sot/source/sdstor/stgstrms.cxx | 2 | ||||
-rw-r--r-- | starmath/inc/caret.hxx | 26 | ||||
-rw-r--r-- | starmath/inc/dialog.hxx | 6 | ||||
-rw-r--r-- | starmath/inc/node.hxx | 14 | ||||
-rw-r--r-- | starmath/inc/rect.hxx | 66 | ||||
-rw-r--r-- | starmath/inc/scrwin.hxx | 6 | ||||
-rw-r--r-- | starmath/inc/utility.hxx | 14 | ||||
-rw-r--r-- | starmath/inc/view.hxx | 2 | ||||
-rw-r--r-- | starmath/qa/cppunit/test_node.cxx | 8 | ||||
-rw-r--r-- | starmath/source/accessibility.cxx | 2 | ||||
-rw-r--r-- | starmath/source/cursor.cxx | 6 | ||||
-rw-r--r-- | starmath/source/dialog.cxx | 4 | ||||
-rw-r--r-- | starmath/source/edit.cxx | 6 | ||||
-rw-r--r-- | starmath/source/mathmlimport.cxx | 6 | ||||
-rw-r--r-- | starmath/source/node.cxx | 104 | ||||
-rw-r--r-- | starmath/source/parse.cxx | 4 | ||||
-rw-r--r-- | starmath/source/rect.cxx | 40 | ||||
-rw-r--r-- | starmath/source/scrwin.cxx | 6 | ||||
-rw-r--r-- | starmath/source/unomodel.cxx | 8 | ||||
-rw-r--r-- | starmath/source/utility.cxx | 6 | ||||
-rw-r--r-- | starmath/source/view.cxx | 18 | ||||
-rw-r--r-- | starmath/source/visitors.cxx | 48 |
25 files changed, 214 insertions, 212 deletions
diff --git a/slideshow/test/slidetest.cxx b/slideshow/test/slidetest.cxx index 1ba6e71638d1..469ed059260d 100644 --- a/slideshow/test/slidetest.cxx +++ b/slideshow/test/slidetest.cxx @@ -18,6 +18,7 @@ */ #include <sal/types.h> +#include <tools/long.hxx> #include <cppunit/TestAssert.h> #include <cppunit/TestFixture.h> #include <cppunit/extensions/HelperMacros.h> @@ -316,13 +317,13 @@ public: mpLayerManager->removeShape(pShape4); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Shape 1 must have refcount of 1", - long(1), mpTestShape.use_count() ); + tools::Long(1), mpTestShape.use_count() ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Shape 2 must have refcount of ", - long(1), pShape2.use_count() ); + tools::Long(1), pShape2.use_count() ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Shape 3 must have refcount of 1", - long(1), pShape3.use_count() ); + tools::Long(1), pShape3.use_count() ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Shape 4 must have refcount of", - long(1), pShape4.use_count() ); + tools::Long(1), pShape4.use_count() ); mpLayerManager->addShape(mpTestShape); @@ -339,13 +340,13 @@ public: mpLayerManager->removeShape(pShape4); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Shape 1 must have refcount of 1", - long(1), mpTestShape.use_count() ); + tools::Long(1), mpTestShape.use_count() ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Shape 2 must have refcount of ", - long(1), pShape2.use_count() ); + tools::Long(1), pShape2.use_count() ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Shape 3 must have refcount of 1", - long(1), pShape3.use_count() ); + tools::Long(1), pShape3.use_count() ); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Shape 4 must have refcount of 1", - long(1), pShape4.use_count() ); + tools::Long(1), pShape4.use_count() ); } // hook up the test diff --git a/smoketest/libtest.cxx b/smoketest/libtest.cxx index 0d9c34d429e1..7d90a8522353 100644 --- a/smoketest/libtest.cxx +++ b/smoketest/libtest.cxx @@ -16,6 +16,7 @@ #include <LibreOfficeKit/LibreOfficeKitInit.h> #include <LibreOfficeKit/LibreOfficeKit.hxx> +#include <tools/long.hxx> #ifdef _WIN32 @@ -38,7 +39,7 @@ #else #include <sys/time.h> - static long getTimeMS() + static tools::Long getTimeMS() { struct timeval t; gettimeofday(&t, nullptr); @@ -69,7 +70,7 @@ static int help() int main (int argc, char **argv) { - long start, end; + tools::Long start, end; start = getTimeMS(); diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx index 3e72d13b3fff..398e3fdb53d1 100644 --- a/sot/source/sdstor/stg.cxx +++ b/sot/source/sdstor/stg.cxx @@ -30,7 +30,7 @@ #include "stgio.hxx" #include "stgole.hxx" -static long nTmpCount = 0; +static tools::Long nTmpCount = 0; // The internal open mode is StreamMode::READ | StreamMode::TRUNC, which is silly // by itself. It inhibits the checking of sharing modes and is used diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx index 3c805283cb4b..717e4e7d175b 100644 --- a/sot/source/sdstor/stgstrms.cxx +++ b/sot/source/sdstor/stgstrms.cxx @@ -1272,7 +1272,7 @@ void StgTmpStrm::SetSize(sal_uInt64 n) } m_pStrm = s.release(); // Shrink the memory to 16 bytes, which seems to be the minimum - ReAllocateMemory( - ( static_cast<long>(nEndOfData) - 16 ) ); + ReAllocateMemory( - ( static_cast<tools::Long>(nEndOfData) - 16 ) ); } else { diff --git a/starmath/inc/caret.hxx b/starmath/inc/caret.hxx index c0e5c4f5fca0..bc69139994ee 100644 --- a/starmath/inc/caret.hxx +++ b/starmath/inc/caret.hxx @@ -61,22 +61,22 @@ struct SmCaretPos{ /** A line that represents a caret */ class SmCaretLine{ public: - SmCaretLine(long left = 0, long top = 0, long height = 0) { + SmCaretLine(tools::Long left = 0, tools::Long top = 0, tools::Long height = 0) { _top = top; _left = left; _height = height; } - long GetTop() const {return _top;} - long GetLeft() const {return _left;} - long GetHeight() const {return _height;} - long SquaredDistanceX(const SmCaretLine& line) const{ + tools::Long GetTop() const {return _top;} + tools::Long GetLeft() const {return _left;} + tools::Long GetHeight() const {return _height;} + tools::Long SquaredDistanceX(const SmCaretLine& line) const{ return (GetLeft() - line.GetLeft()) * (GetLeft() - line.GetLeft()); } - long SquaredDistanceX(const Point &pos) const{ + tools::Long SquaredDistanceX(const Point &pos) const{ return (GetLeft() - pos.X()) * (GetLeft() - pos.X()); } - long SquaredDistanceY(const SmCaretLine& line) const{ - long d = GetTop() - line.GetTop(); + tools::Long SquaredDistanceY(const SmCaretLine& line) const{ + tools::Long d = GetTop() - line.GetTop(); if(d < 0) d = (d * -1) - GetHeight(); else @@ -85,8 +85,8 @@ public: return 0; return d * d; } - long SquaredDistanceY(const Point &pos) const{ - long d = GetTop() - pos.Y(); + tools::Long SquaredDistanceY(const Point &pos) const{ + tools::Long d = GetTop() - pos.Y(); if(d < 0) d = (d * -1) - GetHeight(); if(d < 0) @@ -94,9 +94,9 @@ public: return d * d; } private: - long _top; - long _left; - long _height; + tools::Long _top; + tools::Long _left; + tools::Long _height; }; // SmCaretPosGraph diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx index 48910cafec89..b6210a1d2537 100644 --- a/starmath/inc/dialog.hxx +++ b/starmath/inc/dialog.hxx @@ -247,9 +247,9 @@ class SmShowSymbolSet final : public weld::CustomWidgetController SymbolPtrVec_t aSymbolSet; Link<SmShowSymbolSet&,void> aSelectHdlLink; Link<SmShowSymbolSet&,void> aDblClickHdlLink; - long nLen; - long nRows, nColumns; - long nXOffset, nYOffset; + tools::Long nLen; + tools::Long nRows, nColumns; + tools::Long nXOffset, nYOffset; sal_uInt16 nSelectSymbol; std::unique_ptr<weld::ScrolledWindow> m_xScrolledWindow; diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index 425ca59986f9..2f0b940582d8 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -630,7 +630,7 @@ class SmPolyLineNode final : public SmGraphicNode { tools::Polygon maPoly; Size maToSize; - long mnWidth; + tools::Long mnWidth; public: explicit SmPolyLineNode(const SmToken &rNodeToken); @@ -639,7 +639,7 @@ public: * Gets the width of the rect. * @return width */ - long GetWidth() const { return mnWidth; } + tools::Long GetWidth() const { return mnWidth; } /** * Gets the polygon to draw the node. @@ -1070,7 +1070,7 @@ public: */ class SmTableNode final : public SmStructureNode { - long mnFormulaBaseline; + tools::Long mnFormulaBaseline; public: explicit SmTableNode(const SmToken &rNodeToken) : SmStructureNode(SmNodeType::Table, rNodeToken) @@ -1090,7 +1090,7 @@ public: * Gets the formula baseline. * @return formula baseline */ - long GetFormulaBaseline() const; + tools::Long GetFormulaBaseline() const; /** * Accept a visitor. @@ -1641,7 +1641,7 @@ public: */ class SmBracebodyNode final : public SmStructureNode { - long mnBodyHeight; + tools::Long mnBodyHeight; public: explicit SmBracebodyNode(const SmToken &rNodeToken) @@ -1655,7 +1655,7 @@ public: * @return */ virtual void Arrange(OutputDevice &rDev, const SmFormat &rFormat) override; - long GetBodyHeight() const { return mnBodyHeight; } + tools::Long GetBodyHeight() const { return mnBodyHeight; } /** * Accept a visitor. @@ -1761,7 +1761,7 @@ public: * @param rFormat * @return node's height */ - long CalcSymbolHeight(const SmNode &rSymbol, const SmFormat &rFormat) const; + tools::Long CalcSymbolHeight(const SmNode &rSymbol, const SmFormat &rFormat) const; /** * Prepares the SmRect to render. diff --git a/starmath/inc/rect.hxx b/starmath/inc/rect.hxx index ce390b19724a..55beb7215e26 100644 --- a/starmath/inc/rect.hxx +++ b/starmath/inc/rect.hxx @@ -28,9 +28,9 @@ class SmFormat; -inline long SmFromTo(long nFrom, long nTo, double fRelDist) +inline tools::Long SmFromTo(tools::Long nFrom, tools::Long nTo, double fRelDist) { - return nFrom + static_cast<long>(fRelDist * (nTo - nFrom)); + return nFrom + static_cast<tools::Long>(fRelDist * (nTo - nFrom)); } @@ -85,7 +85,7 @@ class SmRect { Point aTopLeft; Size aSize; - long nBaseline, + tools::Long nBaseline, nAlignT, nAlignM, nAlignB, @@ -108,48 +108,48 @@ public: SmRect(); SmRect(const OutputDevice &rDev, const SmFormat *pFormat, const OUString &rText, sal_uInt16 nBorderWidth); - SmRect(long nWidth, long nHeight); + SmRect(tools::Long nWidth, tools::Long nHeight); sal_uInt16 GetBorderWidth() const { return nBorderWidth; } - void SetItalicSpaces(long nLeftSpace, long nRightSpace); + void SetItalicSpaces(tools::Long nLeftSpace, tools::Long nRightSpace); void SetWidth(sal_uLong nWidth) { aSize.setWidth(nWidth); } - void SetLeft(long nLeft); - void SetRight(long nRight); - void SetBottom(long nBottom); - void SetTop(long nTop); + void SetLeft(tools::Long nLeft); + void SetRight(tools::Long nRight); + void SetBottom(tools::Long nBottom); + void SetTop(tools::Long nTop); const Point & GetTopLeft() const { return aTopLeft; } - long GetTop() const { return GetTopLeft().Y(); } - long GetLeft() const { return GetTopLeft().X(); } - long GetBottom() const { return GetTop() + GetHeight() - 1; } - long GetRight() const { return GetLeft() + GetWidth() - 1; } - long GetCenterY() const { return (GetTop() + GetBottom()) / 2; } - long GetWidth() const { return GetSize().Width(); } - long GetHeight() const { return GetSize().Height(); } + tools::Long GetTop() const { return GetTopLeft().Y(); } + tools::Long GetLeft() const { return GetTopLeft().X(); } + tools::Long GetBottom() const { return GetTop() + GetHeight() - 1; } + tools::Long GetRight() const { return GetLeft() + GetWidth() - 1; } + tools::Long GetCenterY() const { return (GetTop() + GetBottom()) / 2; } + tools::Long GetWidth() const { return GetSize().Width(); } + tools::Long GetHeight() const { return GetSize().Height(); } - long GetItalicLeftSpace() const { return nItalicLeftSpace; } - long GetItalicRightSpace() const { return nItalicRightSpace; } + tools::Long GetItalicLeftSpace() const { return nItalicLeftSpace; } + tools::Long GetItalicRightSpace() const { return nItalicRightSpace; } - long GetHiAttrFence() const { return nHiAttrFence; } - long GetLoAttrFence() const { return nLoAttrFence; } + tools::Long GetHiAttrFence() const { return nHiAttrFence; } + tools::Long GetLoAttrFence() const { return nLoAttrFence; } - long GetItalicLeft() const { return GetLeft() - GetItalicLeftSpace(); } - long GetItalicCenterX() const { return (GetItalicLeft() + GetItalicRight()) / 2; } - long GetItalicRight() const { return GetRight() + GetItalicRightSpace(); } - long GetItalicWidth() const { return GetWidth() + GetItalicLeftSpace() + GetItalicRightSpace(); } + tools::Long GetItalicLeft() const { return GetLeft() - GetItalicLeftSpace(); } + tools::Long GetItalicCenterX() const { return (GetItalicLeft() + GetItalicRight()) / 2; } + tools::Long GetItalicRight() const { return GetRight() + GetItalicRightSpace(); } + tools::Long GetItalicWidth() const { return GetWidth() + GetItalicLeftSpace() + GetItalicRightSpace(); } bool HasBaseline() const { return bHasBaseline; } - inline long GetBaseline() const; - long GetBaselineOffset() const { return GetBaseline() - GetTop(); } + inline tools::Long GetBaseline() const; + tools::Long GetBaselineOffset() const { return GetBaseline() - GetTop(); } - long GetAlignT() const { return nAlignT; } - long GetAlignM() const { return nAlignM; } - long GetAlignB() const { return nAlignB; } + tools::Long GetAlignT() const { return nAlignT; } + tools::Long GetAlignM() const { return nAlignM; } + tools::Long GetAlignB() const { return nAlignB; } const Size & GetSize() const { return aSize; } @@ -171,11 +171,11 @@ public: SmRect & ExtendBy(const SmRect &rRect, RectCopyMBL eCopyMode); void ExtendBy(const SmRect &rRect, RectCopyMBL eCopyMode, - long nNewAlignM); + tools::Long nNewAlignM); SmRect & ExtendBy(const SmRect &rRect, RectCopyMBL eCopyMode, bool bKeepVerAlignParams); - long OrientedDist(const Point &rPoint) const; + tools::Long OrientedDist(const Point &rPoint) const; bool IsInsideRect(const Point &rPoint) const; bool IsInsideItalicRect(const Point &rPoint) const; @@ -184,7 +184,7 @@ public: }; -inline void SmRect::SetItalicSpaces(long nLeftSpace, long nRightSpace) +inline void SmRect::SetItalicSpaces(tools::Long nLeftSpace, tools::Long nRightSpace) // set extra spacing to the left and right for (italic) // letters/text { @@ -202,7 +202,7 @@ inline void SmRect::CopyMBL(const SmRect &rRect) } -inline long SmRect::GetBaseline() const +inline tools::Long SmRect::GetBaseline() const { SAL_WARN_IF( !HasBaseline(), "starmath", "Baseline does not exist" ); return nBaseline; diff --git a/starmath/inc/scrwin.hxx b/starmath/inc/scrwin.hxx index 253f6c59d3f6..348779e312b9 100644 --- a/starmath/inc/scrwin.hxx +++ b/starmath/inc/scrwin.hxx @@ -31,8 +31,8 @@ class ScrollableWindow : public vcl::Window private: Point aPixOffset; // offset to virtual window (pixel) Size aTotPixSz; // total size of virtual window (pixel) - long nLinePixH; // size of a line/column (pixel) - long nColumnPixW; + tools::Long nLinePixH; // size of a line/column (pixel) + tools::Long nColumnPixW; VclPtr<ScrollBar> aVScroll; // the scrollbars VclPtr<ScrollBar> aHScroll; @@ -59,7 +59,7 @@ public: Size GetTotalSize() const { return PixelToLogic( aTotPixSz ); } using Window::Scroll; - virtual void Scroll( long nDeltaX, long nDeltaY, ScrollFlags nFlags = ScrollFlags::NONE ) override; + virtual void Scroll( tools::Long nDeltaX, tools::Long nDeltaY, ScrollFlags nFlags = ScrollFlags::NONE ) override; private: Size GetOutputSizePixel() const; diff --git a/starmath/inc/utility.hxx b/starmath/inc/utility.hxx index 2a462b98d727..f5ec5a4dedec 100644 --- a/starmath/inc/utility.hxx +++ b/starmath/inc/utility.hxx @@ -27,7 +27,7 @@ #include <tools/fract.hxx> #include <deque> -inline long SmPtsTo100th_mm(long nNumPts) +inline tools::Long SmPtsTo100th_mm(tools::Long nNumPts) // returns the length (in 100th of mm) that corresponds to the length // 'nNumPts' (in units points). // 72.27 [pt] = 1 [inch] = 2,54 [cm] = 2540 [100th of mm]. @@ -41,7 +41,7 @@ inline long SmPtsTo100th_mm(long nNumPts) } -inline Fraction Sm100th_mmToPts(long nNum100th_mm) +inline Fraction Sm100th_mmToPts(tools::Long nNum100th_mm) // returns the length (in points) that corresponds to the length // 'nNum100th_mm' (in 100th of mm). { @@ -50,7 +50,7 @@ inline Fraction Sm100th_mmToPts(long nNum100th_mm) } -inline long SmRoundFraction(const Fraction &rFrac) +inline tools::Long SmRoundFraction(const Fraction &rFrac) { SAL_WARN_IF( rFrac <= Fraction(), "starmath", "Ooops..." ); return (rFrac.GetNumerator() + rFrac.GetDenominator() / 2) / rFrac.GetDenominator(); @@ -69,7 +69,7 @@ bool IsBold( const vcl::Font &rFont ); class SmFace final : public vcl::Font { - long nBorderWidth; + tools::Long nBorderWidth; void Impl_Init(); @@ -88,9 +88,9 @@ public: // for font size (height). (Also used in ctor's to do so.) void SetSize(const Size& rSize); - void SetBorderWidth(long nWidth) { nBorderWidth = nWidth; } - long GetBorderWidth() const; - long GetDefaultBorderWidth() const { return GetFontSize().Height() / 20 ; } + void SetBorderWidth(tools::Long nWidth) { nBorderWidth = nWidth; } + tools::Long GetBorderWidth() const; + tools::Long GetDefaultBorderWidth() const { return GetFontSize().Height() / 20 ; } void FreezeBorderWidth() { nBorderWidth = GetDefaultBorderWidth(); } SmFace & operator = (const SmFace &rFace); diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index 5f3a8c52d547..d48f1b2dcd62 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -232,7 +232,7 @@ protected: const OUString& rLine); static Size GetTextSize(OutputDevice const & rDevice, const OUString& rText, - long MaxWidth); + tools::Long MaxWidth); static void DrawTextLine(OutputDevice& rDevice, const Point& rPosition, const OUString& rLine); diff --git a/starmath/qa/cppunit/test_node.cxx b/starmath/qa/cppunit/test_node.cxx index dba0b9ff3c40..e543ac04027c 100644 --- a/starmath/qa/cppunit/test_node.cxx +++ b/starmath/qa/cppunit/test_node.cxx @@ -81,10 +81,10 @@ void NodeTest::testTdf47813() pNodeL->Arrange(*pOutputDevice, aFmt); pNodeR->Prepare(aFmt, *mxDocShell, 0); pNodeR->Arrange(*pOutputDevice, aFmt); - long nWidthA = pNodeA->GetRect().GetWidth(); - long nWidthC = pNodeC->GetRect().GetWidth(); - long nWidthL = pNodeL->GetRect().GetWidth(); - long nWidthR = pNodeR->GetRect().GetWidth(); + tools::Long nWidthA = pNodeA->GetRect().GetWidth(); + tools::Long nWidthC = pNodeC->GetRect().GetWidth(); + tools::Long nWidthL = pNodeL->GetRect().GetWidth(); + tools::Long nWidthR = pNodeR->GetRect().GetWidth(); CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, nWidthC/static_cast<double>(nWidthA), 0.01); // these values appear to change slightly with display scaling CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, nWidthL/static_cast<double>(nWidthA), 0.03); diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx index 014bc79e7ac5..2bf71cecf8f2 100644 --- a/starmath/source/accessibility.cxx +++ b/starmath/source/accessibility.cxx @@ -552,7 +552,7 @@ sal_Int32 SAL_CALL SmGraphicAccessible::getIndexAtPoint( const awt::Point& aPoin OUString aTxt = aBuf.makeStringAndClear(); OSL_ENSURE( !aTxt.isEmpty(), "no accessible text available" ); - long nNodeX = pNode->GetLeft(); + tools::Long nNodeX = pNode->GetLeft(); std::unique_ptr<long[]> pXAry(new long[ aTxt.getLength() ]); pWin->SetFont( pNode->GetFont() ); diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx index c476bd41228e..90bdf2207327 100644 --- a/starmath/source/cursor.cxx +++ b/starmath/source/cursor.cxx @@ -39,7 +39,7 @@ void SmCursor::Move(OutputDevice* pDev, SmMovementDirection direction, bool bMov SmCaretLine from_line = SmCaretPos2LineVisitor(pDev, mpPosition->CaretPos).GetResult(), best_line, //Best approximated line found so far curr_line; //Current line - long dbp_sq = 0; //Distance squared to best line + tools::Long dbp_sq = 0; //Distance squared to best line for(const auto &pEntry : *mpGraph) { //Reject it if it's the current position @@ -54,7 +54,7 @@ void SmCursor::Move(OutputDevice* pDev, SmMovementDirection direction, bool bMov //Compare if it to what we have, if we have anything yet if(NewPos){ //Compute distance to current line squared, multiplied with a horizontal factor - long dp_sq = curr_line.SquaredDistanceX(from_line) * HORIZONTICAL_DISTANCE_FACTOR + + tools::Long dp_sq = curr_line.SquaredDistanceX(from_line) * HORIZONTICAL_DISTANCE_FACTOR + curr_line.SquaredDistanceY(from_line); //Discard current line if best line is closer if(dbp_sq <= dp_sq) continue; @@ -82,7 +82,7 @@ void SmCursor::Move(OutputDevice* pDev, SmMovementDirection direction, bool bMov void SmCursor::MoveTo(OutputDevice* pDev, const Point& pos, bool bMoveAnchor) { SmCaretPosGraphEntry* NewPos = nullptr; - long dp_sq = 0, //Distance to current line squared + tools::Long dp_sq = 0, //Distance to current line squared dbp_sq = 1; //Distance to best line squared for(const auto &pEntry : *mpGraph) { diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 5c206546541a..cf9616ad9980 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -398,7 +398,7 @@ void SmFontSizeDialog::ReadFrom(const SmFormat &rFormat) void SmFontSizeDialog::WriteTo(SmFormat &rFormat) const { - rFormat.SetBaseSize( Size(0, SmPtsTo100th_mm( static_cast< long >(m_xBaseSize->get_value(FieldUnit::NONE)))) ); + rFormat.SetBaseSize( Size(0, SmPtsTo100th_mm( static_cast< tools::Long >(m_xBaseSize->get_value(FieldUnit::NONE)))) ); rFormat.SetRelSize(SIZ_TEXT, sal::static_int_cast<sal_uInt16>(m_xTextSize->get_value(FieldUnit::NONE))); rFormat.SetRelSize(SIZ_INDEX, sal::static_int_cast<sal_uInt16>(m_xIndexSize->get_value(FieldUnit::NONE))); @@ -1026,7 +1026,7 @@ bool SmShowSymbolSet::MouseButtonDown(const MouseEvent& rMEvt) if (rMEvt.IsLeft() && tools::Rectangle(Point(0, 0), aOutputSize).IsInside(rMEvt.GetPosPixel())) { - long nPos = (aPoint.Y() / nLen) * nColumns + (aPoint.X() / nLen) + + tools::Long nPos = (aPoint.Y() / nLen) * nColumns + (aPoint.X() / nLen) + m_xScrolledWindow->vadjustment_get_value() * nColumns; SelectSymbol( sal::static_int_cast< sal_uInt16 >(nPos) ); diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 755bb3b5c667..59cef03975bf 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -278,7 +278,7 @@ void SmEditWindow::Resize() pEditView->ShowCursor(); OSL_ENSURE( pEditView->GetEditEngine(), "EditEngine missing" ); - const long nMaxVisAreaStart = pEditView->GetEditEngine()->GetTextHeight() - + const tools::Long nMaxVisAreaStart = pEditView->GetEditEngine()->GetTextHeight() - pEditView->GetOutputArea().GetHeight(); if (pEditView->GetVisArea().Top() > nMaxVisAreaStart) { @@ -556,7 +556,7 @@ tools::Rectangle SmEditWindow::AdjustScrollBars() if (pVScrollBar && pHScrollBar && pScrollBox) { - const long nTmp = GetSettings().GetStyleSettings().GetScrollBarSize(); + const tools::Long nTmp = GetSettings().GetStyleSettings().GetScrollBarSize(); Point aPt( aRect.TopRight() ); aPt.AdjustX( -(nTmp -1) ); pVScrollBar->SetPosSizePixel( aPt, Size(nTmp, aOut.Height() - nTmp)); @@ -579,7 +579,7 @@ void SmEditWindow::SetScrollBarRanges() EditEngine *pEditEngine = GetEditEngine(); if (pVScrollBar && pHScrollBar && pEditEngine && pEditView) { - long nTmp = pEditEngine->GetTextHeight(); + tools::Long nTmp = pEditEngine->GetTextHeight(); pVScrollBar->SetRange(Range(0, nTmp)); pVScrollBar->SetThumbPos(pEditView->GetVisArea().Top()); diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index be223003bfb7..2f8dfb4aeab2 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -1471,12 +1471,12 @@ bool lcl_CountBlanks(const MathMLAttributeLengthValue &rLV, return false; const Fraction aTwo(2, 1); auto aWide = rLV.aNumber / aTwo; - auto nWide = static_cast<sal_Int32>(static_cast<long>(aWide)); + auto nWide = static_cast<sal_Int32>(static_cast<tools::Long>(aWide)); if (nWide < 0) return false; const Fraction aPointFive(1, 2); auto aNarrow = (rLV.aNumber - Fraction(nWide, 1) * aTwo) / aPointFive; - auto nNarrow = static_cast<sal_Int32>(static_cast<long>(aNarrow)); + auto nNarrow = static_cast<sal_Int32>(static_cast<tools::Long>(aNarrow)); if (nNarrow < 0) return false; *pWide = nWide; @@ -2638,7 +2638,7 @@ void SmXMLImport::SetViewSettings(const Sequence<PropertyValue>& aViewProps) tools::Rectangle aRect( pDocShell->GetVisArea() ); - long nTmp = 0; + tools::Long nTmp = 0; for (const PropertyValue& rValue : aViewProps) { diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index e894ad84b6d8..1604655c08c1 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -153,7 +153,7 @@ void SmNode::SetFontSize(const Fraction &rSize, FontSizeType nType) { Fraction aVal (SmPtsTo100th_mm(rSize.GetNumerator()), rSize.GetDenominator()); - long nHeight = static_cast<long>(aVal); + tools::Long nHeight = static_cast<tools::Long>(aVal); aFntSize = GetFont().GetFontSize(); aFntSize.setWidth( 0 ); @@ -172,12 +172,12 @@ void SmNode::SetFontSize(const Fraction &rSize, FontSizeType nType) break; case FontSizeType::MULTIPLY: - aFntSize.setHeight( static_cast<long>(Fraction(aFntSize.Height()) * rSize) ); + aFntSize.setHeight( static_cast<tools::Long>(Fraction(aFntSize.Height()) * rSize) ); break; case FontSizeType::DIVIDE: if (rSize != Fraction(0)) - aFntSize.setHeight( static_cast<long>(Fraction(aFntSize.Height()) / rSize) ); + aFntSize.setHeight( static_cast<tools::Long>(Fraction(aFntSize.Height()) / rSize) ); break; default: break; @@ -294,7 +294,7 @@ const SmNode * SmNode::FindTokenAt(sal_uInt16 nRow, sal_uInt16 nCol) const const SmNode * SmNode::FindRectClosestTo(const Point &rPoint) const { - long nDist = LONG_MAX; + tools::Long nDist = LONG_MAX; const SmNode *pResult = nullptr; if (IsVisible()) @@ -312,7 +312,7 @@ const SmNode * SmNode::FindRectClosestTo(const Point &rPoint) const const SmNode *pFound = pNode->FindRectClosestTo(rPoint); if (pFound) { - long nTmp = pFound->OrientedDist(rPoint); + tools::Long nTmp = pFound->OrientedDist(rPoint); if (nTmp < nDist) { nDist = nTmp; @@ -479,14 +479,14 @@ void SmTableNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) size_t nSize = GetNumSubNodes(); // make distance depend on font size - long nDist = +(rFormat.GetDistance(DIS_VERTICAL) + tools::Long nDist = +(rFormat.GetDistance(DIS_VERTICAL) * GetFont().GetFontSize().Height()) / 100; if (nSize < 1) return; // arrange subnodes and get maximum width of them - long nMaxWidth = 0, + tools::Long nMaxWidth = 0, nTmp; for (size_t i = 0; i < nSize; ++i) { @@ -536,7 +536,7 @@ const SmNode * SmTableNode::GetLeftMost() const } -long SmTableNode::GetFormulaBaseline() const +tools::Long SmTableNode::GetFormulaBaseline() const { return mnFormulaBaseline; } @@ -590,7 +590,7 @@ void SmLineNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) } // make distance depend on font size - long nDist = (rFormat.GetDistance(DIS_HORIZONTAL) * GetFont().GetFontSize().Height()) / 100; + tools::Long nDist = (rFormat.GetDistance(DIS_HORIZONTAL) * GetFont().GetFontSize().Height()) / 100; if (!IsUseExtraSpaces()) nDist = 0; @@ -648,7 +648,7 @@ void SmUnHorNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) pOper->Arrange(rDev, rFormat); pBody->Arrange(rDev, rFormat); - long nDist = (pOper->GetRect().GetWidth() * rFormat.GetDistance(DIS_HORIZONTAL)) / 100; + tools::Long nDist = (pOper->GetRect().GetWidth() * rFormat.GetDistance(DIS_HORIZONTAL)) / 100; SmRect::operator = (*pNode0); @@ -664,7 +664,7 @@ void SmUnHorNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) namespace { void lcl_GetHeightVerOffset(const SmRect &rRect, - long &rHeight, long &rVerOffset) + tools::Long &rHeight, tools::Long &rVerOffset) // calculate height and vertical offset of root sign suitable for 'rRect' { rVerOffset = (rRect.GetBottom() - rRect.GetAlignB()) / 2; @@ -690,7 +690,7 @@ Point lcl_GetExtraPos(const SmRect &rRootSymbol, // if there's enough space move a bit less to the right // examples: "nroot i a", "nroot j a" // (it looks better if we don't use italic-spaces here) - long nX = rRootSymbol.GetLeft() + (rSymSize.Width() * 30) / 100; + tools::Long nX = rRootSymbol.GetLeft() + (rSymSize.Width() * 30) / 100; if (aPos.X() > nX) aPos.setX( nX ); @@ -713,7 +713,7 @@ void SmRootNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) pBody->Arrange(rDev, rFormat); - long nHeight, + tools::Long nHeight, nVerOffset; lcl_GetHeightVerOffset(*pBody, nHeight, nVerOffset); nHeight += rFormat.GetDistance(DIS_ROOT) @@ -765,7 +765,7 @@ void SmBinHorNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) const SmRect &rOpRect = pOper->GetRect(); - long nDist = (rOpRect.GetWidth() * + tools::Long nDist = (rOpRect.GetWidth() * rFormat.GetDistance(DIS_HORIZONTAL)) / 100; SmRect::operator = (*pLeft); @@ -808,7 +808,7 @@ void SmBinVerNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) pNum ->Arrange(rDev, rFormat); pDenom->Arrange(rDev, rFormat); - long nFontHeight = GetFont().GetFontSize().Height(), + tools::Long nFontHeight = GetFont().GetFontSize().Height(), nExtLen = nFontHeight * rFormat.GetDistance(DIS_FRACTION) / 100, nThick = nFontHeight * rFormat.GetDistance(DIS_STROKEWIDTH) / 100, nWidth = std::max(pNum->GetItalicWidth(), pDenom->GetItalicWidth()), @@ -909,8 +909,8 @@ sal_uInt16 GetLineIntersectionPoint(Point &rResult, double fLambda = ( (rPoint1.Y() - rPoint2.Y()) * rHeading2.X() - (rPoint1.X() - rPoint2.X()) * rHeading2.Y()) / fDet; - rResult = Point(rPoint1.X() + static_cast<long>(fLambda * rHeading1.X()), - rPoint1.Y() + static_cast<long>(fLambda * rHeading1.Y())); + rResult = Point(rPoint1.X() + static_cast<tools::Long>(fLambda * rHeading1.X()), + rPoint1.Y() + static_cast<tools::Long>(fLambda * rHeading1.Y())); } return nRes; @@ -927,16 +927,16 @@ void SmBinDiagonalNode::GetOperPosSize(Point &rPos, Size &rSize, { static const double fPi = 3.1415926535897932384626433; double fAngleRad = fAngleDeg / 180.0 * fPi; - long nRectLeft = GetItalicLeft(), + tools::Long nRectLeft = GetItalicLeft(), nRectRight = GetItalicRight(), nRectTop = GetTop(), nRectBottom = GetBottom(); Point aRightHdg (100, 0), aDownHdg (0, 100), - aDiagHdg ( static_cast<long>(100.0 * cos(fAngleRad)), - static_cast<long>(-100.0 * sin(fAngleRad)) ); + aDiagHdg ( static_cast<tools::Long>(100.0 * cos(fAngleRad)), + static_cast<tools::Long>(-100.0 * sin(fAngleRad)) ); - long nLeft, nRight, nTop, nBottom; // margins of the rectangle for the diagonal + tools::Long nLeft, nRight, nTop, nBottom; // margins of the rectangle for the diagonal Point aPoint; if (IsAscending()) { @@ -1059,7 +1059,7 @@ void SmBinDiagonalNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) // determine implicitly the values (incl. the margin) of the diagonal line pOper->Arrange(aTmpDev, rFormat); - long nDelta = pOper->GetWidth() * 8 / 10; + tools::Long nDelta = pOper->GetWidth() * 8 / 10; // determine TopLeft position from the right argument Point aPos; @@ -1072,7 +1072,7 @@ void SmBinDiagonalNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) pRight->MoveTo(aPos); // determine new baseline - long nTmpBaseline = IsAscending() ? (pLeft->GetBottom() + pRight->GetTop()) / 2 + tools::Long nTmpBaseline = IsAscending() ? (pLeft->GetBottom() + pRight->GetTop()) / 2 : (pLeft->GetTop() + pRight->GetBottom()) / 2; Point aLogCenter ((pLeft->GetItalicRight() + pRight->GetItalicLeft()) / 2, nTmpBaseline); @@ -1108,7 +1108,7 @@ void SmSubSupNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) SmNode *pBody = GetBody(); assert(pBody); - long nOrigHeight = pBody->GetFont().GetFontSize().Height(); + tools::Long nOrigHeight = pBody->GetFont().GetFontSize().Height(); pBody->Arrange(rDev, rFormat); @@ -1116,10 +1116,10 @@ void SmSubSupNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) SmRect::operator = (rBodyRect); // line that separates sub- and supscript rectangles - long nDelimLine = SmFromTo(GetAlignB(), GetAlignT(), 0.4); + tools::Long nDelimLine = SmFromTo(GetAlignB(), GetAlignT(), 0.4); Point aPos; - long nDelta, nDist; + tools::Long nDelta, nDist; // iterate over all possible sub-/supscripts SmRect aTmpRect (rBodyRect); @@ -1229,7 +1229,7 @@ void SmBraceNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) (GetScaleMode() == SmScaleMode::Height || bIsScaleNormal), bIsABS = GetToken().eType == TABS; - long nFaceHeight = GetFont().GetFontSize().Height(); + tools::Long nFaceHeight = GetFont().GetFontSize().Height(); // determine oversize in % sal_uInt16 nPerc = 0; @@ -1241,7 +1241,7 @@ void SmBraceNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) } // determine the height for the braces - long nBraceHeight; + tools::Long nBraceHeight; if (bScale) { nBraceHeight = pBody->GetType() == SmNodeType::Bracebody ? @@ -1254,7 +1254,7 @@ void SmBraceNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) // distance to the argument nPerc = bIsABS ? 0 : rFormat.GetDistance(DIS_BRACKETSPACE); - long nDist = nFaceHeight * nPerc / 100; + tools::Long nDist = nFaceHeight * nPerc / 100; // if wanted, scale the braces to the wanted size if (bScale) @@ -1330,7 +1330,7 @@ void SmBracebodyNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) // scale separators to required height and arrange them bool bScale = GetScaleMode() == SmScaleMode::Height || rFormat.IsScaleNormalBrackets(); - long nHeight = bScale ? aRefRect.GetHeight() : GetFont().GetFontSize().Height(); + tools::Long nHeight = bScale ? aRefRect.GetHeight() : GetFont().GetFontSize().Height(); sal_uInt16 nIndex = GetScaleMode() == SmScaleMode::Height ? DIS_BRACKETSIZE : DIS_NORMALBRACKETSIZE; sal_uInt16 nPerc = rFormat.GetDistance(nIndex); @@ -1344,7 +1344,7 @@ void SmBracebodyNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) } // horizontal distance between argument and brackets or separators - long nDist = GetFont().GetFontSize().Height() + tools::Long nDist = GetFont().GetFontSize().Height() * rFormat.GetDistance(DIS_BRACKETSPACE) / 100; SmNode *pLeft = GetSubNode(0); @@ -1389,7 +1389,7 @@ void SmVerticalBraceNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) // braces are a bit taller than usually pBrace ->SetSize( Fraction(3, 2) ); - long nItalicWidth = pBody->GetItalicWidth(); + tools::Long nItalicWidth = pBody->GetItalicWidth(); if (nItalicWidth > 0) pBrace->AdaptToX(aTmpDev, nItalicWidth); @@ -1398,8 +1398,8 @@ void SmVerticalBraceNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) // determine the relative position and the distances between each other RectPos eRectPos; - long nFontHeight = pBody->GetFont().GetFontSize().Height(); - long nDistBody = nFontHeight * rFormat.GetDistance(DIS_ORNAMENTSIZE), + tools::Long nFontHeight = pBody->GetFont().GetFontSize().Height(); + tools::Long nDistBody = nFontHeight * rFormat.GetDistance(DIS_ORNAMENTSIZE), nDistScript = nFontHeight; if (GetToken().eType == TOVERBRACE) { @@ -1444,11 +1444,11 @@ SmNode * SmOperNode::GetSymbol() } -long SmOperNode::CalcSymbolHeight(const SmNode &rSymbol, +tools::Long SmOperNode::CalcSymbolHeight(const SmNode &rSymbol, const SmFormat &rFormat) const // returns the font height to be used for operator-symbol { - long nHeight = GetFont().GetFontSize().Height(); + tools::Long nHeight = GetFont().GetFontSize().Height(); SmTokenType eTmpType = GetToken().eType; if (eTmpType == TLIM || eTmpType == TLIMINF || eTmpType == TLIMSUP) @@ -1488,8 +1488,8 @@ void SmOperNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) bool bDynamicallySized = false; if (pSymbol->GetToken().eType == TINTD) { - long nBodyHeight = pBody->GetHeight(); - long nFontHeight = pSymbol->GetFont().GetFontSize().Height(); + tools::Long nBodyHeight = pBody->GetHeight(); + tools::Long nFontHeight = pSymbol->GetFont().GetFontSize().Height(); if (nFontHeight < nBodyHeight) { pSymbol->SetSize(Fraction(nBodyHeight, nFontHeight)); @@ -1498,7 +1498,7 @@ void SmOperNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) } pOper->Arrange(rDev, rFormat); - long nOrigHeight = GetFont().GetFontSize().Height(), + tools::Long nOrigHeight = GetFont().GetFontSize().Height(), nDist = nOrigHeight * rFormat.GetDistance(DIS_OPERATORSPACE) / 100; @@ -1557,7 +1557,7 @@ void SmAttributNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) // get relative position of attribute RectVerAlign eVerAlign; - long nDist = 0; + tools::Long nDist = 0; switch (GetToken().eType) { case TUNDERLINE : eVerAlign = RectVerAlign::AttributeLo; @@ -1697,7 +1697,7 @@ void SmPolyLineNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) SmTmpDevice aTmpDev (rDev, true); aTmpDev.SetFont(GetFont()); - long nBorderwidth = GetFont().GetBorderWidth(); + tools::Long nBorderwidth = GetFont().GetBorderWidth(); // create polygon using both endpoints assert(maPoly.GetSize() == 2); @@ -1720,7 +1720,7 @@ void SmPolyLineNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) maPoly.SetPoint(aPointA, 0); maPoly.SetPoint(aPointB, 1); - long nThick = GetFont().GetFontSize().Height() + tools::Long nThick = GetFont().GetFontSize().Height() * rFormat.GetDistance(DIS_STROKEWIDTH) / 100; mnWidth = nThick + 2 * nBorderwidth; @@ -1762,8 +1762,8 @@ void SmRectangleNode::AdaptToY(OutputDevice &/*rDev*/, sal_uLong nHeight) void SmRectangleNode::Arrange(OutputDevice &rDev, const SmFormat &/*rFormat*/) { - long nFontHeight = GetFont().GetFontSize().Height(); - long nWidth = maToSize.Width(), + tools::Long nFontHeight = GetFont().GetFontSize().Height(); + tools::Long nWidth = maToSize.Width(), nHeight = maToSize.Height(); if (nHeight == 0) nHeight = nFontHeight / 30; @@ -1937,16 +1937,16 @@ void SmMatrixNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) } // norm distance from which the following two are calculated - const long nNormDist = 3 * GetFont().GetFontSize().Height(); + const tools::Long nNormDist = 3 * GetFont().GetFontSize().Height(); // define horizontal and vertical minimal distances that separate // the elements - long nHorDist = nNormDist * rFormat.GetDistance(DIS_MATRIXCOL) / 100, + tools::Long nHorDist = nNormDist * rFormat.GetDistance(DIS_MATRIXCOL) / 100, nVerDist = nNormDist * rFormat.GetDistance(DIS_MATRIXROW) / 100; // build array that holds the leftmost position for each column std::vector<long> aColLeft(mnNumCols); - long nX = 0; + tools::Long nX = 0; for (size_t j = 0; j < mnNumCols; ++j) { aColLeft[j] = nX; @@ -2043,8 +2043,8 @@ void SmMathSymbolNode::AdaptToX(OutputDevice &rDev, sal_uLong nWidth) aTmpDev.SetFont(GetFont()); // get denominator of error factor for width - long nTmpBorderWidth = GetFont().GetBorderWidth(); - long nDenom = SmRect(aTmpDev, nullptr, GetText(), nTmpBorderWidth).GetItalicWidth(); + tools::Long nTmpBorderWidth = GetFont().GetBorderWidth(); + tools::Long nDenom = SmRect(aTmpDev, nullptr, GetText(), nTmpBorderWidth).GetItalicWidth(); // scale fontwidth with this error factor aFntSize.setWidth( aFntSize.Width() * nWidth ); @@ -2078,8 +2078,8 @@ void SmMathSymbolNode::AdaptToY(OutputDevice &rDev, sal_uLong nHeight) aTmpDev.SetFont(GetFont()); // get denominator of error factor for height - long nTmpBorderWidth = GetFont().GetBorderWidth(); - long nDenom = 0; + tools::Long nTmpBorderWidth = GetFont().GetBorderWidth(); + tools::Long nDenom = 0; if (!GetText().isEmpty()) nDenom = SmRect(aTmpDev, nullptr, GetText(), nTmpBorderWidth).GetHeight(); @@ -2327,7 +2327,7 @@ void SmBlankNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat) // make distance depend on the font height // (so that it increases when scaling (e.g. size *2 {a ~ b}) - long nDist = GetFont().GetFontSize().Height() / 10, + tools::Long nDist = GetFont().GetFontSize().Height() / 10, nSpace = mnNum * nDist; // get a SmRect with Baseline and all the bells and whistles diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index e931c494b649..a5872f9e9118 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -2010,8 +2010,8 @@ std::unique_ptr<SmStructureNode> SmParser::DoFontSize() //!! or ftmp = 1.11111111111111111... (11/9) on every platform.) if (aValue.GetDenominator() > 1000) { - long nNum = aValue.GetNumerator(); - long nDenom = aValue.GetDenominator(); + tools::Long nNum = aValue.GetNumerator(); + tools::Long nDenom = aValue.GetDenominator(); while (nDenom > 1000) { nNum /= 10; diff --git a/starmath/source/rect.cxx b/starmath/source/rect.cxx index d49daf7474e4..1c9ecb71ccdc 100644 --- a/starmath/source/rect.cxx +++ b/starmath/source/rect.cxx @@ -68,14 +68,14 @@ bool SmGetGlyphBoundRect(const vcl::RenderContext &rDev, Size aFntSize = aFnt.GetFontSize(); // Workaround to avoid HUGE font sizes and resulting problems - long nScaleFactor = 1; + tools::Long nScaleFactor = 1; while( aFntSize.Height() > 2000 * nScaleFactor ) nScaleFactor *= 2; aFnt.SetFontSize( Size( aFntSize.Width() / nScaleFactor, aFntSize.Height() / nScaleFactor ) ); pGlyphDev->SetFont(aFnt); - long nTextWidth = rDev.GetTextWidth(rText); + tools::Long nTextWidth = rDev.GetTextWidth(rText); tools::Rectangle aResult (Point(), Size(nTextWidth, rDev.GetTextHeight())), aTmp; @@ -89,7 +89,7 @@ bool SmGetGlyphBoundRect(const vcl::RenderContext &rDev, aTmp.Right() * nScaleFactor, aTmp.Bottom() * nScaleFactor); if (&rDev != pGlyphDev) /* only when rDev is a printer... */ { - long nGDTextWidth = pGlyphDev->GetTextWidth(rText); + tools::Long nGDTextWidth = pGlyphDev->GetTextWidth(rText); if (nGDTextWidth != 0 && nTextWidth != nGDTextWidth) { @@ -101,7 +101,7 @@ bool SmGetGlyphBoundRect(const vcl::RenderContext &rDev, // move rectangle to match possibly different baselines // (because of different devices) - long nDelta = aDevFM.GetAscent() - pGlyphDev->GetFontMetric().GetAscent() * nScaleFactor; + tools::Long nDelta = aDevFM.GetAscent() - pGlyphDev->GetFontMetric().GetAscent() * nScaleFactor; aResult.Move(0, nDelta); pGlyphDev->Pop(); @@ -186,7 +186,7 @@ SmRect::SmRect(const OutputDevice &rDev, const SmFormat *pFormat, const FontMetric aFM (rDev.GetFontMetric()); bool bIsMath = aFM.GetFamilyName().equalsIgnoreAsciiCase( FONTNAME_MATH ); bool bAllowSmaller = bIsMath && !SmIsMathAlpha(rText); - const long nFontHeight = rDev.GetFont().GetFontSize().Height(); + const tools::Long nFontHeight = rDev.GetFont().GetFontSize().Height(); nBorderWidth = nBorder; bHasAlignInfo = true; @@ -210,7 +210,7 @@ SmRect::SmRect(const OutputDevice &rDev, const SmFormat *pFormat, pWindow->SetMapMode(rDev.GetMapMode()); pWindow->SetFont(rDev.GetFontMetric()); - long nDelta = pWindow->GetFontMetric().GetInternalLeading(); + tools::Long nDelta = pWindow->GetFontMetric().GetInternalLeading(); if (nDelta == 0) { // this value approx. fits a Leading of 80 at a // Fontheight of 422 (12pt) @@ -234,7 +234,7 @@ SmRect::SmRect(const OutputDevice &rDev, const SmFormat *pFormat, if (nItalicRightSpace < 0 && !bAllowSmaller) nItalicRightSpace = 0; - long nDist = 0; + tools::Long nDist = 0; if (pFormat) nDist = (rDev.GetFont().GetFontSize().Height() * pFormat->GetDistance(DIS_ORNAMENTSIZE)) / 100; @@ -264,7 +264,7 @@ SmRect::SmRect(const OutputDevice &rDev, const SmFormat *pFormat, } -SmRect::SmRect(long nWidth, long nHeight) +SmRect::SmRect(tools::Long nWidth, tools::Long nHeight) // this constructor should never be used for anything textlike because // it will not provide useful values for baseline, AlignT and AlignB! // It's purpose is to get a 'SmRect' for the horizontal line in fractions @@ -284,7 +284,7 @@ SmRect::SmRect(long nWidth, long nHeight) } -void SmRect::SetLeft(long nLeft) +void SmRect::SetLeft(tools::Long nLeft) { if (nLeft <= GetRight()) { aSize.setWidth( GetRight() - nLeft + 1 ); @@ -293,21 +293,21 @@ void SmRect::SetLeft(long nLeft) } -void SmRect::SetRight(long nRight) +void SmRect::SetRight(tools::Long nRight) { if (nRight >= GetLeft()) aSize.setWidth( nRight - GetLeft() + 1 ); } -void SmRect::SetBottom(long nBottom) +void SmRect::SetBottom(tools::Long nBottom) { if (nBottom >= GetTop()) aSize.setHeight( nBottom - GetTop() + 1 ); } -void SmRect::SetTop(long nTop) +void SmRect::SetTop(tools::Long nTop) { if (nTop <= GetBottom()) { aSize.setHeight( GetBottom() - nTop + 1 ); @@ -321,7 +321,7 @@ void SmRect::Move(const Point &rPosition) { aTopLeft += rPosition; - long nDelta = rPosition.Y(); + tools::Long nDelta = rPosition.Y(); nBaseline += nDelta; nAlignT += nDelta; nAlignM += nDelta; @@ -428,14 +428,14 @@ void SmRect::Union(const SmRect &rRect) if (rRect.IsEmpty()) return; - long nL = rRect.GetLeft(), + tools::Long nL = rRect.GetLeft(), nR = rRect.GetRight(), nT = rRect.GetTop(), nB = rRect.GetBottom(), nGT = rRect.nGlyphTop, nGB = rRect.nGlyphBottom; if (!IsEmpty()) - { long nTmp; + { tools::Long nTmp; if ((nTmp = GetLeft()) < nL) nL = nTmp; @@ -469,7 +469,7 @@ SmRect & SmRect::ExtendBy(const SmRect &rRect, RectCopyMBL eCopyMode) { // get some values used for (italic) spaces adaptation // ! (need to be done before changing current SmRect) ! - long nL = std::min(GetItalicLeft(), rRect.GetItalicLeft()), + tools::Long nL = std::min(GetItalicLeft(), rRect.GetItalicLeft()), nR = std::max(GetItalicRight(), rRect.GetItalicRight()); Union(rRect); @@ -511,7 +511,7 @@ SmRect & SmRect::ExtendBy(const SmRect &rRect, RectCopyMBL eCopyMode) void SmRect::ExtendBy(const SmRect &rRect, RectCopyMBL eCopyMode, - long nNewAlignM) + tools::Long nNewAlignM) // as 'ExtendBy' but sets AlignM value to 'nNewAlignM'. // (this version will be used in 'SmBinVerNode' to provide means to // align eg "{a over b} over c" correctly where AlignM should not @@ -531,7 +531,7 @@ SmRect & SmRect::ExtendBy(const SmRect &rRect, RectCopyMBL eCopyMode, // (this is used in 'SmSupSubNode' where the sub-/supscripts shouldn't // be allowed to modify these values.) { - long nOldAlignT = GetAlignT(), + tools::Long nOldAlignT = GetAlignT(), nOldAlignM = GetAlignM(), nOldAlignB = GetAlignB(), nOldBaseline = nBaseline; //! depends not on 'HasBaseline' @@ -551,7 +551,7 @@ SmRect & SmRect::ExtendBy(const SmRect &rRect, RectCopyMBL eCopyMode, } -long SmRect::OrientedDist(const Point &rPoint) const +tools::Long SmRect::OrientedDist(const Point &rPoint) const // return oriented distance of rPoint to the current rectangle, // especially the return value is <= 0 iff the point is inside the // rectangle. @@ -588,7 +588,7 @@ long SmRect::OrientedDist(const Point &rPoint) const // build distance vector Point aDist (aRef - rPoint); - long nAbsX = labs(aDist.X()), + tools::Long nAbsX = labs(aDist.X()), nAbsY = labs(aDist.Y()); return bIsInside ? - std::min(nAbsX, nAbsY) : std::max (nAbsX, nAbsY); diff --git a/starmath/source/scrwin.cxx b/starmath/source/scrwin.cxx index 110338a05207..596ed799424e 100644 --- a/starmath/source/scrwin.cxx +++ b/starmath/source/scrwin.cxx @@ -96,7 +96,7 @@ Size ScrollableWindow::GetOutputSizePixel() const { Size aSz( Window::GetOutputSizePixel() ); - long nTmp = GetSettings().GetStyleSettings().GetScrollBarSize(); + tools::Long nTmp = GetSettings().GetStyleSettings().GetScrollBarSize(); if ( aHScroll->IsVisible() ) aSz.AdjustHeight( -nTmp ); if ( aVScroll->IsVisible() ) @@ -134,7 +134,7 @@ void ScrollableWindow::Resize() Size aOutPixSz = Window::GetOutputSizePixel(); // determine the size of the output-area and if we need scrollbars - const long nScrSize = GetSettings().GetStyleSettings().GetScrollBarSize(); + const tools::Long nScrSize = GetSettings().GetStyleSettings().GetScrollBarSize(); bool bVVisible = false; // by default no vertical-ScrollBar bool bHVisible = false; // by default no horizontal-ScrollBar bool bChanged; // determines if a visiblility was changed @@ -270,7 +270,7 @@ void ScrollableWindow::SetTotalSize( const Size& rNewSize ) } -void ScrollableWindow::Scroll( long nDeltaX, long nDeltaY, ScrollFlags ) +void ScrollableWindow::Scroll( tools::Long nDeltaX, tools::Long nDeltaY, ScrollFlags ) { // get the delta in pixel Size aDeltaPix( LogicToPixel( Size(nDeltaX, nDeltaY) ) ); diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index bb46211914e3..623fad785844 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -1023,10 +1023,10 @@ void SAL_CALL SmModel::render( { aPrtPaperSize = lcl_GuessPaperSize(); // factors from Windows DIN A4 - aOutputSize = Size( static_cast<long>(aPrtPaperSize.Width() * 0.941), - static_cast<long>(aPrtPaperSize.Height() * 0.961)); - aPrtPageOffset = Point( static_cast<long>(aPrtPaperSize.Width() * 0.0250), - static_cast<long>(aPrtPaperSize.Height() * 0.0214)); + aOutputSize = Size( static_cast<tools::Long>(aPrtPaperSize.Width() * 0.941), + static_cast<tools::Long>(aPrtPaperSize.Height() * 0.961)); + aPrtPageOffset = Point( static_cast<tools::Long>(aPrtPaperSize.Width() * 0.0250), + static_cast<tools::Long>(aPrtPaperSize.Height() * 0.0214)); } tools::Rectangle OutputRect( Point(), aOutputSize ); diff --git a/starmath/source/utility.cxx b/starmath/source/utility.cxx index 62e0b0294afd..7012004bea94 100644 --- a/starmath/source/utility.cxx +++ b/starmath/source/utility.cxx @@ -208,7 +208,7 @@ void SmFace::SetSize(const Size& rSize) } -long SmFace::GetBorderWidth() const +tools::Long SmFace::GetBorderWidth() const { if (nBorderWidth < 0) return GetDefaultBorderWidth(); @@ -230,8 +230,8 @@ SmFace & operator *= (SmFace &rFace, const Fraction &rFrac) // It's main use is to make scaling fonts look easier. { const Size &rFaceSize = rFace.GetFontSize(); - rFace.SetSize(Size(long(rFaceSize.Width() * rFrac), - long(rFaceSize.Height() * rFrac))); + rFace.SetSize(Size(tools::Long(rFaceSize.Width() * rFrac), + tools::Long(rFaceSize.Height() * rFrac))); return rFace; } diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 43132079dd16..82bd312062c6 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -601,7 +601,7 @@ void SmGraphicWindow::ZoomToFitInWindow() if (!aSize.IsEmpty()) { - long nVal = std::min ((85 * aWindowSize.Width()) / aSize.Width(), + tools::Long nVal = std::min ((85 * aWindowSize.Width()) / aSize.Width(), (85 * aWindowSize.Height()) / aSize.Height()); SetZoom ( sal::static_int_cast< sal_uInt16 >(nVal) ); } @@ -913,7 +913,7 @@ void SmViewShell::QueryObjAreaPixel( tools::Rectangle& rRect ) const void SmViewShell::SetZoomFactor( const Fraction &rX, const Fraction &rY ) { const Fraction &rFrac = std::min(rX, rY); - GetGraphicWindow().SetZoom(sal::static_int_cast<sal_uInt16>(long(rFrac * Fraction( 100, 1 )))); + GetGraphicWindow().SetZoom(sal::static_int_cast<sal_uInt16>(tools::Long(rFrac * Fraction( 100, 1 )))); //To avoid rounding errors base class regulates crooked values too //if necessary @@ -923,7 +923,7 @@ void SmViewShell::SetZoomFactor( const Fraction &rX, const Fraction &rY ) Size SmViewShell::GetTextLineSize(OutputDevice const & rDevice, const OUString& rLine) { Size aSize(rDevice.GetTextWidth(rLine), rDevice.GetTextHeight()); - const long nTabPos = rLine.isEmpty() ? 0 : rDevice.approximate_digit_width() * 8; + const tools::Long nTabPos = rLine.isEmpty() ? 0 : rDevice.approximate_digit_width() * 8; if (nTabPos) { @@ -943,7 +943,7 @@ Size SmViewShell::GetTextLineSize(OutputDevice const & rDevice, const OUString& return aSize; } -Size SmViewShell::GetTextSize(OutputDevice const & rDevice, const OUString& rText, long MaxWidth) +Size SmViewShell::GetTextSize(OutputDevice const & rDevice, const OUString& rText, tools::Long MaxWidth) { Size aSize; Size aTextSize; @@ -1005,7 +1005,7 @@ Size SmViewShell::GetTextSize(OutputDevice const & rDevice, const OUString& rTex void SmViewShell::DrawTextLine(OutputDevice& rDevice, const Point& rPosition, const OUString& rLine) { Point aPoint(rPosition); - const long nTabPos = rLine.isEmpty() ? 0 : rDevice.approximate_digit_width() * 8; + const tools::Long nTabPos = rLine.isEmpty() ? 0 : rDevice.approximate_digit_width() * 8; if (nTabPos) { @@ -1197,8 +1197,8 @@ void SmViewShell::Impl_Print(OutputDevice &rOutDev, const SmPrintUIOptions &rPri Size OutputSize (rOutDev.LogicToPixel(Size(aOutRect.GetWidth(), aOutRect.GetHeight()), MapMode(MapUnit::Map100thMM))); Size GraphicSize (rOutDev.LogicToPixel(aSize, MapMode(MapUnit::Map100thMM))); - sal_uInt16 nZ = sal::static_int_cast<sal_uInt16>(std::min(long(Fraction(OutputSize.Width() * 100, GraphicSize.Width())), - long(Fraction(OutputSize.Height() * 100, GraphicSize.Height())))); + sal_uInt16 nZ = sal::static_int_cast<sal_uInt16>(std::min(tools::Long(Fraction(OutputSize.Width() * 100, GraphicSize.Width())), + tools::Long(Fraction(OutputSize.Height() * 100, GraphicSize.Height())))); nZ -= 10; Fraction aFraction (std::max(MINZOOM, std::min(MAXZOOM, nZ)), 100); @@ -2020,8 +2020,8 @@ void SmViewShell::ZoomByItemSet(const SfxItemSet *pSet) Size OutputSize(pPrinter->LogicToPixel(Size(OutputRect.GetWidth(), OutputRect.GetHeight()), aMap)); Size GraphicSize(pPrinter->LogicToPixel(GetDoc()->GetSize(), aMap)); - sal_uInt16 nZ = sal::static_int_cast<sal_uInt16>(std::min(long(Fraction(OutputSize.Width() * 100, GraphicSize.Width())), - long(Fraction(OutputSize.Height() * 100, GraphicSize.Height())))); + sal_uInt16 nZ = sal::static_int_cast<sal_uInt16>(std::min(tools::Long(Fraction(OutputSize.Width() * 100, GraphicSize.Width())), + tools::Long(Fraction(OutputSize.Height() * 100, GraphicSize.Height())))); mpGraphic->SetZoom (nZ); break; } diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx index b1a1798247c1..3704abc18c32 100644 --- a/starmath/source/visitors.cxx +++ b/starmath/source/visitors.cxx @@ -179,7 +179,7 @@ SmCaretDrawingVisitor::SmCaretDrawingVisitor( OutputDevice& rDevice, void SmCaretDrawingVisitor::Visit( SmTextNode* pNode ) { - long i = maPos.nIndex; + tools::Long i = maPos.nIndex; mrDev.SetFont( pNode->GetFont( ) ); @@ -187,11 +187,11 @@ void SmCaretDrawingVisitor::Visit( SmTextNode* pNode ) SmNode* pLine = SmCursor::FindTopMostNodeInLine( pNode ); //Find coordinates - long left = pNode->GetLeft( ) + mrDev.GetTextWidth( pNode->GetText( ), 0, i ) + maOffset.X( ); - long top = pLine->GetTop( ) + maOffset.Y( ); - long height = pLine->GetHeight( ); - long left_line = pLine->GetLeft( ) + maOffset.X( ); - long right_line = pLine->GetRight( ) + maOffset.X( ); + tools::Long left = pNode->GetLeft( ) + mrDev.GetTextWidth( pNode->GetText( ), 0, i ) + maOffset.X( ); + tools::Long top = pLine->GetTop( ) + maOffset.Y( ); + tools::Long height = pLine->GetHeight( ); + tools::Long left_line = pLine->GetLeft( ) + maOffset.X( ); + tools::Long right_line = pLine->GetRight( ) + maOffset.X( ); //Set color mrDev.SetLineColor( COL_BLACK ); @@ -215,11 +215,11 @@ void SmCaretDrawingVisitor::DefaultVisit( SmNode* pNode ) SmNode* pLine = SmCursor::FindTopMostNodeInLine( pNode ); //Find coordinates - long left = pNode->GetLeft( ) + maOffset.X( ) + ( maPos.nIndex == 1 ? pNode->GetWidth( ) : 0 ); - long top = pLine->GetTop( ) + maOffset.Y( ); - long height = pLine->GetHeight( ); - long left_line = pLine->GetLeft( ) + maOffset.X( ); - long right_line = pLine->GetRight( ) + maOffset.X( ); + tools::Long left = pNode->GetLeft( ) + maOffset.X( ) + ( maPos.nIndex == 1 ? pNode->GetWidth( ) : 0 ); + tools::Long top = pLine->GetTop( ) + maOffset.Y( ); + tools::Long height = pLine->GetHeight( ); + tools::Long left_line = pLine->GetLeft( ) + maOffset.X( ); + tools::Long right_line = pLine->GetRight( ) + maOffset.X( ); //Set color mrDev.SetLineColor( COL_BLACK ); @@ -244,14 +244,14 @@ void SmCaretPos2LineVisitor::Visit( SmTextNode* pNode ) //Save device state mpDev->Push( PushFlags::FONT | PushFlags::TEXTCOLOR ); - long i = maPos.nIndex; + tools::Long i = maPos.nIndex; mpDev->SetFont( pNode->GetFont( ) ); //Find coordinates - long left = pNode->GetLeft( ) + mpDev->GetTextWidth( pNode->GetText( ), 0, i ); - long top = pNode->GetTop( ); - long height = pNode->GetHeight( ); + tools::Long left = pNode->GetLeft( ) + mpDev->GetTextWidth( pNode->GetText( ), 0, i ); + tools::Long top = pNode->GetTop( ); + tools::Long height = pNode->GetHeight( ); maLine = SmCaretLine( left, top, height ); @@ -408,8 +408,8 @@ void SmDrawingVisitor::Visit( SmRootSymbolNode* pNode ) // _unscaled_ font height to be used, we use that to calculate the // bar height. Thus it is independent of the arguments height. // ( see display of sqrt QQQ versus sqrt stack{Q#Q#Q#Q} ) - long nBarHeight = pNode->GetWidth( ) * 7 / 100; - long nBarWidth = pNode->GetBodyWidth( ) + pNode->GetBorderWidth( ); + tools::Long nBarHeight = pNode->GetWidth( ) * 7 / 100; + tools::Long nBarWidth = pNode->GetBodyWidth( ) + pNode->GetBorderWidth( ); Point aBarOffset( pNode->GetWidth( ), +pNode->GetBorderWidth( ) ); Point aBarPos( maPosition + aBarOffset ); @@ -429,7 +429,7 @@ void SmDrawingVisitor::Visit( SmPolyLineNode* pNode ) if ( pNode->IsPhantom( ) ) return; - long nBorderwidth = pNode->GetFont( ).GetBorderWidth( ); + tools::Long nBorderwidth = pNode->GetFont( ).GetBorderWidth( ); LineInfo aInfo; aInfo.SetWidth( pNode->GetWidth( ) - 2 * nBorderwidth ); @@ -666,14 +666,14 @@ void SmSetSelectionVisitor::VisitCompositionNode( SmStructureNode* pNode ) } void SmSetSelectionVisitor::Visit( SmTextNode* pNode ) { - long i1 = -1, + tools::Long i1 = -1, i2 = -1; if( maStartPos.pSelectedNode == pNode ) i1 = maStartPos.nIndex; if( maEndPos.pSelectedNode == pNode ) i2 = maEndPos.nIndex; - long start, end; + tools::Long start, end; pNode->SetSelected(true); if( i1 != -1 && i2 != -1 ) { start = std::min(i1, i2); @@ -1901,10 +1901,10 @@ void SmSelectionDrawingVisitor::Visit( SmTextNode* pNode ) mrDev.SetFont( pNode->GetFont( ) ); Point Position = pNode->GetTopLeft( ); - long left = Position.getX( ) + mrDev.GetTextWidth( pNode->GetText( ), 0, pNode->GetSelectionStart( ) ); - long right = Position.getX( ) + mrDev.GetTextWidth( pNode->GetText( ), 0, pNode->GetSelectionEnd( ) ); - long top = Position.getY( ); - long bottom = top + pNode->GetHeight( ); + tools::Long left = Position.getX( ) + mrDev.GetTextWidth( pNode->GetText( ), 0, pNode->GetSelectionStart( ) ); + tools::Long right = Position.getX( ) + mrDev.GetTextWidth( pNode->GetText( ), 0, pNode->GetSelectionEnd( ) ); + tools::Long top = Position.getY( ); + tools::Long bottom = top + pNode->GetHeight( ); tools::Rectangle rect( left, top, right, bottom ); ExtendSelectionArea( rect ); |