summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-04-29 10:51:11 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-04-29 11:08:38 +0200
commit64f81d62804b7a890c2b4e7a3f4e539a5ef00e40 (patch)
treee107d379cd1dd2f177d215849a229c7fc5fb7124 /oox
parent8c128ceebbf2d5320bd495101401712a3290c3d1 (diff)
oox: clean up customshapes README and data generator
Change-Id: Ie7ef8cd247dedb2a6ea0a6de249cb05e9056f726
Diffstat (limited to 'oox')
-rwxr-xr-xoox/source/drawingml/customshapes/README17
-rwxr-xr-xoox/source/drawingml/customshapes/generatePresetsCXX.pl171
2 files changed, 5 insertions, 183 deletions
diff --git a/oox/source/drawingml/customshapes/README b/oox/source/drawingml/customshapes/README
index 6171e3140bf2..f9e343224b2a 100755
--- a/oox/source/drawingml/customshapes/README
+++ b/oox/source/drawingml/customshapes/README
@@ -26,27 +26,18 @@ make oox.clean && make oox dbglevel=2
# Then load it and store the debugging output.
-# We need only the SAL_INFO output with tag "oox.cscode", plus stderr
-# for PropertyMap::dumpCode() output.
+# We need only the SAL_INFO output with tag "oox.csdata", plus stderr
+# for PropertyMap::dumpData() output.
-SAL_LOG='+INFO.oox.cscode-WARN' instdir/program/soffice --headless --convert-to odp --outdir oox/source/drawingml/customshapes/ oox/source/drawingml/customshapes/pptx/cshape-all.pptx > oox/source/drawingml/customshapes/custom-shapes.log 2>&1
+SAL_LOG='+INFO.oox.csdata-WARN' instdir/program/soffice --headless --convert-to odp --outdir oox/source/drawingml/customshapes/ oox/source/drawingml/customshapes/pptx/cshape-all.pptx > oox/source/drawingml/customshapes/custom-shapes.log 2>&1
# Now run a script that reads the above log file and generates the
-# customshapepresets*.cxx sources:
+# oox-drawingml-cs-presets data:
(cd oox/source/drawingml/customshapes && ./generatePresetsCXX.pl)
-# Run it again to generate the oox-drawingml-cs-presets data:
-
-(cd oox/source/drawingml/customshapes && ./generatePresetsCXX.pl --data)
-
-
-# Then move them into place
-
-mv oox/source/drawingml/customshapes/customshapepresets*.cxx oox/source/drawingml
-
echo
echo "To see what has been done, run git diff --patience oox/source/drawingml"
echo
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: #