/// <summary> /// Resolve <see cref="styleShotTargetEnum"/> into <see cref="imbSCI.Core.reporting.zone.selectRangeArea"/> /// </summary> /// <param name="target">The target - </param> /// <returns>Area to apply style with</returns> protected selectRangeArea resolveAreaForStyleShot(styleShotTargetEnum target) { selectRangeArea output = null; if (target == styleShotTargetEnum.unknown) { target = styleShotTargetEnum.thisAppend; } switch (target) { case styleShotTargetEnum.none: output = null; break; case styleShotTargetEnum.lastAppend: output = metaContentRanges.getLastAny(); break; case styleShotTargetEnum.thisAppend: output = c.pencilAbsolute; break; default: case styleShotTargetEnum.thisScope: output = metaContentRanges[scope.path]; break; } if (output == null) { error("__result for resolveAreaForStyleShot(styleShotTargetEnum target=" + target.ToString() + ") "); } return(output); }
//public void setupForList(IEnumerable<Object> items, String title, String footer, Boolean loadPreset = false) //{ //} /// <summary> /// Setups for variables. /// </summary> /// <param name="data">The data.</param> /// <param name="cur">The current.</param> /// <param name="loadPreset">if set to <c>true</c> [load preset].</param> public void setupForVariables(PropertyCollection data, cursor cur, String title, String footer, String between, Boolean loadPreset = false) { if (loadPreset) { loadPresetForPairs(); } _area = new selectRangeArea(cur.x, cur.y, cur.x + 2, data.Keys.Count + cur.y); if (doBetweenPairs) { area.expand(textCursorZoneCorner.Right, 1); } _leftZone = 1; if (!title.isNullOrEmpty()) { _headZone = area.expand(textCursorZoneCorner.Top, doInsertHeader); } if (!footer.isNullOrEmpty()) { _footZone = area.expand(textCursorZoneCorner.Bottom, doInsertFooter); } //_footZoneExtension = area.expand(textCursorZoneCorner.Bottom, doInsertColumnFooter); if (!between.isNullOrEmpty()) { _leftZone = area.expand(textCursorZoneCorner.Left, 1); } _leftZone += area.expand(textCursorZoneCorner.Left, doInsertRowId); _rightZone = area.expand(textCursorZoneCorner.Right, doInsertMinorMajor); }
public static selectRangeArea takeColumnGroup(this selectRangeArea area, Int32 y, Int32 yT, Int32 leftZone, Int32 rightZone, printHorizontal horizontal) { selectRangeArea output = new selectRangeArea(area.x, y, area.BottomRight.x, y + yT); switch (horizontal) { case printHorizontal.left: output = new selectRangeArea(area.x, y, area.x + leftZone, y + yT); break; case printHorizontal.middle: output = new selectRangeArea(area.x + leftZone, y, area.BottomRight.x - rightZone, y + yT); break; case printHorizontal.right: output = new selectRangeArea(area.BottomRight.x - rightZone, y, area.BottomRight.x, y + yT); break; case printHorizontal.hide: break; } // output = area.getCrossection(output); return(output); }
public areaStyleInstruction Add(IStyleInstruction shot, selectRangeArea area) { areaStyleInstruction tmp = new areaStyleInstruction(shot, area, false); tmp.shots.AddMultiple(tmp as IStyleInstruction); return(tmp); }
#pragma warning disable CS1574 // XML comment has cref attribute 'PropertyCollectionDictionary' that could not be resolved /// <summary> /// Resolves target into <see cref="imbSCI.Core.reporting.zone.selectRangeArea"/> where <c>target</c> can be: <see cref="styleShotTargetEnum"/>, <see cref="imbSCI.Core.reporting.zone.selectRangeArea"/> or string path for <see cref="imbSCI.Data.collection.PropertyCollectionDictionary"/> /// </summary> /// <param name="target">The target.</param> /// <returns>Area to apply style to</returns> /// <seealso cref="imbSCI.Core.reporting.zone.selectRangeAreaDictionary"/> /// <seealso cref="imbSCI.Core.reporting.zone.selectRangeArea"/> /// <seealso cref="imbSCI.Core.reporting.style.shot.IStyleInstruction"/> /// <seealso cref="imbSCI.Core.reporting.style.areaStyleInstruction"/> protected selectRangeArea resolveAreaForStyleShot(object target) #pragma warning restore CS1574 // XML comment has cref attribute 'PropertyCollectionDictionary' that could not be resolved { selectRangeArea output = null; if (target is styleShotTargetEnum) { output = resolveAreaForStyleShot((styleShotTargetEnum)target); } else if (target is selectRangeArea) { output = target as selectRangeArea; } else if (target is string) { output = metaContentRanges[scope.path]; } else { output = null; } if (output == null) { error("__result for resolveAreaForStyleShot(Object target=" + target.ToString() + ") "); } return(output); }
public static selectRangeArea takeRowSlice(this selectRangeArea area, Int32 yStart, Int32 yThickness = 1) { selectRangeArea output = new selectRangeArea(area.x, yStart, area.BottomRight.x, yStart + yThickness); //output = area.getCrossection(output); return(output); }
/// <summary> /// Sets the view box. /// </summary> /// <param name="box">The box.</param> public void SetViewBox(selectRangeArea box = null) { if (box == null) { box = point; } viewbox = box; }
/// <summary> /// Setups for section. /// </summary> /// <param name="_theme">The theme.</param> /// <param name="area">The area.</param> /// <param name="loadPreset">if set to <c>true</c> [load preset].</param> public void setupForSection(styleTheme _theme, selectRangeArea area, Boolean loadPreset = false) { // _area = new selectRangeArea(cur.x, cur.y, cur.x + 1, data.Keys.Count + cur.y); if (loadPreset) { loadPresetForSection(); } _headZone = area.expand(textCursorZoneCorner.Top, doInsertHeader); _leftZone = area.expand(textCursorZoneCorner.Left, doInsertRowId); _footZone = area.expand(textCursorZoneCorner.Bottom, doInsertFooter); }
public static void resizeByVector(this selectRangeArea position, selectRange vector, Boolean isRelative = false) { if (!isRelative) { position.resize(vector.x, vector.y); } else { position.resize(position.width + vector.x, position.height + vector.y); } }
/// <summary> /// Clears the zone and sets cursor at innerHeight position -- and returns cursor position before the call /// </summary> /// <param name="zone">The zone.</param> /// <returns></returns> public static selectRange ClearZoneAndSet(this cursorZone zone) { selectRange output = new selectRange(Console.CursorLeft, Console.CursorTop); selectRangeArea range = zone.selectRangeArea(textCursorZone.innerBoxedZone); Console.CursorLeft = zone.x; Console.CursorTop = zone.y; range.PrintRange(" "); return(output); }
public static void moveByVector(this selectRangeArea position, selectRange vector, Boolean isRelative = false) { if (!isRelative) { position.x = vector.x; position.y = vector.y; } else { position.x += vector.x; position.y += vector.y; } }
/// <summary> /// Gets the Escel range from worksheet. /// </summary> /// <param name="worksheet">The worksheet.</param> /// <param name="area">The area.</param> /// <returns></returns> public static ExcelRange getExcelRange(this selectRangeArea area, ExcelWorksheet worksheet) { area = area.normalizeRange(); ExcelRange range = null; try { range = worksheet.Cells[area.TopLeft.y + 1, area.TopLeft.x + 1, area.BottomRight.y + 1, area.BottomRight.x + 1]; } catch (Exception ex) { throw ex; } return(range); }
public void setupForList(IEnumerable <Object> items, cursor cur, String title, String footer, Boolean loadPreset = false) { _area = new selectRangeArea(cur.x, cur.y, cur.x + 1, items.count() + cur.y); if (loadPreset) { loadPresetForSourceLines(); } if (!title.isNullOrEmpty()) { _headZone = area.expand(textCursorZoneCorner.Top, doInsertHeader); } _leftZone = area.expand(textCursorZoneCorner.Left, doInsertRowId); if (!footer.isNullOrEmpty()) { _footZone = area.expand(textCursorZoneCorner.Bottom, doInsertFooter); } }
public static selectRangeArea normalizeRange(this selectRangeArea target) { String last = target.ToString(); Int32 sX = Math.Min(target.TopLeft.x, target.BottomRight.x); Int32 sY = Math.Min(target.TopLeft.y, target.BottomRight.y); Int32 eX = Math.Max(target.TopLeft.x, target.BottomRight.x); Int32 eY = Math.Max(target.TopLeft.y, target.BottomRight.y); var output = new selectRangeArea(sX, sY, eX, eY); String now = output.ToString(); if (last != now) { } return(output); }
/// <summary> /// Setups for DataTable /// </summary> /// <param name="table">The table.</param> /// <param name="cur">The current.</param> /// <param name="loadPreset">if set to <c>true</c> [load preset].</param> public void setupForTable(DataTable table, cursor cur, Boolean loadPreset = false) { if (loadPreset) { loadPresetForTable(); } _area = new selectRangeArea(cur.x, cur.y, table.Columns.Count + cur.x, table.Rows.Count + cur.y); _headZoneExtension = area.expand(textCursorZoneCorner.Top, doInsertColumnHeading); _headZone = area.expand(textCursorZoneCorner.Top, doInsertHeader); _footZone = area.expand(textCursorZoneCorner.Bottom, doInsertFooter); _footZoneExtension = area.expand(textCursorZoneCorner.Bottom, doInsertColumnFooter); _leftZone = area.expand(textCursorZoneCorner.Left, doInsertRowId); _rightZone = area.expand(textCursorZoneCorner.Right, doInsertMinorMajor); _area = area; }
public abstract void ApplyColor(String hexColorCode, selectRangeArea area = null, Boolean toForeground = false);
public abstract void ApplyStyle(IStyleInstruction shot, selectRangeArea areaToApply, params Object[] resources);
/// <summary> /// Runs the style instruction. /// </summary> /// <param name="ins">The ins.</param> /// <returns></returns> /// <remarks>This is for mutliple execution</remarks> /// <exception cref="System.NotImplementedException">No implementation for: " + ins.type.ToString()</exception> protected appendType runStyleInstruction(docScriptInstruction ins) { //if (!hasDocRender) //{ // return ins.type; //} switch (ins.type) { case appendType.s_settings: if (ins.containsKey(d.dsa_background)) { string bgColor = ins.getProperString(Color.White.ColorToHex(), d.dsa_background); string fgColor = ins.getProperString(Color.Black.ColorToHex(), d.dsa_forecolor); docRender.ApplyColor(bgColor, null, false); docRender.ApplyColor(fgColor, null, true); } else if (ins.containsKey(d.dsa_innerAppend)) { appendType ap_type = ins.getProperEnum <appendType>(appendType.regular, d.dsa_innerAppend); appendRole ap_role = ins.getProperEnum <appendRole>(appendRole.paragraph, d.dsa_styleTarget); styleApplicationFlag ap_flag = ins.getProperEnum <styleApplicationFlag>(styleApplicationFlag.allShots, d.dsa_stylerSettings); styleAutoShotSet _shot = new styleAutoShotSet(ap_flag, ap_type, ap_role); List <IStyleInstruction> shots = _shot.resolve(theme); foreach (IStyleInstruction sh in shots) { docRender.ApplyStyle(sh, render.c.getPencil(pencilType.point, 1)); } } else if (ins.containsKey(d.dsa_variationRole)) { aceColorPalette palette = ins.getProperObject <aceColorPalette>(d.dsa_stylerSettings, null); int var = ins.getProperInt32(0, d.dsa_variationRole); acePaletteShotResEnum res = ins.getProperEnum <acePaletteShotResEnum>(acePaletteShotResEnum.background, d.dsa_styleTarget); Color col = palette.bgColors[var]; switch (res) { case acePaletteShotResEnum.foreground: col = palette.fgColors[var]; break; case acePaletteShotResEnum.background: col = palette.bgColors[var]; break; case acePaletteShotResEnum.border: col = palette.tpColors[var]; break; default: throw new ArgumentOutOfRangeException(); } docRender.ApplyColor(col.ColorToHex()); render.c.enter(); } break; case appendType.s_width: int key = ins.getProperInt32(0, d.dsa_key); int val = ins.getProperInt32(0, d.dsa_value); bool isHorizontal = ins.isHorizontal; var corner = ins.getProperEnum <textCursorZoneCorner>(textCursorZoneCorner.none, d.dsa_cursorCorner); bool isAutofit = (bool)ins.get(d.dsa_autostyling, false); if (isHorizontal) { docRender.ApplyColumn(key, val, corner, isAutofit); } else { docRender.ApplyRow(key, val, corner, isAutofit); } break; case appendType.s_variation: throw new NotImplementedException("No implementation for: " + ins.type.ToString()); break; case appendType.s_style: selectRangeArea area = resolveAreaForStyleShot(ins[d.dsa_styleTarget]); //.get(d.dsa_styleTarget)); if (ins.containsAllOfKeys(d.dsa_autostyling, d.dsa_styleTarget)) { styleApplicationFlag flag = ins.getProperEnum <styleApplicationFlag>(styleApplicationFlag.none, d.dsa_autostyling); styleAutoShotSet shot = new styleAutoShotSet(flag); styleStack.Add(shot, area); } else if (ins.containsAllOfKeys(d.dsa_stylerSettings, d.dsa_styleTarget)) { IStyleInstruction shot = ins[d.dsa_stylerSettings] as IStyleInstruction; if (shot == null) { throw new ArgumentNullException("dsa_stylerSettings", "docScript.s_style(null) - no IStyleInstruction for this instruction"); } else { styleStack.Add(shot, area); } } else { } break; case appendType.s_zone: if (ins.containsAnyOfTypes(typeof(textCursorZone))) { render.c.switchToZone(ins.getProperEnum <textCursorZone>(textCursorZone.unknownZone), ins.getProperEnum <textCursorZoneCorner>(textCursorZoneCorner.default_corner)); } else if (ins.containsAnyOfTypes(typeof(cursorSubzoneFrame))) { // prosledjena mu je zona render.c.setTempFrame(ins.getProperEnum <cursorSubzoneFrame>(cursorSubzoneFrame.fullFrame), ins.getProperEnum <textCursorZoneCorner>(textCursorZoneCorner.default_corner)); } else if (ins.containsAnyOfTypes(typeof(cursorZoneRole))) { cursorZoneRole zr = ins.getProperEnum <cursorZoneRole>(cursorZoneRole.master); int szi = ins.getProperInt32(0, docScriptArguments.dsa_value, docScriptArguments.dsa_level, docScriptArguments.dsa_priority); render.c.setToSubFrame(zr, szi); } else { throw new ArgumentNullException(ins.type.ToString(), "Minimum applicable docScriptArguments are missing - can't execute instruction like this"); } break; case appendType.s_alternate: theme.styler.isDisabled = false; break; case appendType.s_normal: theme.styler.isDisabled = true; break; case appendType.s_palette: acePaletteRole newRole = (acePaletteRole)ins.getProperField(d.dsa_paletteRole); if (ins.containsAnyOfKeys(d.dsa_dataTable, d.dsa_dataPairs, d.dsa_zoneFrame, d.dsa_variationRole)) { theme.styler.layoutPaletteRole = newRole; } else { theme.styler.mainPaletteRole = newRole; } break; default: //executionError(String.Format("Instruction ({0}) not supported by runStyleInstruction() method", ins.type.ToString()), ins); //executionError(String.Format("Instruction ({0}) not supported by runSpecialInstruction() method", ins.type.ToString()), ins); return(ins.type); break; } return(appendType.none); }
/// <summary> /// Gets area for style application with merge on /// </summary> /// <param name="role">The role.</param> /// <param name="x">The x.</param> /// <param name="y">The y.</param> /// <returns></returns> public selectRangeArea getAreaOfRole(appendRole role, Int32 x, Int32 y, Boolean completeArea = false) { selectRangeArea output = new selectRangeArea(x, y, ST, ST); if (completeArea) { switch (role) { case appendRole.sectionHead: role = appendRole.mergedHead; break; case appendRole.sectionContent: role = appendRole.mergedContent; break; case appendRole.sectionFoot: role = appendRole.mergedFoot; break; case appendRole.tableColumnHead: output.reset(area.x, area.TopLeft.y + headZone, area.width, area.TopLeft.y + headZone + headZone); return(output); break; case appendRole.tableColumnFoot: output.reset(area.x, area.BottomRight.y - footZone - footZoneExtension, area.width, area.BottomRight.y - footZone); return(output); break; case appendRole.tableCellValue: case appendRole.tableCellAnnotation: case appendRole.tableCellNovalue: case appendRole.tableBetween: role = appendRole.mergedContent; break; } } switch (role) { case appendRole.none: break; case appendRole.i_container: return(area); break; case appendRole.mergedHead: output.reset(area.TopLeft.x, area.TopLeft.y, area.width, headZone); break; case appendRole.mergedContent: output.reset(area.TopLeft.x + leftZone, area.BottomRight.y + headZone, area.width - leftZone - rightZone, area.height - footZone - headZone - headZoneExtension - footZoneExtension); break; case appendRole.mergedFoot: output.reset(area.TopLeft.x, area.BottomRight.y - footZone, area.width, footZone); break; case appendRole.tableHead: output.reset(area.TopLeft.x, area.TopLeft.y, area.width, headZone); break; case appendRole.tableColumnHead: output.reset(x, area.TopLeft.y + headZone, ST, area.TopLeft.y + headZone + headZone); break; case appendRole.tableColumnFoot: output.reset(x, area.BottomRight.y - footZone - footZoneExtension, ST, area.BottomRight.y - footZone); break; case appendRole.tableCellValue: case appendRole.tableCellAnnotation: case appendRole.tableCellNovalue: case appendRole.tableBetween: output.reset(x, y, ST, ST); break; case appendRole.tableFoot: output.reset(area.TopLeft.x, area.BottomRight.y - footZone, area.width, footZone); break; case appendRole.sectionHead: output.reset(x, area.TopLeft.y, ST, headZone); break; case appendRole.sectionContent: output.reset(x, y, ST, ST); break; case appendRole.sectionFoot: output.reset(x, area.BottomRight.y, ST, footZone); break; default: output.reset(x, y, ST, ST); break; //throw new ArgumentOutOfRangeException(); } return(output); }
public static void InsertArea(this ExcelWorksheet worksheet, cursor cur, selectRangeArea area) { worksheet.InsertColumn(cur.x + 1, area.width); worksheet.InsertRow(cur.y + 1, area.height); }
/// <summary> /// Initializes a new instance of the <see cref="areaStyleInstruction"/> class. /// </summary> /// <param name="styleShots">The style shots.</param> /// <param name="area">The area.</param> /// <param name="__doAllowUnclosed">if set to <c>true</c> [do allow unclosed].</param> public areaStyleInstruction(IStyleInstruction styleShots, selectRangeArea area, Boolean __doAllowUnclosed = false) { Add(styleShots); Add(area); doAllowUnclosed = __doAllowUnclosed; }