public styleTextShot getShotSet(appendRole role, appendType type = appendType.none)
        {
            String key = styleTextShot.getCodeName(role, type, theme);

            if (!shots.ContainsKey(key))
            {
                styleTextShot tmp = new styleTextShot(role, type, theme);
                shots.Add(key, tmp);
            }
            return(shots[key]);
        }
Пример #2
0
        //public selectRangeArea getRowArea(Int32 y)
        //{
        //    cursorVariatorState currentState = state(area.x, y);
        //    appendRole role = getAppendRole(currentState);

        //    return output;
        //}

#pragma warning disable CS1574 // XML comment has cref attribute 'appendType' that could not be resolved
        /// <summary>
        /// Provides complete <see cref="styleShotSet"/> according to x,y coordinates and desired <see cref="aceCommonTypes.enums.appendType"/>.
        /// </summary>
        /// <param name="x">X (horizontal) position relative to <c>selectRangeArea</c> 0,0 point.</param>
        /// <param name="y">Y (vertical) position relative to <c>selectRangeArea</c> 0,0 point.</param>
        /// <param name="type">If <c>appendType.none</c> it will automatically find the best match</param>
        /// <returns></returns>
        public styleShotSet getStyleShot(Int32 x, Int32 y, appendType type = appendType.none)
#pragma warning restore CS1574 // XML comment has cref attribute 'appendType' that could not be resolved
        {
            cursorVariatorState currentState = state(x, y);

            appendRole role = getAppendRole(currentState);

            if (type == appendType.none)
            {
                throw new NotSupportedException("appendType is set to none!");
                //type = role.convertRoleToType();
            }

            acePaletteRole colorToUse = mainPaletteRole;

            if (currentState.useLayoutPalette)
            {
                colorToUse = layoutPaletteRole;
            }

            styleShotSet output = new styleShotSet(role, type, (acePaletteVariationRole)currentState.useColorIndex, colorToUse, currentState.useInvertedForeground, theme);

            return(output);
        }
        public static acePaletteVariationRole convertRoleToVariationRole(this appendRole role)
        {
            //appendType type = appendType.heading;

            //acePaletteVariationRole varRole = acePaletteVariationRole.normal;

            acePaletteVariationRole colorRole = acePaletteVariationRole.normal;

            switch (role)
            {
            case appendRole.none:
                break;

            case appendRole.mergedHead:

                colorRole = acePaletteVariationRole.header;
                break;

            case appendRole.mergedContent:

                colorRole = acePaletteVariationRole.normal;
                break;

            case appendRole.mergedFoot:

                colorRole = acePaletteVariationRole.heading;
                break;

            case appendRole.sectionHead:

                colorRole = acePaletteVariationRole.header;
                break;

            case appendRole.sectionContent:

                colorRole = acePaletteVariationRole.normal;

                break;

            case appendRole.sectionFoot:

                colorRole = acePaletteVariationRole.heading;

                break;

            case appendRole.majorHeading:
                colorRole = acePaletteVariationRole.heading;

                break;

            case appendRole.minorHeading:
                colorRole = acePaletteVariationRole.normal;

                break;

            case appendRole.paragraph:
                colorRole = acePaletteVariationRole.normal;

                break;

            case appendRole.remark:
                colorRole = acePaletteVariationRole.heading;

                break;

            case appendRole.tableHead:

                colorRole = acePaletteVariationRole.header;

                break;

            case appendRole.tableColumnHead:

                colorRole = acePaletteVariationRole.heading;

                break;

            case appendRole.tableColumnFoot:
                colorRole = acePaletteVariationRole.heading;

                break;

            case appendRole.tableCellValue:

                colorRole = acePaletteVariationRole.even;

                break;

            case appendRole.tableCellAnnotation:
                colorRole = acePaletteVariationRole.even;

                break;

            case appendRole.tableCellNovalue:
                colorRole = acePaletteVariationRole.even;

                break;

            case appendRole.tableBetween:
                colorRole = acePaletteVariationRole.even;

                break;

            case appendRole.tableFoot:
                colorRole = acePaletteVariationRole.heading;

                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(colorRole);
        }
Пример #4
0
        /// <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);
        }
Пример #5
0
        /// <summary>
        /// Gets area that matches this position.
        /// </summary>
        /// <param name="x">The x.</param>
        /// <param name="y">The y.</param>
        /// <param name="completeArea">if set to <c>true</c> returns complete area not sliced part</param>
        /// <returns></returns>
        public selectRangeArea getArea(Int32 x, Int32 y, Boolean completeArea = false)
        {
            appendRole rol = getAppendRole(state(x, y));

            return(getAreaOfRole(rol, x, y, completeArea));
        }
        /// <summary>
        /// Sets the sizing.
        /// </summary>
        /// <param name="data">The data.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="doMerge">if set to <c>true</c> [do merge].</param>
        /// <param name="varRole">The variable role.</param>
        /// <param name="role">The role.</param>
        /// <returns></returns>
        public static PropertyCollection setSizing(this PropertyCollection data, int width, int height, bool doMerge, acePaletteVariationRole varRole, appendRole role)
        {
            if (data == null)
            {
                data = new PropertyCollection();
            }

            data.addObjectToMultikeys(width, true, templateFieldStyle.style_width, docScriptArguments.dsa_w);
            data.addObjectToMultikeys(height, true, templateFieldStyle.style_height, docScriptArguments.dsa_h);
            data.addObjectToMultikeys(doMerge, true, docScriptArguments.dsa_doMerge);
            data.addObjectToMultikeys(varRole, true, docScriptArguments.dsa_variationRole);
            data.addObjectToMultikeys(role, true, templateFieldStyle.style_appendRole);

            return(data);
        }
Пример #7
0
 public static String getCodeName(appendRole __role, appendType __type, styleTheme theme)
 {
     return(__role.ToString() + "_" + __type.ToString() + "_" + theme.getCodeName());
 }
Пример #8
0
 public styleContainerShot(appendRole __role, appendType __type, styleTheme theme)
 {
     processRole(__role, __type, theme);
 }
Пример #9
0
        /// <summary>
        /// Sets the styling info using <c>appendRole</c> information
        /// </summary>
        /// <param name="role">The role.</param>
        /// <param name="theme">The theme.</param>
        /// <exception cref="System.ArgumentOutOfRangeException"></exception>
        internal void processRole(appendRole __role)
        {
            //appendType type = appendType.heading;

            //acePaletteVariationRole varRole = acePaletteVariationRole.normal;
            Boolean setType = (type == appendType.none);

            role = __role;

            //colorRole = role.convertRoleToVariationRole();
            switch (role)
            {
            case appendRole.none:
                break;

            case appendRole.mergedHead:
                doCallForMerge   = true;
                doCallForInverse = true;
                modification     = styleTextModificationEnum.bigger;
                //   colorRole = acePaletteVariationRole.header;
                break;

            case appendRole.mergedContent:
                modification   = styleTextModificationEnum.normal;
                doCallForMerge = true;
                //   colorRole = acePaletteVariationRole.normal;
                break;

            case appendRole.mergedFoot:
                modification     = styleTextModificationEnum.smaller;
                doCallForMerge   = true;
                doCallForInverse = true;
                //   colorRole = acePaletteVariationRole.heading;
                break;

            case appendRole.sectionHead:
                modification = styleTextModificationEnum.bigger;
                if (setType)
                {
                    type = appendType.bold;
                }
                doCallForInverse = true;
                //  colorRole = acePaletteVariationRole.header;
                break;

            case appendRole.sectionContent:
                modification = styleTextModificationEnum.normal;
                //  colorRole = acePaletteVariationRole.normal;
                if (setType)
                {
                    type = appendType.regular;
                }
                break;

            case appendRole.sectionFoot:
                modification = styleTextModificationEnum.smaller;
                if (setType)
                {
                    type = appendType.italic;
                }
                //  colorRole = acePaletteVariationRole.heading;
                doCallForInverse = true;
                break;

            case appendRole.majorHeading:
                // colorRole = acePaletteVariationRole.heading;
                if (setType)
                {
                    type = appendType.heading_3;
                }
                break;

            case appendRole.minorHeading:
                // colorRole = acePaletteVariationRole.normal;
                if (setType)
                {
                    type = appendType.heading_5;
                }
                break;

            case appendRole.paragraph:
                // colorRole = acePaletteVariationRole.normal;
                modification = styleTextModificationEnum.normal;
                if (setType)
                {
                    type = appendType.paragraph;
                }
                break;

            case appendRole.remark:
                // colorRole = acePaletteVariationRole.heading;
                modification = styleTextModificationEnum.small;
                break;

            case appendRole.tableHead:
                modification = styleTextModificationEnum.bigger;
                //colorRole = acePaletteVariationRole.header;
                if (setType)
                {
                    type = appendType.bold;
                }
                doCallForInverse = true;
                doCallForMerge   = true;
                break;

            case appendRole.tableColumnHead:
                doCallForInverse = true;
                //colorRole = acePaletteVariationRole.heading;
                modification = styleTextModificationEnum.bigger;
                if (setType)
                {
                    type = appendType.regular;
                }

                break;

            case appendRole.tableColumnFoot:
                //colorRole = acePaletteVariationRole.heading;
                modification = styleTextModificationEnum.smaller;
                //if (setType) type = appendType.italic;
                break;

            case appendRole.tableCellValue:

                //colorRole = acePaletteVariationRole.even;
                doCallForVariance = true;

                if (setType)
                {
                    type = appendType.regular;
                }
                break;

            case appendRole.tableCellAnnotation:
                //colorRole = acePaletteVariationRole.even;
                doCallForVariance = true;
                modification      = styleTextModificationEnum.smaller;
                if (setType)
                {
                    type = appendType.comment;
                }
                break;

            case appendRole.tableCellNovalue:
                //colorRole = acePaletteVariationRole.even;
                doCallForVariance = true;
                if (setType)
                {
                    type = appendType.none;
                }
                break;

            case appendRole.tableBetween:
                //colorRole = acePaletteVariationRole.even;
                doCallForVariance = true;
                modification      = styleTextModificationEnum.smaller;
                if (setType)
                {
                    type = appendType.regular;
                }
                break;

            case appendRole.tableFoot:
                //colorRole = acePaletteVariationRole.heading;
                modification = styleTextModificationEnum.smaller;
                if (setType)
                {
                    type = appendType.italic;
                }
                doCallForInverse = true;
                doCallForMerge   = true;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Пример #10
0
 /// <summary>
 /// The prefered way of obtaining style information
 /// </summary>
 /// <param name="role">The role of particular append</param>
 /// <param name="__type">The type of particular append</param>
 /// <param name="theme">The theme to use fonts and size settings from</param>
 public styleTextShot(appendRole role, appendType __type, styleTheme theme)
 {
     processRole(role);
     processType(__type, theme);
     themeCodeName = theme.getCodeName();
 }
Пример #11
0
        /// <summary>
        /// Executes the specified ins.
        /// </summary>
        /// <param name="ins">The ins.</param>
        /// <param name="kind">The kind.</param>
        /// <returns></returns>
        protected virtual appendType execute(docScriptInstruction ins, appendTypeKind kind, appendType output)
        {
            //appendType output = ins.type;

            if (output != appendType.none)
            {
                output = runComplexInstruction(ins);
            }
            if (output != appendType.none)
            {
                output = runStyleInstruction(ins);
            }

            if (output != appendType.none)
            {
                string str = ins.getProperString(d.dsa_contentLine, d.dsa_title, d.dsa_description);

                appendRole role = ins.getProperEnum <appendRole>(appendRole.paragraph, d.dsa_role);

                styleTextShot tshot = null;

                styleContainerShot sshot = null;

                if (role != appendRole.none)
                {
                    tshot = new styleTextShot(role, theme);
                    sshot = new styleContainerShot(role, ins.type, theme);
                }
                else
                {
                    tshot = new styleTextShot(ins.type, theme);
                }

                List <string> lines = ins.getProperObject <List <string> >(d.dsa_content);

                if (lines == null)
                {
                    lines = ins.getFirstOfType <List <string> >(true);
                }

                if (!str.isNullOrEmpty())
                {
                    lines.Add(str);
                }

                if (lines.Any())
                {
                    foreach (string logLine in lines)
                    {
                        if (hasDocRender)
                        {
                            if (tshot != null)
                            {
                                docRender.ApplyStyle(tshot, render.c.getPencil(pencilType.point, 1));
                            }
                            if (sshot != null)
                            {
                                docRender.ApplyStyle(sshot, render.c.getPencil(pencilType.point, 1));
                            }
                        }
                        render.Append(logLine, ins.type, !ins.isHorizontal);
                    }
                }
                else
                {
                    if (script.flags.HasFlag(docScriptFlags.ignoreArgumentValueNull))
                    {
                        if (doVerboseLog)
                        {
                            log("Simple append called but no content nor contentLine provided");
                        }
                    }
                    else
                    {
                        executionError("Simple append called but no content nor contentLine provided", ins);
                    }
                }
            }

            return(output);
        }
Пример #12
0
        /// <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>
        /// Executes the script instruction.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="instruction">The instruction.</param>
        public void executeScriptInstruction(IRenderExecutionContext context, docScriptInstructionCompiled instruction)
        {
            // outputRender.SubcontentStart(templateFieldSubcontent.main, false);

            if (outputRender is imbStringBuilderBase)
            {
                imbStringBuilderBase outputRender_imbStringBuilderBase = (imbStringBuilderBase)outputRender;
                outputRender_imbStringBuilderBase.data = context.data;
            }

            appendType final = runComplexInstruction(context, instruction);

            if (final != appendType.none)
            {
                final = runSpecialInstruction(context, instruction);
            }

            if (final == appendType.none)
            {
                // context.log("Complex instruction performed inside Output instruction");
                return;
            }

            if (outputRender is builderForMarkdown)
            {
                List <string> lines = new List <string>();
                if (instruction.containsKey(d.dsa_content))
                {
                    lines.AddRange((IEnumerable <string>)instruction[d.dsa_content]);
                }
                if (instruction.containsKey(d.dsa_contentLine))
                {
                    lines.Add((string)instruction[d.dsa_contentLine]);
                }
                for (int i = 0; i < lines.Count(); i++)
                {
                    outputRender.Append(lines[i], instruction.type, !instruction.isHorizontal);
                }
                return;
            }

            string str = instruction.getProperString(d.dsa_contentLine, d.dsa_title, d.dsa_description);

            appendRole role = instruction.getProperEnum <appendRole>(appendRole.paragraph, d.dsa_role);

            styleTextShot tshot = null;

            styleContainerShot sshot = null;

            if (role != appendRole.none)
            {
                tshot = new styleTextShot(role, context.theme);
                sshot = new styleContainerShot(role, instruction.type, context.theme);
            }
            else
            {
                tshot = new styleTextShot(instruction.type, context.theme);
            }

            //instruction.getProperObject<List<String>>(d.dsa_content);

            //if (lines == null) lines = instruction.getFirstOfType<List<String>>(true);

            //if (!str.isNullOrEmpty())
            //{
            //    lines.Add(str);
            //}

            //Boolean hasDocRender = false;
            //IDocumentRender docRender = outputRender as IDocumentRender; //builder.documentBuilder as IDocumentRender;

            //if (docRender != null)
            //{
            //    hasDocRender = true;
            //}

            //if (lines.Any())
            //{
            //    foreach (String logLine in lines)
            //    {
            //        //if (hasDocRender)
            //        //{
            //        //    if (tshot != null) docRender.ApplyStyle(tshot, builder.documentBuilder.c.getPencil(pencilType.point, 1));
            //        //    if (sshot != null) docRender.ApplyStyle(sshot, builder.documentBuilder.c.getPencil(pencilType.point, 1));
            //        //}
            //        outputRender.Append(logLine, instruction.type, !instruction.isHorizontal);

            //    }
            //}
            //else
            //{
            //    context.executionError("content and contentLine is missing for instruction", instruction);
            //}

            //  outputRender.SubcontentClose();

            //throw new NotImplementedException();
        }
        /// <summary>
        /// Converts <c>role</c> into <c>appendType</c>
        /// </summary>
        /// <param name="__role">The role.</param>
        /// <param name="__overrideResult">If not <c>none</c> it will override any conversion and return this as result</param>
        /// <param name="__defaultType">The default append Type to return if no rule is applicable.</param>
        /// <returns></returns>
        public static appendType convertRoleToType(this appendRole __role, appendType __overrideResult = appendType.none, appendType __defaultType = appendType.regular)
        {
            //appendType type = appendType.heading;

            //acePaletteVariationRole varRole = acePaletteVariationRole.normal;
            Boolean setType = (__overrideResult == appendType.none);

            appendType type = __defaultType;

            if (!setType)
            {
                type = __overrideResult;
                return(type);
            }

            switch (__role)
            {
            case appendRole.none:
                // type = appendType.regular;
                break;

            case appendRole.mergedHead:
                type = appendType.bold;
                break;

            case appendRole.mergedContent:
                type = appendType.regular;
                break;

            case appendRole.mergedFoot:
                type = appendType.italic;
                break;

            case appendRole.sectionHead:

                type = appendType.bold;

                break;

            case appendRole.sectionContent:
                type = appendType.regular;
                break;

            case appendRole.sectionFoot:

                type = appendType.italic;

                break;

            case appendRole.majorHeading:
                type = appendType.heading_1;
                break;

            case appendRole.minorHeading:
                type = appendType.heading_3;

                break;

            case appendRole.paragraph:
                type = appendType.paragraph;
                break;

            case appendRole.remark:
                type = appendType.italic;
                break;

            case appendRole.tableHead:
                type = appendType.bold;
                break;

            case appendRole.tableColumnHead:
                type = appendType.regular;
                break;

            case appendRole.tableColumnFoot:
                type = appendType.italic;
                break;

            case appendRole.tableCellValue:

                type = appendType.regular;
                break;

            case appendRole.tableCellAnnotation:
                type = appendType.comment;
                break;

            case appendRole.tableCellNovalue:
                // type = appendType.none;
                break;

            case appendRole.tableBetween:
                type = appendType.regular;
                break;

            case appendRole.tableFoot:
                type = appendType.italic;

                break;

            default:
                //type = appendType.regular;
                //throw new ArgumentOutOfRangeException();
                break;
            }
            return(type);
        }
Пример #15
0
        internal void processRole(appendRole __role, appendType __type, styleTheme theme)
        {
            role = __role;
            type = __type;

            Int32 sizeKWidth  = 8;
            Int32 sizeKHeight = 1;

            themeCodeName = theme.getCodeName();

            var sizeEnum = imbStringMarkdownExtensions.getTextSizeEnum(__type);
            var size     = theme.fontSize.headingSizes[sizeEnum.ToInt32()];

            fourSideSetting margin  = theme.fontSize.headingMargins[sizeEnum.ToInt32()];
            fourSideSetting padding = theme.fontSize.headingPaddings[sizeEnum.ToInt32()];

            sizeAndBorder.apply(margin, styleFourSideParameter.margin);
            sizeAndBorder.apply(padding, styleFourSideParameter.padding);

            String roleName = role.ToString();

            aligment = textCursorZoneCorner.Left;

            if (roleName.StartsWith("merged"))
            {
                doWrapText     = true;
                doCallForMerge = true;
            }

            if (roleName.StartsWith("section"))
            {
                doWrapText = true;
            }

            if (roleName.EndsWith("Head"))
            {
                aligment = textCursorZoneCorner.center;
                sizeAndBorder.bottom.type = styleBorderType.Thin;
            }

            if (roleName.EndsWith("Foot"))
            {
                aligment = textCursorZoneCorner.Left;
                sizeAndBorder.top.type = styleBorderType.Thin;
            }

            switch (role)
            {
            case appendRole.none:
                break;

            case appendRole.mergedHead:

                break;

            case appendRole.mergedContent:
                break;

            case appendRole.mergedFoot:

                break;

            case appendRole.sectionHead:

                break;

            case appendRole.sectionContent:
                break;

            case appendRole.sectionFoot:

                break;

            case appendRole.majorHeading:
                break;

            case appendRole.minorHeading:
                break;

            case appendRole.paragraph:
                break;

            case appendRole.remark:
                break;

            case appendRole.tableHead:
                sizeAndBorder.top.type = styleBorderType.Double;
                doWrapText             = true;
                doCallForMerge         = true;
                break;

            case appendRole.tableColumnHead:
                doWrapText = true;
                break;

            case appendRole.tableColumnFoot:
                sizeAndBorder.top.type = styleBorderType.Dotted;
                break;

            case appendRole.tableCellValue:
                break;

            case appendRole.tableCellAnnotation:
                sizeAndBorder.top.type    = styleBorderType.Dotted;
                sizeAndBorder.bottom.type = styleBorderType.Dotted;
                break;

            case appendRole.tableCellNovalue:

                break;

            case appendRole.tableBetween:
                sizeAndBorder.top.type    = styleBorderType.Dotted;
                sizeAndBorder.bottom.type = styleBorderType.Dotted;
                break;

            case appendRole.tableFoot:
                sizeAndBorder.bottom.type = styleBorderType.Double;
                break;

            case appendRole.i_container:
                break;

            case appendRole.i_margin:
                sizeKHeight = 1;
                sizeKWidth  = 1;
                break;

            case appendRole.i_line:
                break;

            default:
                break;
            }

            minSize         = new styleSize(size * sizeKWidth, size * sizeKHeight);
            minSize.width  += sizeAndBorder.left.padding + sizeAndBorder.right.padding;
            minSize.height += sizeAndBorder.top.padding + sizeAndBorder.bottom.padding;
        }
Пример #16
0
 public styleShotSet(appendRole role, appendType type, acePaletteVariationRole colorRole, acePaletteRole paletteRole, Boolean isInverse, styleTheme theme)
 {
     palette   = theme.palletes.getShotSet(colorRole, isInverse, paletteRole);
     text      = theme.textShotProvider.getShotSet(role, type);
     container = theme.styleContainerProvider.getShotSet(role, type);
 }
Пример #17
0
        //protected IStyleInstruction resolveInstruction(appendRole role, styleApplicationFlag aFlag)
        //{
        //    IStyleInstruction output = null;
        //    appendType type = role.
        //    styleShotSet shot = new styleShotSet(role)

        //    if (flags.HasFlag(styleApplicationFlag.autoByRole))
        //    {
        //    }
        //}

#pragma warning disable CS1574 // XML comment has cref attribute 'appendType' that could not be resolved
        /// <summary>
        /// Resolves autoshot into a series of instructions
        /// </summary>
        /// <param name="theme">The active teme</param>
        /// <param name="__resources">Resources: set of style related enums and appendType</param>
        /// <seealso cref="aceCommonTypes.enums.appendType"/>
        /// <seealso cref="acePaletteRole"/>
        /// <seealso cref="appendRole"/>
        /// <seealso cref="acePaletteVariationRole"/>
        /// <returns></returns>
        public List <IStyleInstruction> resolve(styleTheme theme, params Object[] __resources)
#pragma warning restore CS1574 // XML comment has cref attribute 'appendType' that could not be resolved
        {
            List <IStyleInstruction> output    = new List <IStyleInstruction>();
            acePaletteVariationRole  colorRole = acePaletteVariationRole.none;

            List <Int32> xy = __resources.getAllOfType <Int32>(false);

            //--------- applying customizations
            appendType     type        = __resources.getFirstOfType <appendType>(false, appendType.none);
            appendRole     role        = __resources.getFirstOfType <appendRole>(false, appendRole.none);
            Boolean        isInverse   = __resources.getFirstOfType <Boolean>(false, false);
            acePaletteRole paletteRole = __resources.getFirstOfType <acePaletteRole>(false, acePaletteRole.none);

            if (role == appendRole.none)
            {
                role = appendRole.paragraph;
            }

            //if ((role != appendRole.none) && (type == appendType.none))
            //{
            //    type = role.convertRoleToType();
            //}

            //if ((role != appendRole.none) && (colorRole == acePaletteVariationRole.none))
            //{
            //    colorRole = role.convertRoleToVariationRole();
            //}

            if (paletteRole == acePaletteRole.none)
            {
                flags &= ~styleApplicationFlag.enableColorShot;
            }

            if (flags.HasFlag(styleApplicationFlag.autoByVariator))
            {
                var tmp = theme.styler.getStyleShot(xy[0], xy[1], type);
                if (flags.HasFlag(styleApplicationFlag.enableColorShot))
                {
                    palette = tmp.palette;                                                      //theme.palletes.getShotSet(colorRole, isInverse, paletteRole);
                }
                if (flags.HasFlag(styleApplicationFlag.enableTextShot))
                {
                    text = tmp.text;                                                     // theme.textShotProvider.getShotSet(role);
                }
                if (flags.HasFlag(styleApplicationFlag.enableContentShot))
                {
                    container = container;                                                        // = theme.styleContainerProvider.getShotSet(role, type);
                }
            }
            else
            {
                if (flags.HasFlag(styleApplicationFlag.enableColorShot))
                {
                    palette = theme.palletes.getShotSet(colorRole, isInverse, paletteRole);
                }
                if (flags.HasFlag(styleApplicationFlag.enableTextShot))
                {
                    text = theme.textShotProvider.getShotSet(role);
                }
                if (flags.HasFlag(styleApplicationFlag.enableContentShot))
                {
                    container = theme.styleContainerProvider.getShotSet(role, type);
                }
            }

            if (flags.HasFlag(styleApplicationFlag.setAsActive))
            {
                theme.activeStyleInstruction = this;
            }

            foreach (IStyleInstruction inst in this)
            {
                if (inst != null)
                {
                    output.Add(inst);
                }
            }

            return(output);
        }