diff options
author | Jianyuan Li <lijiany@apache.org> | 2012-09-10 07:13:52 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-06-15 15:50:46 +0100 |
commit | c7876a2c4f2aeb4e5d50716f4519a5b236690a7c (patch) | |
tree | 9fa07ddbc4c603a78790aadfd52836be5e0416e9 /filter/source/msfilter | |
parent | 150ed440c85b7728d5cb65e54a3e4c0f1ac8bc58 (diff) |
Resolves: #i119520# right brace shape not displayed after save to .doc
Reported by: louqle
Patch by: Jianyuan Li
Review by: sunying
(cherry picked from commit 8be633def896c74867b9f9dcc929d7d210b4f192)
Conflicts:
filter/inc/filter/msfilter/escherex.hxx
filter/source/msfilter/escherex.cxx
Change-Id: I3311aad033ca321397c596452d60de5a7c58e223
Diffstat (limited to 'filter/source/msfilter')
-rw-r--r-- | filter/source/msfilter/escherex.cxx | 91 |
1 files changed, 55 insertions, 36 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index f667769ee6e0..ad285b650fe3 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -62,7 +62,6 @@ #include <com/sun/star/text/WritingMode.hpp> #include <com/sun/star/drawing/TextVerticalAdjust.hpp> #include <com/sun/star/drawing/TextHorizontalAdjust.hpp> -#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp> @@ -2381,7 +2380,8 @@ sal_Bool EscherPropertyContainer::CreateShadowProperties( return bHasShadow; } -sal_Int32 GetValueForEnhancedCustomShapeParameter( const com::sun::star::drawing::EnhancedCustomShapeParameter& rParameter, const std::vector< sal_Int32 >& rEquationOrder ) +sal_Int32 EscherPropertyContainer::GetValueForEnhancedCustomShapeParameter( const ::com::sun::star::drawing::EnhancedCustomShapeParameter& rParameter, + const std::vector< sal_Int32 >& rEquationOrder, sal_Bool bAdjustTrans ) { sal_Int32 nValue = 0; if ( rParameter.Value.getValueTypeClass() == uno::TypeClass_DOUBLE ) @@ -2406,11 +2406,26 @@ sal_Int32 GetValueForEnhancedCustomShapeParameter( const com::sun::star::drawing } } break; - case com::sun::star::drawing::EnhancedCustomShapeParameterType::NORMAL : + case com::sun::star::drawing::EnhancedCustomShapeParameterType::ADJUSTMENT: { - + if(bAdjustTrans) + { + sal_uInt32 nAdjustValue = 0; + sal_Bool bGot = GetOpt((sal_uInt16)( DFF_Prop_adjustValue + nValue ), nAdjustValue); + if(bGot) nValue = (sal_Int32)nAdjustValue; + } } break; + case com::sun::star::drawing::EnhancedCustomShapeParameterType::NORMAL : + default: + break; +/* not sure if it is allowed to set following values +(but they are not yet used) + case com::sun::star::drawing::EnhancedCustomShapeParameterType::BOTTOM : + case com::sun::star::drawing::EnhancedCustomShapeParameterType::RIGHT : + case com::sun::star::drawing::EnhancedCustomShapeParameterType::TOP : + case com::sun::star::drawing::EnhancedCustomShapeParameterType::LEFT : +*/ } return nValue; } @@ -2611,6 +2626,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT if ( aXPropSet.is() ) { SdrObjCustomShape* pCustoShape = (SdrObjCustomShape*)GetSdrObjectFromXShape( rXShape ); + if ( !pCustoShape ) return; const OUString sCustomShapeGeometry( "CustomShapeGeometry" ); uno::Any aGeoPropSet = aXPropSet->getPropertyValue( sCustomShapeGeometry ); uno::Sequence< beans::PropertyValue > aGeoPropSeq; @@ -2626,6 +2642,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT const OUString sAdjustmentValues ( "AdjustmentValues" ); const beans::PropertyValue* pAdjustmentValuesProp = NULL; + const beans::PropertyValue* pPathCoordinatesProp = NULL; sal_Int32 nAdjustmentsWhichNeedsToBeConverted = 0; uno::Sequence< beans::PropertyValues > aHandlesPropSeq; sal_Bool bPredefinedHandlesUsed = sal_True; @@ -3073,38 +3090,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT else if ( rrProp.Name.equals( sPathCoordinates ) ) { if ( !bIsDefaultObject ) - { - com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > aCoordinates; - if ( rrProp.Value >>= aCoordinates ) - { - // creating the vertices - if ( (sal_uInt16)aCoordinates.getLength() ) - { - sal_uInt16 j, nElements = (sal_uInt16)aCoordinates.getLength(); - sal_uInt16 nElementSize = 8; - sal_uInt32 nStreamSize = nElementSize * nElements + 6; - SvMemoryStream aOut( nStreamSize ); - aOut << nElements - << nElements - << nElementSize; - for( j = 0; j < nElements; j++ ) - { - sal_Int32 X = GetValueForEnhancedCustomShapeParameter( aCoordinates[ j ].First, aEquationOrder ); - sal_Int32 Y = GetValueForEnhancedCustomShapeParameter( aCoordinates[ j ].Second, aEquationOrder ); - aOut << X - << Y; - } - sal_uInt8* pBuf = new sal_uInt8[ nStreamSize ]; - memcpy( pBuf, aOut.GetData(), nStreamSize ); - AddOpt( DFF_Prop_pVertices, sal_True, nStreamSize - 6, pBuf, nStreamSize ); // -6 - } - else - { - sal_uInt8* pBuf = new sal_uInt8[ 1 ]; - AddOpt( DFF_Prop_pVertices, sal_True, 0, pBuf, 0 ); - } - } - } + pPathCoordinatesProp = &rrProp; } else if ( rrProp.Name.equals( sPathGluePoints ) ) { @@ -3731,6 +3717,39 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT AddOpt( (sal_uInt16)( DFF_Prop_adjustValue + k ), (sal_uInt32)nValue ); } } + if( pPathCoordinatesProp ) + { + com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > aCoordinates; + if ( pPathCoordinatesProp->Value >>= aCoordinates ) + { + // creating the vertices + if ( (sal_uInt16)aCoordinates.getLength() ) + { + sal_uInt16 j, nElements = (sal_uInt16)aCoordinates.getLength(); + sal_uInt16 nElementSize = 8; + sal_uInt32 nStreamSize = nElementSize * nElements + 6; + SvMemoryStream aOut( nStreamSize ); + aOut << nElements + << nElements + << nElementSize; + for( j = 0; j < nElements; j++ ) + { + sal_Int32 X = GetValueForEnhancedCustomShapeParameter( aCoordinates[ j ].First, aEquationOrder, sal_True ); + sal_Int32 Y = GetValueForEnhancedCustomShapeParameter( aCoordinates[ j ].Second, aEquationOrder, sal_True ); + aOut << X + << Y; + } + sal_uInt8* pBuf = new sal_uInt8[ nStreamSize ]; + memcpy( pBuf, aOut.GetData(), nStreamSize ); + AddOpt( DFF_Prop_pVertices, sal_True, nStreamSize - 6, pBuf, nStreamSize ); // -6 + } + else + { + sal_uInt8* pBuf = new sal_uInt8[ 1 ]; + AddOpt( DFF_Prop_pVertices, sal_True, 0, pBuf, 0 ); + } + } + } } } } |