[Libreoffice-commits] core.git: 2 commits - filter/source include/filter
Caolán McNamara
caolanm at redhat.com
Sat Jun 15 07:51:09 PDT 2013
filter/source/msfilter/escherex.cxx | 92 ++++++++++++++++++++++-------------
include/filter/msfilter/escherex.hxx | 3 +
2 files changed, 61 insertions(+), 34 deletions(-)
New commits:
commit af2053c318564ef56235482f058d30ae26ecf77d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Jun 15 15:48:45 2013 +0100
Related: #i119520# rework this to not crash
Change-Id: I479101c5421b03932e69cbf63188f89ee92a1d2f
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index ad285b6..51ab62a 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -2642,7 +2642,9 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT
const OUString sAdjustmentValues ( "AdjustmentValues" );
const beans::PropertyValue* pAdjustmentValuesProp = NULL;
- const beans::PropertyValue* pPathCoordinatesProp = NULL;
+ bool bPathCoordinatesProp = false;
+ uno::Any aPathCoordinatesProp;
+
sal_Int32 nAdjustmentsWhichNeedsToBeConverted = 0;
uno::Sequence< beans::PropertyValues > aHandlesPropSeq;
sal_Bool bPredefinedHandlesUsed = sal_True;
@@ -3090,7 +3092,10 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT
else if ( rrProp.Name.equals( sPathCoordinates ) )
{
if ( !bIsDefaultObject )
- pPathCoordinatesProp = &rrProp;
+ {
+ aPathCoordinatesProp = rrProp.Value;
+ bPathCoordinatesProp = true;
+ }
}
else if ( rrProp.Name.equals( sPathGluePoints ) )
{
@@ -3717,10 +3722,10 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT
AddOpt( (sal_uInt16)( DFF_Prop_adjustValue + k ), (sal_uInt32)nValue );
}
}
- if( pPathCoordinatesProp )
+ if( bPathCoordinatesProp )
{
com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > aCoordinates;
- if ( pPathCoordinatesProp->Value >>= aCoordinates )
+ if ( aPathCoordinatesProp >>= aCoordinates )
{
// creating the vertices
if ( (sal_uInt16)aCoordinates.getLength() )
commit c7876a2c4f2aeb4e5d50716f4519a5b236690a7c
Author: Jianyuan Li <lijiany at apache.org>
Date: Mon Sep 10 07:13:52 2012 +0000
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
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index f667769..ad285b6 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 );
+ }
+ }
+ }
}
}
}
diff --git a/include/filter/msfilter/escherex.hxx b/include/filter/msfilter/escherex.hxx
index 289cc79..4b7a0c9 100644
--- a/include/filter/msfilter/escherex.hxx
+++ b/include/filter/msfilter/escherex.hxx
@@ -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,
More information about the Libreoffice-commits
mailing list