<commit_before>#! /usr/bin/perl -w
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license notice:
#
#   Licensed to the Apache Software Foundation (ASF) under one or more
#   contributor license agreements. See the NOTICE file distributed
#   with this work for additional information regarding copyright
#   ownership. The ASF licenses this file to you under the Apache
#   License, Version 2.0 (the "License"); you may not use this file
#   except in compliance with the License. You may obtain a copy of
#   the License at http://www.apache.org/licenses/LICENSE-2.0 .
#

use strict;
use warnings;

sub usage() {
    print STDERR <<EOF;
Usage: preset-definitions-to-shape-types.pl <shapes> <text>

Converts presetShapeDefinitions.xml and presetTextWarpDefinitions.xml to a
.cxx that contains VML with the definitions of the shapes.  The result is
written to stdout.

<shapes> presetShapeDefinitions.xml (including the path to it)
<text>   presetTextWarpDefinitions.xml (including the path to it)
EOF
    exit 1;
}

sub show_call_stack
{
    my ( $path, $line, $subr );
    my $max_depth = 30;
    my $i = 1;
    print STDERR "--- Begin stack trace ---\n";
    while ( (my @call_details = (caller($i++))) && ($i<$max_depth) ) {
        print STDERR "$call_details[1] line $call_details[2] in function $call_details[3]\n";
    }
    print STDERR "--- End stack trace ---\n";
}

my $src_shapes = shift;
my $src_text = shift;

usage() if ( !defined( $src_shapes ) || !defined( $src_text ) ||
             $src_shapes eq "-h" || $src_shapes eq "--help" ||
             !-f $src_shapes || !-f $src_text );

# Global variables
my @levels = ();
my $shape_name = "";
my $state = "";
my $path = "";
my $adjust = "";
my $max_adj_no = 0;
my @formulas = ();
my %variables = ();
my $ignore_this_shape = 0;
my $handles = "";
my $textboxrect = "";
my $last_pos_x = "";
my $last_pos_y = "";
my $no_stroke = 0;
my $no_fill = 0;
my $path_w = 1;
my $path_h = 1;
my @quadratic_bezier = ();

my %result_shapes = ();

my %shapes_ids = (
    0 => 'notPrimitive',
    1 => 'rectangle',
    2 => 'roundRectangle',
    3 => 'ellipse',
    4 => 'diamond',
    5 => 'triangle',
    6 => 'rtTriangle',
    7 => 'parallelogram',
    8 => 'trapezoid',
    9 => 'hexagon',
    10 => 'octagon',
    11 => 'plus',
    12 => 'star5',
    13 => 'rightArrow',
    14 => 'thickArrow', # should not be used
    15 => 'homePlate',
    16 => 'cube',
    17 => 'wedgeRoundRectCallout', # balloon
    18 => 'star16', # seal
    19 => 'arc',
    20 => 'line',
    21 => 'plaque',
    22 => 'can',
    23 => 'donut',
    24 => 'textPlain', # textSimple - FIXME MS Office 2007 converts these to textboxes with unstyled text, so is it actually correct to map it to a real style?
    25 => 'textStop', # textOctagon FIXME see 24
    26 => 'textTriangle', # textHexagon FIXMME see 24
    27 => 'textCanDown', # textCurve FIXMME see 24
    28 => 'textWave1', # textWave FIXMME see 24
    29 => 'textArchUpPour', # textRing FIXMME see 24
    30 => 'textCanDown', # textOnCurve FIXMME see 24
    31 => 'textArchUp', # textOnRing FIXMME see 24
    32 => 'straightConnector1',
    33 => 'bentConnector2',
    34 => 'bentConnector3',
    35 => 'bentConnector4',
    36 => 'bentConnector5',
    37 => 'curvedConnector2',
    38 => 'curvedConnector3',
    39 => 'curvedConnector4',
    40 => 'curvedConnector5',
    41 => 'callout1',
    42 => 'callout2',
    43 => 'callout3',
    44 => 'accentCallout1',
    45 => 'accentCallout2',
    46 => 'accentCallout3',
    47 => 'borderCallout1',
    48 => 'borderCallout2',
    49 => 'borderCallout3',
    50 => 'accentBorderCallout1',
    51 => 'accentBorderCallout2',
    52 => 'accentBorderCallout3',
    53 => 'ribbon',
    54 => 'ribbon2',
    55 => 'chevron',
    56 => 'pentagon',
    57 => 'noSmoking',
    58 => 'star8', # seal8
    59 => 'star16', # seal16
    60 => 'star32', # seal32
    61 => 'wedgeRectCallout',
    62 => 'wedgeRoundRectCallout', # wedgeRRectCallout
    63 => 'wedgeEllipseCallout',
    64 => 'wave',
    65 => 'foldedCorner',
    66 => 'leftArrow',
    67 => 'downArrow',
    68 => 'upArrow',
    69 => 'leftRightArrow',
    70 => 'upDownArrow',
    71 => 'irregularSeal1',
    72 => 'irregularSeal2',
    73 => 'lightningBolt',
    74 => 'heart',
    75 => 'frame', # pictureFrame
    76 => 'quadArrow',
    77 => 'leftArrowCallout',
    78 => 'rightArrowCallout',
    79 => 'upArrowCallout',
    80 => 'downArrowCallout',
    81 => 'leftRightArrowCallout',
    82 => 'upDownArrowCallout',
    83 => 'quadArrowCallout',
    84 => 'bevel',
    85 => 'leftBracket',<commit_msg>fdo#71581: Use pictureFrame for images.<commit_after>#! /usr/bin/perl -w
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license notice:
#
#   Licensed to the Apache Software Foundation (ASF) under one or more
#   contributor license agreements. See the NOTICE file distributed
#   with this work for additional information regarding copyright
#   ownership. The ASF licenses this file to you under the Apache
#   License, Version 2.0 (the "License"); you may not use this file
#   except in compliance with the License. You may obtain a copy of
#   the License at http://www.apache.org/licenses/LICENSE-2.0 .
#

use strict;
use warnings;

sub usage() {
    print STDERR <<EOF;
Usage: preset-definitions-to-shape-types.pl <shapes> <text>

Converts presetShapeDefinitions.xml and presetTextWarpDefinitions.xml to a
.cxx that contains VML with the definitions of the shapes.  The result is
written to stdout.

<shapes> presetShapeDefinitions.xml (including the path to it)
<text>   presetTextWarpDefinitions.xml (including the path to it)
EOF
    exit 1;
}

sub show_call_stack
{
    my ( $path, $line, $subr );
    my $max_depth = 30;
    my $i = 1;
    print STDERR "--- Begin stack trace ---\n";
    while ( (my @call_details = (caller($i++))) && ($i<$max_depth) ) {
        print STDERR "$call_details[1] line $call_details[2] in function $call_details[3]\n";
    }
    print STDERR "--- End stack trace ---\n";
}

my $src_shapes = shift;
my $src_text = shift;

usage() if ( !defined( $src_shapes ) || !defined( $src_text ) ||
             $src_shapes eq "-h" || $src_shapes eq "--help" ||
             !-f $src_shapes || !-f $src_text );

# Global variables
my @levels = ();
my $shape_name = "";
my $state = "";
my $path = "";
my $adjust = "";
my $max_adj_no = 0;
my @formulas = ();
my %variables = ();
my $ignore_this_shape = 0;
my $handles = "";
my $textboxrect = "";
my $last_pos_x = "";
my $last_pos_y = "";
my $no_stroke = 0;
my $no_fill = 0;
my $path_w = 1;
my $path_h = 1;
my @quadratic_bezier = ();

my %result_shapes = ();

my %shapes_ids = (
    0 => 'notPrimitive',
    1 => 'rectangle',
    2 => 'roundRectangle',
    3 => 'ellipse',
    4 => 'diamond',
    5 => 'triangle',
    6 => 'rtTriangle',
    7 => 'parallelogram',
    8 => 'trapezoid',
    9 => 'hexagon',
    10 => 'octagon',
    11 => 'plus',
    12 => 'star5',
    13 => 'rightArrow',
    14 => 'thickArrow', # should not be used
    15 => 'homePlate',
    16 => 'cube',
    17 => 'wedgeRoundRectCallout', # balloon
    18 => 'star16', # seal
    19 => 'arc',
    20 => 'line',
    21 => 'plaque',
    22 => 'can',
    23 => 'donut',
    24 => 'textPlain', # textSimple - FIXME MS Office 2007 converts these to textboxes with unstyled text, so is it actually correct to map it to a real style?
    25 => 'textStop', # textOctagon FIXME see 24
    26 => 'textTriangle', # textHexagon FIXMME see 24
    27 => 'textCanDown', # textCurve FIXMME see 24
    28 => 'textWave1', # textWave FIXMME see 24
    29 => 'textArchUpPour', # textRing FIXMME see 24
    30 => 'textCanDown', # textOnCurve FIXMME see 24
    31 => 'textArchUp', # textOnRing FIXMME see 24
    32 => 'straightConnector1',
    33 => 'bentConnector2',
    34 => 'bentConnector3',
    35 => 'bentConnector4',
    36 => 'bentConnector5',
    37 => 'curvedConnector2',
    38 => 'curvedConnector3',
    39 => 'curvedConnector4',
    40 => 'curvedConnector5',
    41 => 'callout1',
    42 => 'callout2',
    43 => 'callout3',
    44 => 'accentCallout1',
    45 => 'accentCallout2',
    46 => 'accentCallout3',
    47 => 'borderCallout1',
    48 => 'borderCallout2',
    49 => 'borderCallout3',
    50 => 'accentBorderCallout1',
    51 => 'accentBorderCallout2',
    52 => 'accentBorderCallout3',
    53 => 'ribbon',
    54 => 'ribbon2',
    55 => 'chevron',
    56 => 'pentagon',
    57 => 'noSmoking',
    58 => 'star8', # seal8
    59 => 'star16', # seal16
    60 => 'star32', # seal32
    61 => 'wedgeRectCallout',
    62 => 'wedgeRoundRectCallout', # wedgeRRectCallout
    63 => 'wedgeEllipseCallout',
    64 => 'wave',
    65 => 'foldedCorner',
    66 => 'leftArrow',
    67 => 'downArrow',
    68 => 'upArrow',
    69 => 'leftRightArrow',
    70 => 'upDownArrow',
    71 => 'irregularSeal1',
    72 => 'irregularSeal2',
    73 => 'lightningBolt',
    74 => 'heart',
    75 => 'pictureFrame',
    76 => 'quadArrow',
    77 => 'leftArrowCallout',
    78 => 'rightArrowCallout',
    79 => 'upArrowCallout',
    80 => 'downArrowCallout',
    81 => 'leftRightArrowCallout',
    82 => 'upDownArrowCallout',
    83 => 'quadArrowCallout',
    84 => 'bevel',
    85 => 'leftBracket',
{'fraction_non_alphanumeric': 0.15433621043978626, 'fraction_numerical': 0.049630086313193586, 'mean_word_length': 3.052039966694421, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 183, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3830028', 'n_tokens_mistral': 3620, 'n_tokens_neox': 3400, 'n_words': 1030}