diff options
Diffstat (limited to 'oox/source/drawingml/customshapes/generatePresetsCXX.pl')
-rwxr-xr-x | oox/source/drawingml/customshapes/generatePresetsCXX.pl | 171 |
1 files changed, 1 insertions, 170 deletions
diff --git a/oox/source/drawingml/customshapes/generatePresetsCXX.pl b/oox/source/drawingml/customshapes/generatePresetsCXX.pl index 29a3c1915546..187f3ee33516 100755 --- a/oox/source/drawingml/customshapes/generatePresetsCXX.pl +++ b/oox/source/drawingml/customshapes/generatePresetsCXX.pl @@ -55,167 +55,6 @@ sub loadData() return \%sources; } -sub loadSourceCode() -{ - open (IN, "<custom-shapes.log"); - - my %sources; - - while (<IN>) - { - if (/==cscode== /) - { - if (/shape name: '/) - { - chop; - s/.*shape name: '([^']+)'.*/$1/; - $name = $_; - } - else - { - if (/==cscode== begin/) - { - $inside = true; - @code = (); - } - else - { - if (/==cscode== end/) - { - s/^ <\/([^>]+)>/$1/; - undef $inside; - $sources{$name} = [ @code ]; - #print "added ", $name, "\n"; - } - } - } - } - else - { - if ($inside) - { - push @code, $_; - } - } - } - - close (IN); - - return \%sources; -} - -sub startSource -{ - my $count = shift; - - open (OUT, ">customshapepresets" . $count . ".cxx"); - print OUT << "EOS" - -// This file was generated by: $0 - -// Please, DO NOT EDIT. - -// We mean it. - -#include <oox/drawingml/customshapeproperties.hxx> -#include <oox/token/tokenmap.hxx> -#include <com/sun/star/awt/Rectangle.hpp> -#include <com/sun/star/awt/Size.hpp> -#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp> -#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp> -#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> -#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp> - -using namespace ::com::sun::star; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::drawing; -using namespace ::com::sun::star::uno; - -namespace oox { namespace drawingml { - -namespace -{ -EOS -; - -} - -sub endSource -{ - my $count = shift; - my $classes = shift; - $endBrace > 0 && print OUT "}\n\n"; - - print OUT "} // anonymous namespace\n"; - print OUT "void CustomShapeProperties::initializePresetsMap" . $count . "()\n"; - print OUT "{\n"; - for my $class (@{$classes}) - { - print OUT " maPresetsMap [ StaticTokenMap::get().getTokenFromUnicode( \"", $class, "\" ) ] = new ShapeC".$class."();\n"; - } - print OUT "} - -} } // oox // drawingml - -"; -} - -sub generateSource -{ - my $sources = shift; - my $count = 0; - my $shCount = 0; - - startSource (++$count); - - my @classes = (); - foreach $shape (sort(keys %$sources)) - { - push @classes, $shape; - print OUT "class ShapeC".$shape." : public CustomShapeProvider\n"; - print OUT "{\n"; - print OUT " virtual PropertyMap getProperties() SAL_OVERRIDE\n"; - print OUT " {\n"; - print OUT " PropertyMap aPropertyMap;\n\n"; - print OUT @{$sources->{$shape}}; - print OUT " aPropertyMap.setProperty( PROP_Type, OUString(\"ooxml-", $shape, "\"));\n\n"; - print OUT " return aPropertyMap;\n"; - print OUT " }\n"; - print OUT "};\n"; - print OUT "\n"; - print OUT "// This is a generated source file. DO NOT EDIT.\n"; - print OUT "\n"; - - $shCount++; - - if ($shCount >= 35) { - $shCount = 0; - - endSource ($count, \@classes); - close OUT; - startSource (++$count); - @classes = (); - } - } - - endSource ($count, \@classes); - - print OUT << "EOS" - -void ::oox::drawingml::CustomShapeProperties::initializePresetsMap() -{ -EOS - ; - - for ($i=1; $i <= $count; $i++) { - print OUT "initializePresetsMap" . $i . "();\n"; - } - - print OUT "}\n"; - - close OUT; -} - sub generateData { my $sources = shift; @@ -230,14 +69,6 @@ sub generateData close OUT; } -my $arg = shift; - -if ($arg eq "--data") -{ - generateData(loadData()); -} else -{ - generateSource (loadSourceCode ()); -} +generateData(loadData()); # vim:set ft=perl shiftwidth=4 softtabstop=4 expandtab: # |