diff options
-rw-r--r-- | cui/source/tabpages/measure.cxx | 63 | ||||
-rw-r--r-- | include/svx/sxmtpitm.hxx | 26 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx | 8 | ||||
-rw-r--r-- | svx/source/svdraw/svdattr.cxx | 3 | ||||
-rw-r--r-- | svx/source/svdraw/svdomeas.cxx | 40 |
5 files changed, 71 insertions, 69 deletions
diff --git a/cui/source/tabpages/measure.cxx b/cui/source/tabpages/measure.cxx index de105558b002..289f9929f08d 100644 --- a/cui/source/tabpages/measure.cxx +++ b/cui/source/tabpages/measure.cxx @@ -339,7 +339,7 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs ) // Position if ( rAttrs->GetItemState( SDRATTR_MEASURETEXTVPOS ) != SfxItemState::DONTCARE ) { - SdrMeasureTextVPos eVPos = (SdrMeasureTextVPos) + css::drawing::MeasureTextVertPos eVPos = static_cast<const SdrMeasureTextVPosItem&>( rAttrs->Get( SDRATTR_MEASURETEXTVPOS ) ).GetValue(); { if ( rAttrs->GetItemState( SDRATTR_MEASURETEXTHPOS ) != SfxItemState::DONTCARE ) @@ -352,7 +352,7 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs ) RectPoint eRP = RectPoint::MM; switch( eVPos ) { - case SdrMeasureTextVPos::Above: + case css::drawing::MeasureTextVertPos_EAST: switch( eHPos ) { case css::drawing::MeasureTextHorzPos_LEFTOUTSIDE: eRP = RectPoint::LT; break; @@ -362,7 +362,7 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs ) default: break; } break; - case SdrMeasureTextVPos::VerticalCentered: + case css::drawing::MeasureTextVertPos_CENTERED: switch( eHPos ) { case css::drawing::MeasureTextHorzPos_LEFTOUTSIDE: eRP = RectPoint::LM; break; @@ -372,7 +372,7 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs ) default: break; } break; - case SdrMeasureTextVPos::Below: + case css::drawing::MeasureTextVertPos_WEST: switch( eHPos ) { case css::drawing::MeasureTextHorzPos_LEFTOUTSIDE: eRP = RectPoint::LB; break; @@ -382,7 +382,7 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs ) default: break; } break; - case SdrMeasureTextVPos::Auto: + case css::drawing::MeasureTextVertPos_AUTO: switch( eHPos ) { case css::drawing::MeasureTextHorzPos_LEFTOUTSIDE: eRP = RectPoint::LM; break; @@ -403,7 +403,7 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs ) nState = CTL_STATE::NOHORZ; } - if( eVPos == SdrMeasureTextVPos::Auto ) + if (eVPos == css::drawing::MeasureTextVertPos_AUTO) { m_pTsbAutoPosV->SetState( TRISTATE_TRUE ); nState |= CTL_STATE::NOVERT; @@ -522,42 +522,41 @@ bool SvxMeasurePage::FillItemSet( SfxItemSet* rAttrs) if( bPositionModified ) { // Position - SdrMeasureTextVPos eVPos, eOldVPos; + css::drawing::MeasureTextVertPos eVPos, eOldVPos; css::drawing::MeasureTextHorzPos eHPos, eOldHPos; RectPoint eRP = m_pCtlPosition->GetActualRP(); switch( eRP ) { default: - case RectPoint::LT: eVPos = SdrMeasureTextVPos::Above; + case RectPoint::LT: eVPos = css::drawing::MeasureTextVertPos_EAST; eHPos = css::drawing::MeasureTextHorzPos_LEFTOUTSIDE; break; - case RectPoint::LM: eVPos = SdrMeasureTextVPos::VerticalCentered; + case RectPoint::LM: eVPos = css::drawing::MeasureTextVertPos_CENTERED; eHPos = css::drawing::MeasureTextHorzPos_LEFTOUTSIDE; break; - case RectPoint::LB: eVPos = SdrMeasureTextVPos::Below; + case RectPoint::LB: eVPos = css::drawing::MeasureTextVertPos_WEST; eHPos = css::drawing::MeasureTextHorzPos_LEFTOUTSIDE; break; - case RectPoint::MT: eVPos = SdrMeasureTextVPos::Above; + case RectPoint::MT: eVPos = css::drawing::MeasureTextVertPos_EAST; eHPos = css::drawing::MeasureTextHorzPos_INSIDE; break; - case RectPoint::MM: eVPos = SdrMeasureTextVPos::VerticalCentered; + case RectPoint::MM: eVPos = css::drawing::MeasureTextVertPos_CENTERED; eHPos = css::drawing::MeasureTextHorzPos_INSIDE; break; - case RectPoint::MB: eVPos = SdrMeasureTextVPos::Below; + case RectPoint::MB: eVPos = css::drawing::MeasureTextVertPos_WEST; eHPos = css::drawing::MeasureTextHorzPos_INSIDE; break; - case RectPoint::RT: eVPos = SdrMeasureTextVPos::Above; + case RectPoint::RT: eVPos = css::drawing::MeasureTextVertPos_EAST; eHPos = css::drawing::MeasureTextHorzPos_RIGHTOUTSIDE; break; - case RectPoint::RM: eVPos = SdrMeasureTextVPos::VerticalCentered; + case RectPoint::RM: eVPos = css::drawing::MeasureTextVertPos_CENTERED; eHPos = css::drawing::MeasureTextHorzPos_RIGHTOUTSIDE; break; - case RectPoint::RB: eVPos = SdrMeasureTextVPos::Below; + case RectPoint::RB: eVPos = css::drawing::MeasureTextVertPos_WEST; eHPos = css::drawing::MeasureTextHorzPos_RIGHTOUTSIDE; break; } if (m_pTsbAutoPosH->GetState() == TRISTATE_TRUE) eHPos = css::drawing::MeasureTextHorzPos_AUTO; - if( m_pTsbAutoPosV->GetState() == TRISTATE_TRUE ) - eVPos = SdrMeasureTextVPos::Auto; + if (m_pTsbAutoPosV->GetState() == TRISTATE_TRUE) + eVPos = css::drawing::MeasureTextVertPos_AUTO; if ( rAttrs->GetItemState( SDRATTR_MEASURETEXTVPOS ) != SfxItemState::DONTCARE ) { - eOldVPos = (SdrMeasureTextVPos) - static_cast<const SdrMeasureTextVPosItem&>( rOutAttrs.Get( SDRATTR_MEASURETEXTVPOS ) ).GetValue(); + eOldVPos = static_cast<const SdrMeasureTextVPosItem&>(rOutAttrs.Get(SDRATTR_MEASURETEXTVPOS)).GetValue(); if( eOldVPos != eVPos ) { rAttrs->Put( SdrMeasureTextVPosItem( eVPos ) ); @@ -751,29 +750,29 @@ void SvxMeasurePage::ChangeAttrHdl_Impl( void* p ) // Position RectPoint eRP = m_pCtlPosition->GetActualRP(); - SdrMeasureTextVPos eVPos; + css::drawing::MeasureTextVertPos eVPos; css::drawing::MeasureTextHorzPos eHPos; switch( eRP ) { default: - case RectPoint::LT: eVPos = SdrMeasureTextVPos::Above; + case RectPoint::LT: eVPos = css::drawing::MeasureTextVertPos_EAST; eHPos = css::drawing::MeasureTextHorzPos_LEFTOUTSIDE; break; - case RectPoint::LM: eVPos = SdrMeasureTextVPos::VerticalCentered; + case RectPoint::LM: eVPos = css::drawing::MeasureTextVertPos_CENTERED; eHPos = css::drawing::MeasureTextHorzPos_LEFTOUTSIDE; break; - case RectPoint::LB: eVPos = SdrMeasureTextVPos::Below; + case RectPoint::LB: eVPos = css::drawing::MeasureTextVertPos_WEST; eHPos = css::drawing::MeasureTextHorzPos_LEFTOUTSIDE; break; - case RectPoint::MT: eVPos = SdrMeasureTextVPos::Above; + case RectPoint::MT: eVPos = css::drawing::MeasureTextVertPos_EAST; eHPos = css::drawing::MeasureTextHorzPos_INSIDE; break; - case RectPoint::MM: eVPos = SdrMeasureTextVPos::VerticalCentered; + case RectPoint::MM: eVPos = css::drawing::MeasureTextVertPos_CENTERED; eHPos = css::drawing::MeasureTextHorzPos_INSIDE; break; - case RectPoint::MB: eVPos = SdrMeasureTextVPos::Below; + case RectPoint::MB: eVPos = css::drawing::MeasureTextVertPos_WEST; eHPos = css::drawing::MeasureTextHorzPos_INSIDE; break; - case RectPoint::RT: eVPos = SdrMeasureTextVPos::Above; + case RectPoint::RT: eVPos = css::drawing::MeasureTextVertPos_EAST; eHPos = css::drawing::MeasureTextHorzPos_RIGHTOUTSIDE; break; - case RectPoint::RM: eVPos = SdrMeasureTextVPos::VerticalCentered; + case RectPoint::RM: eVPos = css::drawing::MeasureTextVertPos_CENTERED; eHPos = css::drawing::MeasureTextHorzPos_RIGHTOUTSIDE; break; - case RectPoint::RB: eVPos = SdrMeasureTextVPos::Below; + case RectPoint::RB: eVPos = css::drawing::MeasureTextVertPos_WEST; eHPos = css::drawing::MeasureTextHorzPos_RIGHTOUTSIDE; break; } @@ -785,9 +784,9 @@ void SvxMeasurePage::ChangeAttrHdl_Impl( void* p ) nState = CTL_STATE::NOHORZ; } - if( m_pTsbAutoPosV->GetState() == TRISTATE_TRUE ) + if (m_pTsbAutoPosV->GetState() == TRISTATE_TRUE) { - eVPos = SdrMeasureTextVPos::Auto; + eVPos = css::drawing::MeasureTextVertPos_AUTO; nState |= CTL_STATE::NOVERT; } diff --git a/include/svx/sxmtpitm.hxx b/include/svx/sxmtpitm.hxx index 3caf61fb9966..fc9abf85dcfd 100644 --- a/include/svx/sxmtpitm.hxx +++ b/include/svx/sxmtpitm.hxx @@ -23,19 +23,19 @@ #include <svl/eitem.hxx> #include <svx/svxdllapi.h> #include <com/sun/star/drawing/MeasureTextHorzPos.hpp> - -enum class SdrMeasureTextVPos { Auto, Above, Below, VerticalCentered }; - +#include <com/sun/star/drawing/MeasureTextVertPos.hpp> // class SdrMeasureTextHPosItem - class SVX_DLLPUBLIC SdrMeasureTextHPosItem: public SfxEnumItem { public: SdrMeasureTextHPosItem(css::drawing::MeasureTextHorzPos ePos = css::drawing::MeasureTextHorzPos::MeasureTextHorzPos_AUTO) - : SfxEnumItem(SDRATTR_MEASURETEXTHPOS,sal::static_int_cast< sal_uInt16 >(ePos)) + : SfxEnumItem(SDRATTR_MEASURETEXTHPOS, sal::static_int_cast<sal_uInt16>(ePos)) + { + } + SdrMeasureTextHPosItem(SvStream& rIn) + : SfxEnumItem(SDRATTR_MEASURETEXTHPOS, rIn) { } - SdrMeasureTextHPosItem(SvStream& rIn) : SfxEnumItem(SDRATTR_MEASURETEXTHPOS,rIn) {} virtual SfxPoolItem* Clone(SfxItemPool* pPool=nullptr) const override; virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const override; virtual sal_uInt16 GetValueCount() const override; // { return 4; } @@ -48,17 +48,21 @@ public: virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper * = nullptr) const override; }; - // class SdrMeasureTextVPosItem - class SVX_DLLPUBLIC SdrMeasureTextVPosItem: public SfxEnumItem { public: - SdrMeasureTextVPosItem(SdrMeasureTextVPos ePos=SdrMeasureTextVPos::Auto): SfxEnumItem(SDRATTR_MEASURETEXTVPOS,sal::static_int_cast< sal_uInt16 >(ePos)) {} - SdrMeasureTextVPosItem(SvStream& rIn) : SfxEnumItem(SDRATTR_MEASURETEXTVPOS,rIn) {} + SdrMeasureTextVPosItem(css::drawing::MeasureTextVertPos ePos = css::drawing::MeasureTextVertPos_AUTO) + : SfxEnumItem(SDRATTR_MEASURETEXTVPOS, sal::static_int_cast<sal_uInt16>(ePos)) + { + } + SdrMeasureTextVPosItem(SvStream& rIn) + : SfxEnumItem(SDRATTR_MEASURETEXTVPOS, rIn) + { + } virtual SfxPoolItem* Clone(SfxItemPool* pPool=nullptr) const override; virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const override; virtual sal_uInt16 GetValueCount() const override; // { return 5; } - SdrMeasureTextVPos GetValue() const { return (SdrMeasureTextVPos)SfxEnumItem::GetValue(); } + css::drawing::MeasureTextVertPos GetValue() const { return (css::drawing::MeasureTextVertPos)SfxEnumItem::GetValue(); } virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; diff --git a/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx b/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx index d5eb000dac43..bf9187d792bc 100644 --- a/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx @@ -90,22 +90,22 @@ namespace sdr switch(static_cast<const SdrMeasureTextVPosItem&>(rItemSet.Get(SDRATTR_MEASURETEXTVPOS)).GetValue()) { - case SdrMeasureTextVPos::Above : + case css::drawing::MeasureTextVertPos_EAST: { aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE; break; } - case SdrMeasureTextVPos::VerticalCentered : + case css::drawing::MeasureTextVertPos_CENTERED: { aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED; break; } - case SdrMeasureTextVPos::Below : + case css::drawing::MeasureTextVertPos_WEST: { aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE; break; } - default : // SdrMeasureTextVPos::Auto + default : // css::drawing::MeasureTextVertPos_AUTO { break; } diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index 52a42257bfa1..fcf56a6779b6 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -1850,11 +1850,10 @@ bool SdrMeasureTextVPosItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMember ePos = (drawing::MeasureTextVertPos)nEnum; } - SetValue( sal::static_int_cast< sal_uInt16 >( (SdrMeasureTextVPos)ePos ) ); + SetValue(sal::static_int_cast<sal_uInt16>(ePos)); return true; } - SfxPoolItem* SdrMeasureUnitItem::Clone(SfxItemPool* /*pPool*/) const { return new SdrMeasureUnitItem(*this); } SfxPoolItem* SdrMeasureUnitItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const { return new SdrMeasureUnitItem(rIn); } diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx index 0a38f0c7c045..c29523910dd3 100644 --- a/svx/source/svdraw/svdomeas.cxx +++ b/svx/source/svdraw/svdomeas.cxx @@ -263,7 +263,7 @@ struct ImpMeasureRec : public SdrDragStatUserData Point aPt2; SdrMeasureKind eKind; css::drawing::MeasureTextHorzPos eWantTextHPos; - SdrMeasureTextVPos eWantTextVPos; + css::drawing::MeasureTextVertPos eWantTextVPos; long nLineDist; long nHelplineOverhang; long nHelplineDist; @@ -307,7 +307,7 @@ struct ImpMeasurePoly double nHlpCos; sal_uInt16 nMainlineAnz; css::drawing::MeasureTextHorzPos eUsedTextHPos; - SdrMeasureTextVPos eUsedTextVPos; + css::drawing::MeasureTextVertPos eUsedTextVPos; long nLineWdt2; // half the line width long nArrow1Len; // length of 1st arrowhead; for Center, use only half long nArrow2Len; // length of 2nd arrowhead; for Center, use only half @@ -411,10 +411,10 @@ void SdrMeasureObj::ImpCalcGeometrics(const ImpMeasureRec& rRec, ImpMeasurePoly& rPol.eUsedTextHPos=rRec.eWantTextHPos; rPol.eUsedTextVPos=rRec.eWantTextVPos; - if (rPol.eUsedTextVPos==SdrMeasureTextVPos::Auto) - rPol.eUsedTextVPos=SdrMeasureTextVPos::Above; + if (rPol.eUsedTextVPos == css::drawing::MeasureTextVertPos_AUTO) + rPol.eUsedTextVPos = css::drawing::MeasureTextVertPos_EAST; bool bBrkLine=false; - if (rPol.eUsedTextVPos==SdrMeasureTextVPos::VerticalCentered) + if (rPol.eUsedTextVPos == css::drawing::MeasureTextVertPos_CENTERED) { OutlinerParaObject* pOutlinerParaObject = SdrTextObj::GetOutlinerParaObject(); if (pOutlinerParaObject!=nullptr && pOutlinerParaObject->GetTextObject().GetParagraphCount()==1) @@ -667,7 +667,7 @@ void SdrMeasureObj::TakeUnrotatedSnapRect(Rectangle& rRect) const bool bUpsideDown=aRec.bTextUpsideDown!=aMPol.bAutoUpsideDown; bool bBelowRefEdge=aRec.bBelowRefEdge; css::drawing::MeasureTextHorzPos eMH=aMPol.eUsedTextHPos; - SdrMeasureTextVPos eMV=aMPol.eUsedTextVPos; + css::drawing::MeasureTextVertPos eMV=aMPol.eUsedTextVPos; if (!bRota90) { switch (eMH) { case css::drawing::MeasureTextHorzPos_LEFTOUTSIDE: aTextPos.X()=aPt1b.X()-aTextSize2.Width()-nArr1Len-nLWdt; break; @@ -675,9 +675,9 @@ void SdrMeasureObj::TakeUnrotatedSnapRect(Rectangle& rRect) const default: aTextPos.X()=aPt1b.X(); aTextSize2.Width()=nLen; } switch (eMV) { - case SdrMeasureTextVPos::VerticalCentered: + case css::drawing::MeasureTextVertPos_CENTERED: aTextPos.Y()=aPt1b.Y()-aTextSize2.Height()/2; break; - case SdrMeasureTextVPos::Below: { + case css::drawing::MeasureTextVertPos_WEST: { if (!bUpsideDown) aTextPos.Y()=aPt1b.Y()+nLWdt; else aTextPos.Y()=aPt1b.Y()-aTextSize2.Height()-nLWdt; } break; @@ -697,9 +697,9 @@ void SdrMeasureObj::TakeUnrotatedSnapRect(Rectangle& rRect) const default: aTextPos.X()=aPt1b.X(); aTextSize2.Height()=nLen; } switch (eMV) { - case SdrMeasureTextVPos::VerticalCentered: + case css::drawing::MeasureTextVertPos_CENTERED: aTextPos.Y()=aPt1b.Y()+aTextSize2.Width()/2; break; - case SdrMeasureTextVPos::Below: { + case css::drawing::MeasureTextVertPos_WEST: { if (!bBelowRefEdge) aTextPos.Y()=aPt1b.Y()+aTextSize2.Width()+nLWdt; else aTextPos.Y()=aPt1b.Y()-nLWdt; } break; @@ -1323,8 +1323,8 @@ sal_uInt16 SdrMeasureObj::GetOutlinerViewAnchorMode() const SdrTextHorzAdjust eTH=GetTextHorizontalAdjust(); SdrTextVertAdjust eTV=GetTextVerticalAdjust(); - css::drawing::MeasureTextHorzPos eMH=aMPol.eUsedTextHPos; - SdrMeasureTextVPos eMV=aMPol.eUsedTextVPos; + css::drawing::MeasureTextHorzPos eMH = aMPol.eUsedTextHPos; + css::drawing::MeasureTextVertPos eMV = aMPol.eUsedTextVPos; bool bTextRota90=aRec.bTextRota90; bool bBelowRefEdge=aRec.bBelowRefEdge; @@ -1333,21 +1333,21 @@ sal_uInt16 SdrMeasureObj::GetOutlinerViewAnchorMode() const if (eMH==css::drawing::MeasureTextHorzPos_LEFTOUTSIDE) eTH=SDRTEXTHORZADJUST_RIGHT; if (eMH==css::drawing::MeasureTextHorzPos_RIGHTOUTSIDE) eTH=SDRTEXTHORZADJUST_LEFT; // at eMH==css::drawing::MeasureTextHorzPos_INSIDE we can anchor horizontally - if (eMV==SdrMeasureTextVPos::Above) eTV=SDRTEXTVERTADJUST_BOTTOM; - if (eMV==SdrMeasureTextVPos::Below) eTV=SDRTEXTVERTADJUST_TOP; - if (eMV==SdrMeasureTextVPos::VerticalCentered) eTV=SDRTEXTVERTADJUST_CENTER; + if (eMV==css::drawing::MeasureTextVertPos_EAST) eTV=SDRTEXTVERTADJUST_BOTTOM; + if (eMV==css::drawing::MeasureTextVertPos_WEST) eTV=SDRTEXTVERTADJUST_TOP; + if (eMV==css::drawing::MeasureTextVertPos_CENTERED) eTV=SDRTEXTVERTADJUST_CENTER; } else { if (eMH==css::drawing::MeasureTextHorzPos_LEFTOUTSIDE) eTV=SDRTEXTVERTADJUST_BOTTOM; if (eMH==css::drawing::MeasureTextHorzPos_RIGHTOUTSIDE) eTV=SDRTEXTVERTADJUST_TOP; // at eMH==css::drawing::MeasureTextHorzPos_INSIDE we can anchor vertically if (!bBelowRefEdge) { - if (eMV==SdrMeasureTextVPos::Above) eTH=SDRTEXTHORZADJUST_LEFT; - if (eMV==SdrMeasureTextVPos::Below) eTH=SDRTEXTHORZADJUST_RIGHT; + if (eMV==css::drawing::MeasureTextVertPos_EAST) eTH=SDRTEXTHORZADJUST_LEFT; + if (eMV==css::drawing::MeasureTextVertPos_WEST) eTH=SDRTEXTHORZADJUST_RIGHT; } else { - if (eMV==SdrMeasureTextVPos::Above) eTH=SDRTEXTHORZADJUST_RIGHT; - if (eMV==SdrMeasureTextVPos::Below) eTH=SDRTEXTHORZADJUST_LEFT; + if (eMV==css::drawing::MeasureTextVertPos_EAST) eTH=SDRTEXTHORZADJUST_RIGHT; + if (eMV==css::drawing::MeasureTextVertPos_WEST) eTH=SDRTEXTHORZADJUST_LEFT; } - if (eMV==SdrMeasureTextVPos::VerticalCentered) eTH=SDRTEXTHORZADJUST_CENTER; + if (eMV==css::drawing::MeasureTextVertPos_CENTERED) eTH=SDRTEXTHORZADJUST_CENTER; } EVAnchorMode eRet=ANCHOR_BOTTOM_HCENTER; |