summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oox/inc/oox/drawingml/customshapeproperties.hxx10
-rw-r--r--oox/source/drawingml/customshapeproperties.cxx14
-rw-r--r--oox/source/helper/propertymap.cxx153
3 files changed, 95 insertions, 82 deletions
diff --git a/oox/inc/oox/drawingml/customshapeproperties.hxx b/oox/inc/oox/drawingml/customshapeproperties.hxx
index a2d72e8c69e1..b811efc0998b 100644
--- a/oox/inc/oox/drawingml/customshapeproperties.hxx
+++ b/oox/inc/oox/drawingml/customshapeproperties.hxx
@@ -115,8 +115,16 @@ struct Path2D
class CustomShapeProvider {
protected:
+ struct ParameterPairData {
+ sal_uInt16 nFirstType;
+ sal_uInt16 nSecondType;
+ sal_uInt32 nFirstValue;
+ sal_uInt32 nSecondValue;
+ };
static com::sun::star::uno::Any createStringSequence( size_t nStrings, const char **pStrings );
- static com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > createCustomShapeSegmentSequence( size_t nElems, const sal_uInt16 *pValues );
+ static com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > createSegmentSequence( size_t nElems, const sal_uInt16 *pValues );
+ static com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > createCustomShapeSegmentSequence( size_t nElems, const sal_uInt16 *pValues ) { return createSegmentSequence( nElems, pValues ); }
+ static com::sun::star::drawing::EnhancedCustomShapeParameterPair createParameterPair( const ParameterPairData *pData );
public:
virtual PropertyMap getProperties() = 0;
};
diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx
index a5e31dd2772e..1382ead59c87 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -380,7 +380,8 @@ Any CustomShapeProvider::createStringSequence( size_t nStrings, const char **pSt
return makeAny( aStringSequence );
}
-com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > CustomShapeProvider::createCustomShapeSegmentSequence( size_t nElems, const sal_uInt16 *pValues )
+com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment >
+CustomShapeProvider::createSegmentSequence( size_t nElems, const sal_uInt16 *pValues )
{
Sequence< EnhancedCustomShapeSegment > aSequence( (nElems + 1) / 2 );
for (size_t i = 0, j = 0; i < nElems / 2; i++)
@@ -391,6 +392,17 @@ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegme
return aSequence;
}
+com::sun::star::drawing::EnhancedCustomShapeParameterPair
+CustomShapeProvider::createParameterPair( const ParameterPairData *pData )
+{
+ EnhancedCustomShapeParameterPair aParameterPair;
+ aParameterPair.First.Type = pData->nFirstType;
+ aParameterPair.First.Value = makeAny(pData->nFirstValue);
+ aParameterPair.Second.Type = pData->nSecondType;
+ aParameterPair.Second.Value = makeAny(pData->nSecondValue);
+ return aParameterPair;
+}
+
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx
index 334a9214f933..96d121c9b184 100644
--- a/oox/source/helper/propertymap.cxx
+++ b/oox/source/helper/propertymap.cxx
@@ -463,6 +463,62 @@ static void printLevel (int level)
fprintf (stderr, " ");
}
+static const char *lclGetEnhancedParameterType( sal_uInt16 nType )
+{
+ const char* type;
+ switch (nType) {
+ case EnhancedCustomShapeParameterType::NORMAL:
+ type = "EnhancedCustomShapeParameterType::NORMAL";
+ break;
+ case EnhancedCustomShapeParameterType::EQUATION:
+ type = "EnhancedCustomShapeParameterType::EQUATION";
+ break;
+ case EnhancedCustomShapeParameterType::ADJUSTMENT:
+ type = "EnhancedCustomShapeParameterType::ADJUSTMENT";
+ break;
+ case EnhancedCustomShapeParameterType::LEFT:
+ type = "EnhancedCustomShapeParameterType::LEFT";
+ break;
+ case EnhancedCustomShapeParameterType::TOP:
+ type = "EnhancedCustomShapeParameterType::TOP";
+ break;
+ case EnhancedCustomShapeParameterType::RIGHT:
+ type = "EnhancedCustomShapeParameterType::RIGHT";
+ break;
+ case EnhancedCustomShapeParameterType::BOTTOM:
+ type = "EnhancedCustomShapeParameterType::BOTTOM";
+ break;
+ case EnhancedCustomShapeParameterType::XSTRETCH:
+ type = "EnhancedCustomShapeParameterType::XSTRETCH";
+ break;
+ case EnhancedCustomShapeParameterType::YSTRETCH:
+ type = "EnhancedCustomShapeParameterType::YSTRETCH";
+ break;
+ case EnhancedCustomShapeParameterType::HASSTROKE:
+ type = "EnhancedCustomShapeParameterType::HASSTROKE";
+ break;
+ case EnhancedCustomShapeParameterType::HASFILL:
+ type = "EnhancedCustomShapeParameterType::HASFILL";
+ break;
+ case EnhancedCustomShapeParameterType::WIDTH:
+ type = "EnhancedCustomShapeParameterType::WIDTH";
+ break;
+ case EnhancedCustomShapeParameterType::HEIGHT:
+ type = "EnhancedCustomShapeParameterType::HEIGHT";
+ break;
+ case EnhancedCustomShapeParameterType::LOGWIDTH:
+ type = "EnhancedCustomShapeParameterType::LOGWIDTH";
+ break;
+ case EnhancedCustomShapeParameterType::LOGHEIGHT:
+ type = "EnhancedCustomShapeParameterType::LOGHEIGHT";
+ break;
+ default:
+ type = "unknown";
+ break;
+ }
+ return type;
+}
+
static const char* lclDumpAnyValueCode( Any value, int level = 0)
{
static OUString sVoid = CREATE_OUSTRING("void");
@@ -588,7 +644,7 @@ static const char* lclDumpAnyValueCode( Any value, int level = 0)
}
printLevel (level);
fprintf (stderr,"};\n");
- return "createCustomShapeSegmentSequence( SAL_N_ELEMENTS( nValues ), nValues )";
+ return "createSegmentSequence( SAL_N_ELEMENTS( nValues ), nValues )";
} else if( value >>= segTextFrame ) {
printLevel (level);
fprintf (stderr, "Sequence< EnhancedCustomShapeTextFrame > aTextFrameSeq (%" SAL_PRIdINT32 ");\n", segTextFrame.getLength());
@@ -649,97 +705,34 @@ static const char* lclDumpAnyValueCode( Any value, int level = 0)
return "aTextFrame";
} else if( value >>= pp ) {
+ // These are always sal_Int32s so lets depend on that for our packing ...
+ sal_Int32 nFirstValue, nSecondValue;
+ if (!(pp.First.Value >>= nFirstValue))
+ assert (false);
+ if (!(pp.Second.Value >>= nSecondValue))
+ assert (false);
+
printLevel (level);
- fprintf (stderr, "EnhancedCustomShapeParameterPair aParameterPair;\n");
+ fprintf (stderr, "static const CustomShapeProvider::ParameterPairData aData = {\n");
printLevel (level);
- fprintf (stderr, "{\n");
- if (!pp.First.Value.getValueTypeName().equals(sVoid)) {
- const char* var = lclDumpAnyValueCode( makeAny (pp.First), level + 1 );
- printLevel (level + 1);
- fprintf (stderr, "aParameterPair.First = %s;\n", var);
- } else {
- printLevel (level + 1);
- fprintf (stderr, "EnhancedCustomShapeParameter aParameter;\n");
- printLevel (level + 1);
- fprintf (stderr, "aParameterPair.First = aParameter;\n");
- }
+ fprintf (stderr, "\t%s,\n", lclGetEnhancedParameterType(pp.First.Type));
printLevel (level);
- fprintf (stderr, "}\n");
-
+ fprintf (stderr, "\t%s,\n", lclGetEnhancedParameterType(pp.Second.Type));
printLevel (level);
- fprintf (stderr, "{\n");
- if (!pp.Second.Value.getValueTypeName().equals(sVoid)) {
- const char* var = lclDumpAnyValueCode( makeAny (pp.Second), level + 1 );
- printLevel (level + 1);
- fprintf (stderr, "aParameterPair.Second = %s;\n", var);
- } else {
- printLevel (level + 1);
- fprintf (stderr, "EnhancedCustomShapeParameter aParameter;\n");
- printLevel (level + 1);
- fprintf (stderr, "aParameterPair.Second = aParameter;\n");
- }
+ fprintf (stderr, "\t%d, %d\n", (int)nFirstValue, (int)nSecondValue);
printLevel (level);
- fprintf (stderr, "}\n");
- return "aParameterPair";
+ fprintf (stderr, "};\n");
+
+ return "createParameterPair(&aData)";
} else if( value >>= par ) {
printLevel (level);
fprintf (stderr,"EnhancedCustomShapeParameter aParameter;\n");
const char* var = lclDumpAnyValueCode( par.Value, level );
printLevel (level);
fprintf (stderr,"aParameter.Value = %s;\n", var);
- const char* type;
- switch (par.Type) {
- case EnhancedCustomShapeParameterType::NORMAL:
- type = "EnhancedCustomShapeParameterType::NORMAL";
- break;
- case EnhancedCustomShapeParameterType::EQUATION:
- type = "EnhancedCustomShapeParameterType::EQUATION";
- break;
- case EnhancedCustomShapeParameterType::ADJUSTMENT:
- type = "EnhancedCustomShapeParameterType::ADJUSTMENT";
- break;
- case EnhancedCustomShapeParameterType::LEFT:
- type = "EnhancedCustomShapeParameterType::LEFT";
- break;
- case EnhancedCustomShapeParameterType::TOP:
- type = "EnhancedCustomShapeParameterType::TOP";
- break;
- case EnhancedCustomShapeParameterType::RIGHT:
- type = "EnhancedCustomShapeParameterType::RIGHT";
- break;
- case EnhancedCustomShapeParameterType::BOTTOM:
- type = "EnhancedCustomShapeParameterType::BOTTOM";
- break;
- case EnhancedCustomShapeParameterType::XSTRETCH:
- type = "EnhancedCustomShapeParameterType::XSTRETCH";
- break;
- case EnhancedCustomShapeParameterType::YSTRETCH:
- type = "EnhancedCustomShapeParameterType::YSTRETCH";
- break;
- case EnhancedCustomShapeParameterType::HASSTROKE:
- type = "EnhancedCustomShapeParameterType::HASSTROKE";
- break;
- case EnhancedCustomShapeParameterType::HASFILL:
- type = "EnhancedCustomShapeParameterType::HASFILL";
- break;
- case EnhancedCustomShapeParameterType::WIDTH:
- type = "EnhancedCustomShapeParameterType::WIDTH";
- break;
- case EnhancedCustomShapeParameterType::HEIGHT:
- type = "EnhancedCustomShapeParameterType::HEIGHT";
- break;
- case EnhancedCustomShapeParameterType::LOGWIDTH:
- type = "EnhancedCustomShapeParameterType::LOGWIDTH";
- break;
- case EnhancedCustomShapeParameterType::LOGHEIGHT:
- type = "EnhancedCustomShapeParameterType::LOGHEIGHT";
- break;
- default:
- type = "unknown";
- break;
- }
printLevel (level);
- fprintf (stderr,"aParameter.Type = %s;\n", type);
+ fprintf (stderr,"aParameter.Type = %s;\n",
+ lclGetEnhancedParameterType(par.Type));
return "aParameter";
} else if( value >>= longValue ) {
printLevel (level);