convert SdrTextAniDirection to scoped enum

Change-Id: I67d1ffb1169e9faf4df90dd70a5496aa485979cf
This commit is contained in:
Noel Grandin
2016-08-23 13:18:25 +02:00
parent 92743c1da6
commit 02329af0cb
13 changed files with 42 additions and 42 deletions

View File

@@ -618,26 +618,26 @@ IMPL_LINK_TYPED( SvxTextAnimationPage, ClickDirectionHdl_Impl, Button *, pBtn, v
void SvxTextAnimationPage::SelectDirection( SdrTextAniDirection nValue )
{
m_pBtnUp->Check( nValue == SDRTEXTANI_UP );
m_pBtnLeft->Check( nValue == SDRTEXTANI_LEFT );
m_pBtnRight->Check( nValue == SDRTEXTANI_RIGHT );
m_pBtnDown->Check( nValue == SDRTEXTANI_DOWN );
m_pBtnUp->Check( nValue == SdrTextAniDirection::Up );
m_pBtnLeft->Check( nValue == SdrTextAniDirection::Left );
m_pBtnRight->Check( nValue == SdrTextAniDirection::Right );
m_pBtnDown->Check( nValue == SdrTextAniDirection::Down );
}
sal_uInt16 SvxTextAnimationPage::GetSelectedDirection()
{
sal_uInt16 nValue = 0;
SdrTextAniDirection nValue = SdrTextAniDirection::Left;
if( m_pBtnUp->IsChecked() )
nValue = SDRTEXTANI_UP;
nValue = SdrTextAniDirection::Up;
else if( m_pBtnLeft->IsChecked() )
nValue = SDRTEXTANI_LEFT;
nValue = SdrTextAniDirection::Left;
else if( m_pBtnRight->IsChecked() )
nValue = SDRTEXTANI_RIGHT;
nValue = SdrTextAniDirection::Right;
else if( m_pBtnDown->IsChecked() )
nValue = SDRTEXTANI_DOWN;
nValue = SdrTextAniDirection::Down;
return nValue;
return (sal_uInt16)nValue;
}

View File

@@ -27,14 +27,14 @@
// class SdrTextAniDirectionItem
enum SdrTextAniDirection {SDRTEXTANI_LEFT,
SDRTEXTANI_RIGHT,
SDRTEXTANI_UP,
SDRTEXTANI_DOWN};
enum class SdrTextAniDirection
{
Left, Right, Up, Down
};
class SVX_DLLPUBLIC SdrTextAniDirectionItem: public SfxEnumItem {
public:
SdrTextAniDirectionItem(SdrTextAniDirection eDir=SDRTEXTANI_LEFT): SfxEnumItem(SDRATTR_TEXT_ANIDIRECTION,(sal_uInt16)eDir) {}
SdrTextAniDirectionItem(SdrTextAniDirection eDir=SdrTextAniDirection::Left): SfxEnumItem(SDRATTR_TEXT_ANIDIRECTION,(sal_uInt16)eDir) {}
SdrTextAniDirectionItem(SvStream& rIn) : SfxEnumItem(SDRATTR_TEXT_ANIDIRECTION,rIn) {}
virtual SfxPoolItem* Clone(SfxItemPool* pPool=nullptr) const override;
virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const override;

View File

@@ -100,7 +100,7 @@
#define SDRATTR_TEXT_AUTOGROWWIDTH (SDRATTR_MISC_FIRST +12) /* 1109 */ /* 1109 */ /* 1092 sal_Bool, def=sal_False - Pool V2 */
#define SDRATTR_TEXT_HORZADJUST (SDRATTR_MISC_FIRST +13) /* 1110 */ /* 1110 */ /* 1093 enum, def=SDRTEXTHORZADJUST_LEFT */ /* Pool V2+ (04-12-1995) */
#define SDRATTR_TEXT_ANIKIND (SDRATTR_MISC_FIRST +14) /* 1111 */ /* 1111 */ /* 1094 enum, def=SDRTEXTANI_NONE - Pool V2/V4 */
#define SDRATTR_TEXT_ANIDIRECTION (SDRATTR_MISC_FIRST +15) /* 1112 */ /* 1112 */ /* 1095 enum, def=SDRTEXTANI_LEFT - Pool V2/V4 */
#define SDRATTR_TEXT_ANIDIRECTION (SDRATTR_MISC_FIRST +15) /* 1112 */ /* 1112 */ /* 1095 enum, def=SdrTextAniDirection::Left - Pool V2/V4 */
#define SDRATTR_TEXT_ANISTARTINSIDE (SDRATTR_MISC_FIRST +16) /* 1113 */ /* 1113 */ /* 1096 sal_Bool, def=sal_False - Pool V2/V4 */
#define SDRATTR_TEXT_ANISTOPINSIDE (SDRATTR_MISC_FIRST +17) /* 1114 */ /* 1114 */ /* 1097 sal_Bool, def=sal_False - Pool V2/V4 */
#define SDRATTR_TEXT_ANICOUNT (SDRATTR_MISC_FIRST +18) /* 1115 */ /* 1115 */ /* 1098 sal_uInt16, def=0 - Pool V2/V4 */

View File

@@ -458,7 +458,7 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
aItemSet.Put( makeSdrTextAutoGrowWidthItem( false ) );
aItemSet.Put( makeSdrTextAutoGrowHeightItem( false ) );
aItemSet.Put( SdrTextAniKindItem( SDRTEXTANI_SLIDE ) );
aItemSet.Put( SdrTextAniDirectionItem( SDRTEXTANI_LEFT ) );
aItemSet.Put( SdrTextAniDirectionItem( SdrTextAniDirection::Left ) );
aItemSet.Put( SdrTextAniCountItem( 1 ) );
aItemSet.Put( SdrTextAniAmountItem(
(sal_Int16)pWindow->PixelToLogic(Size(2,1)).Width()) );
@@ -762,7 +762,7 @@ SdrObject* FuText::CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rR
aSet.Put( makeSdrTextAutoGrowWidthItem( false ) );
aSet.Put( makeSdrTextAutoGrowHeightItem( false ) );
aSet.Put( SdrTextAniKindItem( SDRTEXTANI_SLIDE ) );
aSet.Put( SdrTextAniDirectionItem( SDRTEXTANI_LEFT ) );
aSet.Put( SdrTextAniDirectionItem( SdrTextAniDirection::Left ) );
aSet.Put( SdrTextAniCountItem( 1 ) );
aSet.Put( SdrTextAniAmountItem( (sal_Int16)pWindow->PixelToLogic(Size(2,1)).Width()) );

View File

@@ -369,7 +369,7 @@ namespace drawinglayer
{
// get scroll direction
const SdrTextAniDirection eDirection(rText.getSdrText().GetObject().GetTextAniDirection());
const bool bHorizontal(SDRTEXTANI_LEFT == eDirection || SDRTEXTANI_RIGHT == eDirection);
const bool bHorizontal(SdrTextAniDirection::Left == eDirection || SdrTextAniDirection::Right == eDirection);
// decompose to get separated values for the scroll box
basegfx::B2DVector aScale, aTranslate;

View File

@@ -296,7 +296,7 @@ bool SdrTextObj::IsAutoGrowHeight() const
{
SdrTextAniDirection eDirection = static_cast<const SdrTextAniDirectionItem&>(rSet.Get(SDRATTR_TEXT_ANIDIRECTION)).GetValue();
if(eDirection == SDRTEXTANI_UP || eDirection == SDRTEXTANI_DOWN)
if(eDirection == SdrTextAniDirection::Up || eDirection == SdrTextAniDirection::Down)
{
bRet = false;
}
@@ -323,7 +323,7 @@ bool SdrTextObj::IsAutoGrowWidth() const
{
SdrTextAniDirection eDirection = static_cast<const SdrTextAniDirectionItem&>(rSet.Get(SDRATTR_TEXT_ANIDIRECTION)).GetValue();
if(eDirection == SDRTEXTANI_LEFT || eDirection == SDRTEXTANI_RIGHT)
if(eDirection == SdrTextAniDirection::Left || eDirection == SdrTextAniDirection::Right)
{
bRet = false;
}
@@ -354,7 +354,7 @@ SdrTextHorzAdjust SdrTextObj::GetTextHorizontalAdjust(const SfxItemSet& rSet) co
{
SdrTextAniDirection eDirection = static_cast<const SdrTextAniDirectionItem&>(rSet.Get(SDRATTR_TEXT_ANIDIRECTION)).GetValue();
if(eDirection == SDRTEXTANI_LEFT || eDirection == SDRTEXTANI_RIGHT)
if(eDirection == SdrTextAniDirection::Left || eDirection == SdrTextAniDirection::Right)
{
eRet = SDRTEXTHORZADJUST_LEFT;
}
@@ -387,7 +387,7 @@ SdrTextVertAdjust SdrTextObj::GetTextVerticalAdjust(const SfxItemSet& rSet) cons
{
SdrTextAniDirection eDirection = static_cast<const SdrTextAniDirectionItem&>(rSet.Get(SDRATTR_TEXT_ANIDIRECTION)).GetValue();
if(eDirection == SDRTEXTANI_LEFT || eDirection == SDRTEXTANI_RIGHT)
if(eDirection == SdrTextAniDirection::Left || eDirection == SdrTextAniDirection::Right)
{
eRet = SDRTEXTVERTADJUST_TOP;
}
@@ -721,8 +721,8 @@ void SdrTextObj::TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, boo
if (!bInEditMode && (eAniKind==SDRTEXTANI_SCROLL || eAniKind==SDRTEXTANI_ALTERNATE || eAniKind==SDRTEXTANI_SLIDE))
{
// unlimited paper size for ticker text
if (eAniDirection==SDRTEXTANI_LEFT || eAniDirection==SDRTEXTANI_RIGHT) nWdt=1000000;
if (eAniDirection==SDRTEXTANI_UP || eAniDirection==SDRTEXTANI_DOWN) nHgt=1000000;
if (eAniDirection==SdrTextAniDirection::Left || eAniDirection==SdrTextAniDirection::Right) nWdt=1000000;
if (eAniDirection==SdrTextAniDirection::Up || eAniDirection==SdrTextAniDirection::Down) nHgt=1000000;
}
bool bChainedFrame = IsChainable();
@@ -1877,13 +1877,13 @@ GDIMetaFile* SdrTextObj::GetTextScrollMetaFileAndRectangle(
const SfxItemSet& rSet = GetObjectItemSet();
SdrTextAniDirection eDirection = static_cast<const SdrTextAniDirectionItem&>(rSet.Get(SDRATTR_TEXT_ANIDIRECTION)).GetValue();
if(SDRTEXTANI_LEFT == eDirection || SDRTEXTANI_RIGHT == eDirection)
if(SdrTextAniDirection::Left == eDirection || SdrTextAniDirection::Right == eDirection)
{
aScrollFrameRect.Left() = aAnchorRect.Left();
aScrollFrameRect.Right() = aAnchorRect.Right();
}
if(SDRTEXTANI_UP == eDirection || SDRTEXTANI_DOWN == eDirection)
if(SdrTextAniDirection::Up == eDirection || SdrTextAniDirection::Down == eDirection)
{
aScrollFrameRect.Top() = aAnchorRect.Top();
aScrollFrameRect.Bottom() = aAnchorRect.Bottom();

View File

@@ -1368,7 +1368,7 @@ void SdrTextObj::impGetScrollTextTiming(drawinglayer::animation::AnimationEntryL
double fAnimationDelay((double)static_cast<const SdrTextAniDelayItem&>(rSet.Get(SDRATTR_TEXT_ANIDELAY)).GetValue());
double fSingleStepWidth((double)static_cast<const SdrTextAniAmountItem&>(rSet.Get(SDRATTR_TEXT_ANIAMOUNT)).GetValue());
const SdrTextAniDirection eDirection(GetTextAniDirection());
const bool bForward(SDRTEXTANI_RIGHT == eDirection || SDRTEXTANI_DOWN == eDirection);
const bool bForward(SdrTextAniDirection::Right == eDirection || SdrTextAniDirection::Down == eDirection);
if(basegfx::fTools::equalZero(fAnimationDelay))
{

View File

@@ -85,8 +85,8 @@ bool SdrTextObj::AdjustTextFrameWidthAndHeight( Rectangle& rR, bool bHgt, bool b
SdrTextAniDirection eAniDir = GetTextAniDirection();
bool bScroll = eAniKind == SDRTEXTANI_SCROLL || eAniKind == SDRTEXTANI_ALTERNATE || eAniKind == SDRTEXTANI_SLIDE;
bool bHScroll = bScroll && (eAniDir == SDRTEXTANI_LEFT || eAniDir == SDRTEXTANI_RIGHT);
bool bVScroll = bScroll && (eAniDir == SDRTEXTANI_UP || eAniDir == SDRTEXTANI_DOWN);
bool bHScroll = bScroll && (eAniDir == SdrTextAniDirection::Left || eAniDir == SdrTextAniDirection::Right);
bool bVScroll = bScroll && (eAniDir == SdrTextAniDirection::Up || eAniDir == SdrTextAniDirection::Down);
Rectangle aOldRect = rR;
long nHgt = 0, nMinHgt = 0, nMaxHgt = 0;

View File

@@ -201,8 +201,8 @@ void SdrTextObj::TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* p
if (!bInEditMode && (eAniKind==SDRTEXTANI_SCROLL || eAniKind==SDRTEXTANI_ALTERNATE || eAniKind==SDRTEXTANI_SLIDE))
{
// ticker text uses an unlimited paper size
if (eAniDirection==SDRTEXTANI_LEFT || eAniDirection==SDRTEXTANI_RIGHT) nMaxWdt=1000000;
if (eAniDirection==SDRTEXTANI_UP || eAniDirection==SDRTEXTANI_DOWN) nMaxHgt=1000000;
if (eAniDirection==SdrTextAniDirection::Left || eAniDirection==SdrTextAniDirection::Right) nMaxWdt=1000000;
if (eAniDirection==SdrTextAniDirection::Up || eAniDirection==SdrTextAniDirection::Down) nMaxHgt=1000000;
}
bool bChainedFrame = IsChainable();

View File

@@ -2890,7 +2890,7 @@ long SwFEShell::GetSectionWidth( SwFormat const & rFormat ) const
aSet.Put( makeSdrTextAutoGrowWidthItem( false ) );
aSet.Put( makeSdrTextAutoGrowHeightItem( false ) );
aSet.Put( SdrTextAniKindItem( SDRTEXTANI_SLIDE ) );
aSet.Put( SdrTextAniDirectionItem( SDRTEXTANI_LEFT ) );
aSet.Put( SdrTextAniDirectionItem( SdrTextAniDirection::Left ) );
aSet.Put( SdrTextAniCountItem( 1 ) );
aSet.Put( SdrTextAniAmountItem( (sal_Int16)GetWin()->PixelToLogic(Size(2,1)).Width()) );
pObj->SetMergedItemSetAndBroadcast(aSet);

View File

@@ -65,9 +65,9 @@ static HTMLOptionEnum aHTMLMarqBehaviorTable[] =
static HTMLOptionEnum aHTMLMarqDirectionTable[] =
{
{ OOO_STRING_SVTOOLS_HTML_AL_left, SDRTEXTANI_LEFT },
{ OOO_STRING_SVTOOLS_HTML_AL_right, SDRTEXTANI_RIGHT },
{ nullptr, 0 }
{ OOO_STRING_SVTOOLS_HTML_AL_left, (sal_uInt16)SdrTextAniDirection::Left },
{ OOO_STRING_SVTOOLS_HTML_AL_right, (sal_uInt16)SdrTextAniDirection::Right },
{ nullptr, 0 }
};
void SwHTMLParser::InsertDrawObject( SdrObject* pNewDrawObj,
@@ -260,7 +260,7 @@ void SwHTMLParser::NewMarquee( HTMLTable *pCurTable )
sal_Int16 eVertOri = text::VertOrientation::TOP;
sal_Int16 eHoriOri = text::HoriOrientation::NONE;
SdrTextAniKind eAniKind = SDRTEXTANI_SCROLL;
SdrTextAniDirection eAniDir = SDRTEXTANI_LEFT;
SdrTextAniDirection eAniDir = SdrTextAniDirection::Left;
sal_uInt16 nCount = 0, nDelay = 60;
sal_Int16 nAmount = -6;
Color aBGColor;
@@ -370,7 +370,7 @@ void SwHTMLParser::NewMarquee( HTMLTable *pCurTable )
// (Nur) Alternate leueft per Default von links nach rechts
if( SDRTEXTANI_ALTERNATE==eAniKind && !bDirection )
eAniDir = SDRTEXTANI_RIGHT;
eAniDir = SdrTextAniDirection::Right;
// die fuer das Scrollen benoetigten Attribute umsetzen
sal_uInt16 aWhichMap[7] = { XATTR_FILL_FIRST, XATTR_FILL_LAST,
@@ -390,7 +390,7 @@ void SwHTMLParser::NewMarquee( HTMLTable *pCurTable )
// (Nur) Alternate startet und stoppt per default Inside
aItemSet.Put( SdrTextAniStartInsideItem(true) );
aItemSet.Put( SdrTextAniStopInsideItem(true) );
if( SDRTEXTANI_LEFT==eAniDir )
if( SdrTextAniDirection::Left==eAniDir )
aItemSet.Put( SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT) );
}

View File

@@ -179,8 +179,8 @@ Writer& OutHTML_DrawFrameFormatAsMarquee( Writer& rWrt,
SdrTextAniDirection eAniDir = pTextObj->GetTextAniDirection();
switch( eAniDir )
{
case SDRTEXTANI_LEFT: pStr = OOO_STRING_SVTOOLS_HTML_AL_left; break;
case SDRTEXTANI_RIGHT: pStr = OOO_STRING_SVTOOLS_HTML_AL_right; break;
case SdrTextAniDirection::Left: pStr = OOO_STRING_SVTOOLS_HTML_AL_left; break;
case SdrTextAniDirection::Right: pStr = OOO_STRING_SVTOOLS_HTML_AL_right; break;
default:
;
}

View File

@@ -87,7 +87,7 @@ bool ConstRectangle::MouseButtonUp(const MouseEvent& rMEvt)
aItemSet.Put( makeSdrTextAutoGrowWidthItem( false ) );
aItemSet.Put( makeSdrTextAutoGrowHeightItem( false ) );
aItemSet.Put( SdrTextAniKindItem( SDRTEXTANI_SCROLL ) );
aItemSet.Put( SdrTextAniDirectionItem( SDRTEXTANI_LEFT ) );
aItemSet.Put( SdrTextAniDirectionItem( SdrTextAniDirection::Left ) );
aItemSet.Put( SdrTextAniCountItem( 0 ) );
aItemSet.Put( SdrTextAniAmountItem(
(sal_Int16)m_pWin->PixelToLogic(Size(2,1)).Width()) );