diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-04-16 18:29:46 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-04-16 18:36:41 +0200 |
commit | e1f9e73893e3d5760dab45b9322eca9fb8ce7ac4 (patch) | |
tree | f410372b750898b9d2a321be7fc29f121e475a72 /oox/source/drawingml | |
parent | 142d63d01567b5c7e513258f2835dbde54b30012 (diff) |
oox: add --data switch to generatePresetsCXX.pl
generatePresetsCXX.pl (as its name says) by default generates C++ code,
but with the new switch it filters out data from the provided
custom-shapes.log.
Change-Id: Ic59c666422db667112c280716f98342fabdae692
Diffstat (limited to 'oox/source/drawingml')
-rwxr-xr-x | oox/source/drawingml/customshapes/generatePresetsCXX.pl | 72 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 1 |
2 files changed, 72 insertions, 1 deletions
diff --git a/oox/source/drawingml/customshapes/generatePresetsCXX.pl b/oox/source/drawingml/customshapes/generatePresetsCXX.pl index 2ce96f58d8b3..29a3c1915546 100755 --- a/oox/source/drawingml/customshapes/generatePresetsCXX.pl +++ b/oox/source/drawingml/customshapes/generatePresetsCXX.pl @@ -7,6 +7,54 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # +sub loadData() +{ + open (IN, "<custom-shapes.log"); + + my %sources; + + while (<IN>) + { + if (/==csdata== /) + { + if (/shape name: '/) + { + chop; + s/.*shape name: '([^']+)'.*/$1/; + $name = $_; + } + else + { + if (/==csdata== begin/) + { + $inside = true; + @code = (); + } + else + { + if (/==csdata== end/) + { + s/^ <\/([^>]+)>/$1/; + undef $inside; + $sources{$name} = [ @code ]; + } + } + } + } + else + { + if ($inside) + { + push @code, $_; + } + } + } + + close (IN); + + return \%sources; +} + sub loadSourceCode() { open (IN, "<custom-shapes.log"); @@ -168,6 +216,28 @@ EOS close OUT; } -generateSource (loadSourceCode ()); +sub generateData +{ + my $sources = shift; + open (OUT, ">oox-drawingml-cs-presets"); + + foreach $shape (sort(keys %$sources)) + { + printf OUT "/* %s */\n", $shape; + print OUT @{$sources->{$shape}}; + } + + close OUT; +} + +my $arg = shift; + +if ($arg eq "--data") +{ + generateData(loadData()); +} else +{ + generateSource (loadSourceCode ()); +} # vim:set ft=perl shiftwidth=4 softtabstop=4 expandtab: # diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index c1d00f65a42a..f7150db048d1 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -895,6 +895,7 @@ Reference< XShape > Shape::createAndInsert( } SAL_INFO("oox.cscode", "==cscode== shape name: '" << msName << "'"); + SAL_INFO("oox.csdata", "==csdata== shape name: '" << msName << "'"); mpCustomShapePropertiesPtr->pushToPropSet( rFilterBase, xSet, mxShape, maSize ); } else if( getTextBody() ) |