diff options
author | Tor Lillqvist <tml@iki.fi> | 2013-08-15 17:08:11 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2013-08-15 22:53:35 +0300 |
commit | 8b1af0d6f476c8953611cbc9bd3510fa6913badc (patch) | |
tree | 90f6b88d2a1141261566232c5f684fb693f27c69 /oox | |
parent | 14af57cc7a47195490815519b8a6b15c7e31bc75 (diff) |
Work on the custom shape preset generation
Don't generate code that uses the old RTL_CONSTASCII_USTRINGPARAM horror.
Update the README file to have actually working command lines, and at the same
time make it into a shell script that can actually be run.
Use SAL_INFO with tag oox.cscode to output the stuff that the
generatePresetsCXX.pl is looking for.
Change-Id: I3f8f756fbe8e35857c2bd07beece0f3ab4234e7f
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/customshapeproperties.cxx | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | oox/source/drawingml/customshapes/README | 61 | ||||
-rwxr-xr-x | oox/source/drawingml/customshapes/generatePresetsCXX.pl | 17 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 2 |
4 files changed, 64 insertions, 20 deletions
diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx index aab5cc471f6c..05a9e0c3f1dc 100644 --- a/oox/source/drawingml/customshapeproperties.cxx +++ b/oox/source/drawingml/customshapeproperties.cxx @@ -341,9 +341,9 @@ void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFi aPropertyMap[ PROP_Handles ] <<= aHandles; #ifdef DEBUG - OSL_TRACE("==cscode== begin"); + SAL_INFO("oox.cscode", "==cscode== begin"); aPropertyMap.dumpCode(); - OSL_TRACE("==cscode== end"); + SAL_INFO("oox.cscode", "==cscode== end"); #endif // converting the vector to a sequence Sequence< PropertyValue > aSeq = aPropertyMap.makePropertyValueSequence(); diff --git a/oox/source/drawingml/customshapes/README b/oox/source/drawingml/customshapes/README index d32d1cd2f703..53b4fd114cb9 100644..100755 --- a/oox/source/drawingml/customshapes/README +++ b/oox/source/drawingml/customshapes/README @@ -1,18 +1,59 @@ -This code is used to generate the customshapepresets source code. +#!/bin/bash -To re-generate the code first you need to re-build oox with: +# The Perl code here is used to generate the custom shape presets +# source code. -make oox.clean oox dbglevel=2 +# This file is both a README and also, if run as a shell script, does what +# it describes. -Then load the cshape-all.pptx file[1] +# We want to exit on errors... -SAL_LOG='+INFO+WARN' ./soffice /path/to/oox/pptx/cshape-all.pptx 2>& | tee /path/to/oox/custom-shapes.log +set -o errexit -Now run: +# To re-generate the code, you need to be on Linux (I think). You need +# to have done a make dev-install. oox needs to be build with +# dbglevel=2 so that DEBUG is defined. -generatePresetsCXX.pl # this operates on custom-shapes.log in the CWD +make oox.clean && make oox dbglevel=2 -And this will re-generate the .cxx sources we need to embed the right -custom shapes into the source code. +# This reads the +# oox/source/drawingml/customshapes/presetShapeDefinitions.xml file. +# It will produce the file +# oox/source/drawingml/customshapes/pptx/cshape-all.ppx and a whole +# bunch of other files that aren't needed further. + +(cd oox/source/drawingml/customshapes && ./generatePresetsPPTXs.pl) + + +# Then load it and store the debugging output. Note that this will run +# an *interactive* LO, and you need to quit it manually. + +echo +echo "Starting LibreOffice, quit once you see the slide." +echo + +# We need only the SAL_INFO output with tag "oox.cscode", plus stderr +# for PropertyMap::dumpCode() output. + +SAL_LOG='+INFO.oox.cscode-WARN' install/program/soffice 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: + +(cd oox/source/drawingml/customshapes && ./generatePresetsCXX.pl) + + +# 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 +echo "The generatePresetsCXX.pl doesn't sort the classes by name (it uses just" +echo "the keys function on a hash which returns the keys in an unspecified" +echo "order), so there will almost always be some random re-ordering of" +echo "classes, sigh." +echo -[1] - this file is built by generatePresetsPPTXs.pl incidentally. diff --git a/oox/source/drawingml/customshapes/generatePresetsCXX.pl b/oox/source/drawingml/customshapes/generatePresetsCXX.pl index e129d0320a8b..fcd21529d7c7 100755 --- a/oox/source/drawingml/customshapes/generatePresetsCXX.pl +++ b/oox/source/drawingml/customshapes/generatePresetsCXX.pl @@ -62,11 +62,15 @@ sub startSource open (OUT, ">customshapepresets" . $count . ".cxx"); print OUT << "EOS" -// this file was generated by: $0 -// please do not edit - -#include \"oox/drawingml/customshapeproperties.hxx\" -#include \"oox/token/tokenmap.hxx\" +// +// 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> @@ -74,7 +78,6 @@ sub startSource #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp> -using rtl::OUString; using namespace ::com::sun::star; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::drawing; @@ -100,7 +103,7 @@ sub endSource print OUT "{\n"; for my $class (@{$classes}) { - print OUT " maPresetsMap [ StaticTokenMap::get().getTokenFromUnicode( OUString( RTL_CONSTASCII_USTRINGPARAM( \"", $class, "\" ) ) ) ] = new ShapeC".$class."();\n"; + print OUT " maPresetsMap [ StaticTokenMap::get().getTokenFromUnicode( \"", $class, "\" ) ] = new ShapeC".$class."();\n"; } print OUT "} diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 64a7ab5df0a1..f4a795e525b3 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -592,7 +592,7 @@ Reference< XShape > Shape::createAndInsert( mpCustomShapePropertiesPtr->setTextRotateAngle( nTextRotateAngle / 60000 ); } - SAL_INFO("oox", "==cscode== shape name: '" << msName << "'"); + SAL_INFO("oox.cscode", "==cscode== shape name: '" << msName << "'"); mpCustomShapePropertiesPtr->pushToPropSet( rFilterBase, xSet, mxShape ); } else if( getTextBody() ) |