You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by wa...@apache.org on 2012/09/07 07:05:44 UTC

svn commit: r1381871 - in /incubator/ooo/trunk/main: filter/inc/filter/msfilter/ filter/source/msfilter/ oox/source/drawingml/ svx/inc/svx/ svx/source/customshapes/

Author: wangzcdl
Date: Fri Sep  7 05:05:43 2012
New Revision: 1381871

URL: http://svn.apache.org/viewvc?rev=1381871&view=rev
Log:
  Fix issue #i119631#: [From Symphony]Teardrop shape can not show correct in pptx sample file 
   * 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 <ji...@gmail.com>
   Suggested by: Wang Zhe <ki...@gmail.com>
   Found by: Zong Dongjun <zo...@gmail.com> 
   Review by: Wang Zhe <ki...@gmail.com>

Modified:
    incubator/ooo/trunk/main/filter/inc/filter/msfilter/escherex.hxx
    incubator/ooo/trunk/main/filter/source/msfilter/escherex.cxx
    incubator/ooo/trunk/main/oox/source/drawingml/customshapegeometry.cxx
    incubator/ooo/trunk/main/svx/inc/svx/msdffdef.hxx
    incubator/ooo/trunk/main/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
    incubator/ooo/trunk/main/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx

Modified: incubator/ooo/trunk/main/filter/inc/filter/msfilter/escherex.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/inc/filter/msfilter/escherex.hxx?rev=1381871&r1=1381870&r2=1381871&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/inc/filter/msfilter/escherex.hxx (original)
+++ incubator/ooo/trunk/main/filter/inc/filter/msfilter/escherex.hxx Fri Sep  7 05:05:43 2012
@@ -1251,7 +1251,7 @@ class MSFILTER_DLLPUBLIC EscherPropertyC
 	static sal_Bool GetLineArrow( const sal_Bool bLineStart,
 				      const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
 				      ESCHER_LineEnd& reLineEnd, 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 );
 	static sal_Bool GetAdjustmentValue( const com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue & rkProp, sal_Int32 nIndex, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, sal_Int32& nValue );
 };

Modified: incubator/ooo/trunk/main/filter/source/msfilter/escherex.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/source/msfilter/escherex.cxx?rev=1381871&r1=1381870&r2=1381871&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/source/msfilter/escherex.cxx (original)
+++ incubator/ooo/trunk/main/filter/source/msfilter/escherex.cxx Fri Sep  7 05:05:43 2012
@@ -2351,9 +2351,19 @@ void ConvertEnhancedCustomShapeEquation(
 	}
 }
 
-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 )
@@ -2437,7 +2447,7 @@ void EscherPropertyContainer::CreateCust
 			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;

Modified: incubator/ooo/trunk/main/oox/source/drawingml/customshapegeometry.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/oox/source/drawingml/customshapegeometry.cxx?rev=1381871&r1=1381870&r2=1381871&view=diff
==============================================================================
--- incubator/ooo/trunk/main/oox/source/drawingml/customshapegeometry.cxx (original)
+++ incubator/ooo/trunk/main/oox/source/drawingml/customshapegeometry.cxx Fri Sep  7 05:05:43 2012
@@ -1251,7 +1251,10 @@ OUString GetShapeType( sal_Int32 nType )
             static const OUString sPlaque = CREATE_OUSTRING( "mso-spt21" );
 			sType = sPlaque;
 			} break;
-		case XML_teardrop:					// TODO
+		case XML_teardrop:{                
+            static const OUString sTearDrop = CREATE_OUSTRING( "teardrop" );
+			sType = sTearDrop;
+			} break;
 		case XML_ellipse: {
             static const OUString sEllipse = CREATE_OUSTRING( "ellipse" );
 			sType = sEllipse;

Modified: incubator/ooo/trunk/main/svx/inc/svx/msdffdef.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/inc/svx/msdffdef.hxx?rev=1381871&r1=1381870&r2=1381871&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/inc/svx/msdffdef.hxx (original)
+++ incubator/ooo/trunk/main/svx/inc/svx/msdffdef.hxx Fri Sep  7 05:05:43 2012
@@ -788,6 +788,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;

Modified: incubator/ooo/trunk/main/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx?rev=1381871&r1=1381870&r2=1381871&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx Fri Sep  7 05:05:43 2012
@@ -8289,6 +8289,68 @@ static const mso_CustomShape msoCurvedCo
 	(SvxMSDffHandle*)mso_sptCurvedConnector5Handle, sizeof( mso_sptCurvedConnector5Handle ) / sizeof( SvxMSDffHandle )
 };
 
+/////////////////////////////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, 0x80000000, 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,
+	0x80000000, 0x80000000,
+	NULL, 0,
+	(SvxMSDffHandle*)mso_sptTearDropHandle, sizeof(mso_sptTearDropHandle)/sizeof(SvxMSDffHandle)		// handles
+};
+
+
 const mso_CustomShape* GetCustomShapeContent( MSO_SPT eSpType )
 {
 	const mso_CustomShape* pCustomShape = NULL;
@@ -8499,6 +8561,7 @@ const mso_CustomShape* GetCustomShapeCon
 		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;
 	}

Modified: incubator/ooo/trunk/main/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx?rev=1381871&r1=1381870&r2=1381871&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx Fri Sep  7 05:05:43 2012
@@ -251,7 +251,8 @@ static const NameTypeTable pNameTypeTabl
 	{ "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