summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorobo <obo@openoffice.org>2010-06-15 06:55:41 +0200
committerobo <obo@openoffice.org>2010-06-15 06:55:41 +0200
commit907aa92c4b44b195551d5f2d3631ab6599d3f002 (patch)
tree9916a1ad1c1ff5f93f53b5cf7b72fef31526c1fe /svx/source
parent0851f9d79b693900b6ba767ce2e51d0bde07d731 (diff)
parent439ff308757c277d224bf46a92fb05b0653899b9 (diff)
CWS-TOOLING: integrate CWS impress190
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx240
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.hxx12
-rw-r--r--svx/source/svdraw/svdoutl.cxx5
3 files changed, 153 insertions, 104 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 410f792fd1..12123ecc58 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -468,6 +468,10 @@ sal_Bool EnhancedCustomShape2d::ConvertSequenceToEnhancedCustomShape2dHandle(
const rtl::OUString sSwitched ( RTL_CONSTASCII_USTRINGPARAM( "Switched" ) );
const rtl::OUString sPolar ( RTL_CONSTASCII_USTRINGPARAM( "Polar" ) );
// const rtl::OUString sMap ( RTL_CONSTASCII_USTRINGPARAM( "Map" ) );
+ const rtl::OUString sRefX ( RTL_CONSTASCII_USTRINGPARAM( "RefX" ) );
+ const rtl::OUString sRefY ( RTL_CONSTASCII_USTRINGPARAM( "RefY" ) );
+ const rtl::OUString sRefAngle ( RTL_CONSTASCII_USTRINGPARAM( "RefAngle" ) );
+ const rtl::OUString sRefR ( RTL_CONSTASCII_USTRINGPARAM( "RefR" ) );
const rtl::OUString sRadiusRangeMinimum ( RTL_CONSTASCII_USTRINGPARAM( "RadiusRangeMinimum" ) );
const rtl::OUString sRadiusRangeMaximum ( RTL_CONSTASCII_USTRINGPARAM( "RadiusRangeMaximum" ) );
const rtl::OUString sRangeXMinimum ( RTL_CONSTASCII_USTRINGPARAM( "RangeXMinimum" ) );
@@ -526,6 +530,26 @@ sal_Bool EnhancedCustomShape2d::ConvertSequenceToEnhancedCustomShape2dHandle(
}
}
*/
+ else if ( rPropVal.Name.equals( sRefX ) )
+ {
+ if ( rPropVal.Value >>= rDestinationHandle.nRefX )
+ rDestinationHandle.nFlags |= HANDLE_FLAGS_REFX;
+ }
+ else if ( rPropVal.Name.equals( sRefY ) )
+ {
+ if ( rPropVal.Value >>= rDestinationHandle.nRefY )
+ rDestinationHandle.nFlags |= HANDLE_FLAGS_REFY;
+ }
+ else if ( rPropVal.Name.equals( sRefAngle ) )
+ {
+ if ( rPropVal.Value >>= rDestinationHandle.nRefAngle )
+ rDestinationHandle.nFlags |= HANDLE_FLAGS_REFANGLE;
+ }
+ else if ( rPropVal.Name.equals( sRefR ) )
+ {
+ if ( rPropVal.Value >>= rDestinationHandle.nRefR )
+ rDestinationHandle.nFlags |= HANDLE_FLAGS_REFR;
+ }
else if ( rPropVal.Name.equals( sRadiusRangeMinimum ) )
{
if ( rPropVal.Value >>= rDestinationHandle.aRadiusRangeMinimum )
@@ -1182,131 +1206,141 @@ sal_Bool EnhancedCustomShape2d::SetHandleControllerPosition( const sal_uInt32 nI
Handle aHandle;
if ( ConvertSequenceToEnhancedCustomShape2dHandle( seqHandles[ nIndex ], aHandle ) )
{
- sal_Bool bAdjFirst = aHandle.aPosition.First.Type == EnhancedCustomShapeParameterType::ADJUSTMENT;
- sal_Bool bAdjSecond= aHandle.aPosition.Second.Type == EnhancedCustomShapeParameterType::ADJUSTMENT;
- if ( bAdjFirst || bAdjSecond )
+ Point aP( rPosition.X, rPosition.Y );
+ // apply the negative object rotation to the controller position
+
+ aP.Move( -aLogicRect.Left(), -aLogicRect.Top() );
+ if ( bFlipH )
+ aP.X() = aLogicRect.GetWidth() - aP.X();
+ if ( bFlipV )
+ aP.Y() = aLogicRect.GetHeight() - aP.Y();
+ if ( nRotateAngle )
{
- Point aP( rPosition.X, rPosition.Y );
- // apply the negative object rotation to the controller position
-
- aP.Move( -aLogicRect.Left(), -aLogicRect.Top() );
- if ( bFlipH )
- aP.X() = aLogicRect.GetWidth() - aP.X();
- if ( bFlipV )
- aP.Y() = aLogicRect.GetHeight() - aP.Y();
- if ( nRotateAngle )
- {
- double a = -nRotateAngle * F_PI18000;
- RotatePoint( aP, Point( aLogicRect.GetWidth() / 2, aLogicRect.GetHeight() / 2 ), sin( a ), cos( a ) );
- }
- const GeoStat aGeoStat( ((SdrObjCustomShape*)pCustomShapeObj)->GetGeoStat() );
- if ( aGeoStat.nShearWink )
- {
- double nTan = -aGeoStat.nTan;
- if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV))
- nTan = -nTan;
- ShearPoint( aP, Point( aLogicRect.GetWidth() / 2, aLogicRect.GetHeight() / 2 ), nTan );
- }
+ double a = -nRotateAngle * F_PI18000;
+ RotatePoint( aP, Point( aLogicRect.GetWidth() / 2, aLogicRect.GetHeight() / 2 ), sin( a ), cos( a ) );
+ }
+ const GeoStat aGeoStat( ((SdrObjCustomShape*)pCustomShapeObj)->GetGeoStat() );
+ if ( aGeoStat.nShearWink )
+ {
+ double nTan = -aGeoStat.nTan;
+ if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV))
+ nTan = -nTan;
+ ShearPoint( aP, Point( aLogicRect.GetWidth() / 2, aLogicRect.GetHeight() / 2 ), nTan );
+ }
- double fPos1 = aP.X(); //( bFlipH ) ? aLogicRect.GetWidth() - aP.X() : aP.X();
- double fPos2 = aP.Y(); //( bFlipV ) ? aLogicRect.GetHeight() -aP.Y() : aP.Y();
- fPos1 /= fXScale;
- fPos2 /= fYScale;
+ double fPos1 = aP.X(); //( bFlipH ) ? aLogicRect.GetWidth() - aP.X() : aP.X();
+ double fPos2 = aP.Y(); //( bFlipV ) ? aLogicRect.GetHeight() -aP.Y() : aP.Y();
+ fPos1 /= fXScale;
+ fPos2 /= fYScale;
- if ( aHandle.nFlags & HANDLE_FLAGS_SWITCHED )
+ if ( aHandle.nFlags & HANDLE_FLAGS_SWITCHED )
+ {
+ if ( aLogicRect.GetHeight() > aLogicRect.GetWidth() )
{
- if ( aLogicRect.GetHeight() > aLogicRect.GetWidth() )
- {
- double fX = fPos1;
- double fY = fPos2;
- fPos1 = fY;
- fPos2 = fX;
- }
+ double fX = fPos1;
+ double fY = fPos2;
+ fPos1 = fY;
+ fPos2 = fX;
}
+ }
- sal_Int32 nFirstAdjustmentValue = 0, nSecondAdjustmentValue = 0;
+ sal_Int32 nFirstAdjustmentValue = -1, nSecondAdjustmentValue = -1;
+
+ if ( aHandle.aPosition.First.Type == EnhancedCustomShapeParameterType::ADJUSTMENT )
aHandle.aPosition.First.Value >>= nFirstAdjustmentValue;
+ if ( aHandle.aPosition.Second.Type == EnhancedCustomShapeParameterType::ADJUSTMENT )
aHandle.aPosition.Second.Value>>= nSecondAdjustmentValue;
- if ( aHandle.nFlags & HANDLE_FLAGS_POLAR )
+ if ( aHandle.nFlags & HANDLE_FLAGS_POLAR )
+ {
+ double fXRef, fYRef, fAngle;
+ GetParameter( fXRef, aHandle.aPolar.First, sal_False, sal_False );
+ GetParameter( fYRef, aHandle.aPolar.Second, sal_False, sal_False );
+ const double fDX = fPos1 - fXRef;
+ fAngle = -( atan2( -fPos2 + fYRef, ( ( fDX == 0.0L ) ? 0.000000001 : fDX ) ) / F_PI180 );
+ double fX = ( fPos1 - fXRef );
+ double fY = ( fPos2 - fYRef );
+ double fRadius = sqrt( fX * fX + fY * fY );
+ if ( aHandle.nFlags & HANDLE_FLAGS_RADIUS_RANGE_MINIMUM )
+ {
+ double fMin;
+ GetParameter( fMin, aHandle.aRadiusRangeMinimum, sal_False, sal_False );
+ if ( fRadius < fMin )
+ fRadius = fMin;
+ }
+ if ( aHandle.nFlags & HANDLE_FLAGS_RADIUS_RANGE_MAXIMUM )
+ {
+ double fMax;
+ GetParameter( fMax, aHandle.aRadiusRangeMaximum, sal_False, sal_False );
+ if ( fRadius > fMax )
+ fRadius = fMax;
+ }
+ if ( nFirstAdjustmentValue >= 0 )
+ SetAdjustValueAsDouble( fRadius, nFirstAdjustmentValue );
+ if ( nSecondAdjustmentValue >= 0 )
+ SetAdjustValueAsDouble( fAngle, nSecondAdjustmentValue );
+ }
+ else
+ {
+ if ( aHandle.nFlags & HANDLE_FLAGS_REFX )
+ {
+ nFirstAdjustmentValue = aHandle.nRefX;
+ fPos1 *= 100000.0;
+ fPos1 /= nCoordWidth;
+ }
+ if ( aHandle.nFlags & HANDLE_FLAGS_REFY )
{
- double fXRef, fYRef, fAngle;
- GetParameter( fXRef, aHandle.aPolar.First, sal_False, sal_False );
- GetParameter( fYRef, aHandle.aPolar.Second, sal_False, sal_False );
- const double fDX = fPos1 - fXRef;
- fAngle = -( atan2( -fPos2 + fYRef, ( ( fDX == 0.0L ) ? 0.000000001 : fDX ) ) / F_PI180 );
- double fX = ( fPos1 - fXRef );
- double fY = ( fPos2 - fYRef );
- double fRadius = sqrt( fX * fX + fY * fY );
- if ( aHandle.nFlags & HANDLE_FLAGS_RADIUS_RANGE_MINIMUM )
+ nSecondAdjustmentValue = aHandle.nRefY;
+ fPos2 *= 100000.0;
+ fPos2 /= nCoordHeight;
+ }
+ if ( nFirstAdjustmentValue >= 0 )
+ {
+ if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_X_MINIMUM ) // check if horizontal handle needs to be within a range
{
- double fMin;
- GetParameter( fMin, aHandle.aRadiusRangeMinimum, sal_False, sal_False );
- if ( fRadius < fMin )
- fRadius = fMin;
+ double fXMin;
+ GetParameter( fXMin, aHandle.aXRangeMinimum, sal_False, sal_False );
+ if ( fPos1 < fXMin )
+ fPos1 = fXMin;
}
- if ( aHandle.nFlags & HANDLE_FLAGS_RADIUS_RANGE_MAXIMUM )
+ if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_X_MAXIMUM ) // check if horizontal handle needs to be within a range
{
- double fMax;
- GetParameter( fMax, aHandle.aRadiusRangeMaximum, sal_False, sal_False );
- if ( fRadius > fMax )
- fRadius = fMax;
+ double fXMax;
+ GetParameter( fXMax, aHandle.aXRangeMaximum, sal_False, sal_False );
+ if ( fPos1 > fXMax )
+ fPos1 = fXMax;
}
- if ( bAdjFirst )
- SetAdjustValueAsDouble( fRadius, nFirstAdjustmentValue );
- if ( bAdjSecond )
- SetAdjustValueAsDouble( fAngle, nSecondAdjustmentValue );
+ SetAdjustValueAsDouble( fPos1, nFirstAdjustmentValue );
}
- else
+ if ( nSecondAdjustmentValue >= 0 )
{
- if ( bAdjFirst )
+ if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_Y_MINIMUM ) // check if vertical handle needs to be within a range
{
- if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_X_MINIMUM ) // check if horizontal handle needs to be within a range
- {
- double fXMin;
- GetParameter( fXMin, aHandle.aXRangeMinimum, sal_False, sal_False );
- if ( fPos1 < fXMin )
- fPos1 = fXMin;
- }
- if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_X_MAXIMUM ) // check if horizontal handle needs to be within a range
- {
- double fXMax;
- GetParameter( fXMax, aHandle.aXRangeMaximum, sal_False, sal_False );
- if ( fPos1 > fXMax )
- fPos1 = fXMax;
- }
- SetAdjustValueAsDouble( fPos1, nFirstAdjustmentValue );
+ double fYMin;
+ GetParameter( fYMin, aHandle.aYRangeMinimum, sal_False, sal_False );
+ if ( fPos2 < fYMin )
+ fPos2 = fYMin;
}
- if ( bAdjSecond )
+ if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_Y_MAXIMUM ) // check if vertical handle needs to be within a range
{
- if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_Y_MINIMUM ) // check if vertical handle needs to be within a range
- {
- double fYMin;
- GetParameter( fYMin, aHandle.aYRangeMinimum, sal_False, sal_False );
- if ( fPos2 < fYMin )
- fPos2 = fYMin;
- }
- if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_Y_MAXIMUM ) // check if vertical handle needs to be within a range
- {
- double fYMax;
- GetParameter( fYMax, aHandle.aYRangeMaximum, sal_False, sal_False );
- if ( fPos2 > fYMax )
- fPos2 = fYMax;
- }
- SetAdjustValueAsDouble( fPos2, nSecondAdjustmentValue );
+ double fYMax;
+ GetParameter( fYMax, aHandle.aYRangeMaximum, sal_False, sal_False );
+ if ( fPos2 > fYMax )
+ fPos2 = fYMax;
}
+ SetAdjustValueAsDouble( fPos2, nSecondAdjustmentValue );
}
- // and writing them back into the GeometryItem
- SdrCustomShapeGeometryItem aGeometryItem((SdrCustomShapeGeometryItem&)
- (const SdrCustomShapeGeometryItem&)pCustomShapeObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ));
- const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM ( "AdjustmentValues" ) );
- com::sun::star::beans::PropertyValue aPropVal;
- aPropVal.Name = sAdjustmentValues;
- aPropVal.Value <<= seqAdjustmentValues;
- aGeometryItem.SetPropertyValue( aPropVal );
- pCustomShapeObj->SetMergedItem( aGeometryItem );
- bRetValue = sal_True;
}
+ // and writing them back into the GeometryItem
+ SdrCustomShapeGeometryItem aGeometryItem((SdrCustomShapeGeometryItem&)
+ (const SdrCustomShapeGeometryItem&)pCustomShapeObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ));
+ const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM ( "AdjustmentValues" ) );
+ com::sun::star::beans::PropertyValue aPropVal;
+ aPropVal.Name = sAdjustmentValues;
+ aPropVal.Value <<= seqAdjustmentValues;
+ aGeometryItem.SetPropertyValue( aPropVal );
+ pCustomShapeObj->SetMergedItem( aGeometryItem );
+ bRetValue = sal_True;
}
}
return bRetValue;
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.hxx b/svx/source/customshapes/EnhancedCustomShape2d.hxx
index 6123e7f4c9..9853b5f1b7 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.hxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.hxx
@@ -67,6 +67,10 @@ class SvxMSDffAdjustmentHandle;
#define HANDLE_FLAGS_RANGE_Y_MAXIMUM 0x0100
#define HANDLE_FLAGS_RADIUS_RANGE_MINIMUM 0x0200
#define HANDLE_FLAGS_RADIUS_RANGE_MAXIMUM 0x0400
+#define HANDLE_FLAGS_REFX 0x0800
+#define HANDLE_FLAGS_REFY 0x1000
+#define HANDLE_FLAGS_REFANGLE 0x2000
+#define HANDLE_FLAGS_REFR 0x4000
// MSDFF_HANDLE_FLAGS_RANGE_Y seems to be not defined in
// escher, but we are using it internally in to differentiate
@@ -145,12 +149,20 @@ class EnhancedCustomShape2d : public SfxItemSet
com::sun::star::drawing::EnhancedCustomShapeParameterPair aPosition;
com::sun::star::drawing::EnhancedCustomShapeParameterPair aPolar;
+ sal_Int32 nRefX;
+ sal_Int32 nRefY;
+ sal_Int32 nRefAngle;
+ sal_Int32 nRefR;
+
com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum;
com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum;
com::sun::star::drawing::EnhancedCustomShapeParameter aXRangeMinimum;
com::sun::star::drawing::EnhancedCustomShapeParameter aXRangeMaximum;
com::sun::star::drawing::EnhancedCustomShapeParameter aYRangeMinimum;
com::sun::star::drawing::EnhancedCustomShapeParameter aYRangeMaximum;
+
+ Handle() : bMirroredX ( sal_False ), bMirroredY ( sal_False ), bSwitched( sal_False ),
+ nRefX( -1 ), nRefY( -1 ), nRefAngle( -1 ), nRefR( -1 ) {};
};
sal_Bool IsFlipVert() { return bFlipV; };
diff --git a/svx/source/svdraw/svdoutl.cxx b/svx/source/svdraw/svdoutl.cxx
index 738526f015..20f248c3c9 100644
--- a/svx/source/svdraw/svdoutl.cxx
+++ b/svx/source/svdraw/svdoutl.cxx
@@ -125,5 +125,8 @@ XubString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, USHORT nPara,
const SdrTextObj* SdrOutliner::GetTextObj() const
{
- return static_cast< SdrTextObj* >( mpTextObj.get() );
+ if( mpTextObj.is() )
+ return static_cast< SdrTextObj* >( mpTextObj.get() );
+ else
+ return 0;
}