Kaydet (Commit) 336ace7c authored tarafından Noel Grandin's avatar Noel Grandin

convert CUSTOMSHAPE_HANDLE_ constants to scoped enum

Change-Id: I4cbbf9d2e42ef5e361449fff8bc9280ac337720e
üst 45ba5f2f
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <com/sun/star/drawing/XCustomShapeEngine.hpp> #include <com/sun/star/drawing/XCustomShapeEngine.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
#include <svx/svxdllapi.h> #include <svx/svxdllapi.h>
#include <o3tl/typed_flags_set.hxx>
// Initial Declarations // Initial Declarations
...@@ -57,18 +58,26 @@ class SdrAShapeObjGeoData : public SdrTextObjGeoData ...@@ -57,18 +58,26 @@ class SdrAShapeObjGeoData : public SdrTextObjGeoData
aAdjustmentSeq; aAdjustmentSeq;
}; };
#define CUSTOMSHAPE_HANDLE_RESIZE_FIXED 1 enum class CustomShapeHandleModes
#define CUSTOMSHAPE_HANDLE_CREATE_FIXED 2 {
#define CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_X 4 NONE = 0,
#define CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_Y 8 RESIZE_FIXED = 1,
#define CUSTOMSHAPE_HANDLE_MOVE_SHAPE 16 CREATE_FIXED = 2,
#define CUSTOMSHAPE_HANDLE_ORTHO4 32 RESIZE_ABSOLUTE_X = 4,
RESIZE_ABSOLUTE_Y = 8,
MOVE_SHAPE = 16,
ORTHO4 = 32,
};
namespace o3tl
{
template<> struct typed_flags<CustomShapeHandleModes> : is_typed_flags<CustomShapeHandleModes, 63> {};
}
struct SdrCustomShapeInteraction struct SdrCustomShapeInteraction
{ {
com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeHandle > xInteraction; com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeHandle > xInteraction;
com::sun::star::awt::Point aPosition; com::sun::star::awt::Point aPosition;
sal_Int32 nMode; CustomShapeHandleModes nMode;
}; };
......
...@@ -619,15 +619,15 @@ std::vector< SdrCustomShapeInteraction > SdrObjCustomShape::GetInteractionHandle ...@@ -619,15 +619,15 @@ std::vector< SdrCustomShapeInteraction > SdrObjCustomShape::GetInteractionHandle
aSdrCustomShapeInteraction.xInteraction = xInteractionHandles[ i ]; aSdrCustomShapeInteraction.xInteraction = xInteractionHandles[ i ];
aSdrCustomShapeInteraction.aPosition = xInteractionHandles[ i ]->getPosition(); aSdrCustomShapeInteraction.aPosition = xInteractionHandles[ i ]->getPosition();
sal_Int32 nMode = 0; CustomShapeHandleModes nMode = CustomShapeHandleModes::NONE;
switch( ImpGetCustomShapeType( *this ) ) switch( ImpGetCustomShapeType( *this ) )
{ {
case mso_sptAccentBorderCallout90 : // 2 ortho case mso_sptAccentBorderCallout90 : // 2 ortho
{ {
if (i == 0) if (i == 0)
nMode |= CUSTOMSHAPE_HANDLE_RESIZE_FIXED | CUSTOMSHAPE_HANDLE_CREATE_FIXED; nMode |= CustomShapeHandleModes::RESIZE_FIXED | CustomShapeHandleModes::CREATE_FIXED;
else if (i == 1) else if (i == 1)
nMode |= CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_X | CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_Y | CUSTOMSHAPE_HANDLE_MOVE_SHAPE | CUSTOMSHAPE_HANDLE_ORTHO4; nMode |= CustomShapeHandleModes::RESIZE_ABSOLUTE_X | CustomShapeHandleModes::RESIZE_ABSOLUTE_Y | CustomShapeHandleModes::MOVE_SHAPE | CustomShapeHandleModes::ORTHO4;
} }
break; break;
...@@ -637,24 +637,24 @@ std::vector< SdrCustomShapeInteraction > SdrObjCustomShape::GetInteractionHandle ...@@ -637,24 +637,24 @@ std::vector< SdrCustomShapeInteraction > SdrObjCustomShape::GetInteractionHandle
case mso_sptWedgeEllipseCallout : case mso_sptWedgeEllipseCallout :
{ {
if (i == 0) if (i == 0)
nMode |= CUSTOMSHAPE_HANDLE_RESIZE_FIXED; nMode |= CustomShapeHandleModes::RESIZE_FIXED;
} }
break; break;
case mso_sptBorderCallout1 : // 2 diag case mso_sptBorderCallout1 : // 2 diag
{ {
if (i == 0) if (i == 0)
nMode |= CUSTOMSHAPE_HANDLE_RESIZE_FIXED | CUSTOMSHAPE_HANDLE_CREATE_FIXED; nMode |= CustomShapeHandleModes::RESIZE_FIXED | CustomShapeHandleModes::CREATE_FIXED;
else if (i == 1) else if (i == 1)
nMode |= CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_X | CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_Y | CUSTOMSHAPE_HANDLE_MOVE_SHAPE; nMode |= CustomShapeHandleModes::RESIZE_ABSOLUTE_X | CustomShapeHandleModes::RESIZE_ABSOLUTE_Y | CustomShapeHandleModes::MOVE_SHAPE;
} }
break; break;
case mso_sptBorderCallout2 : // 3 case mso_sptBorderCallout2 : // 3
{ {
if (i == 0) if (i == 0)
nMode |= CUSTOMSHAPE_HANDLE_RESIZE_FIXED | CUSTOMSHAPE_HANDLE_CREATE_FIXED; nMode |= CustomShapeHandleModes::RESIZE_FIXED | CustomShapeHandleModes::CREATE_FIXED;
else if (i == 2) else if (i == 2)
nMode |= CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_X | CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_Y | CUSTOMSHAPE_HANDLE_MOVE_SHAPE; nMode |= CustomShapeHandleModes::RESIZE_ABSOLUTE_X | CustomShapeHandleModes::RESIZE_ABSOLUTE_Y | CustomShapeHandleModes::MOVE_SHAPE;
} }
break; break;
case mso_sptCallout90 : case mso_sptCallout90 :
...@@ -672,7 +672,7 @@ std::vector< SdrCustomShapeInteraction > SdrObjCustomShape::GetInteractionHandle ...@@ -672,7 +672,7 @@ std::vector< SdrCustomShapeInteraction > SdrObjCustomShape::GetInteractionHandle
case mso_sptAccentBorderCallout3 : case mso_sptAccentBorderCallout3 :
{ {
if (i == 0) if (i == 0)
nMode |= CUSTOMSHAPE_HANDLE_RESIZE_FIXED | CUSTOMSHAPE_HANDLE_CREATE_FIXED; nMode |= CustomShapeHandleModes::RESIZE_FIXED | CustomShapeHandleModes::CREATE_FIXED;
} }
break; break;
default: break; default: break;
...@@ -1603,14 +1603,14 @@ void SdrObjCustomShape::NbcResize( const Point& rRef, const Fraction& rxFact, co ...@@ -1603,14 +1603,14 @@ void SdrObjCustomShape::NbcResize( const Point& rRef, const Fraction& rxFact, co
{ {
try try
{ {
if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_FIXED ) if ( aIter->nMode & CustomShapeHandleModes::RESIZE_FIXED )
aIter->xInteraction->setControllerPosition( aIter->aPosition ); aIter->xInteraction->setControllerPosition( aIter->aPosition );
if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_X ) if ( aIter->nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_X )
{ {
sal_Int32 nX = ( aIter->aPosition.X - aOld.Left() ) + maRect.Left(); sal_Int32 nX = ( aIter->aPosition.X - aOld.Left() ) + maRect.Left();
aIter->xInteraction->setControllerPosition( com::sun::star::awt::Point( nX, aIter->xInteraction->getPosition().Y ) ); aIter->xInteraction->setControllerPosition( com::sun::star::awt::Point( nX, aIter->xInteraction->getPosition().Y ) );
} }
if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_Y ) if ( aIter->nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_Y )
{ {
sal_Int32 nY = ( aIter->aPosition.Y - aOld.Top() ) + maRect.Top(); sal_Int32 nY = ( aIter->aPosition.Y - aOld.Top() ) + maRect.Top();
aIter->xInteraction->setControllerPosition( com::sun::star::awt::Point( aIter->xInteraction->getPosition().X, nY ) ); aIter->xInteraction->setControllerPosition( com::sun::star::awt::Point( aIter->xInteraction->getPosition().X, nY ) );
...@@ -2022,9 +2022,9 @@ void SdrObjCustomShape::DragResizeCustomShape( const Rectangle& rNewRect ) ...@@ -2022,9 +2022,9 @@ void SdrObjCustomShape::DragResizeCustomShape( const Rectangle& rNewRect )
{ {
try try
{ {
if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_FIXED ) if ( aIter->nMode & CustomShapeHandleModes::RESIZE_FIXED )
aIter->xInteraction->setControllerPosition( aIter->aPosition ); aIter->xInteraction->setControllerPosition( aIter->aPosition );
if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_X ) if ( aIter->nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_X )
{ {
sal_Int32 nX; sal_Int32 nX;
if ( bOldMirroredX ) if ( bOldMirroredX )
...@@ -2045,7 +2045,7 @@ void SdrObjCustomShape::DragResizeCustomShape( const Rectangle& rNewRect ) ...@@ -2045,7 +2045,7 @@ void SdrObjCustomShape::DragResizeCustomShape( const Rectangle& rNewRect )
} }
aIter->xInteraction->setControllerPosition( com::sun::star::awt::Point( nX, aIter->xInteraction->getPosition().Y ) ); aIter->xInteraction->setControllerPosition( com::sun::star::awt::Point( nX, aIter->xInteraction->getPosition().Y ) );
} }
if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_Y ) if ( aIter->nMode & CustomShapeHandleModes::RESIZE_ABSOLUTE_Y )
{ {
sal_Int32 nY; sal_Int32 nY;
if ( bOldMirroredY ) if ( bOldMirroredY )
...@@ -2086,7 +2086,7 @@ void SdrObjCustomShape::DragMoveCustomShapeHdl( const Point& rDestination, ...@@ -2086,7 +2086,7 @@ void SdrObjCustomShape::DragMoveCustomShapeHdl( const Point& rDestination,
try try
{ {
com::sun::star::awt::Point aPt( rDestination.X(), rDestination.Y() ); com::sun::star::awt::Point aPt( rDestination.X(), rDestination.Y() );
if ( aInteractionHandle.nMode & CUSTOMSHAPE_HANDLE_MOVE_SHAPE && bMoveCalloutRectangle ) if ( aInteractionHandle.nMode & CustomShapeHandleModes::MOVE_SHAPE && bMoveCalloutRectangle )
{ {
sal_Int32 nXDiff = aPt.X - aInteractionHandle.aPosition.X; sal_Int32 nXDiff = aPt.X - aInteractionHandle.aPosition.X;
sal_Int32 nYDiff = aPt.Y - aInteractionHandle.aPosition.Y; sal_Int32 nYDiff = aPt.Y - aInteractionHandle.aPosition.Y;
...@@ -2100,7 +2100,7 @@ void SdrObjCustomShape::DragMoveCustomShapeHdl( const Point& rDestination, ...@@ -2100,7 +2100,7 @@ void SdrObjCustomShape::DragMoveCustomShapeHdl( const Point& rDestination,
for (std::vector< SdrCustomShapeInteraction >::const_iterator aIter( aInteractionHandles.begin() ), aEnd( aInteractionHandles.end() ) ; for (std::vector< SdrCustomShapeInteraction >::const_iterator aIter( aInteractionHandles.begin() ), aEnd( aInteractionHandles.end() ) ;
aIter != aEnd; ++aIter) aIter != aEnd; ++aIter)
{ {
if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_FIXED ) if ( aIter->nMode & CustomShapeHandleModes::RESIZE_FIXED )
{ {
if ( aIter->xInteraction.is() ) if ( aIter->xInteraction.is() )
aIter->xInteraction->setControllerPosition( aIter->aPosition ); aIter->xInteraction->setControllerPosition( aIter->aPosition );
...@@ -2190,7 +2190,7 @@ void SdrObjCustomShape::DragCreateObject( SdrDragStat& rStat ) ...@@ -2190,7 +2190,7 @@ void SdrObjCustomShape::DragCreateObject( SdrDragStat& rStat )
{ {
try try
{ {
if ( aIter->nMode & CUSTOMSHAPE_HANDLE_CREATE_FIXED ) if ( aIter->nMode & CustomShapeHandleModes::CREATE_FIXED )
aIter->xInteraction->setControllerPosition( awt::Point( rStat.GetStart().X(), rStat.GetStart().Y() ) ); aIter->xInteraction->setControllerPosition( awt::Point( rStat.GetStart().X(), rStat.GetStart().Y() ) );
} }
catch ( const uno::RuntimeException& ) catch ( const uno::RuntimeException& )
...@@ -2526,7 +2526,7 @@ bool SdrObjCustomShape::NbcAdjustTextFrameWidthAndHeight(bool bHgt, bool bWdt) ...@@ -2526,7 +2526,7 @@ bool SdrObjCustomShape::NbcAdjustTextFrameWidthAndHeight(bool bHgt, bool bWdt)
{ {
try try
{ {
if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_FIXED ) if ( aIter->nMode & CustomShapeHandleModes::RESIZE_FIXED )
aIter->xInteraction->setControllerPosition( aIter->aPosition ); aIter->xInteraction->setControllerPosition( aIter->aPosition );
} }
catch ( const uno::RuntimeException& ) catch ( const uno::RuntimeException& )
...@@ -2558,7 +2558,7 @@ bool SdrObjCustomShape::AdjustTextFrameWidthAndHeight(bool bHgt, bool bWdt) ...@@ -2558,7 +2558,7 @@ bool SdrObjCustomShape::AdjustTextFrameWidthAndHeight(bool bHgt, bool bWdt)
{ {
try try
{ {
if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_FIXED ) if ( aIter->nMode & CustomShapeHandleModes::RESIZE_FIXED )
aIter->xInteraction->setControllerPosition( aIter->aPosition ); aIter->xInteraction->setControllerPosition( aIter->aPosition );
} }
catch ( const uno::RuntimeException& ) catch ( const uno::RuntimeException& )
......
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