summaryrefslogtreecommitdiff
path: root/sc/source/core
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2020-12-22 15:42:08 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-01-02 15:26:38 +0100
commit11e52fe2979b0947814a49b9c17ec373795cbf8e (patch)
tree48268579f052b7fdfcc2c334fffe8c91d29cb234 /sc/source/core
parent610ceb05025c9c7a9a34dddcb0dac506b8eab441 (diff)
introduce Degree100 strong_int type
Change-Id: I78f837a1340be0ca5c49097f543a481b7b43a632 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108367 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/core')
-rw-r--r--sc/source/core/data/attarray.cxx4
-rw-r--r--sc/source/core/data/attrib.cxx2
-rw-r--r--sc/source/core/data/column2.cxx10
-rw-r--r--sc/source/core/data/docpool.cxx2
-rw-r--r--sc/source/core/data/document.cxx4
-rw-r--r--sc/source/core/data/patattr.cxx22
-rw-r--r--sc/source/core/data/table2.cxx4
-rw-r--r--sc/source/core/tool/autoform.cxx2
8 files changed, 25 insertions, 25 deletions
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index a44f00243ce4..da8490b72f99 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -1355,8 +1355,8 @@ bool ScAttrArray::HasAttrib_Impl(const ScPatternAttr* pPattern, HasAttrFlags nMa
const ScRotateValueItem* pRotate = &pPattern->GetItem( ATTR_ROTATE_VALUE );
// 90 or 270 degrees is former SvxOrientationItem - only look for other values
// (see ScPatternAttr::GetCellOrientation)
- sal_Int32 nAngle = pRotate->GetValue();
- if ( nAngle != 0 && nAngle != 9000 && nAngle != 27000 )
+ Degree100 nAngle = pRotate->GetValue();
+ if ( nAngle && nAngle != 9000_deg100 && nAngle != 27000_deg100 )
bFound = true;
}
if ( nMask & HasAttrFlags::NeedHeight )
diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx
index 1a155a8fa13d..cb39fec0b2f0 100644
--- a/sc/source/core/data/attrib.cxx
+++ b/sc/source/core/data/attrib.cxx
@@ -729,7 +729,7 @@ void ScCondFormatItem::dumpAsXml(xmlTextWriterPtr pWriter) const
xmlTextWriterEndElement(pWriter);
}
-ScRotateValueItem::ScRotateValueItem(sal_Int32 nAngle)
+ScRotateValueItem::ScRotateValueItem(Degree100 nAngle)
: SdrAngleItem(ATTR_ROTATE_VALUE, nAngle)
{
}
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index d3d9910d9326..22d5a16de895 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -211,7 +211,7 @@ tools::Long ScColumn::GetNeededSize(
if ( bWidth && bBreak ) // after determining bAsianVertical (bBreak may be reset)
return 0;
- tools::Long nRotate = 0;
+ Degree100 nRotate(0);
SvxRotateMode eRotMode = SVX_ROTATE_MODE_STANDARD;
if ( eOrient == SvxCellOrientation::Standard )
{
@@ -228,7 +228,7 @@ tools::Long ScColumn::GetNeededSize(
else
eRotMode = pPattern->GetItem(ATTR_ROTATE_MODE).GetValue();
- if ( nRotate == 18000 )
+ if ( nRotate == 18000_deg100 )
eRotMode = SVX_ROTATE_MODE_STANDARD; // no overflow
}
}
@@ -237,7 +237,7 @@ tools::Long ScColumn::GetNeededSize(
{
// ignore orientation/rotation if "repeat" is active
eOrient = SvxCellOrientation::Standard;
- nRotate = 0;
+ nRotate = 0_deg100;
bAsianVertical = false;
}
@@ -301,7 +301,7 @@ tools::Long ScColumn::GetNeededSize(
{
//TODO: take different X/Y scaling into consideration
- double nRealOrient = nRotate * F_PI18000; // nRotate is in 1/100 Grad
+ double nRealOrient = nRotate.get() * F_PI18000; // nRotate is in 1/100 Grad
double nCosAbs = fabs( cos( nRealOrient ) );
double nSinAbs = fabs( sin( nRealOrient ) );
tools::Long nHeight = static_cast<tools::Long>( aSize.Height() * nCosAbs + aSize.Width() * nSinAbs );
@@ -482,7 +482,7 @@ tools::Long ScColumn::GetNeededSize(
//TODO: take different X/Y scaling into consideration
Size aSize( pEngine->CalcTextWidth(), pEngine->GetTextHeight() );
- double nRealOrient = nRotate * F_PI18000; // nRotate is in 1/100 Grad
+ double nRealOrient = nRotate.get() * F_PI18000; // nRotate is in 1/100 Grad
double nCosAbs = fabs( cos( nRealOrient ) );
double nSinAbs = fabs( sin( nRealOrient ) );
tools::Long nHeight = static_cast<tools::Long>( aSize.Height() * nCosAbs + aSize.Width() * nSinAbs );
diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx
index 011b59613689..0a96c3b4ee5d 100644
--- a/sc/source/core/data/docpool.cxx
+++ b/sc/source/core/data/docpool.cxx
@@ -249,7 +249,7 @@ ScDocumentPool::ScDocumentPool()
mvPoolDefaults[ ATTR_VER_JUSTIFY - ATTR_STARTINDEX ] = new SvxVerJustifyItem( SvxCellVerJustify::Standard, ATTR_VER_JUSTIFY);
mvPoolDefaults[ ATTR_VER_JUSTIFY_METHOD - ATTR_STARTINDEX ] = new SvxJustifyMethodItem( SvxCellJustifyMethod::Auto, ATTR_VER_JUSTIFY_METHOD);
mvPoolDefaults[ ATTR_STACKED - ATTR_STARTINDEX ] = new ScVerticalStackCell(false);
- mvPoolDefaults[ ATTR_ROTATE_VALUE - ATTR_STARTINDEX ] = new ScRotateValueItem( 0 );
+ mvPoolDefaults[ ATTR_ROTATE_VALUE - ATTR_STARTINDEX ] = new ScRotateValueItem( 0_deg100 );
mvPoolDefaults[ ATTR_ROTATE_MODE - ATTR_STARTINDEX ] = new SvxRotateModeItem( SVX_ROTATE_MODE_BOTTOM, ATTR_ROTATE_MODE );
mvPoolDefaults[ ATTR_VERTICAL_ASIAN - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_VERTICAL_ASIAN );
// The default for the ATTR_WRITINGDIR cell attribute must by SvxFrameDirection::Environment,
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index cb3212ece075..5bbdd06266ee 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -5184,8 +5184,8 @@ bool ScDocument::HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
{
// 90 or 270 degrees is former SvxOrientationItem - only look for other values
// (see ScPatternAttr::GetCellOrientation)
- sal_Int32 nAngle = static_cast<const ScRotateValueItem*>(pItem)->GetValue();
- if ( nAngle != 0 && nAngle != 9000 && nAngle != 27000 )
+ Degree100 nAngle = static_cast<const ScRotateValueItem*>(pItem)->GetValue();
+ if ( nAngle && nAngle != 9000_deg100 && nAngle != 27000_deg100 )
{
bAnyItem = true;
break;
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 0a3433ba3d25..2f77588165d2 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -165,10 +165,10 @@ SvxCellOrientation ScPatternAttr::GetCellOrientation( const SfxItemSet& rItemSet
}
else
{
- sal_Int32 nAngle = GetItem( ATTR_ROTATE_VALUE, rItemSet, pCondSet ).GetValue();
- if( nAngle == 9000 )
+ Degree100 nAngle = GetItem( ATTR_ROTATE_VALUE, rItemSet, pCondSet ).GetValue();
+ if( nAngle == 9000_deg100 )
eOrient = SvxCellOrientation::BottomUp;
- else if( nAngle == 27000 )
+ else if( nAngle == 27000_deg100 )
eOrient = SvxCellOrientation::TopBottom;
}
@@ -1312,9 +1312,9 @@ const SfxPoolItem& ScPatternAttr::GetItem( sal_uInt16 nSubWhich, const SfxItemSe
// GetRotateVal is tested before ATTR_ORIENTATION
-tools::Long ScPatternAttr::GetRotateVal( const SfxItemSet* pCondSet ) const
+Degree100 ScPatternAttr::GetRotateVal( const SfxItemSet* pCondSet ) const
{
- tools::Long nAttrRotate = 0;
+ Degree100 nAttrRotate(0);
if ( GetCellOrientation() == SvxCellOrientation::Standard )
{
bool bRepeat = ( GetItem(ATTR_HOR_JUSTIFY, pCondSet).
@@ -1330,22 +1330,22 @@ ScRotateDir ScPatternAttr::GetRotateDir( const SfxItemSet* pCondSet ) const
{
ScRotateDir nRet = ScRotateDir::NONE;
- tools::Long nAttrRotate = GetRotateVal( pCondSet );
+ Degree100 nAttrRotate = GetRotateVal( pCondSet );
if ( nAttrRotate )
{
SvxRotateMode eRotMode = GetItem(ATTR_ROTATE_MODE, pCondSet).GetValue();
- if ( eRotMode == SVX_ROTATE_MODE_STANDARD || nAttrRotate == 18000 )
+ if ( eRotMode == SVX_ROTATE_MODE_STANDARD || nAttrRotate == 18000_deg100 )
nRet = ScRotateDir::Standard;
else if ( eRotMode == SVX_ROTATE_MODE_CENTER )
nRet = ScRotateDir::Center;
else if ( eRotMode == SVX_ROTATE_MODE_TOP || eRotMode == SVX_ROTATE_MODE_BOTTOM )
{
- tools::Long nRot180 = nAttrRotate % 18000; // 1/100 degrees
- if ( nRot180 == 9000 )
+ Degree100 nRot180 = nAttrRotate % 18000_deg100; // 1/100 degrees
+ if ( nRot180 == 9000_deg100 )
nRet = ScRotateDir::Center;
- else if ( ( eRotMode == SVX_ROTATE_MODE_TOP && nRot180 < 9000 ) ||
- ( eRotMode == SVX_ROTATE_MODE_BOTTOM && nRot180 > 9000 ) )
+ else if ( ( eRotMode == SVX_ROTATE_MODE_TOP && nRot180 < 9000_deg100 ) ||
+ ( eRotMode == SVX_ROTATE_MODE_BOTTOM && nRot180 > 9000_deg100 ) )
nRet = ScRotateDir::Left;
else
nRet = ScRotateDir::Right;
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index d8fb7fac5b0f..1ddf2993b170 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2172,9 +2172,9 @@ SCSIZE ScTable::FillMaxRot( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCO
double nFactor = 0.0;
if ( nCol > nX2+1 )
{
- tools::Long nRotVal = pPattern->
+ Degree100 nRotVal = pPattern->
GetItem( ATTR_ROTATE_VALUE, pCondSet ).GetValue();
- double nRealOrient = nRotVal * F_PI18000; // 1/100 degree
+ double nRealOrient = nRotVal.get() * F_PI18000; // 1/100 degree
double nCos = cos( nRealOrient );
double nSin = sin( nRealOrient );
//TODO: limit !!!
diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx
index f8bb63325318..c7d70f4ac82e 100644
--- a/sc/source/core/tool/autoform.cxx
+++ b/sc/source/core/tool/autoform.cxx
@@ -189,7 +189,7 @@ ScAutoFormatDataField::ScAutoFormatDataField()
m_aStacked = std::make_unique<ScVerticalStackCell>();
m_aMargin = std::make_unique<SvxMarginItem>(ATTR_MARGIN);
m_aLinebreak = std::make_unique<ScLineBreakCell>();
- m_aRotateAngle = std::make_unique<ScRotateValueItem>(0);
+ m_aRotateAngle = std::make_unique<ScRotateValueItem>(0_deg100);
m_aRotateMode = std::make_unique<SvxRotateModeItem>(SVX_ROTATE_MODE_STANDARD, ATTR_ROTATE_MODE);
}