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>
This commit is contained in:
Noel
2020-10-22 08:08:05 +02:00
committed by Noel Grandin
parent 180dd91c18
commit e25fd7782a
27 changed files with 117 additions and 106 deletions
+2 -1
View File
@@ -21,6 +21,7 @@
#include <comphelper/newarray.hxx>
#include <unotools/configmgr.hxx>
#include <tools/long.hxx>
#include <assert.h>
@@ -117,7 +118,7 @@ bool FieldCode::Read(HWPFile & hwpf)
// book mark(6)
bool Bookmark::Read(HWPFile & hwpf)
{
long len;
tools::Long len;
hwpf.Read4b(&len, 1);
if (!hwpf.Read2b(dummy))
+1 -1
View File
@@ -2046,7 +2046,7 @@ void HwpReader::makeDrawStyle( HWPDrawingObject * hdo, FBoxStyle * fstyle)
padd("style:wrap", sXML_CDATA, "dynamic");
break;
}
long color;
tools::Long color;
// invisible line
if( hdo->property.line_color > 0xffffff )
{
+1 -1
View File
@@ -190,7 +190,7 @@ MzString &MzString::operator << (int i)
}
MzString &MzString::operator << (long l)
MzString &MzString::operator << (tools::Long l)
{
char str[80];
+2 -1
View File
@@ -23,6 +23,7 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <tools/long.hxx>
/** @name MzString class
@@ -98,7 +99,7 @@ class MzString
MzString &operator << (char);
MzString &operator << (unsigned char c) { return *this<<static_cast<char>(c); }
MzString &operator << (int);
MzString &operator << (long);
MzString &operator << (tools::Long);
MzString &operator << (short i) { return *this<<static_cast<int>(i); }
MzString &operator << (MzString const &);
/* MzString &operator << (MzString *s) { return *this<<*s; }
@@ -20,6 +20,7 @@
#include <osl/mutex.hxx>
#include <rtl/instance.hxx>
#include <rtl/locale.h>
#include <tools/long.hxx>
#include <algorithm>
#include <map>
#include <unordered_set>
@@ -839,7 +840,7 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const
osl::MutexGuard aGuard( theMutex::get());
#if OSL_DEBUG_LEVEL > 0
static long nRunning = 0;
static tools::Long nRunning = 0;
// Entering twice here is ok, which is needed for fallback init in
// getKnowns() in canonicalize() via pImpl->convertBcp47ToLocale() below,
// everything else is suspicious.
+8 -7
View File
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <calendar_hijri.hxx>
#include <tools/long.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
@@ -257,14 +258,14 @@ void
Calendar_hijri::getGregorianDay(sal_Int32 lJulianDay, sal_Int32 *pnDay, sal_Int32 *pnMonth, sal_Int32 *pnYear)
{
/* working variables */
long lFactorA, lFactorB, lFactorC, lFactorD, lFactorE;
tools::Long lFactorA, lFactorB, lFactorC, lFactorD, lFactorE;
/* test whether to adjust for the Gregorian calendar crossover */
if (lJulianDay >= GREGORIAN_CROSSOVER) {
/* calculate a small adjustment */
long lAdjust = static_cast<long>((static_cast<float>(lJulianDay - 1867216) - 0.25) / 36524.25);
tools::Long lAdjust = static_cast<tools::Long>((static_cast<float>(lJulianDay - 1867216) - 0.25) / 36524.25);
lFactorA = lJulianDay + 1 + lAdjust - static_cast<long>(0.25 * lAdjust);
lFactorA = lJulianDay + 1 + lAdjust - static_cast<tools::Long>(0.25 * lAdjust);
} else {
/* no adjustment needed */
@@ -272,12 +273,12 @@ Calendar_hijri::getGregorianDay(sal_Int32 lJulianDay, sal_Int32 *pnDay, sal_Int3
}
lFactorB = lFactorA + 1524;
lFactorC = static_cast<long>(6680.0 + (static_cast<float>(lFactorB - 2439870) - 122.1) / 365.25);
lFactorD = static_cast<long>(365 * lFactorC + (0.25 * lFactorC));
lFactorE = static_cast<long>((lFactorB - lFactorD) / 30.6001);
lFactorC = static_cast<tools::Long>(6680.0 + (static_cast<float>(lFactorB - 2439870) - 122.1) / 365.25);
lFactorD = static_cast<tools::Long>(365 * lFactorC + (0.25 * lFactorC));
lFactorE = static_cast<tools::Long>((lFactorB - lFactorD) / 30.6001);
/* now, pull out the day number */
*pnDay = lFactorB - lFactorD - static_cast<long>(30.6001 * lFactorE);
*pnDay = lFactorB - lFactorD - static_cast<tools::Long>(30.6001 * lFactorE);
/* ...and the month, adjusting it if necessary */
*pnMonth = lFactorE - 1;
+2 -2
View File
@@ -35,7 +35,7 @@
#include <cppuhelper/bootstrap.hxx>
#include <cppuhelper/implbase.hxx>
#include <tools/long.hxx>
#include "LocaleNode.hxx"
@@ -113,7 +113,7 @@ static Reference< XInputStream > createStreamFromFile(
return r;
}
long nLength = ftell( f );
tools::Long nLength = ftell( f );
if (nLength == -1)
{
fprintf(stderr, "failure ftelling %s\n", pcFile);
+15 -14
View File
@@ -24,6 +24,7 @@
#include <sal/macros.h>
#include <rtl/ustring.hxx>
#include <rtl/string.hxx>
#include <tools/long.hxx>
#include <i18nutil/paper.hxx>
@@ -43,8 +44,8 @@ namespace {
struct PageDesc
{
long m_nWidth;
long m_nHeight;
tools::Long m_nWidth;
tools::Long m_nHeight;
const char *m_pPSName;
const char *m_pAltPSName;
};
@@ -52,13 +53,13 @@ struct PageDesc
}
#define PT2MM100( v ) \
long(((v) * 35.27777778) + 0.5)
tools::Long(((v) * 35.27777778) + 0.5)
#define IN2MM100( v ) \
(long(((v) * 2540) + 0.5))
(tools::Long(((v) * 2540) + 0.5))
#define MM2MM100( v ) \
(long((v) * 100))
(tools::Long((v) * 100))
//PostScript Printer Description File Format Specification
//http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf
@@ -171,10 +172,10 @@ void PaperInfo::doSloppyFit()
{
if (i == PAPER_USER) continue;
long lDiffW = labs(aDinTab[i].m_nWidth - m_nPaperWidth);
long lDiffH = labs(aDinTab[i].m_nHeight - m_nPaperHeight);
long lFlipDiffW = labs(aDinTab[i].m_nHeight - m_nPaperWidth);
long lFlipDiffH = labs(aDinTab[i].m_nWidth - m_nPaperHeight);
tools::Long lDiffW = labs(aDinTab[i].m_nWidth - m_nPaperWidth);
tools::Long lDiffH = labs(aDinTab[i].m_nHeight - m_nPaperHeight);
tools::Long lFlipDiffW = labs(aDinTab[i].m_nHeight - m_nPaperWidth);
tools::Long lFlipDiffH = labs(aDinTab[i].m_nWidth - m_nPaperHeight);
if ( (lDiffW < MAXSLOPPY && lDiffH < MAXSLOPPY) ||
(lFlipDiffW < MAXSLOPPY && lFlipDiffH < MAXSLOPPY) )
@@ -196,12 +197,12 @@ bool PaperInfo::sloppyEqual(const PaperInfo &rOther) const
);
}
long PaperInfo::sloppyFitPageDimension(long nDimension)
tools::Long PaperInfo::sloppyFitPageDimension(tools::Long nDimension)
{
for ( size_t i = 0; i < nTabSize; ++i )
{
if (i == PAPER_USER) continue;
long lDiff;
tools::Long lDiff;
lDiff = labs(aDinTab[i].m_nWidth - nDimension);
if ( lDiff < MAXSLOPPY )
@@ -320,8 +321,8 @@ PaperInfo PaperInfo::getSystemDefaultPaper()
//glibc stores sizes as integer mm units, and so is inaccurate.
//To find a standard paper size we calculate the standard paper
//sizes into equally inaccurate mm and compare
long width = (aDinTab[i].m_nWidth + 50) / 100;
long height = (aDinTab[i].m_nHeight + 50) / 100;
tools::Long width = (aDinTab[i].m_nWidth + 50) / 100;
tools::Long height = (aDinTab[i].m_nHeight + 50) / 100;
if (width == w.word/100 && height == h.word/100)
{
@@ -366,7 +367,7 @@ PaperInfo::PaperInfo(Paper eType) : m_eType(eType)
m_nPaperHeight = aDinTab[m_eType].m_nHeight;
}
PaperInfo::PaperInfo(long nPaperWidth, long nPaperHeight)
PaperInfo::PaperInfo(tools::Long nPaperWidth, tools::Long nPaperHeight)
: m_eType(PAPER_USER),
m_nPaperWidth(nPaperWidth),
m_nPaperHeight(nPaperHeight)
+7 -6
View File
@@ -22,6 +22,7 @@
#include <i18nutil/i18nutildllapi.h>
#include <rtl/string.hxx>
#include <tools/long.hxx>
namespace com::sun::star::lang { struct Locale; }
@@ -121,15 +122,15 @@ enum Paper
class I18NUTIL_DLLPUBLIC PaperInfo
{
Paper m_eType;
long m_nPaperWidth; // width in 100thMM
long m_nPaperHeight; // height in 100thMM
tools::Long m_nPaperWidth; // width in 100thMM
tools::Long m_nPaperHeight; // height in 100thMM
public:
PaperInfo(Paper eType);
PaperInfo(long nPaperWidth, long nPaperHeight);
PaperInfo(tools::Long nPaperWidth, tools::Long nPaperHeight);
Paper getPaper() const { return m_eType; }
long getWidth() const { return m_nPaperWidth; }
long getHeight() const { return m_nPaperHeight; }
tools::Long getWidth() const { return m_nPaperWidth; }
tools::Long getHeight() const { return m_nPaperHeight; }
bool sloppyEqual(const PaperInfo &rOther) const;
void doSloppyFit();
@@ -139,7 +140,7 @@ public:
static Paper fromPSName(const OString &rName);
static OString toPSName(Paper eType);
static long sloppyFitPageDimension(long nDimension);
static tools::Long sloppyFitPageDimension(tools::Long nDimension);
};
#endif // INCLUDED_I18NUTIL_PAPER_HXX
+2 -1
View File
@@ -25,6 +25,7 @@
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <osl/endian.h>
#include <tools/long.hxx>
#include <com/sun/star/io/NotConnectedException.hpp>
#include <com/sun/star/io/XObjectInputStream.hpp>
@@ -1093,7 +1094,7 @@ Reference< XPersistObject > OObjectInputStream::readObject()
{
// grow to the right size
Reference< XPersistObject > xEmpty;
m_aPersistVector.insert( m_aPersistVector.end(), static_cast<long>(nId - nSize + 1), xEmpty );
m_aPersistVector.insert( m_aPersistVector.end(), static_cast<tools::Long>(nId - nSize + 1), xEmpty );
}
m_aPersistVector[nId] = xLoadedObj;
+12 -10
View File
@@ -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
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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; }
+1 -1
View File
@@ -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);
+19 -19
View File
@@ -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;
+1 -1
View File
@@ -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;}
+1 -1
View File
@@ -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));
+2 -2
View File
@@ -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)
@@ -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;
+19 -19
View File
@@ -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)));
}
+4 -3
View File
@@ -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
+1 -1
View File
@@ -770,7 +770,7 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe
// When custom shape is rotated, bitmap have to be rotated too.
if(rPropMap.hasProperty(PROP_RotateAngle))
{
long nAngle = rPropMap.getProperty(PROP_RotateAngle).get<long>();
tools::Long nAngle = rPropMap.getProperty(PROP_RotateAngle).get<long>();
xGraphic = lclRotateGraphic(xGraphic, Degree10(nAngle/10) );
}
+1 -1
View File
@@ -142,7 +142,7 @@ void TextParagraph::insertAt(
if( !aioBulletList.hasProperty( PROP_GraphicSize ) && !maRuns.empty()
&& aParaProp.getBulletList().maGraphic.hasValue())
{
long nFirstCharHeightMm = TransformMetric(nCharHeightFirst > 0 ? nCharHeightFirst : 1200, FieldUnit::POINT, FieldUnit::MM);
tools::Long nFirstCharHeightMm = TransformMetric(nCharHeightFirst > 0 ? nCharHeightFirst : 1200, FieldUnit::POINT, FieldUnit::MM);
float fBulletSizeRel = 1.f;
if( aParaProp.getBulletList().mnSize.hasValue() )
fBulletSizeRel = aParaProp.getBulletList().mnSize.get<sal_Int16>() / 100.f;
+3 -3
View File
@@ -2453,7 +2453,7 @@ void DrawingML::WriteParagraphNumbering(const Reference< XPropertySet >& rXPropS
Graphic aGraphic(xGraphic);
if (xGraphic.is() && aGraphic.GetType() != GraphicType::NONE)
{
long nFirstCharHeightMm = TransformMetric(fFirstCharHeight * 100.f, FieldUnit::POINT, FieldUnit::MM);
tools::Long nFirstCharHeightMm = TransformMetric(fFirstCharHeight * 100.f, FieldUnit::POINT, FieldUnit::MM);
float fBulletSizeRel = aGraphicSize.Height / static_cast<float>(nFirstCharHeightMm) / OOX_BULLET_LIST_SCALE_FACTOR;
OUString sRelationId;
@@ -2463,8 +2463,8 @@ void DrawingML::WriteParagraphNumbering(const Reference< XPropertySet >& rXPropS
// Add padding to get the bullet point centered in PPT
Size aDestSize(64, 64);
float fBulletSizeRelX = fBulletSizeRel / aGraphicSize.Height * aGraphicSize.Width;
long nPaddingX = std::max<long>(0, std::lround((aDestSize.Width() - fBulletSizeRelX * aDestSize.Width()) / 2.f));
long nPaddingY = std::lround((aDestSize.Height() - fBulletSizeRel * aDestSize.Height()) / 2.f);
tools::Long nPaddingX = std::max<long>(0, std::lround((aDestSize.Width() - fBulletSizeRelX * aDestSize.Width()) / 2.f));
tools::Long nPaddingY = std::lround((aDestSize.Height() - fBulletSizeRel * aDestSize.Height()) / 2.f);
tools::Rectangle aDestRect(nPaddingX, nPaddingY, aDestSize.Width() - nPaddingX, aDestSize.Height() - nPaddingY);
AlphaMask aMask(aDestSize);
+1 -1
View File
@@ -388,7 +388,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle&
if ( IsWaterMarkShape( m_pSdrObject->GetName() ) )
{
// Watermark need some padding to be compatible with MSO
long nPaddingY = 0;
tools::Long nPaddingY = 0;
const SfxItemSet& rSet = m_pSdrObject->GetMergedItemSet();
if ( const SdrMetricItem* pItem = rSet.GetItem( SDRATTR_TEXT_UPPERDIST ) )
nPaddingY += pItem->GetValue();
+1
View File
@@ -47,6 +47,7 @@ using ::com::sun::star::text::WritingMode;
#include <osl/diagnose.h>
#include <osl/mutex.hxx>
#include <sal/log.hxx>
#include <tools/long.hxx>
#include <oox/token/properties.hxx>
#include <oox/token/propertynames.hxx>
using ::com::sun::star::uno::Any;
+2 -2
View File
@@ -84,8 +84,8 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken
// If the text is not rotated the way the shape wants it already, set the angle.
const sal_Int32 nRotation = nVert == XML_vert270 ? -270 : -90;
if (static_cast<long>(basegfx::rad2deg(fRotate))
!= NormAngle36000(static_cast<long>(nRotation) * 100) / 100)
if (static_cast<tools::Long>(basegfx::rad2deg(fRotate))
!= NormAngle36000(static_cast<tools::Long>(nRotation) * 100) / 100)
{
comphelper::SequenceAsHashMap aCustomShapeGeometry(
xPropertySet->getPropertyValue("CustomShapeGeometry"));