summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-10-20 07:27:44 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-10-21 08:13:05 +0200
commit0fb58a1ff168ae122e9c8993a3136658e3b0e3f0 (patch)
tree908983b02f466e0a49599edc70aaa1baaa240371 /editeng
parentb84afd2188d6993c91081885dc24664bd3f1cc73 (diff)
new tools::Degree10 strong typedef
partly to flush some use of "long" out the codebase, but also to make it obvious which units are being used for angle values. Change-Id: I1dc22494ca42c4677a63f685d5903f2b89886dc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104548 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editdoc.cxx2
-rw-r--r--editeng/source/editeng/editeng.cxx4
-rw-r--r--editeng/source/editeng/impedit.cxx2
-rw-r--r--editeng/source/editeng/impedit.hxx4
-rw-r--r--editeng/source/editeng/impedit3.cxx10
-rw-r--r--editeng/source/items/textitem.cxx18
-rw-r--r--editeng/source/outliner/outleeng.cxx2
-rw-r--r--editeng/source/outliner/outleeng.hxx2
-rw-r--r--editeng/source/outliner/outliner.cxx6
-rw-r--r--editeng/source/rtf/rtfitem.cxx2
-rw-r--r--editeng/source/uno/unofdesc.cxx4
11 files changed, 28 insertions, 28 deletions
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 454fc460849a..b26142224a1f 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -2038,7 +2038,7 @@ void EditDoc::CreateDefFont( bool bUseStyles )
SfxItemSet aTmpSet( GetItemPool(), svl::Items<EE_PARA_START, EE_CHAR_END>{} );
CreateFont( aDefFont, aTmpSet );
aDefFont.SetVertical( IsVertical() );
- aDefFont.SetOrientation( IsVertical() ? (IsTopToBottom() ? 2700 : 900) : 0 );
+ aDefFont.SetOrientation( Degree10(IsVertical() ? (IsTopToBottom() ? 2700 : 900) : 0) );
for ( sal_Int32 nNode = 0; nNode < Count(); nNode++ )
{
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 071f78947b2f..91bb8217ec3f 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -200,7 +200,7 @@ void EditEngine::Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect )
Draw( pOutDev, rOutRect, Point( 0, 0 ) );
}
-void EditEngine::Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation )
+void EditEngine::Draw( OutputDevice* pOutDev, const Point& rStartPos, Degree10 nOrientation )
{
// Create with 2 points, as with positive points it will end up with
// LONGMAX as Size, Bottom and Right in the range > LONGMAX.
@@ -2462,7 +2462,7 @@ void EditEngine::DrawingTab( const Point& /*rStartPos*/, tools::Long /*nWidth*/,
{
}
-void EditEngine::PaintingFirstLine( sal_Int32, const Point&, tools::Long, const Point&, short, OutputDevice* )
+void EditEngine::PaintingFirstLine( sal_Int32, const Point&, tools::Long, const Point&, Degree10, OutputDevice* )
{
}
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 411a63766020..2c18762e1f9d 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -1282,7 +1282,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
aCursorSz.setWidth( aOldSz.Height() );
aCursorSz.setHeight( aOldSz.Width() );
GetCursor()->SetPos( aCursorRect.TopRight() );
- GetCursor()->SetOrientation( IsTopToBottom() ? 2700 : 900 );
+ GetCursor()->SetOrientation( Degree10(IsTopToBottom() ? 2700 : 900) );
}
else
// #i32593# Reset correct orientation in horizontal layout
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index a6ebf55c7ccc..9ab6c7fdfe88 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -834,7 +834,7 @@ public:
void FormatFullDoc();
void UpdateViews( EditView* pCurView = nullptr );
void Paint( ImpEditView* pView, const tools::Rectangle& rRect, OutputDevice* pTargetDevice );
- void Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Point aStartPos, bool bStripOnly = false, short nOrientation = 0 );
+ void Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Point aStartPos, bool bStripOnly = false, Degree10 nOrientation = Degree10(0) );
bool MouseButtonUp( const MouseEvent& rMouseEvent, EditView* pView );
bool MouseButtonDown( const MouseEvent& rMouseEvent, EditView* pView );
@@ -1292,7 +1292,7 @@ inline vcl::Cursor* ImpEditView::GetCursor()
void ConvertItem( std::unique_ptr<SfxPoolItem>& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit );
void ConvertAndPutItems( SfxItemSet& rDest, const SfxItemSet& rSource, const MapUnit* pSourceUnit = nullptr, const MapUnit* pDestUnit = nullptr );
AsianCompressionFlags GetCharTypeForCompression( sal_Unicode cChar );
-Point Rotate( const Point& rPoint, short nOrientation, const Point& rOrigin );
+Point Rotate( const Point& rPoint, Degree10 nOrientation, const Point& rOrigin );
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 23d00bb7dc1b..d070ec660786 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -105,9 +105,9 @@ struct TabInfo
}
-Point Rotate( const Point& rPoint, short nOrientation, const Point& rOrigin )
+Point Rotate( const Point& rPoint, Degree10 nOrientation, const Point& rOrigin )
{
- double nRealOrientation = nOrientation*F_PI1800;
+ double nRealOrientation = nOrientation.get() * F_PI1800;
double nCos = cos( nRealOrientation );
double nSin = sin( nRealOrientation );
@@ -158,7 +158,7 @@ static void lcl_DrawRedLines( OutputDevice* pOutDev,
size_t nMaxEnd,
const tools::Long* pDXArray,
WrongList const * pWrongs,
- short nOrientation,
+ Degree10 nOrientation,
const Point& rOrigin,
bool bVertical,
bool bIsRightToLeft )
@@ -2952,7 +2952,7 @@ void ImpEditEngine::RecalcFormatterFontMetrics( FormatterFontMetric& rCurMetrics
}
}
-void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Point aStartPos, bool bStripOnly, short nOrientation )
+void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Point aStartPos, bool bStripOnly, Degree10 nOrientation )
{
if ( !GetUpdateMode() && !bStripOnly )
return;
@@ -2978,7 +2978,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
double nCos = 0.0, nSin = 0.0;
if ( nOrientation )
{
- double nRealOrientation = nOrientation*F_PI1800;
+ double nRealOrientation = nOrientation.get()*F_PI1800;
nCos = cos( nRealOrientation );
nSin = sin( nRealOrientation );
}
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 8b856d6e7497..e1700df6e254 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -99,7 +99,7 @@ SfxPoolItem* SvxEscapementItem::CreateDefault() {return new SvxEscapementItem(0)
SfxPoolItem* SvxLanguageItem::CreateDefault() {return new SvxLanguageItem(LANGUAGE_GERMAN, 0);}
SfxPoolItem* SvxBlinkItem::CreateDefault() {return new SvxBlinkItem(false, 0);}
SfxPoolItem* SvxEmphasisMarkItem::CreateDefault() {return new SvxEmphasisMarkItem(FontEmphasisMark::NONE, 0);}
-SfxPoolItem* SvxCharRotateItem::CreateDefault() {return new SvxCharRotateItem(0, false, 0);}
+SfxPoolItem* SvxCharRotateItem::CreateDefault() {return new SvxCharRotateItem(Degree10(0), false, 0);}
SfxPoolItem* SvxCharScaleWidthItem::CreateDefault() {return new SvxCharScaleWidthItem(100, 0);}
SfxPoolItem* SvxCharReliefItem::CreateDefault() {return new SvxCharReliefItem(FontRelief::NONE, 0);}
@@ -2153,8 +2153,8 @@ bool SvxTwoLinesItem::GetPresentation( SfxItemPresentation /*ePres*/,
|* class SvxTextRotateItem
*************************************************************************/
-SvxTextRotateItem::SvxTextRotateItem(sal_uInt16 nValue, const sal_uInt16 nW)
- : SfxUInt16Item(nW, nValue)
+SvxTextRotateItem::SvxTextRotateItem(Degree10 nValue, const sal_uInt16 nW)
+ : SfxUInt16Item(nW, nValue.get())
{
}
@@ -2174,7 +2174,7 @@ bool SvxTextRotateItem::GetPresentation(
{
rText = EditResId(RID_SVXITEMS_TEXTROTATE);
rText = rText.replaceFirst("$(ARG1)",
- OUString::number(GetValue() / 10));
+ OUString::number(GetValue().get() / 10));
}
return true;
}
@@ -2206,7 +2206,7 @@ bool SvxTextRotateItem::PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId)
{
sal_Int16 nVal = 0;
if ((rVal >>= nVal) && (0 == nVal || 900 == nVal || 2700 == nVal))
- SetValue(static_cast<sal_uInt16>(nVal));
+ SetValue(Degree10(nVal));
else
bRet = false;
break;
@@ -2221,7 +2221,7 @@ void SvxTextRotateItem::dumpAsXml(xmlTextWriterPtr pWriter) const
{
xmlTextWriterStartElement(pWriter, BAD_CAST("SvxTextRotateItem"));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
- xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::number(GetValue()).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::number(GetValue().get()).getStr()));
xmlTextWriterEndElement(pWriter);
}
@@ -2230,7 +2230,7 @@ void SvxTextRotateItem::dumpAsXml(xmlTextWriterPtr pWriter) const
|* class SvxCharRotateItem
*************************************************************************/
-SvxCharRotateItem::SvxCharRotateItem( sal_uInt16 nValue,
+SvxCharRotateItem::SvxCharRotateItem( Degree10 nValue,
bool bFitIntoLine,
const sal_uInt16 nW )
: SvxTextRotateItem(nValue, nW), bFitToLine( bFitIntoLine )
@@ -2253,7 +2253,7 @@ bool SvxCharRotateItem::GetPresentation(
{
rText = EditResId( RID_SVXITEMS_CHARROTATE );
rText = rText.replaceFirst( "$(ARG1)",
- OUString::number( GetValue() / 10 ));
+ OUString::number( GetValue().get() / 10 ));
if( IsFitToLine() )
rText += EditResId( RID_SVXITEMS_CHARROTATE_FITLINE );
}
@@ -2311,7 +2311,7 @@ void SvxCharRotateItem::dumpAsXml(xmlTextWriterPtr pWriter) const
{
xmlTextWriterStartElement(pWriter, BAD_CAST("SvxCharRotateItem"));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
- xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::number(GetValue()).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::number(GetValue().get()).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("fitToLine"), BAD_CAST(OString::boolean(IsFitToLine()).getStr()));
xmlTextWriterEndElement(pWriter);
}
diff --git a/editeng/source/outliner/outleeng.cxx b/editeng/source/outliner/outleeng.cxx
index 645ecdb7fce2..116fec186fc3 100644
--- a/editeng/source/outliner/outleeng.cxx
+++ b/editeng/source/outliner/outleeng.cxx
@@ -38,7 +38,7 @@ OutlinerEditEng::~OutlinerEditEng()
{
}
-void OutlinerEditEng::PaintingFirstLine( sal_Int32 nPara, const Point& rStartPos, tools::Long /*nBaseLineY*/, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev )
+void OutlinerEditEng::PaintingFirstLine( sal_Int32 nPara, const Point& rStartPos, tools::Long /*nBaseLineY*/, const Point& rOrigin, Degree10 nOrientation, OutputDevice* pOutDev )
{
if( GetControlWord() & EEControlBits::OUTLINER )
{
diff --git a/editeng/source/outliner/outleeng.hxx b/editeng/source/outliner/outleeng.hxx
index 6830460204a0..fa6ae0da381b 100644
--- a/editeng/source/outliner/outleeng.hxx
+++ b/editeng/source/outliner/outleeng.hxx
@@ -37,7 +37,7 @@ public:
OutlinerEditEng( Outliner* pOwner, SfxItemPool* pPool );
virtual ~OutlinerEditEng() override;
- virtual void PaintingFirstLine( sal_Int32 nPara, const Point& rStartPos, tools::Long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev ) override;
+ virtual void PaintingFirstLine( sal_Int32 nPara, const Point& rStartPos, tools::Long nBaseLineY, const Point& rOrigin, Degree10 nOrientation, OutputDevice* pOutDev ) override;
virtual void ParagraphInserted( sal_Int32 nNewParagraph ) override;
virtual void ParagraphDeleted( sal_Int32 nDeletedParagraph ) override;
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 411cc62a2158..73c62414bd53 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -864,7 +864,7 @@ vcl::Font Outliner::ImpCalcBulletFont( sal_Int32 nPara ) const
aBulletFont.SetFontSize( Size( 0, nScaledLineHeight ) );
bool bVertical = IsVertical();
aBulletFont.SetVertical( bVertical );
- aBulletFont.SetOrientation( bVertical ? (IsTopToBottom() ? 2700 : 900) : 0 );
+ aBulletFont.SetOrientation( Degree10(bVertical ? (IsTopToBottom() ? 2700 : 900) : 0) );
Color aColor( COL_AUTO );
if( !pEditEngine->IsFlatMode() && !( pEditEngine->GetControlWord() & EEControlBits::NOCOLORS ) )
@@ -880,7 +880,7 @@ vcl::Font Outliner::ImpCalcBulletFont( sal_Int32 nPara ) const
}
void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
- const Point& rOrigin, short nOrientation, OutputDevice* pOutDev )
+ const Point& rOrigin, Degree10 nOrientation, OutputDevice* pOutDev )
{
bool bDrawBullet = false;
@@ -949,7 +949,7 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
{
// Both TopLeft and bottom left is not quite correct,
// since in EditEngine baseline ...
- double nRealOrientation = nOrientation*F_PI1800;
+ double nRealOrientation = nOrientation.get() * F_PI1800;
double nCos = cos( nRealOrientation );
double nSin = sin( nRealOrientation );
Point aRotatedPos;
diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx
index 790085b4031b..5be9b0a7493e 100644
--- a/editeng/source/rtf/rtfitem.cxx
+++ b/editeng/source/rtf/rtfitem.cxx
@@ -1039,7 +1039,7 @@ ATTR_SETEMPHASIS:
if( aPlainMap.nHorzVert )
{
// RTF knows only 90deg
- pSet->Put( SvxCharRotateItem( 900, 1 == nTokenValue,
+ pSet->Put( SvxCharRotateItem( Degree10(900), 1 == nTokenValue,
aPlainMap.nHorzVert ));
}
break;
diff --git a/editeng/source/uno/unofdesc.cxx b/editeng/source/uno/unofdesc.cxx
index a7042726c41f..0cfd7a710dcf 100644
--- a/editeng/source/uno/unofdesc.cxx
+++ b/editeng/source/uno/unofdesc.cxx
@@ -48,7 +48,7 @@ void SvxUnoFontDescriptor::ConvertToFont( const awt::FontDescriptor& rDesc, vcl:
rFont.SetFamily( static_cast<FontFamily>(rDesc.Family) );
rFont.SetCharSet( static_cast<rtl_TextEncoding>(rDesc.CharSet) );
rFont.SetPitch( static_cast<FontPitch>(rDesc.Pitch) );
- rFont.SetOrientation( static_cast<short>(rDesc.Orientation*10) );
+ rFont.SetOrientation( Degree10(static_cast<sal_Int16>(rDesc.Orientation*10)) );
rFont.SetKerning( rDesc.Kerning ? FontKerning::FontSpecific : FontKerning::NONE );
rFont.SetWeight( vcl::unohelper::ConvertFontWeight(rDesc.Weight) );
rFont.SetItalic( static_cast<FontItalic>(rDesc.Slant) );
@@ -66,7 +66,7 @@ void SvxUnoFontDescriptor::ConvertFromFont( const vcl::Font& rFont, awt::FontDes
rDesc.Family = sal::static_int_cast< sal_Int16 >(rFont.GetFamilyType());
rDesc.CharSet = rFont.GetCharSet();
rDesc.Pitch = sal::static_int_cast< sal_Int16 >(rFont.GetPitch());
- rDesc.Orientation = static_cast< float >(rFont.GetOrientation() / 10);
+ rDesc.Orientation = static_cast< float >(rFont.GetOrientation().get() / 10);
rDesc.Kerning = rFont.IsKerning();
rDesc.Weight = vcl::unohelper::ConvertFontWeight( rFont.GetWeight() );
rDesc.Slant = vcl::unohelper::ConvertFontSlant( rFont.GetItalic() );