Kaydet (Commit) 55b74b45 authored tarafından Noel Grandin's avatar Noel Grandin

convert SdrCaptionType to scoped enum

Change-Id: I5c1a2300ec6b3d9dc3085affa08cc544f46b27d6
üst 1cd85a60
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
#include <vcl/fixed.hxx> #include <vcl/fixed.hxx>
#include <svtools/valueset.hxx> #include <svtools/valueset.hxx>
#include <sfx2/tabdlg.hxx> #include <sfx2/tabdlg.hxx>
#include <svx/sxctitm.hxx>
class SdrView; class SdrView;
// class SvxCaptionTabPage ----------------------------------------------- // class SvxCaptionTabPage -----------------------------------------------
...@@ -51,7 +54,7 @@ private: ...@@ -51,7 +54,7 @@ private:
std::vector<OUString> m_aStrVertList; std::vector<OUString> m_aStrVertList;
std::vector<OUString> m_aLineTypes; std::vector<OUString> m_aLineTypes;
short nCaptionType; SdrCaptionType nCaptionType;
sal_Int32 nGap; sal_Int32 nGap;
short nEscDir; short nEscDir;
bool bEscRel; bool bEscRel;
...@@ -64,7 +67,7 @@ private: ...@@ -64,7 +67,7 @@ private:
sal_uInt16 nAnsatzTypePos; sal_uInt16 nAnsatzTypePos;
void SetupAnsatz_Impl( sal_uInt16 nType ); void SetupAnsatz_Impl( sal_uInt16 nType );
void SetupType_Impl( sal_uInt16 nType ); void SetupType_Impl( SdrCaptionType nType );
DECL_LINK_TYPED( AnsatzSelectHdl_Impl, ListBox&, void ); DECL_LINK_TYPED( AnsatzSelectHdl_Impl, ListBox&, void );
DECL_LINK_TYPED( AnsatzRelSelectHdl_Impl, ListBox&, void ); DECL_LINK_TYPED( AnsatzRelSelectHdl_Impl, ListBox&, void );
DECL_LINK_TYPED( LineOptHdl_Impl, Button *, void ); DECL_LINK_TYPED( LineOptHdl_Impl, Button *, void );
......
...@@ -72,7 +72,7 @@ const sal_uInt16 SvxCaptionTabPage::pCaptionRanges[] = ...@@ -72,7 +72,7 @@ const sal_uInt16 SvxCaptionTabPage::pCaptionRanges[] =
SvxCaptionTabPage::SvxCaptionTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs) SvxCaptionTabPage::SvxCaptionTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs)
: SfxTabPage(pParent, "CalloutPage", "cui/ui/calloutpage.ui", &rInAttrs) : SfxTabPage(pParent, "CalloutPage", "cui/ui/calloutpage.ui", &rInAttrs)
, nCaptionType(0) , nCaptionType(SdrCaptionType::Type1)
, nGap(0) , nGap(0)
, nEscDir(0) , nEscDir(0)
, bEscRel(false) , bEscRel(false)
...@@ -172,7 +172,7 @@ bool SvxCaptionTabPage::FillItemSet( SfxItemSet* _rOutAttrs) ...@@ -172,7 +172,7 @@ bool SvxCaptionTabPage::FillItemSet( SfxItemSet* _rOutAttrs)
SfxMapUnit eUnit; SfxMapUnit eUnit;
nCaptionType = m_pCT_CAPTTYPE->GetSelectItemId()-1; nCaptionType = (SdrCaptionType) (m_pCT_CAPTTYPE->GetSelectItemId()-1);
_rOutAttrs->Put( SdrCaptionTypeItem( (SdrCaptionType) nCaptionType ) ); _rOutAttrs->Put( SdrCaptionTypeItem( (SdrCaptionType) nCaptionType ) );
...@@ -183,7 +183,7 @@ bool SvxCaptionTabPage::FillItemSet( SfxItemSet* _rOutAttrs) ...@@ -183,7 +183,7 @@ bool SvxCaptionTabPage::FillItemSet( SfxItemSet* _rOutAttrs)
} }
// special treatment!!! XXX // special treatment!!! XXX
if( nCaptionType==SDRCAPT_TYPE1 ) if( nCaptionType==SdrCaptionType::Type1 )
{ {
switch( nEscDir ) switch( nEscDir )
{ {
...@@ -285,13 +285,13 @@ void SvxCaptionTabPage::Reset( const SfxItemSet* ) ...@@ -285,13 +285,13 @@ void SvxCaptionTabPage::Reset( const SfxItemSet* )
SetMetricValue( *m_pMF_ABSTAND, nGap, eUnit ); SetMetricValue( *m_pMF_ABSTAND, nGap, eUnit );
nGap = static_cast<long>(m_pMF_ABSTAND->GetValue()); nGap = static_cast<long>(m_pMF_ABSTAND->GetValue());
nCaptionType = (short)static_cast<const SdrCaptionTypeItem&>( rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONTYPE ) ) ).GetValue(); nCaptionType = (SdrCaptionType)static_cast<const SdrCaptionTypeItem&>( rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONTYPE ) ) ).GetValue();
bFitLineLen = static_cast<const SfxBoolItem&>( rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONFITLINELEN ) ) ).GetValue(); bFitLineLen = static_cast<const SfxBoolItem&>( rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONFITLINELEN ) ) ).GetValue();
nEscDir = (short)static_cast<const SdrCaptionEscDirItem&>( rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCDIR ) ) ).GetValue(); nEscDir = (short)static_cast<const SdrCaptionEscDirItem&>( rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCDIR ) ) ).GetValue();
bEscRel = static_cast<const SfxBoolItem&>( rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCISREL ) ) ).GetValue(); bEscRel = static_cast<const SfxBoolItem&>( rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCISREL ) ) ).GetValue();
// special treatment!!! XXX // special treatment!!! XXX
if( nCaptionType==SDRCAPT_TYPE1 ) if( nCaptionType==SdrCaptionType::Type1 )
{ {
switch( nEscDir ) switch( nEscDir )
{ {
...@@ -348,8 +348,8 @@ void SvxCaptionTabPage::Reset( const SfxItemSet* ) ...@@ -348,8 +348,8 @@ void SvxCaptionTabPage::Reset( const SfxItemSet* )
m_pLB_ANSATZ->SelectEntryPos( nAnsatzTypePos ); m_pLB_ANSATZ->SelectEntryPos( nAnsatzTypePos );
SetupAnsatz_Impl( nAnsatzTypePos ); SetupAnsatz_Impl( nAnsatzTypePos );
m_pCT_CAPTTYPE->SelectItem( nCaptionType+1 ); // Enum starts at 0! m_pCT_CAPTTYPE->SelectItem( (int)nCaptionType+1 ); // Enum starts at 0!
SetupType_Impl( nCaptionType+1 ); SetupType_Impl( nCaptionType );
} }
...@@ -453,32 +453,32 @@ IMPL_LINK_TYPED( SvxCaptionTabPage, LineOptHdl_Impl, Button *, pButton, void ) ...@@ -453,32 +453,32 @@ IMPL_LINK_TYPED( SvxCaptionTabPage, LineOptHdl_Impl, Button *, pButton, void )
IMPL_LINK_NOARG_TYPED(SvxCaptionTabPage, SelectCaptTypeHdl_Impl, ValueSet*, void) IMPL_LINK_NOARG_TYPED(SvxCaptionTabPage, SelectCaptTypeHdl_Impl, ValueSet*, void)
{ {
SetupType_Impl( m_pCT_CAPTTYPE->GetSelectItemId() ); SetupType_Impl( (SdrCaptionType) m_pCT_CAPTTYPE->GetSelectItemId() );
} }
void SvxCaptionTabPage::SetupType_Impl( sal_uInt16 nType ) void SvxCaptionTabPage::SetupType_Impl( SdrCaptionType nType )
{ {
switch( nType-1 ) switch( nType )
{ {
case SDRCAPT_TYPE1: case SdrCaptionType::Type1:
m_pFT_LAENGE->Disable(); m_pFT_LAENGE->Disable();
m_pCB_LAENGE->Disable(); m_pCB_LAENGE->Disable();
LineOptHdl_Impl( m_pCB_LAENGE ); LineOptHdl_Impl( m_pCB_LAENGE );
break; break;
case SDRCAPT_TYPE2: case SdrCaptionType::Type2:
m_pFT_LAENGE->Disable(); m_pFT_LAENGE->Disable();
m_pCB_LAENGE->Disable(); m_pCB_LAENGE->Disable();
LineOptHdl_Impl( m_pCB_LAENGE ); LineOptHdl_Impl( m_pCB_LAENGE );
break; break;
case SDRCAPT_TYPE3: case SdrCaptionType::Type3:
m_pFT_LAENGE->Enable(); m_pFT_LAENGE->Enable();
m_pCB_LAENGE->Enable(); m_pCB_LAENGE->Enable();
LineOptHdl_Impl( m_pCB_LAENGE ); LineOptHdl_Impl( m_pCB_LAENGE );
break; break;
case SDRCAPT_TYPE4: case SdrCaptionType::Type4:
m_pFT_LAENGE->Enable(); m_pFT_LAENGE->Enable();
m_pCB_LAENGE->Enable(); m_pCB_LAENGE->Enable();
LineOptHdl_Impl( m_pCB_LAENGE ); LineOptHdl_Impl( m_pCB_LAENGE );
......
...@@ -23,14 +23,14 @@ ...@@ -23,14 +23,14 @@
#include <svx/svddef.hxx> #include <svx/svddef.hxx>
#include <svx/svxdllapi.h> #include <svx/svxdllapi.h>
enum SdrCaptionType {SDRCAPT_TYPE1,SDRCAPT_TYPE2,SDRCAPT_TYPE3,SDRCAPT_TYPE4}; enum class SdrCaptionType { Type1, Type2, Type3, Type4 };
// class SdrCaptionTypeItem // class SdrCaptionTypeItem
class SVX_DLLPUBLIC SdrCaptionTypeItem: public SfxEnumItem { class SVX_DLLPUBLIC SdrCaptionTypeItem: public SfxEnumItem {
public: public:
SdrCaptionTypeItem(SdrCaptionType eStyle=SDRCAPT_TYPE3): SfxEnumItem(SDRATTR_CAPTIONTYPE,sal::static_int_cast< sal_uInt16 >(eStyle)) {} SdrCaptionTypeItem(SdrCaptionType eStyle=SdrCaptionType::Type3): SfxEnumItem(SDRATTR_CAPTIONTYPE,sal::static_int_cast< sal_uInt16 >(eStyle)) {}
SdrCaptionTypeItem(SvStream& rIn) : SfxEnumItem(SDRATTR_CAPTIONTYPE,rIn) {} SdrCaptionTypeItem(SvStream& rIn) : SfxEnumItem(SDRATTR_CAPTIONTYPE,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;
......
...@@ -80,7 +80,7 @@ public: ...@@ -80,7 +80,7 @@ public:
public: public:
ImpCaptParams() ImpCaptParams()
{ {
eType =SDRCAPT_TYPE3; eType =SdrCaptionType::Type3;
bFixedAngle=false; bFixedAngle=false;
nAngle =4500; nAngle =4500;
nGap =0; nGap =0;
...@@ -113,7 +113,7 @@ void ImpCaptParams::CalcEscPos(const Point& rTailPt, const Rectangle& rRect, Poi ...@@ -113,7 +113,7 @@ void ImpCaptParams::CalcEscPos(const Point& rTailPt, const Rectangle& rRect, Poi
EscDir eBestDir=LKS; EscDir eBestDir=LKS;
bool bTryH=eEscDir==SDRCAPT_ESCBESTFIT; bool bTryH=eEscDir==SDRCAPT_ESCBESTFIT;
if (!bTryH) { if (!bTryH) {
if (eType!=SDRCAPT_TYPE1) { if (eType!=SdrCaptionType::Type1) {
bTryH=eEscDir==SDRCAPT_ESCHORIZONTAL; bTryH=eEscDir==SDRCAPT_ESCHORIZONTAL;
} else { } else {
bTryH=eEscDir==SDRCAPT_ESCVERTICAL; bTryH=eEscDir==SDRCAPT_ESCVERTICAL;
...@@ -121,7 +121,7 @@ void ImpCaptParams::CalcEscPos(const Point& rTailPt, const Rectangle& rRect, Poi ...@@ -121,7 +121,7 @@ void ImpCaptParams::CalcEscPos(const Point& rTailPt, const Rectangle& rRect, Poi
} }
bool bTryV=eEscDir==SDRCAPT_ESCBESTFIT; bool bTryV=eEscDir==SDRCAPT_ESCBESTFIT;
if (!bTryV) { if (!bTryV) {
if (eType!=SDRCAPT_TYPE1) { if (eType!=SdrCaptionType::Type1) {
bTryV=eEscDir==SDRCAPT_ESCVERTICAL; bTryV=eEscDir==SDRCAPT_ESCVERTICAL;
} else { } else {
bTryV=eEscDir==SDRCAPT_ESCHORIZONTAL; bTryV=eEscDir==SDRCAPT_ESCHORIZONTAL;
...@@ -159,7 +159,7 @@ void ImpCaptParams::CalcEscPos(const Point& rTailPt, const Rectangle& rRect, Poi ...@@ -159,7 +159,7 @@ void ImpCaptParams::CalcEscPos(const Point& rTailPt, const Rectangle& rRect, Poi
BigInt aHorY(aBestPt.Y()-aTl.Y()); aHorY*=aHorY; BigInt aHorY(aBestPt.Y()-aTl.Y()); aHorY*=aHorY;
BigInt aVerX(aBest2.X()-aTl.X()); aVerX*=aVerX; BigInt aVerX(aBest2.X()-aTl.X()); aVerX*=aVerX;
BigInt aVerY(aBest2.Y()-aTl.Y()); aVerY*=aVerY; BigInt aVerY(aBest2.Y()-aTl.Y()); aVerY*=aVerY;
if (eType!=SDRCAPT_TYPE1) { if (eType!=SdrCaptionType::Type1) {
bTakeIt=aVerX+aVerY<aHorX+aHorY; bTakeIt=aVerX+aVerY<aHorX+aHorY;
} else { } else {
bTakeIt=aVerX+aVerY>=aHorX+aHorY; bTakeIt=aVerX+aVerY>=aHorX+aHorY;
...@@ -446,7 +446,7 @@ void SdrCaptionObj::ImpRecalcTail() ...@@ -446,7 +446,7 @@ void SdrCaptionObj::ImpRecalcTail()
// twice or SetSnapRect after it again just to work around this. // twice or SetSnapRect after it again just to work around this.
// Changed this method to not do that. // Changed this method to not do that.
// Also found why this has been done: For interactive dragging of the // Also found why this has been done: For interactive dragging of the
// tail end pos for SDRCAPT_TYPE1. This sure was the simplest method // tail end pos for SdrCaptionType::Type1. This sure was the simplest method
// to achieve this, at the cost of making a whole group of const methods // to achieve this, at the cost of making a whole group of const methods
// of this object implicitly change the object's position. // of this object implicitly change the object's position.
void SdrCaptionObj::ImpCalcTail1(const ImpCaptParams& rPara, tools::Polygon& rPoly, Rectangle& rRect) const void SdrCaptionObj::ImpCalcTail1(const ImpCaptParams& rPara, tools::Polygon& rPoly, Rectangle& rRect) const
...@@ -533,10 +533,10 @@ void SdrCaptionObj::ImpCalcTail4(const ImpCaptParams& rPara, tools::Polygon& rPo ...@@ -533,10 +533,10 @@ void SdrCaptionObj::ImpCalcTail4(const ImpCaptParams& rPara, tools::Polygon& rPo
void SdrCaptionObj::ImpCalcTail(const ImpCaptParams& rPara, tools::Polygon& rPoly, Rectangle& rRect) const void SdrCaptionObj::ImpCalcTail(const ImpCaptParams& rPara, tools::Polygon& rPoly, Rectangle& rRect) const
{ {
switch (rPara.eType) { switch (rPara.eType) {
case SDRCAPT_TYPE1: ImpCalcTail1(rPara,rPoly,rRect); break; case SdrCaptionType::Type1: ImpCalcTail1(rPara,rPoly,rRect); break;
case SDRCAPT_TYPE2: ImpCalcTail2(rPara,rPoly,rRect); break; case SdrCaptionType::Type2: ImpCalcTail2(rPara,rPoly,rRect); break;
case SDRCAPT_TYPE3: ImpCalcTail3(rPara,rPoly,rRect); break; case SdrCaptionType::Type3: ImpCalcTail3(rPara,rPoly,rRect); break;
case SDRCAPT_TYPE4: ImpCalcTail4(rPara,rPoly,rRect); break; case SdrCaptionType::Type4: ImpCalcTail4(rPara,rPoly,rRect); break;
} }
} }
......
...@@ -1237,8 +1237,8 @@ SdrObject* SwWW8ImplReader::ReadTextBox(WW8_DPHEAD* pHd, SfxAllItemSet &rSet) ...@@ -1237,8 +1237,8 @@ SdrObject* SwWW8ImplReader::ReadTextBox(WW8_DPHEAD* pHd, SfxAllItemSet &rSet)
SdrObject* SwWW8ImplReader::ReadCaptionBox(WW8_DPHEAD* pHd, SfxAllItemSet &rSet) SdrObject* SwWW8ImplReader::ReadCaptionBox(WW8_DPHEAD* pHd, SfxAllItemSet &rSet)
{ {
static const SdrCaptionType aCaptA[] = { SDRCAPT_TYPE1, SDRCAPT_TYPE2, static const SdrCaptionType aCaptA[] = { SdrCaptionType::Type1, SdrCaptionType::Type2,
SDRCAPT_TYPE3, SDRCAPT_TYPE4 }; SdrCaptionType::Type3, SdrCaptionType::Type4 };
WW8_DP_CALLOUT_TXTBOX aCallB; WW8_DP_CALLOUT_TXTBOX aCallB;
......
...@@ -722,9 +722,9 @@ static SvXMLEnumMapEntry const pXML_Caption_Esc_Dir_Enum[] = ...@@ -722,9 +722,9 @@ static SvXMLEnumMapEntry const pXML_Caption_Esc_Dir_Enum[] =
static SvXMLEnumMapEntry const pXML_Caption_Type_Enum[] = static SvXMLEnumMapEntry const pXML_Caption_Type_Enum[] =
{ {
{ XML_STRAIGHT_LINE, 0 }, //SDRCAPT_TYPE1, { XML_STRAIGHT_LINE, 0 }, //SdrCaptionType::Type1,
{ XML_ANGLED_LINE, 1 }, //SDRCAPT_TYPE2, { XML_ANGLED_LINE, 1 }, //SdrCaptionType::Type2,
{ XML_ANGLED_CONNECTOR_LINE, 2 }, //SDRCAPT_TYPE3, { XML_ANGLED_CONNECTOR_LINE, 2 }, //SdrCaptionType::Type3,
{ XML_TOKEN_INVALID,0 } { XML_TOKEN_INVALID,0 }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment