convert XFormTextAdjust to scoped enum

Change-Id: Ibc38e73aa5f2134cde7f1ea25b158ea9b8f241a9
This commit is contained in:
Noel Grandin
2016-08-17 13:14:54 +02:00
parent 7d2cf760ec
commit a43de3d55b
6 changed files with 23 additions and 23 deletions

View File

@@ -23,8 +23,8 @@
enum XFormTextStyle { XFT_ROTATE, XFT_UPRIGHT, XFT_SLANTX, XFT_SLANTY,
XFT_NONE };
enum XFormTextAdjust { XFT_LEFT, XFT_RIGHT, XFT_AUTOSIZE, XFT_CENTER };
enum class XFormTextShadow { NONE, Normal, Slant};
enum class XFormTextAdjust { Left, Right, AutoSize, Center };
enum class XFormTextShadow { NONE, Normal, Slant };
enum class XBitmapType { Import, N8x8 };

View File

@@ -34,7 +34,7 @@ class SVX_DLLPUBLIC XFormTextAdjustItem : public SfxEnumItem
public:
static SfxPoolItem* CreateDefault();
XFormTextAdjustItem(XFormTextAdjust = XFT_CENTER);
XFormTextAdjustItem(XFormTextAdjust = XFormTextAdjust::Center);
XFormTextAdjustItem(SvStream& rIn);
virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const override;

View File

@@ -387,15 +387,15 @@ void SvxFontWorkDialog::SetAdjust_Impl(const XFormTextAdjustItem* pItem)
m_pTbxAdjust->Enable();
m_pMtrFldDistance->Enable();
if ( pItem->GetValue() == XFT_LEFT || pItem->GetValue() == XFT_RIGHT )
if ( pItem->GetValue() == XFormTextAdjust::Left || pItem->GetValue() == XFormTextAdjust::Right )
{
if ( pItem->GetValue() == XFT_LEFT ) nId = nAdjustLeftId;
if ( pItem->GetValue() == XFormTextAdjust::Left ) nId = nAdjustLeftId;
else nId = nAdjustRightId;
m_pMtrFldTextStart->Enable();
}
else
{
if ( pItem->GetValue() == XFT_CENTER ) nId = nAdjustCenterId;
if ( pItem->GetValue() == XFormTextAdjust::Center ) nId = nAdjustCenterId;
else nId = nAdjustAutoSizeId;
m_pMtrFldTextStart->Disable();
}
@@ -673,14 +673,14 @@ IMPL_LINK_NOARG_TYPED(SvxFontWorkDialog, SelectAdjustHdl_Impl, ToolBox *, void)
}
else if ( nId != nLastAdjustTbxId )
{
XFormTextAdjust eAdjust = XFT_AUTOSIZE;
XFormTextAdjust eAdjust = XFormTextAdjust::AutoSize;
if (nId == nAdjustLeftId)
eAdjust = XFT_LEFT;
eAdjust = XFormTextAdjust::Left;
else if (nId == nAdjustCenterId)
eAdjust = XFT_CENTER;
eAdjust = XFormTextAdjust::Center;
else if (nId == nAdjustRightId)
eAdjust = XFT_RIGHT;
eAdjust = XFormTextAdjust::Right;
XFormTextAdjustItem aItem(eAdjust);
GetBindings().GetDispatcher()->ExecuteList(SID_FORMTEXT_ADJUST,

View File

@@ -214,7 +214,7 @@ namespace drawinglayer
mnFormTextShdwYVal(0),
mnFormTextShdwTransp(0),
meFormTextStyle(XFT_NONE),
meFormTextAdjust(XFT_CENTER),
meFormTextAdjust(XFormTextAdjust::Center),
meFormTextShadow(XFormTextShadow::NONE),
maFormTextShdwColor(),
maOutline(),

View File

@@ -273,10 +273,10 @@ namespace
}
if(maSdrFormTextAttribute.getFormTextStart()
&& (XFT_LEFT == maSdrFormTextAttribute.getFormTextAdjust()
|| XFT_RIGHT == maSdrFormTextAttribute.getFormTextAdjust()))
&& (XFormTextAdjust::Left == maSdrFormTextAttribute.getFormTextAdjust()
|| XFormTextAdjust::Right == maSdrFormTextAttribute.getFormTextAdjust()))
{
if(XFT_LEFT == maSdrFormTextAttribute.getFormTextAdjust())
if(XFormTextAdjust::Left == maSdrFormTextAttribute.getFormTextAdjust())
{
fPolyStart += maSdrFormTextAttribute.getFormTextStart();
@@ -296,16 +296,16 @@ namespace
}
}
if(XFT_LEFT != maSdrFormTextAttribute.getFormTextAdjust())
if(XFormTextAdjust::Left != maSdrFormTextAttribute.getFormTextAdjust())
{
// calculate total text length of this paragraph, some layout needs to be done
const double fParagraphTextLength(getParagraphTextLength(rTextPortions));
// check if text is too long for paragraph. If yes, handle as if left aligned (default),
// but still take care of XFT_AUTOSIZE in that case
// but still take care of XFormTextAdjust::AutoSize in that case
const bool bTextTooLong(fParagraphTextLength > (fPolyEnd - fPolyStart));
if(XFT_RIGHT == maSdrFormTextAttribute.getFormTextAdjust())
if(XFormTextAdjust::Right == maSdrFormTextAttribute.getFormTextAdjust())
{
if(!bTextTooLong)
{
@@ -313,7 +313,7 @@ namespace
fPolyStart += ((fPolyEnd - fPolyStart) - fParagraphTextLength);
}
}
else if(XFT_CENTER == maSdrFormTextAttribute.getFormTextAdjust())
else if(XFormTextAdjust::Center == maSdrFormTextAttribute.getFormTextAdjust())
{
if(!bTextTooLong)
{
@@ -321,7 +321,7 @@ namespace
fPolyStart += ((fPolyEnd - fPolyStart) - fParagraphTextLength) / 2.0;
}
}
else if(XFT_AUTOSIZE == maSdrFormTextAttribute.getFormTextAdjust())
else if(XFormTextAdjust::AutoSize == maSdrFormTextAttribute.getFormTextAdjust())
{
// if scale, prepare scale factor between curve length and text length
if(0.0 != fParagraphTextLength)

View File

@@ -679,10 +679,10 @@ static SvXMLEnumMapEntry const pXML_Fontwork_Style_Enum[] =
static SvXMLEnumMapEntry const pXML_Fontwork_Adjust_Enum[] =
{
{ XML_LEFT, 0 }, //XFT_LEFT,
{ XML_RIGHT, 1 }, //XFT_RIGHT,
{ XML_AUTOSIZE, 2 }, //XFT_AUTOSIZE,
{ XML_CENTER, 3 }, //XFT_CENTER
{ XML_LEFT, 0 }, //XFormTextAdjust::Left,
{ XML_RIGHT, 1 }, //XFormTextAdjust::Right,
{ XML_AUTOSIZE, 2 }, //XFormTextAdjust::AutoSize,
{ XML_CENTER, 3 }, //XFormTextAdjust::Center
{ XML_TOKEN_INVALID,0 }
};