<commit_before>"use strict";

var MOVE_DELTA = 1/100000;
var SNAP_DISTANCE = 1.27;

function StartAddNewShape(drawingObjects, preset)
{
    this.drawingObjects = drawingObjects;
    this.preset = preset;

    this.bStart = false;
    this.bMoved = false;//отошли ли мы от начальной точки

    this.startX = null;
    this.startY = null;

}

StartAddNewShape.prototype =
{
    onMouseDown: function(e, x, y)
    {
        if(this.drawingObjects.handleEventMode === HANDLE_EVENT_MODE_CURSOR)
            return {objectId: "1", bMarker: true};
        this.startX = x;
        this.startY = y;
        this.drawingObjects.arrPreTrackObjects.length = 0;
        this.drawingObjects.arrPreTrackObjects.push(new NewShapeTrack(this.preset, x, y, this.drawingObjects.getTheme(), null, null, null, 0));
        this.bStart = true;
        this.drawingObjects.swapTrackObjects();
    },

    onMouseMove: function(e, x, y)
    {
        if(this.bStart && e.IsLocked)
        {
            if(!this.bMoved && (Math.abs(this.startX - x) > MOVE_DELTA || Math.abs(this.startY - y) > MOVE_DELTA ))
                this.bMoved = true;
            this.drawingObjects.arrTrackObjects[0].track(e, x, y);
            this.drawingObjects.updateOverlay();
        }
    },

    onMouseUp: function(e, x, y)
    {
        if(this.bStart)
        {
            if(this.drawingObjects.drawingObjects.objectLocker)
            {
                this.drawingObjects.drawingObjects.objectLocker.reset();
                this.drawingObjects.drawingObjects.objectLocker.addObjectId(g_oIdCounter.Get_NewId());
            }
            var oThis = this;
            var track =  oThis.drawingObjects.arrTrackObjects[0];
            if(!this.bMoved && this instanceof StartAddNewShape)
            {
                var ext_x, ext_y;
                if(typeof SHAPE_ASPECTS[this.preset] === "number")
                {
                    var _aspect = SHAPE_ASPECTS[this.preset];
                    if(_aspect >= 1)
                    {
                        ext_y = 25.4;
                        ext_x = ext_y*_aspect;
                    }
                    else
                    {
                        ext_x = 25.4;
                        ext_y = ext_x/_aspect;
                    }
                }
                else
                {
                    ext_x = 25.4;
                    ext_y = 25.4;
                }
                this.onMouseMove({IsLocked: true}, this.startX + ext_x, this.startY + ext_y);
            }
            var callback = function(bLock){

                if(bLock)
                {
                    History.Create_NewPoint(historydescription_CommonStatesAddNewShape);
                    var shape = track.getShape(false, oThis.drawingObjects.getDrawingDocument(), oThis.drawingObjects.drawingObjects);

                    if(!(oThis.drawingObjects.drawingObjects && oThis.drawingObjects.drawingObjects.cSld))
                    {
                        if(shape.spPr.xfrm.offX < 0)
                        {
                            shape.spPr.xfrm.setOffX(0);
                        }
                        if(shape.spPr.xfrm.offY < 0)
                        {
                            shape.spPr.xfrm.setOffY(0);
                        }
                    }
                    oThis.drawingObjects.drawingObjects.getWorksheetModel && shape.setWorksheet(oThis.drawingObjects.drawingObjects.getWorksheetModel());
                    if(oThis.drawingObjects.drawingObjects && oThis.drawingObjects.drawingObjects.cSld)
                    {
                        shape.setParent(oThis.drawingObjects.drawingObjects);
                        shape.setRecalculateInfo();
                    }
                    shape.addToDrawingObjects();
                    shape.checkDrawingBaseCoords();
                    oThis.drawingObjects.checkChartTextSelection();
                    oThis.drawingObjects.resetSelection();
                    shape.select(oThis.drawingObjects, 0);
                    if(oThis.preset === "textRect")
                    {
                        oThis.drawingObjects.selection.textSelection = shape;
                    }
                    oThis.drawingObjects.startRecalculate();
                    oThis.drawingObjects.drawingObjects.sendGraphicObjectProps();
                }

            };
            if(this.drawingObjects.drawingObjects.objectLocker)
            {
                this.drawingObjects.drawingObjects.objectLocker.checkObjects(callback);
            }
            else
            {
                callback(true);
            }
        }
        this.drawingObjects.clearTrackObjects();
        this.drawingObjects.updateOverlay();
        if(asc["editor"])
        {
            asc["editor"].asc_endAddShape();
        }
        else if(editor && editor.sync_EndAddShape)
        {
            editor.sync_EndAddShape();
        }
        this.drawingObjects.changeCurrentState(new NullState(this.drawingObjects));
    }
};


function checkEmptyPlaceholderContent(content)
{
    if(!content || content.Parent && content.Parent.parent && (content.Is_Empty() && content.Parent.parent.isPlaceholder && content.Parent.parent.isPlaceholder() || content.Parent.parent.txWarpStruct)  )
        return content;
    return null;
}<commit_msg>Bug 30406 - [TextArt] [Copy&Paste] Текст отображается с дефолтной трансформацией, если находится внутри фигуры<commit_after>"use strict";

var MOVE_DELTA = 1/100000;
var SNAP_DISTANCE = 1.27;

function StartAddNewShape(drawingObjects, preset)
{
    this.drawingObjects = drawingObjects;
    this.preset = preset;

    this.bStart = false;
    this.bMoved = false;//отошли ли мы от начальной точки

    this.startX = null;
    this.startY = null;

}

StartAddNewShape.prototype =
{
    onMouseDown: function(e, x, y)
    {
        if(this.drawingObjects.handleEventMode === HANDLE_EVENT_MODE_CURSOR)
            return {objectId: "1", bMarker: true};
        this.startX = x;
        this.startY = y;
        this.drawingObjects.arrPreTrackObjects.length = 0;
        this.drawingObjects.arrPreTrackObjects.push(new NewShapeTrack(this.preset, x, y, this.drawingObjects.getTheme(), null, null, null, 0));
        this.bStart = true;
        this.drawingObjects.swapTrackObjects();
    },

    onMouseMove: function(e, x, y)
    {
        if(this.bStart && e.IsLocked)
        {
            if(!this.bMoved && (Math.abs(this.startX - x) > MOVE_DELTA || Math.abs(this.startY - y) > MOVE_DELTA ))
                this.bMoved = true;
            this.drawingObjects.arrTrackObjects[0].track(e, x, y);
            this.drawingObjects.updateOverlay();
        }
    },

    onMouseUp: function(e, x, y)
    {
        if(this.bStart)
        {
            if(this.drawingObjects.drawingObjects.objectLocker)
            {
                this.drawingObjects.drawingObjects.objectLocker.reset();
                this.drawingObjects.drawingObjects.objectLocker.addObjectId(g_oIdCounter.Get_NewId());
            }
            var oThis = this;
            var track =  oThis.drawingObjects.arrTrackObjects[0];
            if(!this.bMoved && this instanceof StartAddNewShape)
            {
                var ext_x, ext_y;
                if(typeof SHAPE_ASPECTS[this.preset] === "number")
                {
                    var _aspect = SHAPE_ASPECTS[this.preset];
                    if(_aspect >= 1)
                    {
                        ext_y = 25.4;
                        ext_x = ext_y*_aspect;
                    }
                    else
                    {
                        ext_x = 25.4;
                        ext_y = ext_x/_aspect;
                    }
                }
                else
                {
                    ext_x = 25.4;
                    ext_y = 25.4;
                }
                this.onMouseMove({IsLocked: true}, this.startX + ext_x, this.startY + ext_y);
            }
            var callback = function(bLock){

                if(bLock)
                {
                    History.Create_NewPoint(historydescription_CommonStatesAddNewShape);
                    var shape = track.getShape(false, oThis.drawingObjects.getDrawingDocument(), oThis.drawingObjects.drawingObjects);

                    if(!(oThis.drawingObjects.drawingObjects && oThis.drawingObjects.drawingObjects.cSld))
                    {
                        if(shape.spPr.xfrm.offX < 0)
                        {
                            shape.spPr.xfrm.setOffX(0);
                        }
                        if(shape.spPr.xfrm.offY < 0)
                        {
                            shape.spPr.xfrm.setOffY(0);
                        }
                    }
                    oThis.drawingObjects.drawingObjects.getWorksheetModel && shape.setWorksheet(oThis.drawingObjects.drawingObjects.getWorksheetModel());
                    if(oThis.drawingObjects.drawingObjects && oThis.drawingObjects.drawingObjects.cSld)
                    {
                        shape.setParent(oThis.drawingObjects.drawingObjects);
                        shape.setRecalculateInfo();
                    }
                    shape.addToDrawingObjects();
                    shape.checkDrawingBaseCoords();
                    oThis.drawingObjects.checkChartTextSelection();
                    oThis.drawingObjects.resetSelection();
                    shape.select(oThis.drawingObjects, 0);
                    if(oThis.preset === "textRect")
                    {
                        oThis.drawingObjects.selection.textSelection = shape;
                    }
                    oThis.drawingObjects.startRecalculate();
                    oThis.drawingObjects.drawingObjects.sendGraphicObjectProps();
                }

            };
            if(this.drawingObjects.drawingObjects.objectLocker)
            {
                this.drawingObjects.drawingObjects.objectLocker.checkObjects(callback);
            }
            else
            {
                callback(true);
            }
        }
        this.drawingObjects.clearTrackObjects();
        this.drawingObjects.updateOverlay();
        if(asc["editor"])
        {
            asc["editor"].asc_endAddShape();
        }
        else if(editor && editor.sync_EndAddShape)
        {
            editor.sync_EndAddShape();
        }
        this.drawingObjects.changeCurrentState(new NullState(this.drawingObjects));
    }
};


function checkEmptyPlaceholderContent(content)
{
    if(!content ||
    content.Parent && content.Parent.parent &&
        (content.Is_Empty() && content.Parent.parent.isPlaceholder && content.Parent.parent.isPlaceholder() ||
            content.Parent.parent.txWarpStruct || content.Parent.parent.recalcInfo && content.Parent.parent.recalcInfo.warpGeometry)  )
        return content;
    return null;
}
{'fraction_non_alphanumeric': 0.09898989898989899, 'fraction_numerical': 0.006519742883379247, 'mean_word_length': 1.4922196796338674, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '6241348', 'n_tokens_mistral': 3173, 'n_tokens_neox': 3007, 'n_words': 392}