Kaydet (Commit) c7876a2c authored tarafından Jianyuan Li's avatar Jianyuan Li Kaydeden (comit) Caolán McNamara

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 8be633de)

Conflicts:
	filter/inc/filter/msfilter/escherex.hxx
	filter/source/msfilter/escherex.cxx

Change-Id: I3311aad033ca321397c596452d60de5a7c58e223
üst 150ed440
......@@ -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 );
}
}
}
}
}
}
......
......@@ -35,6 +35,7 @@
#include <com/sun/star/beans/PropertyState.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/drawing/BitmapMode.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
#include <com/sun/star/drawing/Hatch.hpp>
#include <svx/msdffdef.hxx>
#include "filter/msfilter/msfilterdllapi.h"
......@@ -1313,6 +1314,8 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &
);
sal_Int32 GetValueForEnhancedCustomShapeParameter( const ::com::sun::star::drawing::EnhancedCustomShapeParameter& rParameter,
const std::vector< sal_Int32 >& rEquationOrder, sal_Bool bAdjustTrans = sal_False );
// creates all necessary CustomShape properties, this includes also Text-, Shadow-, Fill-, and LineProperties
void CreateCustomShapeProperties(
const MSO_SPT eShapeType,
......
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