Kaydet (Commit) 8b1af0d6 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

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
üst 14af57cc
......@@ -129,9 +129,10 @@ certain functionality.
@li @c filter.config
@li @c filter.ms - escher import/export
@li @c filter.xslt - xslt import/export
@li @c oox.xmlstream - XmlStream class
@li @c oox.storage - ZipStorage class
@li @c oox.cscode - see oox/source/drawingml/customshapes/README
@li @c oox.ppt - pptx filter
@li @c oox.storage - ZipStorage class
@li @c oox.xmlstream - XmlStream class
@section forms
......
......@@ -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();
......
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.
......@@ -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 "}
......
......@@ -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() )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment