summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhe Wang <wangzcdl@apache.org>2012-09-07 04:05:43 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-05-31 10:53:10 +0100
commitcd582f922bf7bf350669c5d7cec379fe6bb7c886 (patch)
treea53cdcebd88407f2483036fa18a75bfc4ae2773a
parent30c3032920be91741ab089966f7e458ce08d09a4 (diff)
Resolves: #i119631# Teardrop shape cannot be shown correctly in pptx
* subversion/main/filter/inc/filter/msfilter/escherex.hxx * subversion/main/filter/source/msfilter/escherex.cxx []check whether one shape is default shape of ppt by shape type * subversion/main/svx/inc/svx/msdffdef.hxx * subversion/main/oox/source/drawingml/customshapegeometry.cxx * subversion/main/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx []add definition and declaration for tear drop * subversion/main/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx []the content of tear drop shape which incudes "path, adjust value, handle" Patch by: Ma Bingbing <jiazema@gmail.com> Suggested by: Wang Zhe <kingwisemmx@gmail.com> Found by: Zong Dongjun <zongdongjun@gmail.com> Review by: Wang Zhe <kingwisemmx@gmail.com> (cherry picked from commit 26218ac2472838d63485c3c6b4dc2f1aa0bdd0f6) Conflicts: filter/inc/filter/msfilter/escherex.hxx oox/source/drawingml/customshapegeometry.cxx svx/inc/svx/msdffdef.hxx Change-Id: I8347832bc842cca8b944c28e807af7f45a7da5b0
-rw-r--r--filter/source/msfilter/escherex.cxx14
-rw-r--r--include/filter/msfilter/escherex.hxx2
-rw-r--r--include/svx/msdffdef.hxx2
-rw-r--r--oox/source/export/shapes.cxx4
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeGeometry.cxx63
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx3
6 files changed, 82 insertions, 6 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index 68bd12dd6352..3f31b255cef3 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -2354,9 +2354,19 @@ void ConvertEnhancedCustomShapeEquation( SdrObjCustomShape* pCustoShape,
}
}
-sal_Bool EscherPropertyContainer::IsDefaultObject( SdrObjCustomShape* pCustoShape )
+sal_Bool EscherPropertyContainer::IsDefaultObject( SdrObjCustomShape* pCustoShape , const MSO_SPT eShapeType )
{
sal_Bool bIsDefaultObject = sal_False;
+ switch(eShapeType)
+ {
+ //if the custom shape is not default shape of ppt, return sal_Fasle;
+ case mso_sptTearDrop:
+ return bIsDefaultObject;
+
+ default:
+ break;
+ }
+
if ( pCustoShape )
{
if ( pCustoShape->IsDefaultGeometry( SdrObjCustomShape::DEFAULT_EQUATIONS )
@@ -2439,7 +2449,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT
sal_Int32 nAdjustmentsWhichNeedsToBeConverted = 0;
uno::Sequence< beans::PropertyValues > aHandlesPropSeq;
sal_Bool bPredefinedHandlesUsed = sal_True;
- sal_Bool bIsDefaultObject = IsDefaultObject( pCustoShape );
+ sal_Bool bIsDefaultObject = IsDefaultObject( pCustoShape , eShapeType);
// convert property "Equations" into std::vector< EnhancedCustomShapeEquationEquation >
std::vector< EnhancedCustomShapeEquation > aEquations;
diff --git a/include/filter/msfilter/escherex.hxx b/include/filter/msfilter/escherex.hxx
index c4807e80875d..d21e2f0f066e 100644
--- a/include/filter/msfilter/escherex.hxx
+++ b/include/filter/msfilter/escherex.hxx
@@ -1344,7 +1344,7 @@ public:
sal_Int32& rnArrowLength,
sal_Int32& rnArrowWidth
);
- static sal_Bool IsDefaultObject( SdrObjCustomShape* pCustoShape );
+ static sal_Bool IsDefaultObject( SdrObjCustomShape* pCustoShape, const MSO_SPT eShapeType );
static void LookForPolarHandles(
const MSO_SPT eShapeType,
sal_Int32& nAdjustmentsWhichNeedsToBeConverted
diff --git a/include/svx/msdffdef.hxx b/include/svx/msdffdef.hxx
index 007f273ae837..671932c2f9fa 100644
--- a/include/svx/msdffdef.hxx
+++ b/include/svx/msdffdef.hxx
@@ -781,6 +781,8 @@ typedef enum
mso_sptActionButtonMovie = 200,
mso_sptHostControl = 201,
mso_sptTextBox = 202,
+ //for pptx shape which not exist in ppt
+ mso_sptTearDrop = 203,
mso_sptMax = 0x0FFF,
mso_sptNil = mso_sptMax
} MSO_SPT;
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index c487d2dddf36..d4b65ff140c3 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -675,12 +675,12 @@ ShapeExport& ShapeExport::WriteCustomShape( Reference< XShape > xShape )
DBG(printf("write custom shape\n"));
Reference< XPropertySet > rXPropSet( xShape, UNO_QUERY );
- SdrObjCustomShape* pShape = (SdrObjCustomShape*) GetSdrObjectFromXShape( xShape );
- sal_Bool bIsDefaultObject = EscherPropertyContainer::IsDefaultObject( pShape );
sal_Bool bPredefinedHandlesUsed = sal_True;
OUString sShapeType;
sal_uInt32 nMirrorFlags = 0;
MSO_SPT eShapeType = EscherPropertyContainer::GetCustomShapeType( xShape, nMirrorFlags, sShapeType );
+ SdrObjCustomShape* pShape = (SdrObjCustomShape*) GetSdrObjectFromXShape( xShape );
+ sal_Bool bIsDefaultObject = EscherPropertyContainer::IsDefaultObject( pShape, eShapeType );
const char* sPresetShape = lcl_GetPresetGeometry( USS( sShapeType ) );
DBG(printf("custom shape type: %s ==> %s\n", USS( sShapeType ), sPresetShape));
Sequence< PropertyValue > aGeometrySeq;
diff --git a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
index 0c8e447a8537..d64ab357cf8c 100644
--- a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
@@ -8265,6 +8265,68 @@ static const mso_CustomShape msoCurvedConnector5 =
(SvxMSDffHandle*)mso_sptCurvedConnector5Handle, SAL_N_ELEMENTS( mso_sptCurvedConnector5Handle )
};
+/////////////////////////////teardrop////////////////////////////////////////////
+static const SvxMSDffVertPair mso_sptTearDropVert[] =
+{
+ { 10800, 0 },
+ { 0, 10800 }, // X
+ { 10800, 21600 }, // Y
+ { 21600, 10800 }, // X
+ { 21600, 10800 }, { 21600, 3 MSO_I }, { 0 MSO_I, 1 MSO_I }, // C
+ { 0 MSO_I, 1 MSO_I }, { 4 MSO_I, 0 }, { 10800, 0 }
+};
+
+// the last number (0x***n) : 0 = sum, 1 = prod, 2 = mid, 3 = abs, 4 = min, 5 = max, 6 = if, 13 = sqrt, 15 = eclipse ...
+// the first number(0xn***) : 2/4/8 the first/second/third value is not directly value
+static const SvxMSDffCalculationData mso_sptTearDropCalc[] =
+{
+ { 0x2000 , { DFF_Prop_adjustValue , 0 , 0 } }, // 0 adjust value #0
+ { 0x8000 , { 21600 , 0 , 0x0400 } }, // 1 21600 - @0 y0
+ { 0x8000 , { 32400 , 0 , 0x0400 } }, // 2 (32400 - @0)
+ { 0x2001 , { 0x0402 , 1 , 2 } }, // 3 (32400 - @0)/2 y1
+ { 0x2002 , { 0x0400 , 10800 , 0 } }, // 4 (@0+10800)/2 x2
+};
+
+//m, qx, qy, qx,C,C
+//the last number(0x***n) : repeat number of this current Segm
+static const sal_uInt16 mso_sptTearDropSegm[] =
+{
+ 0x4000, 0xa701, 0xa801, 0xa701, 0x2002, 0x6000, 0x8000
+};
+
+static const SvxMSDffTextRectangles mso_sptTearDropTextRect[] =
+{
+ { { 2863, 2863 }, { 18737, 18737 } }
+};
+
+//the range of adjust values
+static const SvxMSDffHandle mso_sptTearDropHandle[] =
+{
+ //position="$0,0" xrange="10800,32400"
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL| MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL,
+ 0x100, 0, 10800, 10800, 10800, 32400, MIN_INT32, 0x7fffffff }
+};
+
+//the number of adjust values, the default values
+static const sal_Int32 mso_sptTearDropDefault[] =
+{
+ 1, 21600
+};
+
+static const mso_CustomShape msoTearDrop =
+{
+ (SvxMSDffVertPair*)mso_sptTearDropVert, sizeof( mso_sptTearDropVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTearDropSegm, sizeof( mso_sptTearDropSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTearDropCalc, sizeof(mso_sptTearDropCalc)/sizeof(SvxMSDffCalculationData),
+ (sal_Int32*)mso_sptTearDropDefault,
+ (SvxMSDffTextRectangles*)mso_sptTearDropTextRect, sizeof( mso_sptTearDropTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ MIN_INT32, MIN_INT32,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTearDropHandle, sizeof(mso_sptTearDropHandle)/sizeof(SvxMSDffHandle) // handles
+};
+
+
const mso_CustomShape* GetCustomShapeContent( MSO_SPT eSpType )
{
const mso_CustomShape* pCustomShape = NULL;
@@ -8475,6 +8537,7 @@ const mso_CustomShape* GetCustomShapeContent( MSO_SPT eSpType )
case mso_sptTextWave2 : pCustomShape = &msoTextWave2; break;
case mso_sptTextWave3 : pCustomShape = &msoTextWave3; break;
case mso_sptTextWave4 : pCustomShape = &msoTextWave4; break;
+ case mso_sptTearDrop : pCustomShape = &msoTearDrop; break;
default :
break;
}
diff --git a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
index ca8dfdea2415..88115ee89434 100644
--- a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
@@ -239,7 +239,8 @@ static const NameTypeTable pNameTypeTableArray[] =
{ "mso-spt199", mso_sptActionButtonSound },
{ "mso-spt200", mso_sptActionButtonMovie },
{ "mso-spt201", mso_sptHostControl },
- { "mso-spt202", mso_sptTextBox }
+ { "mso-spt202", mso_sptTextBox },
+ { "teardrop", mso_sptTearDrop }
};
// gallery: quadrat