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
This commit is contained in:
Miklos Vajna
2014-04-16 18:29:46 +02:00
parent 142d63d015
commit e1f9e73893
2 changed files with 72 additions and 1 deletions

View File

@@ -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: #

View File

@@ -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() )