[Libreoffice-commits] core.git: 3 commits - include/oox oox/source unusedcode.easy

Miklos Vajna vmiklos at collabora.co.uk
Tue Apr 29 02:09:47 PDT 2014


 include/oox/drawingml/customshapeproperties.hxx          |    3 
 oox/source/drawingml/customshapeproperties.cxx           |   31 -
 oox/source/drawingml/customshapes/README                 |   19 -
 oox/source/drawingml/customshapes/generatePresetsCXX.pl  |  243 ---------------
 oox/source/drawingml/customshapes/generatePresetsData.pl |   74 ++++
 unusedcode.easy                                          |    3 
 6 files changed, 79 insertions(+), 294 deletions(-)

New commits:
commit 839d7f9c59f7778db5b785af56071f92657777e4
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Apr 29 10:51:48 2014 +0200

    oox: generatePresetsCXX -> generatePresetsData
    
    As it no longer actually generates C++ code, but data.
    
    Change-Id: I9b05f139ca4ad2bcfdbbb4b954ed4e0f2a9bcd8b

diff --git a/oox/source/drawingml/customshapes/README b/oox/source/drawingml/customshapes/README
index f9e3432..0b3ef8f 100755
--- a/oox/source/drawingml/customshapes/README
+++ b/oox/source/drawingml/customshapes/README
@@ -35,7 +35,7 @@ SAL_LOG='+INFO.oox.csdata-WARN' instdir/program/soffice --headless --convert-to
 # Now run a script that reads the above log file and generates the
 # oox-drawingml-cs-presets data:
 
-(cd oox/source/drawingml/customshapes && ./generatePresetsCXX.pl)
+(cd oox/source/drawingml/customshapes && ./generatePresetsData.pl)
 
 
 echo
diff --git a/oox/source/drawingml/customshapes/generatePresetsCXX.pl b/oox/source/drawingml/customshapes/generatePresetsData.pl
similarity index 100%
rename from oox/source/drawingml/customshapes/generatePresetsCXX.pl
rename to oox/source/drawingml/customshapes/generatePresetsData.pl
commit 64f81d62804b7a890c2b4e7a3f4e539a5ef00e40
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Apr 29 10:51:11 2014 +0200

    oox: clean up customshapes README and data generator
    
    Change-Id: Ie7ef8cd247dedb2a6ea0a6de249cb05e9056f726

diff --git a/oox/source/drawingml/customshapes/README b/oox/source/drawingml/customshapes/README
index 6171e31..f9e3432 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 29a3c19..187f3ee 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: #
commit 8c128ceebbf2d5320bd495101401712a3290c3d1
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Apr 29 10:44:15 2014 +0200

    oox: remove now unused helper methods (generated code used them in the past)
    
    Change-Id: I532dc4ec24c635b9889d77c37113a8ece2c9b88b

diff --git a/include/oox/drawingml/customshapeproperties.hxx b/include/oox/drawingml/customshapeproperties.hxx
index 06af820..c0753e0 100644
--- a/include/oox/drawingml/customshapeproperties.hxx
+++ b/include/oox/drawingml/customshapeproperties.hxx
@@ -112,10 +112,7 @@ protected:
         sal_uInt32 nFirstValue;
         sal_uInt32 nSecondValue;
     };
-    static com::sun::star::uno::Any createStringSequence( size_t nStrings, const char **pStrings );
-    static com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > createSegmentSequence( size_t nElems, const sal_uInt16 *pValues );
     static com::sun::star::drawing::EnhancedCustomShapeParameterPair createParameterPair( const ParameterPairData *pData );
-    static com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > createParameterPairSequence( size_t nElems, const ParameterPairData *pData );
 public:
     virtual ~CustomShapeProvider() {}
     virtual PropertyMap getProperties() = 0;
diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx
index 0496dc3..1feec30 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -369,28 +369,6 @@ void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFi
     }
 }
 
-Any CustomShapeProvider::createStringSequence( size_t nStrings, const char **pStrings )
-{
-    Sequence< OUString > aStringSequence( nStrings );
-    for (size_t i = 0; i < nStrings; i++)
-        aStringSequence[i] = OUString::intern(
-                                pStrings[i], strlen( pStrings[i] ),
-                                RTL_TEXTENCODING_ASCII_US );
-    return makeAny( aStringSequence );
-}
-
-com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment >
-CustomShapeProvider::createSegmentSequence( size_t nElems, const sal_uInt16 *pValues )
-{
-    Sequence< EnhancedCustomShapeSegment > aSequence( (nElems + 1) / 2 );
-    for (size_t i = 0, j = 0; i < nElems / 2; i++)
-    {
-        aSequence[i].Command = pValues[j++];
-        aSequence[i].Count = pValues[j++];
-    }
-    return aSequence;
-}
-
 com::sun::star::drawing::EnhancedCustomShapeParameterPair
 CustomShapeProvider::createParameterPair( const ParameterPairData *pData )
 {
@@ -402,15 +380,6 @@ CustomShapeProvider::createParameterPair( const ParameterPairData *pData )
     return aParameterPair;
 }
 
-com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair >
-CustomShapeProvider::createParameterPairSequence( size_t nElems, const ParameterPairData *pData )
-{
-    Sequence< EnhancedCustomShapeParameterPair > aSequence( nElems );
-    for (size_t i = 0; i < nElems; i++)
-        aSequence[i] = createParameterPair( pData + i );
-    return aSequence;
-}
-
 } }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unusedcode.easy b/unusedcode.easy
index 4f5c4c2..b07368f 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -220,9 +220,6 @@ connectivity::sdbcx::OGroup::OGroup(bool)
 connectivity::sdbcx::OGroup::OGroup(rtl::OUString const&, bool)
 oglcanvas::CanvasHelper::flush() const
 oglcanvas::TextLayout::draw(com::sun::star::rendering::ViewState const&, com::sun::star::rendering::RenderState const&, com::sun::star::uno::Reference<com::sun::star::rendering::XGraphicDevice> const&) const
-oox::drawingml::CustomShapeProvider::createParameterPairSequence(unsigned long, oox::drawingml::CustomShapeProvider::ParameterPairData const*)
-oox::drawingml::CustomShapeProvider::createSegmentSequence(unsigned long, unsigned short const*)
-oox::drawingml::CustomShapeProvider::createStringSequence(unsigned long, char const**)
 oox::xls::BiffDrawingObjectBase::BiffDrawingObjectBase(oox::xls::WorksheetHelper const&)
 sc::CLBuildKernelThread::CLBuildKernelThread()
 sc::CLBuildKernelThread::consume()


More information about the Libreoffice-commits mailing list