diff options
author | Noel <noelgrandin@gmail.com> | 2020-10-21 15:30:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-10-22 08:08:05 +0200 |
commit | e25fd7782ad04dc363b4265e1bd08d6e092b50c5 (patch) | |
tree | 1dd202549adbc1ed7dbe17e5a81abbe408086e85 /lotuswordpro | |
parent | 180dd91c189de0bf03d5062e33c20da94c5d35d9 (diff) |
long->tools::Long in hwpfilter..oox
Change-Id: I9ab8876aac7b2f8b488db6dfa9c6fd0cecd2238b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104626
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'lotuswordpro')
-rw-r--r-- | lotuswordpro/inc/localtime.hxx | 22 | ||||
-rw-r--r-- | lotuswordpro/source/filter/bencont.cxx | 2 | ||||
-rw-r--r-- | lotuswordpro/source/filter/bento.hxx | 2 | ||||
-rw-r--r-- | lotuswordpro/source/filter/explode.cxx | 2 | ||||
-rw-r--r-- | lotuswordpro/source/filter/localtime.cxx | 38 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpgrfobj.hxx | 2 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpnotes.cxx | 2 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpoleobject.hxx | 4 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx | 10 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpsdwrect.cxx | 38 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpsdwrect.hxx | 7 |
11 files changed, 66 insertions, 63 deletions
diff --git a/lotuswordpro/inc/localtime.hxx b/lotuswordpro/inc/localtime.hxx index 1722b60d3293..9149ada7a437 100644 --- a/lotuswordpro/inc/localtime.hxx +++ b/lotuswordpro/inc/localtime.hxx @@ -56,16 +56,18 @@ #ifndef INCLUDED_LOTUSWORDPRO_INC_LOCALTIME_HXX #define INCLUDED_LOTUSWORDPRO_INC_LOCALTIME_HXX +#include <tools/long.hxx> + struct LtTm { - long tm_sec; /* seconds after the minute - [0,59] */ - long tm_min; /* minutes after the hour - [0,59] */ - long tm_hour; /* hours since midnight - [0,23] */ - long tm_mday; /* day of the month - [1,31] */ - long tm_mon; /* months since January - [0,11] */ - long tm_year; /* years since 1900 */ - long tm_wday; /* days since Sunday - [0,6] */ - long tm_yday; /* days since January 1 - [0,365] */ + tools::Long tm_sec; /* seconds after the minute - [0,59] */ + tools::Long tm_min; /* minutes after the hour - [0,59] */ + tools::Long tm_hour; /* hours since midnight - [0,23] */ + tools::Long tm_mday; /* day of the month - [1,31] */ + tools::Long tm_mon; /* months since January - [0,11] */ + tools::Long tm_year; /* years since 1900 */ + tools::Long tm_wday; /* days since Sunday - [0,6] */ + tools::Long tm_yday; /* days since January 1 - [0,365] */ LtTm() : tm_sec(0) , tm_min(0) @@ -78,8 +80,8 @@ struct LtTm { } }; -bool LtgGmTime(long rtime,LtTm& rtm); -bool LtgLocalTime(long rtime,LtTm& rtm); +bool LtgGmTime(tools::Long rtime,LtTm& rtm); +bool LtgLocalTime(tools::Long rtime,LtTm& rtm); #endif diff --git a/lotuswordpro/source/filter/bencont.cxx b/lotuswordpro/source/filter/bencont.cxx index 459467c1a02f..a7d1a5727875 100644 --- a/lotuswordpro/source/filter/bencont.cxx +++ b/lotuswordpro/source/filter/bencont.cxx @@ -201,7 +201,7 @@ void LtcBenContainer::SeekToPosition(BenContainerPos Pos) * Seek to position compare to end of bento file * @param position in container file from end */ -void LtcBenContainer::SeekFromEnd(long Offset) +void LtcBenContainer::SeekFromEnd(tools::Long Offset) { cpStream->Seek(STREAM_SEEK_TO_END); cpStream->SeekRel(Offset); diff --git a/lotuswordpro/source/filter/bento.hxx b/lotuswordpro/source/filter/bento.hxx index 68850985b988..b506c525af4b 100644 --- a/lotuswordpro/source/filter/bento.hxx +++ b/lotuswordpro/source/filter/bento.hxx @@ -212,7 +212,7 @@ public: // Internal methods size_t* pAmtRead); BenError ReadKnownSize(void * pBuffer, size_t Amt); void SeekToPosition(BenContainerPos Pos); - void SeekFromEnd(long Offset); + void SeekFromEnd(tools::Long Offset); void SetNextAvailObjectID(BenObjectID ID) { cNextAvailObjectID = ID; } CUtList& GetObjects() { return cObjects; } diff --git a/lotuswordpro/source/filter/explode.cxx b/lotuswordpro/source/filter/explode.cxx index ab82f3380b23..359aab5f36cd 100644 --- a/lotuswordpro/source/filter/explode.cxx +++ b/lotuswordpro/source/filter/explode.cxx @@ -309,7 +309,7 @@ sal_Int32 Decompression::explode() m_pOutStream->Flush(); // point back to copy position and read bytes - m_pOutStream->SeekRel(-static_cast<long>(distance)); + m_pOutStream->SeekRel(-static_cast<tools::Long>(distance)); sal_uInt8 sTemp[MAXWIN]; sal_uInt32 nRead = std::min(distance, Length); m_pOutStream->ReadBytes(sTemp, nRead); diff --git a/lotuswordpro/source/filter/localtime.cxx b/lotuswordpro/source/filter/localtime.cxx index 9532cbbdcba8..f33e3a82b67b 100644 --- a/lotuswordpro/source/filter/localtime.cxx +++ b/lotuswordpro/source/filter/localtime.cxx @@ -58,16 +58,16 @@ #include <unicode/timezone.h> #include <memory> -const long DAY_SEC =24 * 60 * 60; -const long YEAR_SEC = 365 * DAY_SEC; -const long FOURYEAR_SEC = 4 * YEAR_SEC + DAY_SEC; +const tools::Long DAY_SEC =24 * 60 * 60; +const tools::Long YEAR_SEC = 365 * DAY_SEC; +const tools::Long FOURYEAR_SEC = 4 * YEAR_SEC + DAY_SEC; #ifndef LONG_MAX const long LONG_MAX=2147483647; #endif //01-01-70 was a Thursday -const long BASE_DOW = 4; +const tools::Long BASE_DOW = 4; -bool LtgGmTime(long rtime,LtTm& rtm) +bool LtgGmTime(tools::Long rtime,LtTm& rtm) { if (rtime < 0) { @@ -76,9 +76,9 @@ bool LtgGmTime(long rtime,LtTm& rtm) //is-current-year-a-leap-year flag int islpyr = 0; - long tmptim; - long caltim = rtime; - tmptim = static_cast<long>(caltim / FOURYEAR_SEC); + tools::Long tmptim; + tools::Long caltim = rtime; + tmptim = static_cast<tools::Long>(caltim / FOURYEAR_SEC); caltim -= tmptim * FOURYEAR_SEC; //Determine which year of the interval @@ -121,21 +121,21 @@ bool LtgGmTime(long rtime,LtTm& rtm) //Determine days since January 1 (0 - 365). This is the tm_yday value. //Leave caltim with number of elapsed seconds in that day. - rtm.tm_yday = static_cast<long>(caltim / DAY_SEC); + rtm.tm_yday = static_cast<tools::Long>(caltim / DAY_SEC); caltim -= rtm.tm_yday * DAY_SEC; //Determine months since January (0 - 11) and day of month (1 - 31) - long const * mdays; + tools::Long const * mdays; if ( islpyr ) { - static long const lpdays[] = + static tools::Long const lpdays[] = {-1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}; mdays = lpdays; } else { - static long const days[] = + static tools::Long const days[] = {-1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364}; mdays = days; } @@ -148,16 +148,16 @@ bool LtgGmTime(long rtime,LtTm& rtm) //Determine days since Sunday (0 - 6) - rtm.tm_wday = (static_cast<long>(rtime / DAY_SEC) + BASE_DOW) % 7; + rtm.tm_wday = (static_cast<tools::Long>(rtime / DAY_SEC) + BASE_DOW) % 7; //Determine hours since midnight (0 - 23), minutes after the hour //(0 - 59), and seconds after the minute (0 - 59). - rtm.tm_hour = static_cast<long>(caltim / 3600); + rtm.tm_hour = static_cast<tools::Long>(caltim / 3600); caltim -= rtm.tm_hour * 3600; - rtm.tm_min = static_cast<long>(caltim / 60); - rtm.tm_sec = static_cast<long>(caltim - (rtm.tm_min) * 60); + rtm.tm_min = static_cast<tools::Long>(caltim / 60); + rtm.tm_sec = static_cast<tools::Long>(caltim - (rtm.tm_min) * 60); //adjust year & month rtm.tm_year += 1900; @@ -166,7 +166,7 @@ bool LtgGmTime(long rtime,LtTm& rtm) return true; }; -bool LtgLocalTime(long rtime,LtTm& rtm) +bool LtgLocalTime(tools::Long rtime,LtTm& rtm) { if (rtime < 0) { @@ -176,9 +176,9 @@ bool LtgLocalTime(long rtime,LtTm& rtm) if ((rtime > 3 * DAY_SEC)&&(rtime < LONG_MAX - 3 * DAY_SEC)) { std::unique_ptr<icu::TimeZone> pLocalZone(icu::TimeZone::createDefault()); - long offset = (pLocalZone->getRawOffset())/1000; + tools::Long offset = (pLocalZone->getRawOffset())/1000; pLocalZone.reset(); - long ltime = rtime + offset; + tools::Long ltime = rtime + offset; return LtgGmTime(ltime,rtm); } return false; diff --git a/lotuswordpro/source/filter/lwpgrfobj.hxx b/lotuswordpro/source/filter/lwpgrfobj.hxx index 49e8d514b295..406f5883d6bb 100644 --- a/lotuswordpro/source/filter/lwpgrfobj.hxx +++ b/lotuswordpro/source/filter/lwpgrfobj.hxx @@ -119,7 +119,7 @@ public: static void GetBentoNamebyID(LwpObjectID const & rMyID, std::string& rName); std::vector<sal_uInt8> GetRawGrafData(); sal_uInt32 GetGrafData(std::unique_ptr<sal_uInt8[]>& pGrafData); - void GetGrafOrgSize(long& rWidth, long& rHeight) { rWidth = m_Cache.Width; rHeight = m_Cache.Height; } + void GetGrafOrgSize(tools::Long& rWidth, tools::Long& rHeight) { rWidth = m_Cache.Width; rHeight = m_Cache.Height; } void GetGrafOrgSize(double& rWidth, double& rHeight) override; sal_Int16 IsLinked() const { return m_bIsLinked;} diff --git a/lotuswordpro/source/filter/lwpnotes.cxx b/lotuswordpro/source/filter/lwpnotes.cxx index db25f3e3afb4..b82bd871733f 100644 --- a/lotuswordpro/source/filter/lwpnotes.cxx +++ b/lotuswordpro/source/filter/lwpnotes.cxx @@ -105,7 +105,7 @@ void LwpFribNote::XFConvert(XFContentContainer* pCont) XFAnnotation* pXFNote = new XFAnnotation; pXFNote->SetAuthor(pLayout->GetAuthor()); LtTm aTm; - long nTime = pLayout->GetTime(); + tools::Long nTime = pLayout->GetTime(); if(LtgLocalTime(nTime, aTm)) { pXFNote->SetDate(LwpTools::DateTimeToOUString(aTm)); diff --git a/lotuswordpro/source/filter/lwpoleobject.hxx b/lotuswordpro/source/filter/lwpoleobject.hxx index 177bf3ef1eed..d9bb95d56710 100644 --- a/lotuswordpro/source/filter/lwpoleobject.hxx +++ b/lotuswordpro/source/filter/lwpoleobject.hxx @@ -70,8 +70,8 @@ typedef struct tagAFID_CACHE { unsigned long LinkedFileSize; /* 0 if not linked */ unsigned long LinkedFileTime; /* 0 if not linked */ - long Width; /* -1 if not present */ - long Height; /* -1 if not present */ + tools::Long Width; /* -1 if not present */ + tools::Long Height; /* -1 if not present */ tagAFID_CACHE() : LinkedFileSize(0) , LinkedFileTime(0) diff --git a/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx b/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx index 5c8d9941344a..3b8e8accad33 100644 --- a/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx +++ b/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx @@ -127,7 +127,7 @@ void LwpSdwGroupLoaderV0102::BeginDrawObjects(std::vector< rtl::Reference<XFFram if (pMyScale && pFrameGeo) { // original drawing size - long nWidth = 0, nHeight = 0; + tools::Long nWidth = 0, nHeight = 0; m_pGraphicObj->GetGrafOrgSize(nWidth, nHeight); double fGrafOrgWidth = static_cast<double>(nWidth)/TWIPS_PER_CM; double fGrafOrgHeight = static_cast<double>(nHeight)/TWIPS_PER_CM; @@ -187,10 +187,10 @@ void LwpSdwGroupLoaderV0102::BeginDrawObjects(std::vector< rtl::Reference<XFFram // placement: centered if (xMyFrameLayout->GetScaleCenter()) { - tools::Rectangle aBoundRect(static_cast<long>(left*m_aTransformData.fScaleX + fLeftMargin), - static_cast<long>(top * m_aTransformData.fScaleY + fTopMargin), - static_cast<long>(right * m_aTransformData.fScaleX), - static_cast<long>(bottom * m_aTransformData.fScaleY)); + tools::Rectangle aBoundRect(static_cast<tools::Long>(left*m_aTransformData.fScaleX + fLeftMargin), + static_cast<tools::Long>(top * m_aTransformData.fScaleY + fTopMargin), + static_cast<tools::Long>(right * m_aTransformData.fScaleX), + static_cast<tools::Long>(bottom * m_aTransformData.fScaleY)); Point aCenter = aBoundRect.Center(); double fNewCenterX = (double(left)/TWIPS_PER_CM + fFrameWidth/*-fOffsetX*/) / 2; diff --git a/lotuswordpro/source/filter/lwpsdwrect.cxx b/lotuswordpro/source/filter/lwpsdwrect.cxx index 353d8dd38544..3ec27ccfbc42 100644 --- a/lotuswordpro/source/filter/lwpsdwrect.cxx +++ b/lotuswordpro/source/filter/lwpsdwrect.cxx @@ -87,8 +87,8 @@ SdwRectangle::SdwRectangle(const Point& rPt0, const Point& rPt1, **************************************************************************/ Point SdwRectangle::GetRectCenter() const { - long nX = static_cast<long>(static_cast<double>(m_nRectCorner[0].X() + m_nRectCorner[2].X())/2 + 0.5); - long nY = static_cast<long>(static_cast<double>(m_nRectCorner[0].Y() + m_nRectCorner[2].Y())/2 + 0.5); + tools::Long nX = static_cast<tools::Long>(static_cast<double>(m_nRectCorner[0].X() + m_nRectCorner[2].X())/2 + 0.5); + tools::Long nY = static_cast<tools::Long>(static_cast<double>(m_nRectCorner[0].Y() + m_nRectCorner[2].Y())/2 + 0.5); return Point(nX, nY); } @@ -96,27 +96,27 @@ Point SdwRectangle::GetRectCenter() const * @short: Calculate width of the rectangle. * @return: rectangle width. **************************************************************************/ -long SdwRectangle::GetWidth() const +tools::Long SdwRectangle::GetWidth() const { - long nX0 = m_nRectCorner[0].X(); - long nY0 = m_nRectCorner[0].Y(); - long nX1 = m_nRectCorner[1].X(); - long nY1 = m_nRectCorner[1].Y(); + tools::Long nX0 = m_nRectCorner[0].X(); + tools::Long nY0 = m_nRectCorner[0].Y(); + tools::Long nX1 = m_nRectCorner[1].X(); + tools::Long nY1 = m_nRectCorner[1].Y(); - return static_cast<long>(CalcDistBetween2Points(nX0, nY0, nX1, nY1)); + return static_cast<tools::Long>(CalcDistBetween2Points(nX0, nY0, nX1, nY1)); } /************************************************************************** * @short: Calculate height of the rectangle. * @return: rectangle height. **************************************************************************/ -long SdwRectangle::GetHeight() const +tools::Long SdwRectangle::GetHeight() const { - long nX1 = m_nRectCorner[1].X(); - long nY1 = m_nRectCorner[1].Y(); - long nX2 = m_nRectCorner[2].X(); - long nY2 = m_nRectCorner[2].Y(); + tools::Long nX1 = m_nRectCorner[1].X(); + tools::Long nY1 = m_nRectCorner[1].Y(); + tools::Long nX2 = m_nRectCorner[2].X(); + tools::Long nY2 = m_nRectCorner[2].Y(); - return static_cast<long>(CalcDistBetween2Points(nX1, nY1, nX2, nY2)); + return static_cast<tools::Long>(CalcDistBetween2Points(nX1, nY1, nX2, nY2)); } /************************************************************************** * @short: Calculate coordinate of the original rectangle. @@ -126,12 +126,12 @@ tools::Rectangle SdwRectangle::GetOriginalRect() const { if (m_bRotated) { - long nHeight = GetHeight(); - long nWidth = GetWidth(); + tools::Long nHeight = GetHeight(); + tools::Long nWidth = GetWidth(); Point aCenter = GetRectCenter(); - Point aLT(aCenter.X()-static_cast<long>(static_cast<double>(nWidth)/2+0.5), - aCenter.Y()-static_cast<long>(static_cast<double>(nHeight)/2+0.5)); + Point aLT(aCenter.X()-static_cast<tools::Long>(static_cast<double>(nWidth)/2+0.5), + aCenter.Y()-static_cast<tools::Long>(static_cast<double>(nHeight)/2+0.5)); Point aRB(aLT.X()+nWidth, aLT.Y()+nHeight); return tools::Rectangle(aLT, aRB); @@ -168,7 +168,7 @@ double SdwRectangle::GetRotationAngle() const return -fAngle; } -double SdwRectangle::CalcDistBetween2Points(long nX1, long nY1, long nX2, long nY2) +double SdwRectangle::CalcDistBetween2Points(tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2) { return sqrt(static_cast<double>((nX1-nX2)*(nX1-nX2) + (nY1-nY2)*(nY1-nY2))); } diff --git a/lotuswordpro/source/filter/lwpsdwrect.hxx b/lotuswordpro/source/filter/lwpsdwrect.hxx index 4aefb6a09f88..ec92097f58bd 100644 --- a/lotuswordpro/source/filter/lwpsdwrect.hxx +++ b/lotuswordpro/source/filter/lwpsdwrect.hxx @@ -107,15 +107,16 @@ public: Point GetRectCenter() const; - long GetWidth() const; + tools::Long GetWidth() const; - long GetHeight() const; + tools::Long GetHeight() const; tools::Rectangle GetOriginalRect() const; double GetRotationAngle() const; - static double CalcDistBetween2Points(long nX1, long nY1, long nX2, long nY2); + static double CalcDistBetween2Points(tools::Long nX1, tools::Long nY1, tools::Long nX2, + tools::Long nY2); }; #endif |