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:
@@ -7,6 +7,54 @@
|
|||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# 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()
|
sub loadSourceCode()
|
||||||
{
|
{
|
||||||
open (IN, "<custom-shapes.log");
|
open (IN, "<custom-shapes.log");
|
||||||
@@ -168,6 +216,28 @@ EOS
|
|||||||
close OUT;
|
close OUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 ());
|
generateSource (loadSourceCode ());
|
||||||
|
}
|
||||||
|
|
||||||
# vim:set ft=perl shiftwidth=4 softtabstop=4 expandtab: #
|
# vim:set ft=perl shiftwidth=4 softtabstop=4 expandtab: #
|
||||||
|
@@ -895,6 +895,7 @@ Reference< XShape > Shape::createAndInsert(
|
|||||||
}
|
}
|
||||||
|
|
||||||
SAL_INFO("oox.cscode", "==cscode== shape name: '" << msName << "'");
|
SAL_INFO("oox.cscode", "==cscode== shape name: '" << msName << "'");
|
||||||
|
SAL_INFO("oox.csdata", "==csdata== shape name: '" << msName << "'");
|
||||||
mpCustomShapePropertiesPtr->pushToPropSet( rFilterBase, xSet, mxShape, maSize );
|
mpCustomShapePropertiesPtr->pushToPropSet( rFilterBase, xSet, mxShape, maSize );
|
||||||
}
|
}
|
||||||
else if( getTextBody() )
|
else if( getTextBody() )
|
||||||
|
Reference in New Issue
Block a user