summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-01-02 18:27:11 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-01-02 19:03:10 +0100
commit65e25963e06c295ae8101f49da2774586d0110d5 (patch)
tree5ae4ad8bf38f0193fcdcd9f3d2e943a4a23e1154
parent05175da8b4c1331e74b9293e3dbce8426df6a7d0 (diff)
oox: extract adjustment names by type from spec XML
The naming of adjustments is not consistent for drawingML shapes, some of them have the first parameter as "adj1", some of them have it as "adj". We already have a script that generates some code based on these XML files, make it generate a function that returns the naming for each type. Change-Id: I2250f72854295055e1b31f2df9aec25a997db749
-rw-r--r--oox/source/export/preset-definitions-to-shape-types.pl25
1 files changed, 25 insertions, 0 deletions
diff --git a/oox/source/export/preset-definitions-to-shape-types.pl b/oox/source/export/preset-definitions-to-shape-types.pl
index fc0b781db752..8f5904d791e8 100644
--- a/oox/source/export/preset-definitions-to-shape-types.pl
+++ b/oox/source/export/preset-definitions-to-shape-types.pl
@@ -59,6 +59,7 @@ my $shape_name = "";
my $state = "";
my $path = "";
my $adjust = "";
+my %adj_names;
my $max_adj_no = 0;
my @formulas = ();
my %variables = ();
@@ -887,6 +888,10 @@ sub start_element( $% )
elsif ( $state eq "adjust" ) {
if ( $element eq "gd" ) {
my $adj_no = $attr{'name'};
+
+ # Save this adj number for this type for later use.
+ push(@{$adj_names{$shape_name}}, $adj_no);
+
my $is_const = 0;
$adj_no =~ s/^adj//;
@@ -1189,6 +1194,7 @@ print <<EOF;
// '$src_text'
// which are part of the OOXML documentation
+#include <map>
#include <filter/msfilter/escherex.hxx>
const char* pShapeTypes[ ESCHER_ShpInst_COUNT ] =
@@ -1224,4 +1230,23 @@ for ( my $i = 0; $i < 203; ++$i ) {
print <<EOF;
};
+
+std::map< OString, std::vector<OString> > ooxDrawingMLGetAdjNames()
+{
+ std::map< OString, std::vector<OString> > aMap;
EOF
+
+foreach my $adj_name (keys %adj_names)
+{
+ foreach my $adj (@{$adj_names{$adj_name}})
+ {
+ print " aMap[\"$adj_name\"].push_back(\"$adj\");\n";
+ }
+}
+
+print <<EOF;
+ return aMap;
+}
+EOF
+
+# vim:set ft=perl shiftwidth=4 softtabstop=4 expandtab: #