/// <summary> /// Sets the temporary frame by using subzone preset /// </summary> /// <param name="sub">The sub.</param> /// <param name="startPosition">The start position.</param> /// <returns></returns> public cursorZone setTempFrame(cursorSubzoneFrame sub, textCursorZoneCorner startPosition = textCursorZoneCorner.none) { tempFrame = new cursorZone(this.frame, sub); useTempFrame = true; moveToCorner(startPosition); return(tempFrame); }
public static ExcelVerticalAlignment GetVerticalAlignment(this textCursorZoneCorner aligment) { switch (aligment) { default: case textCursorZoneCorner.Top: case textCursorZoneCorner.UpLeft: case textCursorZoneCorner.UpRight: return(ExcelVerticalAlignment.Top); break; case textCursorZoneCorner.Bottom: case textCursorZoneCorner.DownRight: case textCursorZoneCorner.DownLeft: return(ExcelVerticalAlignment.Bottom); break; case textCursorZoneCorner.Left: case textCursorZoneCorner.Right: case textCursorZoneCorner.center: case textCursorZoneCorner.default_corner: case textCursorZoneCorner.none: return(ExcelVerticalAlignment.Center); break; } }
/// <summary> /// Expands in the specified direction for number of boolean arguments being true /// </summary> /// <param name="direction">The direction.</param> /// <param name="stepCriterias">The step criterias.</param> public Int32 expand(textCursorZoneCorner direction, Int32 stepPerTrue, params Boolean[] stepCriterias) { List <Boolean> stepCriteriaList = stepCriterias.getFlatList <Boolean>(); Int32 step = stepCriteriaList.getCountOf(true) * stepPerTrue; return(expand(direction, step)); }
/// <summary> /// Sets the temporary zone by adjusting /// </summary> /// <param name="rel_width">From current position to <c>rel_width</c>.</param> /// <param name="rel_height">Height of the relative<c>rel_height</c></param> /// <param name="startPosition">The start position.</param> /// <param name="leftRightPadding">The left right padding.</param> /// <param name="topBottomPadding">The top bottom padding.</param> public cursorZone setTempFrame(Int32 rel_width, Int32 rel_height, textCursorZoneCorner startPosition = textCursorZoneCorner.none, Int32 leftRightPadding = 0, Int32 topBottomPadding = 0) { tempFrame = new cursorZone(x + rel_width, y + rel_height, x, y, leftRightPadding, topBottomPadding); useTempFrame = true; moveToCorner(startPosition); return(tempFrame); }
public static textCursorZoneCorner Aligment(this DataColumn dc, textCursorZoneCorner default_description) { if (!dc.ExtendedProperties.ContainsKey(templateFieldDataTable.col_alignment)) { dc.ExtendedProperties.add(templateFieldDataTable.col_alignment, default_description); } return((textCursorZoneCorner)dc.ExtendedProperties[templateFieldDataTable.col_alignment]); }
/// <summary> /// Cancels temporal frame if tempFrame was used /// </summary> /// <param name="startPosition">The start position.</param> public void setToParentFrame(textCursorZoneCorner startPosition = textCursorZoneCorner.none) { if (frame.parent != null) { frame = frame.parent; } moveToCorner(startPosition); }
/// <summary> /// Absolute distance from corner or edge /// </summary> /// <param name="tX"></param> /// <param name="tY"></param> /// <param name="edgeOrCorner"></param> /// <returns></returns> public Int32 getDistanceFromCorner(Int32 tX, Int32 tY, textCursorZoneCorner edgeOrCorner) { switch (edgeOrCorner) { case textCursorZoneCorner.none: case textCursorZoneCorner.default_corner: break; case textCursorZoneCorner.UpLeft: return((TopLeft.y - tY).calcDiagonal(TopLeft.x - tX)); break; case textCursorZoneCorner.UpRight: return((TopLeft.y - tY).calcDiagonal(BottomRight.x - tX)); break; case textCursorZoneCorner.DownLeft: return((BottomRight.y - tY).calcDiagonal(TopLeft.x - tX)); break; case textCursorZoneCorner.DownRight: return((BottomRight.y - tY).calcDiagonal(BottomRight.x - tX)); break; case textCursorZoneCorner.Left: return(Math.Abs(BottomRight.x - tX)); break; case textCursorZoneCorner.Right: return(Math.Abs(TopLeft.x - tX)); break; case textCursorZoneCorner.Top: return(Math.Abs(y - tY)); break; case textCursorZoneCorner.Bottom: return(Math.Abs(BottomRight.y - tY)); break; case textCursorZoneCorner.center: return((yCenter - tY).calcDiagonal(xCenter - tX)); break; default: throw new ArgumentOutOfRangeException(); } return(0); }
/// <summary> /// Determines whether x,y coordinates are near to the specified corner or edge of the area /// </summary> /// <param name="tX">X (horizontal position) to test</param> /// <param name="tY">Y (vertical position) to test </param> /// <param name="edgeOrCorner">The edge or corner to test against</param> /// <param name="nearLimit">Absolute distance considered to be near</param> /// <returns> /// <c>true</c> if [is near to corner] [the specified t x]; otherwise, <c>false</c>. /// </returns> /// <exception cref="System.ArgumentOutOfRangeException"></exception> public Boolean isNearToCorner(Int32 tX, Int32 tY, textCursorZoneCorner edgeOrCorner, Int32 nearLimit = 2) { switch (edgeOrCorner) { case textCursorZoneCorner.none: case textCursorZoneCorner.default_corner: break; case textCursorZoneCorner.UpLeft: return((Math.Abs(TopLeft.y - tY) <= nearLimit) && (Math.Abs(TopLeft.x - tX) <= nearLimit)); break; case textCursorZoneCorner.UpRight: return((Math.Abs(TopLeft.y - tY) <= nearLimit) && (Math.Abs(BottomRight.x - tX) <= nearLimit)); break; case textCursorZoneCorner.DownLeft: return((Math.Abs(BottomRight.y - tY) <= nearLimit) && (Math.Abs(TopLeft.x - tX) <= nearLimit)); break; case textCursorZoneCorner.DownRight: return((Math.Abs(BottomRight.y - tY) <= nearLimit) && (Math.Abs(BottomRight.x - tX) <= nearLimit)); break; case textCursorZoneCorner.Left: return(Math.Abs(BottomRight.x - tX) <= nearLimit); break; case textCursorZoneCorner.Right: return(Math.Abs(TopLeft.x - tX) <= nearLimit); break; case textCursorZoneCorner.Top: return(Math.Abs(y - tY) <= nearLimit); break; case textCursorZoneCorner.Bottom: return(Math.Abs(BottomRight.y - tY) <= nearLimit); break; case textCursorZoneCorner.center: return((Math.Abs(yCenter - tY) <= nearLimit) && (Math.Abs(xCenter - tX) <= nearLimit)); break; default: throw new ArgumentOutOfRangeException(); } return(true); }
/// <summary> /// Expands the specified direction. /// </summary> /// <param name="direction">The direction of expansion</param> /// <param name="stepCriteria">If <c>true</c> it will expand one step</param> /// <returns>Size of expansion</returns> public Int32 expand(textCursorZoneCorner direction, Boolean stepCriteria) { if (!stepCriteria) { return(0); } return(expand(direction, 1)); }
/// <summary> /// Prebacuje kursor u datu zonu /// </summary> /// <param name="__zone">The zone.</param> /// <param name="__corner">The corner.</param> public void switchToZone(textCursorZone __zone, textCursorZoneCorner __corner = textCursorZoneCorner.default_corner) { if (__corner == textCursorZoneCorner.default_corner) { __corner = default_direction; } currentZone = __zone; moveToCorner(__corner); }
/// <summary> /// Cancels temporal frame if tempFrame was used /// </summary> /// <param name="startPosition">The start position.</param> public void backToMainFrame(textCursorZoneCorner startPosition = textCursorZoneCorner.none, Boolean exceptionIfWasInMain = false) { if ((!isTempFrameActive) && exceptionIfWasInMain) { throw new NotSupportedException(nameof(backToMainFrame) + " backToMainZone called but cursor is already in the main frame!"); } tempFrame = null; useTempFrame = false; moveToCorner(startPosition); }
public cursorZone setToSubFrame(cursorZoneRole role, Int32 index = 0, textCursorZoneCorner __corner = textCursorZoneCorner.default_corner) { cursorZone subframe = frame.subzones[role, index]; if (subframe != null) { tempFrame = subframe; } return(subframe); }
/// <summary> /// Selects the zone area in. /// </summary> /// <param name="direction">The direction.</param> /// <param name="steps">The steps.</param> /// <returns></returns> public selectRangeArea selectZoneAreaIn(textCursorZoneCorner direction, Int32 steps = 1) { Int32 __x = x; Int32 __y = y; for (int i = 0; i < steps; i++) { moveInDirection(direction, i); } selectRangeArea output = new selectRangeArea(__x, __y, x, y); moveTo(__x, __y); return(output); }
/// <summary> /// Vraca rastojanje izmedju trenutne pozicije kursora i datog kraja/coska /// </summary> /// <param name="__corner"></param> /// <returns></returns> public selectRange selectToCorner(textCursorZoneCorner __corner = textCursorZoneCorner.default_corner) { Int32 __x = x; Int32 __y = y; moveToCorner(__corner); Int32 _dX = x - __x; Int32 _dY = y - __y; selectRange res = new selectRange(_dX, _dY); x = __x; y = __y; return(res); }
public static ExcelHorizontalAlignment GetHorizontalAlignment(this textCursorZoneCorner aligment) { switch (aligment) { default: case textCursorZoneCorner.Top: case textCursorZoneCorner.Bottom: case textCursorZoneCorner.center: case textCursorZoneCorner.default_corner: case textCursorZoneCorner.none: return(ExcelHorizontalAlignment.Center); break; case textCursorZoneCorner.UpRight: case textCursorZoneCorner.DownRight: case textCursorZoneCorner.Right: return(ExcelHorizontalAlignment.Right); break; case textCursorZoneCorner.DownLeft: case textCursorZoneCorner.Left: case textCursorZoneCorner.UpLeft: return(ExcelHorizontalAlignment.Left); break; } /* * * if (dc.GetValueType().isNumber()) * { * ws.Cells[ex_row.Row, dc.Ordinal + 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Right; * } * else if (dc.GetValueType().IsEnum) * { * ws.Cells[ex_row.Row, dc.Ordinal + 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; * } * else if (dc.GetValueType().isBoolean()) * { * ws.Cells[ex_row.Row, dc.Ordinal + 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; * } * else * { * ws.Cells[ex_row.Row, dc.Ordinal + 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Left; * }*/ }
public static textCursorZoneCorner GetAligment(this DataColumn dc) { textCursorZoneCorner output = textCursorZoneCorner.none; if (dc.ExtendedProperties.ContainsKey(templateFieldDataTable.col_alignment)) { output = (textCursorZoneCorner)dc.ExtendedProperties[templateFieldDataTable.col_alignment]; } if (output == textCursorZoneCorner.none) { output = GetAligmentByValueType(dc); } return(output); }
/// <summary> /// Transforms direction to vector /// </summary> /// <param name="direction">The direction.</param> /// <param name="force">The force.</param> /// <param name="vector">The vector.</param> /// <returns></returns> public static selectRange toVector(this textCursorZoneCorner direction, Int32 force = 1, selectRange vector = null) { if (vector == null) { vector = new selectRange(); } switch (direction) { case textCursorZoneCorner.Left: vector.x = -force; break; case textCursorZoneCorner.Right: vector.x = force; break; case textCursorZoneCorner.Top: vector.y = -force; break; case textCursorZoneCorner.Bottom: vector.y = force; break; case textCursorZoneCorner.UpLeft: vector.y = -force; vector.x = -force; break; case textCursorZoneCorner.UpRight: vector.y = -force; vector.x = force; break; case textCursorZoneCorner.DownLeft: vector.y = force; vector.x = -force; break; case textCursorZoneCorner.DownRight: vector.y = force; vector.x = force; break; } return(vector); }
/// <summary> /// Pomera kursor u dati ugao /// </summary> /// <param name="__corner">The corner.</param> public void moveInDirection(textCursorZoneCorner __corner = textCursorZoneCorner.default_corner, Int32 step = 1) { if (__corner == textCursorZoneCorner.default_corner) { __corner = default_direction; } switch (__corner) { case textCursorZoneCorner.Left: prev(step); break; case textCursorZoneCorner.Right: next(step); break; case textCursorZoneCorner.Top: prevLine(step); break; case textCursorZoneCorner.Bottom: nextLine(step); break; case textCursorZoneCorner.UpLeft: moveInDirection(textCursorZoneCorner.Top, step); moveInDirection(textCursorZoneCorner.Left, step); break; case textCursorZoneCorner.UpRight: moveInDirection(textCursorZoneCorner.Top, step); moveInDirection(textCursorZoneCorner.Right, step); break; case textCursorZoneCorner.DownLeft: moveInDirection(textCursorZoneCorner.Bottom, step); moveInDirection(textCursorZoneCorner.Left, step); break; case textCursorZoneCorner.DownRight: moveInDirection(textCursorZoneCorner.Bottom, step); moveInDirection(textCursorZoneCorner.Right, step); break; } checkPositions(); }
/// <summary> /// Sets margin at current position using direction parameter /// </summary> /// <param name="direction">What border of margin to set at this position</param> public void setMarginHere(textCursorZoneCorner direction = textCursorZoneCorner.default_corner) { if (direction == textCursorZoneCorner.default_corner) { direction = default_direction; } switch (direction) { case textCursorZoneCorner.Left: frame.margin.left = x; break; case textCursorZoneCorner.Right: frame.margin.right = frame.outerRightPosition - x; break; case textCursorZoneCorner.Top: frame.margin.top = y; break; case textCursorZoneCorner.Bottom: frame.margin.top = frame.outerBottomPosition - y; break; case textCursorZoneCorner.UpLeft: setMarginHere(textCursorZoneCorner.Top); setMarginHere(textCursorZoneCorner.Left); break; case textCursorZoneCorner.UpRight: setMarginHere(textCursorZoneCorner.Top); setMarginHere(textCursorZoneCorner.Right); break; case textCursorZoneCorner.DownLeft: setMarginHere(textCursorZoneCorner.Bottom); setMarginHere(textCursorZoneCorner.Left); break; case textCursorZoneCorner.DownRight: setMarginHere(textCursorZoneCorner.Bottom); setMarginHere(textCursorZoneCorner.Right); break; } }
/// <summary> /// Pomera kursor u dati ugao /// </summary> /// <param name="__corner">The corner.</param> public void moveToCorner(textCursorZoneCorner __corner = textCursorZoneCorner.default_corner) { if (__corner == textCursorZoneCorner.default_corner) { __corner = default_direction; } switch (__corner) { case textCursorZoneCorner.Left: x = 0; break; case textCursorZoneCorner.Right: x = frame.width; break; case textCursorZoneCorner.Top: y = 0; break; case textCursorZoneCorner.Bottom: y = frame.height; break; case textCursorZoneCorner.UpLeft: y = 0; x = 0; break; case textCursorZoneCorner.UpRight: y = 0; x = frame.width; break; case textCursorZoneCorner.DownLeft: y = frame.height; x = 0; break; case textCursorZoneCorner.DownRight: y = frame.height; x = frame.width; break; } checkPositions(); }
/// <summary> /// Vraca rastojanje izmedju trenutne pozicije kursora i datog kraja/coska /// </summary> /// <param name="__corner">The corner.</param> /// <returns></returns> public selectRangeArea selectAreaToCorner(textCursorZoneCorner __corner = textCursorZoneCorner.default_corner) { if (__corner == textCursorZoneCorner.default_corner) { __corner = default_direction; } Int32 __x = x; Int32 __y = y; moveToCorner(__corner); Int32 _dX = x - __x; Int32 _dY = y - __y; selectRangeArea res = new selectRangeArea(__x, __y, _dX, _dY); x = __x; y = __y; return(res); }
/// <summary> /// Pomera kursor u dati ugao /// </summary> /// <param name="__corner"></param> public void moveToCorner(textCursorZoneCorner __corner = textCursorZoneCorner.default_corner) { switch (__corner) { case textCursorZoneCorner.Left: x = 0; break; case textCursorZoneCorner.Right: x = target.width; break; case textCursorZoneCorner.Top: y = 0; break; case textCursorZoneCorner.Bottom: y = target.height; break; case textCursorZoneCorner.UpLeft: y = 0; x = 0; break; case textCursorZoneCorner.UpRight: y = 0; x = target.width; break; case textCursorZoneCorner.DownLeft: y = target.height; x = 0; break; case textCursorZoneCorner.DownRight: y = target.height; x = target.width; break; } checkPositions(); }
public static textCursorZoneCorner GetAligmentByValueType(this DataColumn dc) { Type dataType = dc.DataType; if ((dataType == typeof(Object)) || (dataType == typeof(String))) { dataType = dc.GetValueType(); } //dc.GetValueType(); textCursorZoneCorner output = textCursorZoneCorner.none; if (dataType.isNumber()) { output = textCursorZoneCorner.Right; // ws.Cells[ex_row.Row, dc.Ordinal + 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Right; } else if (dataType.IsEnum) { output = textCursorZoneCorner.Left; //ws.Cells[ex_row.Row, dc.Ordinal + 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; } else if (dataType.isBoolean()) { output = textCursorZoneCorner.Right; // ws.Cells[ex_row.Row, dc.Ordinal + 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; } else { output = textCursorZoneCorner.Left; // ws.Cells[ex_row.Row, dc.Ordinal + 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Left; } return(output); }
public abstract void ApplyColumn(Int32 column, Int32 width, textCursorZoneCorner align, Boolean doAutofit = false);
public abstract void ApplyRow(Int32 row, Int32 height, textCursorZoneCorner align, Boolean doAutofit = false);
public static DataColumn SetAligment(this DataColumn dc, textCursorZoneCorner description) { dc.ExtendedProperties.add(templateFieldDataTable.col_alignment, description); return(dc); }
/// <summary> /// Setting dsa_cursorCorner argument /// </summary> /// <param name="cursorCorner">Value for dsa_cursorCorner</param> /// <returns>Instruction</returns> public docScriptInstruction arg(textCursorZoneCorner cursorCorner) { this.add(docScriptArguments.dsa_cursorCorner, cursorCorner); return(this); }
/// <summary> /// Prebacuje kursor u datu zonu /// </summary> /// <param name="__zone"></param> /// <param name="__corner"></param> public void switchToZone(textCursorZone __zone, textCursorZoneCorner __corner = textCursorZoneCorner.default_corner) { currentZone = __zone; moveToCorner(__corner); }
/// <summary> /// Rotates the element for specified angle. /// </summary> /// <param name="element">The element.</param> /// <param name="angle">The angle.</param> /// <param name="pivot">The pivot.</param> /// <returns></returns> public static svgGraphicElementBase rotate(this svgGraphicElementBase element, Int32 angle, textCursorZoneCorner pivot) { var p = element.point.GetCornerPoint(pivot); return(element.rotate(angle, p.x, p.y)); }
/// <summary> /// Sets the default direction. /// </summary> /// <param name="newDefault">The new default.</param> public void setDefaultDirection(textCursorZoneCorner newDefault) { default_direction = newDefault; }