summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2012-03-02 22:00:00 +0000
committerMichael Meeks <michael.meeks@suse.com>2012-03-02 22:14:25 +0000
commit62ee264429ee7f4bbb2da62c8f963d9c25d29242 (patch)
tree5364e58de35463b9f8905e13f72fca22ad5923af /oox
parent40b30c31ff9e53e233799bdb18971c43b9b77dc8 (diff)
customshapes: special-case Sequence of EnhancedCustomShapeParameterPair
another 20% compile time win, and 350K saved from the shared library
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/oox/drawingml/customshapeproperties.hxx2
-rw-r--r--oox/source/drawingml/customshapeproperties.cxx9
-rw-r--r--oox/source/helper/propertymap.cxx69
3 files changed, 49 insertions, 31 deletions
diff --git a/oox/inc/oox/drawingml/customshapeproperties.hxx b/oox/inc/oox/drawingml/customshapeproperties.hxx
index b811efc0998b..5fd6cd0121c6 100644
--- a/oox/inc/oox/drawingml/customshapeproperties.hxx
+++ b/oox/inc/oox/drawingml/customshapeproperties.hxx
@@ -123,8 +123,8 @@ protected:
};
static com::sun::star::uno::Any createStringSequence( size_t nStrings, const char **pStrings );
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 );
+ static com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > createParameterPairSequence( size_t nElems, const ParameterPairData *pData );
public:
virtual PropertyMap getProperties() = 0;
};
diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx
index 1382ead59c87..ab99e82f016e 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -403,6 +403,15 @@ CustomShapeProvider::createParameterPair( const ParameterPairData *pData )
return aParameterPair;
}
+com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair >
+CustomShapeProvider::createParameterPairSequence( size_t nElems, const ParameterPairData *pData )
+{
+ Sequence< EnhancedCustomShapeParameterPair > aSequence( nElems );
+ for (size_t i = 0; i < nElems; i++)
+ aSequence[i] = createParameterPair( pData + i );
+ return aSequence;
+}
+
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx
index 96d121c9b184..6b3a2d4a8769 100644
--- a/oox/source/helper/propertymap.cxx
+++ b/oox/source/helper/propertymap.cxx
@@ -519,6 +519,27 @@ static const char *lclGetEnhancedParameterType( sal_uInt16 nType )
return type;
}
+static void printParameterPairData(int level, EnhancedCustomShapeParameterPair &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, "{\n");
+ printLevel (level + 1);
+ fprintf (stderr, "%s,\n", lclGetEnhancedParameterType(pp.First.Type));
+ printLevel (level + 1);
+ fprintf (stderr, "%s,\n", lclGetEnhancedParameterType(pp.Second.Type));
+ printLevel (level + 1);
+ fprintf (stderr, "%d, %d\n", (int)nFirstValue, (int)nSecondValue);
+ printLevel (level);
+ fprintf (stderr, "}");
+}
+
static const char* lclDumpAnyValueCode( Any value, int level = 0)
{
static OUString sVoid = CREATE_OUSTRING("void");
@@ -563,8 +584,8 @@ static const char* lclDumpAnyValueCode( Any value, int level = 0)
printLevel (level);
fprintf (stderr,"static const char *aStrings[] = {\n");
for( int i=0; i<strArray.getLength(); i++ ) {
- printLevel (level);
- fprintf (stderr,"\t\"%s\"%s\n", USS( strArray[i] ), i < strArray.getLength() - 1 ? "," : "" );
+ printLevel (level + 1);
+ fprintf (stderr,"\"%s\"%s\n", USS( strArray[i] ), i < strArray.getLength() - 1 ? "," : "" );
}
printLevel (level);
fprintf (stderr,"};\n");
@@ -638,8 +659,8 @@ static const char* lclDumpAnyValueCode( Any value, int level = 0)
printLevel (level);
fprintf (stderr,"// Command, Count\n");
for( int i = 0; i < segArray.getLength(); i++ ) {
- printLevel (level);
- fprintf (stderr,"\t%d,%d%s\n", segArray[i].Command,
+ printLevel (level + 1);
+ fprintf (stderr,"%d,%d%s\n", segArray[i].Command,
segArray[i].Count, i < segArray.getLength() - 1 ? "," : "");
}
printLevel (level);
@@ -660,17 +681,18 @@ static const char* lclDumpAnyValueCode( Any value, int level = 0)
return "aTextFrameSeq";
} else if( value >>= ppArray ) {
printLevel (level);
- fprintf (stderr, "Sequence< EnhancedCustomShapeParameterPair > aParameterPairSeq (%" SAL_PRIdINT32 ");\n", ppArray.getLength());
- for( int i=0; i<ppArray.getLength(); i++ ) {
- printLevel (level);
- fprintf (stderr, "{\n");
- const char *var = lclDumpAnyValueCode (makeAny (ppArray[i]), level + 1);
- printLevel (level + 1);
- fprintf (stderr, "aParameterPairSeq [%d] = %s;\n", i, var);
- printLevel (level);
- fprintf (stderr, "}\n");
+ if (ppArray.getLength() == 0)
+ return "Sequence< EnhancedCustomShapeParameterPair >(0)";
+
+ fprintf (stderr, "static const CustomShapeProvider::ParameterPairData aData[] = {\n");
+ for( int i = 0; i < ppArray.getLength(); i++ ) {
+ printParameterPairData(level + 1, ppArray[i]);
+ fprintf (stderr,"%s\n", i < ppArray.getLength() - 1 ? "," : "");
}
- return "aParameterPairSeq";
+ printLevel (level);
+ fprintf (stderr,"};\n");
+
+ return "createParameterPairSequence(SAL_N_ELEMENTS(aData), aData)";
} else if( value >>= segment ) {
printLevel (level);
fprintf (stderr, "EnhancedCustomShapeSegment aSegment;\n");
@@ -705,23 +727,10 @@ 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, "static const CustomShapeProvider::ParameterPairData aData = {\n");
- printLevel (level);
- fprintf (stderr, "\t%s,\n", lclGetEnhancedParameterType(pp.First.Type));
- printLevel (level);
- fprintf (stderr, "\t%s,\n", lclGetEnhancedParameterType(pp.Second.Type));
- printLevel (level);
- fprintf (stderr, "\t%d, %d\n", (int)nFirstValue, (int)nSecondValue);
printLevel (level);
- fprintf (stderr, "};\n");
+ fprintf (stderr, "static const CustomShapeProvider::ParameterPairData aData =\n");
+ printParameterPairData(level, pp);
+ fprintf (stderr, ";\n");
return "createParameterPair(&aData)";
} else if( value >>= par ) {