convert XFormTextAdjust to scoped enum
Change-Id: Ibc38e73aa5f2134cde7f1ea25b158ea9b8f241a9
This commit is contained in:
@@ -23,8 +23,8 @@
|
|||||||
|
|
||||||
enum XFormTextStyle { XFT_ROTATE, XFT_UPRIGHT, XFT_SLANTX, XFT_SLANTY,
|
enum XFormTextStyle { XFT_ROTATE, XFT_UPRIGHT, XFT_SLANTX, XFT_SLANTY,
|
||||||
XFT_NONE };
|
XFT_NONE };
|
||||||
enum XFormTextAdjust { XFT_LEFT, XFT_RIGHT, XFT_AUTOSIZE, XFT_CENTER };
|
enum class XFormTextAdjust { Left, Right, AutoSize, Center };
|
||||||
enum class XFormTextShadow { NONE, Normal, Slant};
|
enum class XFormTextShadow { NONE, Normal, Slant };
|
||||||
enum class XBitmapType { Import, N8x8 };
|
enum class XBitmapType { Import, N8x8 };
|
||||||
|
|
||||||
|
|
||||||
|
@@ -34,7 +34,7 @@ class SVX_DLLPUBLIC XFormTextAdjustItem : public SfxEnumItem
|
|||||||
public:
|
public:
|
||||||
static SfxPoolItem* CreateDefault();
|
static SfxPoolItem* CreateDefault();
|
||||||
|
|
||||||
XFormTextAdjustItem(XFormTextAdjust = XFT_CENTER);
|
XFormTextAdjustItem(XFormTextAdjust = XFormTextAdjust::Center);
|
||||||
XFormTextAdjustItem(SvStream& rIn);
|
XFormTextAdjustItem(SvStream& rIn);
|
||||||
virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
|
virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
|
||||||
virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const override;
|
virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const override;
|
||||||
|
@@ -387,15 +387,15 @@ void SvxFontWorkDialog::SetAdjust_Impl(const XFormTextAdjustItem* pItem)
|
|||||||
m_pTbxAdjust->Enable();
|
m_pTbxAdjust->Enable();
|
||||||
m_pMtrFldDistance->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;
|
else nId = nAdjustRightId;
|
||||||
m_pMtrFldTextStart->Enable();
|
m_pMtrFldTextStart->Enable();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( pItem->GetValue() == XFT_CENTER ) nId = nAdjustCenterId;
|
if ( pItem->GetValue() == XFormTextAdjust::Center ) nId = nAdjustCenterId;
|
||||||
else nId = nAdjustAutoSizeId;
|
else nId = nAdjustAutoSizeId;
|
||||||
m_pMtrFldTextStart->Disable();
|
m_pMtrFldTextStart->Disable();
|
||||||
}
|
}
|
||||||
@@ -673,14 +673,14 @@ IMPL_LINK_NOARG_TYPED(SvxFontWorkDialog, SelectAdjustHdl_Impl, ToolBox *, void)
|
|||||||
}
|
}
|
||||||
else if ( nId != nLastAdjustTbxId )
|
else if ( nId != nLastAdjustTbxId )
|
||||||
{
|
{
|
||||||
XFormTextAdjust eAdjust = XFT_AUTOSIZE;
|
XFormTextAdjust eAdjust = XFormTextAdjust::AutoSize;
|
||||||
|
|
||||||
if (nId == nAdjustLeftId)
|
if (nId == nAdjustLeftId)
|
||||||
eAdjust = XFT_LEFT;
|
eAdjust = XFormTextAdjust::Left;
|
||||||
else if (nId == nAdjustCenterId)
|
else if (nId == nAdjustCenterId)
|
||||||
eAdjust = XFT_CENTER;
|
eAdjust = XFormTextAdjust::Center;
|
||||||
else if (nId == nAdjustRightId)
|
else if (nId == nAdjustRightId)
|
||||||
eAdjust = XFT_RIGHT;
|
eAdjust = XFormTextAdjust::Right;
|
||||||
|
|
||||||
XFormTextAdjustItem aItem(eAdjust);
|
XFormTextAdjustItem aItem(eAdjust);
|
||||||
GetBindings().GetDispatcher()->ExecuteList(SID_FORMTEXT_ADJUST,
|
GetBindings().GetDispatcher()->ExecuteList(SID_FORMTEXT_ADJUST,
|
||||||
|
@@ -214,7 +214,7 @@ namespace drawinglayer
|
|||||||
mnFormTextShdwYVal(0),
|
mnFormTextShdwYVal(0),
|
||||||
mnFormTextShdwTransp(0),
|
mnFormTextShdwTransp(0),
|
||||||
meFormTextStyle(XFT_NONE),
|
meFormTextStyle(XFT_NONE),
|
||||||
meFormTextAdjust(XFT_CENTER),
|
meFormTextAdjust(XFormTextAdjust::Center),
|
||||||
meFormTextShadow(XFormTextShadow::NONE),
|
meFormTextShadow(XFormTextShadow::NONE),
|
||||||
maFormTextShdwColor(),
|
maFormTextShdwColor(),
|
||||||
maOutline(),
|
maOutline(),
|
||||||
|
@@ -273,10 +273,10 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(maSdrFormTextAttribute.getFormTextStart()
|
if(maSdrFormTextAttribute.getFormTextStart()
|
||||||
&& (XFT_LEFT == maSdrFormTextAttribute.getFormTextAdjust()
|
&& (XFormTextAdjust::Left == maSdrFormTextAttribute.getFormTextAdjust()
|
||||||
|| XFT_RIGHT == maSdrFormTextAttribute.getFormTextAdjust()))
|
|| XFormTextAdjust::Right == maSdrFormTextAttribute.getFormTextAdjust()))
|
||||||
{
|
{
|
||||||
if(XFT_LEFT == maSdrFormTextAttribute.getFormTextAdjust())
|
if(XFormTextAdjust::Left == maSdrFormTextAttribute.getFormTextAdjust())
|
||||||
{
|
{
|
||||||
fPolyStart += maSdrFormTextAttribute.getFormTextStart();
|
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
|
// calculate total text length of this paragraph, some layout needs to be done
|
||||||
const double fParagraphTextLength(getParagraphTextLength(rTextPortions));
|
const double fParagraphTextLength(getParagraphTextLength(rTextPortions));
|
||||||
|
|
||||||
// check if text is too long for paragraph. If yes, handle as if left aligned (default),
|
// 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));
|
const bool bTextTooLong(fParagraphTextLength > (fPolyEnd - fPolyStart));
|
||||||
|
|
||||||
if(XFT_RIGHT == maSdrFormTextAttribute.getFormTextAdjust())
|
if(XFormTextAdjust::Right == maSdrFormTextAttribute.getFormTextAdjust())
|
||||||
{
|
{
|
||||||
if(!bTextTooLong)
|
if(!bTextTooLong)
|
||||||
{
|
{
|
||||||
@@ -313,7 +313,7 @@ namespace
|
|||||||
fPolyStart += ((fPolyEnd - fPolyStart) - fParagraphTextLength);
|
fPolyStart += ((fPolyEnd - fPolyStart) - fParagraphTextLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(XFT_CENTER == maSdrFormTextAttribute.getFormTextAdjust())
|
else if(XFormTextAdjust::Center == maSdrFormTextAttribute.getFormTextAdjust())
|
||||||
{
|
{
|
||||||
if(!bTextTooLong)
|
if(!bTextTooLong)
|
||||||
{
|
{
|
||||||
@@ -321,7 +321,7 @@ namespace
|
|||||||
fPolyStart += ((fPolyEnd - fPolyStart) - fParagraphTextLength) / 2.0;
|
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 scale, prepare scale factor between curve length and text length
|
||||||
if(0.0 != fParagraphTextLength)
|
if(0.0 != fParagraphTextLength)
|
||||||
|
@@ -679,10 +679,10 @@ static SvXMLEnumMapEntry const pXML_Fontwork_Style_Enum[] =
|
|||||||
|
|
||||||
static SvXMLEnumMapEntry const pXML_Fontwork_Adjust_Enum[] =
|
static SvXMLEnumMapEntry const pXML_Fontwork_Adjust_Enum[] =
|
||||||
{
|
{
|
||||||
{ XML_LEFT, 0 }, //XFT_LEFT,
|
{ XML_LEFT, 0 }, //XFormTextAdjust::Left,
|
||||||
{ XML_RIGHT, 1 }, //XFT_RIGHT,
|
{ XML_RIGHT, 1 }, //XFormTextAdjust::Right,
|
||||||
{ XML_AUTOSIZE, 2 }, //XFT_AUTOSIZE,
|
{ XML_AUTOSIZE, 2 }, //XFormTextAdjust::AutoSize,
|
||||||
{ XML_CENTER, 3 }, //XFT_CENTER
|
{ XML_CENTER, 3 }, //XFormTextAdjust::Center
|
||||||
{ XML_TOKEN_INVALID,0 }
|
{ XML_TOKEN_INVALID,0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user