from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl

from openpyxl.styles.colors import Color, BLACK, WHITE

from openpyxl.utils.units import (
    pixels_to_EMU,
    EMU_to_pixels,
    short_color,
)

from openpyxl.compat import deprecated
from openpyxl.xml.functions import Element, SubElement, tostring
from openpyxl.xml.constants import (
    DRAWING_NS,
    SHEET_DRAWING_NS,
    CHART_NS,
    CHART_DRAWING_NS,
    PKG_REL_NS
)
from openpyxl.compat.strings import safe_string


class Shape(object):
    """ a drawing inside a chart
        coordiantes are specified by the user in the axis units
    """

    MARGIN_LEFT = 6 + 13 + 1
    MARGIN_BOTTOM = 17 + 11

    FONT_WIDTH = 7
    FONT_HEIGHT = 8

    ROUND_RECT = 'roundRect'
    RECT = 'rect'

    # other shapes to define :
    '''
    "line"
    "lineInv"
    "triangle"
    "rtTriangle"
    "diamond"
    "parallelogram"
    "trapezoid"
    "nonIsoscelesTrapezoid"
    "pentagon"
    "hexagon"
    "heptagon"
    "octagon"
    "decagon"
    "dodecagon"
    "star4"
    "star5"
    "star6"
    "star7"
    "star8"
    "star10"
    "star12"
    "star16"
    "star24"
    "star32"
    "roundRect"
    "round1Rect"
    "round2SameRect"
    "round2DiagRect"
    "snipRoundRect"
    "snip1Rect"
    "snip2SameRect"
    "snip2DiagRect"
    "plaque"
    "ellipse"
    "teardrop"
    "homePlate"
    "chevron"
    "pieWedge"
    "pie"
    "blockArc"
    "donut"
    "noSmoking"
    "rightArrow"
    "leftArrow"
    "upArrow"
    "downArrow"
    "stripedRightArrow"
    "notchedRightArrow"
    "bentUpArrow"
    "leftRightArrow"
    "upDownArrow"
    "leftUpArrow"
    "leftRightUpArrow"
    "quadArrow"
    "leftArrowCallout"
    "rightArrowCallout"
    "upArrowCallout"
    "downArrowCallout"
    "leftRightArrowCallout"
    "upDownArrowCallout"
    "quadArrowCallout"
    "bentArrow"
    "uturnArrow"
    "circularArrow"
    "leftCircularArrow"
    "leftRightCircularArrow"
    "curvedRightArrow"
    "curvedLeftArrow"
    "curvedUpArrow"
    "curvedDownArrow"
    "swooshArrow"
    "cube"
    "can"
    "lightningBolt"
    "heart"
    "sun"
    "moon"
    "smileyFace"
    "irregularSeal1"
    "irregularSeal2"
    "foldedCorner"
    "bevel"
    "frame"
    "halfFrame"
    "corner"
    "diagStripe"
    "chord"
    "arc"
    "leftBracket"
    "rightBracket"
    "leftBrace"
    "rightBrace"
    "bracketPair"
    "bracePair"
    "straightConnector1"
    "bentConnector2"
    "bentConnector3"
    "bentConnector4"
    "bentConnector5"
    "curvedConnector2"
    "curvedConnector3"
    "curvedConnector4"
    "curvedConnector5"
    "callout1"
    "callout2"
    "callout3"
    "accentCallout1"
    "accentCallout2"
    "accentCallout3"
    "borderCallout1"
    "borderCallout2"
    "borderCallout3"
    "accentBorderCallout1"
    "accentBorderCallout2"
    "accentBorderCallout3"
    "wedgeRectCallout"
    "wedgeRoundRectCallout"
    "wedgeEllipseCallout"
    "cloudCallout"
    "cloud"
    "ribbon"
    "ribbon2"
    "ellipseRibbon"
    "ellipseRibbon2"
    "leftRightRibbon"
    "verticalScroll"
    "horizontalScroll"
    "wave"
    "doubleWave"
    "plus"
    "flowChartProcess"
    "flowChartDecision"
    "flowChartInputOutput"
    "flowChartPredefinedProcess"
    "flowChartInternalStorage"
    "flowChartDocument"
    "flowChartMultidocument"
    "flowChartTerminator"
    "flowChartPreparation"
    "flowChartManualInput"
    "flowChartManualOperation"
    "flowChartConnector"
    "flowChartPunchedCard"
    "flowChartPunchedTape"
    "flowChartSummingJunction"
    "flowChartOr"
    "flowChartCollate"
    "flowChartSort"
    "flowChartExtract"
    "flowChartMerge"
    "flowChartOfflineStorage"
    "flowChartOnlineStorage"
    "flowChartMagneticTape"
    "flowChartMagneticDisk"
    "flowChartMagneticDrum"
    "flowChartDisplay"
    "flowChartDelay"
    "flowChartAlternateProcess"
    "flowChartOffpageConnector"
    "actionButtonBlank"
    "actionButtonHome"
    "actionButtonHelp"
    "actionButtonInformation"
    "actionButtonForwardNext"
    "actionButtonBackPrevious"
    "actionButtonEnd"
    "actionButtonBeginning"
    "actionButtonReturn"
    "actionButtonDocument"
    "actionButtonSound"
    "actionButtonMovie"
    "gear6"
    "gear9"
    "funnel"
    "mathPlus"
    "mathMinus"
    "mathMultiply"
    "mathDivide"
    "mathEqual"
    "mathNotEqual"
    "cornerTabs"
    "squareTabs"
    "plaqueTabs"
    "chartX"
    "chartStar"
    "chartPlus"
    '''

    @deprecated("Chart Drawings need a complete rewrite")
    def __init__(self,
                 chart,
                 coordinates=((0, 0), (1, 1)),
                 text=None,
                 scheme="accent1"):
        self.chart = chart
        self.coordinates = coordinates  # in axis units
        self.text = text
        self.scheme = scheme
        self.style = Shape.RECT
        self.border_width = 0
        self.border_color = BLACK  # "F3B3C5"
        self.color = WHITE
        self.text_color = BLACK

    @property
    def border_color(self):
        return self._border_color

    @border_color.setter
    def border_color(self, color):
        self._border_color = short_color(color)

    @property
    def color(self):
        return self._color

    @color.setter
    def color(self, color):
        self._color = short_color(color)

    @property
    def text_color(self):
        return self._text_color

    @text_color.setter
    def text_color(self, color):
        self._text_color = short_color(color)

    @property
    def border_width(self):
        return self._border_width

    @border_width.setter
    def border_width(self, w):
        self._border_width = w

    @property
    def coordinates(self):
        """Return coordindates in axis units"""
        return self._coordinates

    @coordinates.setter
    def coordinates(self, coords):
        """ set shape coordinates in percentages (left, top, right, bottom)
        """
        # this needs refactoring to reflect changes in charts
        self.axis_coordinates = coords
        (x1, y1), (x2, y2) = coords # bottom left, top right
        drawing_width = pixels_to_EMU(self.chart.drawing.width)
        drawing_height = pixels_to_EMU(self.chart.drawing.height)
        plot_width = drawing_width * self.chart.width
        plot_height = drawing_height * self.chart.height

        margin_left = self.chart._get_margin_left() * drawing_width
        xunit = plot_width / self.chart.get_x_units()

        margin_top = self.chart._get_margin_top() * drawing_height
        yunit = self.chart.get_y_units()

        x_start = (margin_left + (float(x1) * xunit)) / drawing_width
        y_start = ((margin_top
                    + plot_height
                    - (float(y1) * yunit))
                    / drawing_height)

        x_end = (margin_left + (float(x2) * xunit)) / drawing_width
        y_end = ((margin_top
                  + plot_height
                  - (float(y2) * yunit))
                  / drawing_height)

        # allow user to specify y's in whatever order
        # excel expect y_end to be lower
        if y_end < y_start:
            y_end, y_start = y_start, y_end

        self._coordinates = (
            self._norm_pct(x_start), self._norm_pct(y_start),
            self._norm_pct(x_end), self._norm_pct(y_end)
        )

    @staticmethod
    def _norm_pct(pct):
        """ force shapes to appear by truncating too large sizes """
        if pct > 1:
            return 1
        elif pct < 0:
            return 0
        return pct


class ShapeWriter(object):
    """ one file per shape """

    def __init__(self, shapes):

        self._shapes = shapes

    def write(self, shape_id):

        root = Element('{%s}userShapes' % CHART_NS)

        for shape in self._shapes:
            anchor = SubElement(root, '{%s}relSizeAnchor' % CHART_DRAWING_NS)

            xstart, ystart, xend, yend = shape.coordinates

            _from = SubElement(anchor, '{%s}from' % CHART_DRAWING_NS)
            SubElement(_from, '{%s}x' % CHART_DRAWING_NS).text = str(xstart)
            SubElement(_from, '{%s}y' % CHART_DRAWING_NS).text = str(ystart)

            _to = SubElement(anchor, '{%s}to' % CHART_DRAWING_NS)
            SubElement(_to, '{%s}x' % CHART_DRAWING_NS).text = str(xend)
            SubElement(_to, '{%s}y' % CHART_DRAWING_NS).text = str(yend)

            sp = SubElement(anchor, '{%s}sp' % CHART_DRAWING_NS, {'macro':'', 'textlink':''})
            nvspr = SubElement(sp, '{%s}nvSpPr' % CHART_DRAWING_NS)
            SubElement(nvspr, '{%s}cNvPr' % CHART_DRAWING_NS, {'id':str(shape_id), 'name':'shape %s' % shape_id})
            SubElement(nvspr, '{%s}cNvSpPr' % CHART_DRAWING_NS)

            sppr = SubElement(sp, '{%s}spPr' % CHART_DRAWING_NS)
            frm = SubElement(sppr, '{%s}xfrm' % DRAWING_NS,)
            # no transformation
            SubElement(frm, '{%s}off' % DRAWING_NS, {'x':'0', 'y':'0'})
            SubElement(frm, '{%s}ext' % DRAWING_NS, {'cx':'0', 'cy':'0'})

            prstgeom = SubElement(sppr, '{%s}prstGeom' % DRAWING_NS, {'prst':str(shape.style)})
            SubElement(prstgeom, '{%s}avLst' % DRAWING_NS)

            fill = SubElement(sppr, '{%s}solidFill' % DRAWING_NS, )
            SubElement(fill, '{%s}srgbClr' % DRAWING_NS, {'val':shape.color})

            border = SubElement(sppr, '{%s}ln' % DRAWING_NS, {'w':str(shape._border_width)})
            sf = SubElement(border, '{%s}solidFill' % DRAWING_NS)
            SubElement(sf, '{%s}srgbClr' % DRAWING_NS, {'val':shape.border_color})

            self._write_style(sp)
            self._write_text(sp, shape)

            shape_id += 1

        return tostring(root)

    def _write_text(self, node, shape):
        """ write text in the shape """

        tx_body = SubElement(node, '{%s}txBody' % CHART_DRAWING_NS)
        SubElement(tx_body, '{%s}bodyPr' % DRAWING_NS, {'vertOverflow':'clip'})
        SubElement(tx_body, '{%s}lstStyle' % DRAWING_NS)
        p = SubElement(tx_body, '{%s}p' % DRAWING_NS)
        if shape.text:
            r = SubElement(p, '{%s}r' % DRAWING_NS)
            rpr = SubElement(r, '{%s}rPr' % DRAWING_NS, {'lang':'en-US'})
            fill = SubElement(rpr, '{%s}solidFill' % DRAWING_NS)
            SubElement(fill, '{%s}srgbClr' % DRAWING_NS, {'val':shape.text_color})

            SubElement(r, '{%s}t' % DRAWING_NS).text = shape.text
        else:
            SubElement(p, '{%s}endParaRPr' % DRAWING_NS, {'lang':'en-US'})

    def _write_style(self, node):
        """ write style theme """

        style = SubElement(node, '{%s}style' % CHART_DRAWING_NS)

        ln_ref = SubElement(style, '{%s}lnRef' % DRAWING_NS, {'idx':'2'})
        scheme_clr = SubElement(ln_ref, '{%s}schemeClr' % DRAWING_NS, {'val':'accent1'})
        SubElement(scheme_clr, '{%s}shade' % DRAWING_NS, {'val':'50000'})

        fill_ref = SubElement(style, '{%s}fillRef' % DRAWING_NS, {'idx':'1'})
        SubElement(fill_ref, '{%s}schemeClr' % DRAWING_NS, {'val':'accent1'})

        effect_ref = SubElement(style, '{%s}effectRef' % DRAWING_NS, {'idx':'0'})
        SubElement(effect_ref, '{%s}schemeClr' % DRAWING_NS, {'val':'accent1'})

        font_ref = SubElement(style, '{%s}fontRef' % DRAWING_NS, {'idx':'minor'})
        SubElement(font_ref, '{%s}schemeClr' % DRAWING_NS, {'val':'lt1'})

[((4470, 4522), 'openpyxl.compat.deprecated', 'deprecated', (['"""Chart Drawings need a complete rewrite"""'], {}), "('Chart Drawings need a complete rewrite')\n", (4480, 4522), False, 'from openpyxl.compat import deprecated\n'), ((5152, 5170), 'openpyxl.utils.units.short_color', 'short_color', (['color'], {}), '(color)\n', (5163, 5170), False, 'from openpyxl.utils.units import pixels_to_EMU, EMU_to_pixels, short_color\n'), ((5303, 5321), 'openpyxl.utils.units.short_color', 'short_color', (['color'], {}), '(color)\n', (5314, 5321), False, 'from openpyxl.utils.units import pixels_to_EMU, EMU_to_pixels, short_color\n'), ((5479, 5497), 'openpyxl.utils.units.short_color', 'short_color', (['color'], {}), '(color)\n', (5490, 5497), False, 'from openpyxl.utils.units import pixels_to_EMU, EMU_to_pixels, short_color\n'), ((6120, 6159), 'openpyxl.utils.units.pixels_to_EMU', 'pixels_to_EMU', (['self.chart.drawing.width'], {}), '(self.chart.drawing.width)\n', (6133, 6159), False, 'from openpyxl.utils.units import pixels_to_EMU, EMU_to_pixels, short_color\n'), ((6185, 6225), 'openpyxl.utils.units.pixels_to_EMU', 'pixels_to_EMU', (['self.chart.drawing.height'], {}), '(self.chart.drawing.height)\n', (6198, 6225), False, 'from openpyxl.utils.units import pixels_to_EMU, EMU_to_pixels, short_color\n'), ((7708, 7744), 'openpyxl.xml.functions.Element', 'Element', (["('{%s}userShapes' % CHART_NS)"], {}), "('{%s}userShapes' % CHART_NS)\n", (7715, 7744), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((9667, 9681), 'openpyxl.xml.functions.tostring', 'tostring', (['root'], {}), '(root)\n', (9675, 9681), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((9782, 9831), 'openpyxl.xml.functions.SubElement', 'SubElement', (['node', "('{%s}txBody' % CHART_DRAWING_NS)"], {}), "(node, '{%s}txBody' % CHART_DRAWING_NS)\n", (9792, 9831), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((9840, 9912), 'openpyxl.xml.functions.SubElement', 'SubElement', (['tx_body', "('{%s}bodyPr' % DRAWING_NS)", "{'vertOverflow': 'clip'}"], {}), "(tx_body, '{%s}bodyPr' % DRAWING_NS, {'vertOverflow': 'clip'})\n", (9850, 9912), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((9920, 9968), 'openpyxl.xml.functions.SubElement', 'SubElement', (['tx_body', "('{%s}lstStyle' % DRAWING_NS)"], {}), "(tx_body, '{%s}lstStyle' % DRAWING_NS)\n", (9930, 9968), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((9981, 10022), 'openpyxl.xml.functions.SubElement', 'SubElement', (['tx_body', "('{%s}p' % DRAWING_NS)"], {}), "(tx_body, '{%s}p' % DRAWING_NS)\n", (9991, 10022), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((10562, 10610), 'openpyxl.xml.functions.SubElement', 'SubElement', (['node', "('{%s}style' % CHART_DRAWING_NS)"], {}), "(node, '{%s}style' % CHART_DRAWING_NS)\n", (10572, 10610), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((10629, 10686), 'openpyxl.xml.functions.SubElement', 'SubElement', (['style', "('{%s}lnRef' % DRAWING_NS)", "{'idx': '2'}"], {}), "(style, '{%s}lnRef' % DRAWING_NS, {'idx': '2'})\n", (10639, 10686), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((10707, 10775), 'openpyxl.xml.functions.SubElement', 'SubElement', (['ln_ref', "('{%s}schemeClr' % DRAWING_NS)", "{'val': 'accent1'}"], {}), "(ln_ref, '{%s}schemeClr' % DRAWING_NS, {'val': 'accent1'})\n", (10717, 10775), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((10783, 10849), 'openpyxl.xml.functions.SubElement', 'SubElement', (['scheme_clr', "('{%s}shade' % DRAWING_NS)", "{'val': '50000'}"], {}), "(scheme_clr, '{%s}shade' % DRAWING_NS, {'val': '50000'})\n", (10793, 10849), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((10869, 10928), 'openpyxl.xml.functions.SubElement', 'SubElement', (['style', "('{%s}fillRef' % DRAWING_NS)", "{'idx': '1'}"], {}), "(style, '{%s}fillRef' % DRAWING_NS, {'idx': '1'})\n", (10879, 10928), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((10936, 11006), 'openpyxl.xml.functions.SubElement', 'SubElement', (['fill_ref', "('{%s}schemeClr' % DRAWING_NS)", "{'val': 'accent1'}"], {}), "(fill_ref, '{%s}schemeClr' % DRAWING_NS, {'val': 'accent1'})\n", (10946, 11006), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((11028, 11089), 'openpyxl.xml.functions.SubElement', 'SubElement', (['style', "('{%s}effectRef' % DRAWING_NS)", "{'idx': '0'}"], {}), "(style, '{%s}effectRef' % DRAWING_NS, {'idx': '0'})\n", (11038, 11089), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((11097, 11169), 'openpyxl.xml.functions.SubElement', 'SubElement', (['effect_ref', "('{%s}schemeClr' % DRAWING_NS)", "{'val': 'accent1'}"], {}), "(effect_ref, '{%s}schemeClr' % DRAWING_NS, {'val': 'accent1'})\n", (11107, 11169), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((11189, 11252), 'openpyxl.xml.functions.SubElement', 'SubElement', (['style', "('{%s}fontRef' % DRAWING_NS)", "{'idx': 'minor'}"], {}), "(style, '{%s}fontRef' % DRAWING_NS, {'idx': 'minor'})\n", (11199, 11252), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((11260, 11326), 'openpyxl.xml.functions.SubElement', 'SubElement', (['font_ref', "('{%s}schemeClr' % DRAWING_NS)", "{'val': 'lt1'}"], {}), "(font_ref, '{%s}schemeClr' % DRAWING_NS, {'val': 'lt1'})\n", (11270, 11326), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((7802, 7858), 'openpyxl.xml.functions.SubElement', 'SubElement', (['root', "('{%s}relSizeAnchor' % CHART_DRAWING_NS)"], {}), "(root, '{%s}relSizeAnchor' % CHART_DRAWING_NS)\n", (7812, 7858), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((7940, 7989), 'openpyxl.xml.functions.SubElement', 'SubElement', (['anchor', "('{%s}from' % CHART_DRAWING_NS)"], {}), "(anchor, '{%s}from' % CHART_DRAWING_NS)\n", (7950, 7989), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((8163, 8210), 'openpyxl.xml.functions.SubElement', 'SubElement', (['anchor', "('{%s}to' % CHART_DRAWING_NS)"], {}), "(anchor, '{%s}to' % CHART_DRAWING_NS)\n", (8173, 8210), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((8375, 8453), 'openpyxl.xml.functions.SubElement', 'SubElement', (['anchor', "('{%s}sp' % CHART_DRAWING_NS)", "{'macro': '', 'textlink': ''}"], {}), "(anchor, '{%s}sp' % CHART_DRAWING_NS, {'macro': '', 'textlink': ''})\n", (8385, 8453), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((8472, 8519), 'openpyxl.xml.functions.SubElement', 'SubElement', (['sp', "('{%s}nvSpPr' % CHART_DRAWING_NS)"], {}), "(sp, '{%s}nvSpPr' % CHART_DRAWING_NS)\n", (8482, 8519), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((8646, 8697), 'openpyxl.xml.functions.SubElement', 'SubElement', (['nvspr', "('{%s}cNvSpPr' % CHART_DRAWING_NS)"], {}), "(nvspr, '{%s}cNvSpPr' % CHART_DRAWING_NS)\n", (8656, 8697), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((8718, 8763), 'openpyxl.xml.functions.SubElement', 'SubElement', (['sp', "('{%s}spPr' % CHART_DRAWING_NS)"], {}), "(sp, '{%s}spPr' % CHART_DRAWING_NS)\n", (8728, 8763), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((8782, 8823), 'openpyxl.xml.functions.SubElement', 'SubElement', (['sppr', "('{%s}xfrm' % DRAWING_NS)"], {}), "(sppr, '{%s}xfrm' % DRAWING_NS)\n", (8792, 8823), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((8869, 8930), 'openpyxl.xml.functions.SubElement', 'SubElement', (['frm', "('{%s}off' % DRAWING_NS)", "{'x': '0', 'y': '0'}"], {}), "(frm, '{%s}off' % DRAWING_NS, {'x': '0', 'y': '0'})\n", (8879, 8930), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((8941, 9004), 'openpyxl.xml.functions.SubElement', 'SubElement', (['frm', "('{%s}ext' % DRAWING_NS)", "{'cx': '0', 'cy': '0'}"], {}), "(frm, '{%s}ext' % DRAWING_NS, {'cx': '0', 'cy': '0'})\n", (8951, 9004), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((9112, 9158), 'openpyxl.xml.functions.SubElement', 'SubElement', (['prstgeom', "('{%s}avLst' % DRAWING_NS)"], {}), "(prstgeom, '{%s}avLst' % DRAWING_NS)\n", (9122, 9158), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((9179, 9225), 'openpyxl.xml.functions.SubElement', 'SubElement', (['sppr', "('{%s}solidFill' % DRAWING_NS)"], {}), "(sppr, '{%s}solidFill' % DRAWING_NS)\n", (9189, 9225), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((9240, 9306), 'openpyxl.xml.functions.SubElement', 'SubElement', (['fill', "('{%s}srgbClr' % DRAWING_NS)", "{'val': shape.color}"], {}), "(fill, '{%s}srgbClr' % DRAWING_NS, {'val': shape.color})\n", (9250, 9306), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((9417, 9465), 'openpyxl.xml.functions.SubElement', 'SubElement', (['border', "('{%s}solidFill' % DRAWING_NS)"], {}), "(border, '{%s}solidFill' % DRAWING_NS)\n", (9427, 9465), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((9478, 9549), 'openpyxl.xml.functions.SubElement', 'SubElement', (['sf', "('{%s}srgbClr' % DRAWING_NS)", "{'val': shape.border_color}"], {}), "(sf, '{%s}srgbClr' % DRAWING_NS, {'val': shape.border_color})\n", (9488, 9549), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((10062, 10097), 'openpyxl.xml.functions.SubElement', 'SubElement', (['p', "('{%s}r' % DRAWING_NS)"], {}), "(p, '{%s}r' % DRAWING_NS)\n", (10072, 10097), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((10116, 10172), 'openpyxl.xml.functions.SubElement', 'SubElement', (['r', "('{%s}rPr' % DRAWING_NS)", "{'lang': 'en-US'}"], {}), "(r, '{%s}rPr' % DRAWING_NS, {'lang': 'en-US'})\n", (10126, 10172), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((10191, 10236), 'openpyxl.xml.functions.SubElement', 'SubElement', (['rpr', "('{%s}solidFill' % DRAWING_NS)"], {}), "(rpr, '{%s}solidFill' % DRAWING_NS)\n", (10201, 10236), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((10249, 10320), 'openpyxl.xml.functions.SubElement', 'SubElement', (['fill', "('{%s}srgbClr' % DRAWING_NS)", "{'val': shape.text_color}"], {}), "(fill, '{%s}srgbClr' % DRAWING_NS, {'val': shape.text_color})\n", (10259, 10320), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((10413, 10476), 'openpyxl.xml.functions.SubElement', 'SubElement', (['p', "('{%s}endParaRPr' % DRAWING_NS)", "{'lang': 'en-US'}"], {}), "(p, '{%s}endParaRPr' % DRAWING_NS, {'lang': 'en-US'})\n", (10423, 10476), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((8002, 8047), 'openpyxl.xml.functions.SubElement', 'SubElement', (['_from', "('{%s}x' % CHART_DRAWING_NS)"], {}), "(_from, '{%s}x' % CHART_DRAWING_NS)\n", (8012, 8047), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((8079, 8124), 'openpyxl.xml.functions.SubElement', 'SubElement', (['_from', "('{%s}y' % CHART_DRAWING_NS)"], {}), "(_from, '{%s}y' % CHART_DRAWING_NS)\n", (8089, 8124), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((8223, 8266), 'openpyxl.xml.functions.SubElement', 'SubElement', (['_to', "('{%s}x' % CHART_DRAWING_NS)"], {}), "(_to, '{%s}x' % CHART_DRAWING_NS)\n", (8233, 8266), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((8296, 8339), 'openpyxl.xml.functions.SubElement', 'SubElement', (['_to', "('{%s}y' % CHART_DRAWING_NS)"], {}), "(_to, '{%s}y' % CHART_DRAWING_NS)\n", (8306, 8339), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n'), ((10333, 10368), 'openpyxl.xml.functions.SubElement', 'SubElement', (['r', "('{%s}t' % DRAWING_NS)"], {}), "(r, '{%s}t' % DRAWING_NS)\n", (10343, 10368), False, 'from openpyxl.xml.functions import Element, SubElement, tostring\n')]