Kaydet (Commit) f5973365 authored tarafından Michael Meeks's avatar Michael Meeks

customshapes: use static integer array for EnhancedCustomShapeSequences

Saves 4% compile time and 200K of space
üst 36f8ef7f
......@@ -116,6 +116,7 @@ struct Path2D
class CustomShapeProvider {
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 > createCustomShapeSegmentSequence( size_t nElems, const sal_uInt16 *pValues );
public:
virtual PropertyMap getProperties() = 0;
};
......
......@@ -374,14 +374,21 @@ Any CustomShapeProvider::createStringSequence( size_t nStrings, const char **pSt
{
Sequence< OUString > aStringSequence( nStrings );
for (size_t i = 0; i < nStrings; i++)
{
aStringSequence[i] = ::rtl::OUString::intern(
pStrings[i], strlen( pStrings[i] ),
RTL_TEXTENCODING_ASCII_US );
return makeAny( aStringSequence );
}
com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > CustomShapeProvider::createCustomShapeSegmentSequence( size_t nElems, const sal_uInt16 *pValues )
{
Sequence< EnhancedCustomShapeSegment > aSequence( (nElems + 1) / 2 );
for (size_t i = 0, j = 0; i < nElems / 2; i++)
{
aSequence[i].Command = pValues[j++];
aSequence[i].Count = pValues[j++];
}
Any aAny;
aAny <<= aStringSequence;
return aAny;
return aSequence;
}
} }
......
......@@ -574,18 +574,21 @@ static const char* lclDumpAnyValueCode( Any value, int level = 0)
}
return "aAdjSequence";
} else if( value >>= segArray ) {
if (segArray.getLength() == 0)
return "Sequence< EnhancedCustomShapeSegment >(0)";
printLevel (level);
fprintf (stderr, "Sequence< EnhancedCustomShapeSegment > aSegmentSeq (%" SAL_PRIdINT32 ");\n", segArray.getLength());
for( int i=0; i<segArray.getLength(); i++ ) {
printLevel (level);
fprintf (stderr, "{\n");
const char *var = lclDumpAnyValueCode (makeAny (segArray[i]), level + 1);
printLevel (level + 1);
fprintf (stderr, "aSegmentSeq [%d] = %s;\n", i, var);
fprintf (stderr,"static const sal_uInt16 nValues[] = {\n");
printLevel (level);
fprintf (stderr,"// Command, Count\n");
for( int i = 0; i < segArray.getLength(); i++ ) {
printLevel (level);
fprintf (stderr, "}\n");
fprintf (stderr,"\t%d,%d%s\n", segArray[i].Command,
segArray[i].Count, i < segArray.getLength() - 1 ? "," : "");
}
return "aSegmentSeq";
printLevel (level);
fprintf (stderr,"};\n");
return "createCustomShapeSegmentSequence( SAL_N_ELEMENTS( nValues ), nValues )";
} else if( value >>= segTextFrame ) {
printLevel (level);
fprintf (stderr, "Sequence< EnhancedCustomShapeTextFrame > aTextFrameSeq (%" SAL_PRIdINT32 ");\n", segTextFrame.getLength());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment