Esempio n. 1
0
        internal void UpdateXml()
        {
            if (Automatic)
            {
                _vmlHelper.SetXmlNodeString("@o:insetmode", "auto");
            }
            else
            {
                _vmlHelper.DeleteNode("@o:insetmode");    //Custom
            }

            if (LeftMargin.Value != 0 && TopMargin.Value != 0 && RightMargin.Value != 0 && BottomMargin.Value != 0)
            {
                var v =
                    LeftMargin.GetValueString() + "," +
                    TopMargin.GetValueString() + "," +
                    RightMargin.GetValueString() + "," +
                    BottomMargin.GetValueString();

                _control.TextBody.LeftInsert   = LeftMargin.ToEmu();
                _control.TextBody.TopInsert    = TopMargin.ToEmu();
                _control.TextBody.RightInsert  = RightMargin.ToEmu();
                _control.TextBody.BottomInsert = BottomMargin.ToEmu();

                _vmlHelper.SetXmlNodeString("v:textbox/@inset", v);
            }
            else
            {
                _vmlHelper.DeleteNode("v:textbox/@inset");
            }
        }
        public PageSetupSequence(IStreamReader reader)
            : base(reader)
        {
            //PAGESETUP = Header Footer HCenter VCenter [LeftMargin] [RightMargin] [TopMargin] [BottomMargin] [Pls *Continue] Setup

            // Header
            this.Header = (Header)BiffRecord.ReadRecord(reader);

            // Footer
            this.Footer = (Footer)BiffRecord.ReadRecord(reader);

            // HCenter
            this.HCenter = (HCenter)BiffRecord.ReadRecord(reader);

            // VCenter
            this.VCenter = (VCenter)BiffRecord.ReadRecord(reader);

            // [LeftMargin]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.LeftMargin)
            {
                this.LeftMargin = (LeftMargin)BiffRecord.ReadRecord(reader);
            }

            // [RightMargin]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.RightMargin)
            {
                this.RightMargin = (RightMargin)BiffRecord.ReadRecord(reader);
            }

            // [TopMargin]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.TopMargin)
            {
                this.TopMargin = (TopMargin)BiffRecord.ReadRecord(reader);
            }

            // [BottomMargin]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.BottomMargin)
            {
                this.BottomMargin = (BottomMargin)BiffRecord.ReadRecord(reader);
            }

            // [Pls *Continue]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.Pls)
            {
                this.Pls = (Pls)BiffRecord.ReadRecord(reader);

                this.Continues = new List <Continue>();
                while (BiffRecord.GetNextRecordType(reader) == RecordType.Continue)
                {
                    this.Continues.Add((Continue)BiffRecord.ReadRecord(reader));
                }
            }

            // Setup
            this.Setup = (Setup)BiffRecord.ReadRecord(reader);
        }
        /// <summary>
        /// On mouse move over title right margin
        /// </summary>
        /// <param name="sender">sender of the event</param>
        /// <param name="e">event arg</param>
        private void OnMouseMoveInRightMargin(object sender, MouseEventArgs e)
        {
            if (_sizeMode == zSizeMode.Right)
            {
                Point location = RightMargin.PointToScreen(e.Location);
                int   dx       = location.X - _mouseDownScreenPos.X;

                Positioner.Size = new Size(
                    _positionerSizeOnMouseDown.Width + dx,
                    Positioner.Size.Height);
            }
        }
        /// <summary>
        /// On mouse down in title right margin
        /// </summary>
        /// <param name="sender">sender of the event</param>
        /// <param name="e">event arg</param>
        private void OnMouseDownInRightMargin(object sender, MouseEventArgs e)
        {
            _sizeMode = zSizeMode.None;

            if (e.Button == MouseButtons.Left && Positioner.CanSizeRight && CanResizeByMouse)
            {
                _mouseDownScreenPos            = RightMargin.PointToScreen(e.Location);
                _positionerPositionOnMouseDown = Positioner.Location;
                _positionerSizeOnMouseDown     = Positioner.Size;
                _sizeMode = zSizeMode.Right;
            }
        }
Esempio n. 5
0
        protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state)
        {
            PropertyDescriptor property = context.DataContext.GetProperties()[WordCreate.GetWordAppTag];
            Application        wordApp  = property.GetValue(context.DataContext) as Application;

            try
            {
                float     fontSize     = FontSize.Get(context);
                Int32     leftMargin   = LeftMargin.Get(context);
                Int32     rightMargin  = RightMargin.Get(context);
                Int32     topMargin    = TopMargin.Get(context);
                Int32     bottomMargin = BottomMargin.Get(context);
                Selection sel          = wordApp.Selection;
                Font      font         = sel.Font;

                /*字体设置*/
                font.Size = fontSize;
                if (Font != 0)
                {
                    font.Name = ConvertFont(Font.ToString());
                }
                font.ColorIndex = (WdColorIndex)_FontColor;
                font.Shadow     = Convert.ToInt32(_Shadow);
                font.Bold       = Convert.ToInt32(_FontBold);
                font.Italic     = Convert.ToInt32(_FontItalic);
                if (_FontUnderLine)
                {
                    font.Underline = WdUnderline.wdUnderlineSingle;
                }

                /*段落对齐设置*/
                ParagraphFormat paraFmt;
                paraFmt             = sel.ParagraphFormat;
                paraFmt.Alignment   = (WdParagraphAlignment)_Align;
                sel.ParagraphFormat = paraFmt;

                /*页面设置*/
                PageSetup pgSet = wordApp.ActiveDocument.PageSetup;
                pgSet.LeftMargin   = leftMargin;
                pgSet.RightMargin  = rightMargin;
                pgSet.TopMargin    = topMargin;
                pgSet.BottomMargin = bottomMargin;
            }
            catch (Exception e)
            {
                SharedObject.Instance.Output(SharedObject.enOutputType.Error, "Word执行过程出错", e.Message);
                CommonVariable.realaseProcessExit(wordApp);
            }

            m_Delegate = new runDelegate(Run);
            return(m_Delegate.BeginInvoke(callback, state));
        }
Esempio n. 6
0
        /// <summary>
        /// Возвращает ячейку с настройками может применятся для создания строки
        /// </summary>
        /// <param name="paragraph">Коллекция параграффов для добавления в ячейку</param>
        /// <param name="number">Количество объединенных ячеек</param>
        /// <param name="width">Длина ячейки</param>
        /// <param name="type">Тип выравнивания</param>
        /// <param name="leftmargin">Левый отступ в пикселях</param>
        /// <param name="rightmargin">Правый отступ в пикселях</param>
        /// <param name="borders">Отражение границы ячейки</param>
        /// <returns></returns>
        public static TableCell GenerateCell(ref ObservableCollection <Paragraph> paragraph, string width, TableWidthUnitValues type, string leftmargin = "0", string rightmargin = "0", TableVerticalAlignmentValues verticalAlignment = TableVerticalAlignmentValues.Bottom, TableCellBorders borders = null, int number = 0)
        {
            TableCell           tableCell           = new TableCell();
            TableCellProperties tableCellProperties = new TableCellProperties();
            TableCellWidth      tableCellWidth      = new TableCellWidth()
            {
                Width = width, Type = type
            };
            GridSpan gridSpan = new GridSpan()
            {
                Val = number
            };
            TableCellVerticalAlignment tcVA = new TableCellVerticalAlignment()
            {
                Val = verticalAlignment
            };

            TableCellMargin tableCellMargin = new TableCellMargin();

            if (leftmargin != "0")
            {
                LeftMargin leftMargin = new LeftMargin()
                {
                    Width = leftmargin, Type = TableWidthUnitValues.Dxa
                };
                tableCellMargin.Append(leftMargin);
            }

            if (rightmargin != "0")
            {
                RightMargin rightMargin = new RightMargin()
                {
                    Width = rightmargin, Type = TableWidthUnitValues.Dxa
                };
                tableCellMargin.Append(rightMargin);
            }
            tableCellProperties.Append(tcVA);
            tableCellProperties.Append(tableCellWidth);
            tableCellProperties.Append(tableCellMargin);
            tableCellProperties.Append(gridSpan);
            if (borders != null)
            {
                tableCellProperties.Append(borders);
            }

            tableCell.Append(tableCellProperties);
            AddParagraphCell(ref tableCell, ref paragraph);

            return(tableCell);
        }
Esempio n. 7
0
        private void paperSizeCombo_SelectedIndexChanged(object sender, EventArgs e)
        {
            PaperSize size = WbContext.get_paper_sizes()[paperSizeCombo.SelectedIndex];

            paperSizeLabel.Text = size.description;
            if (size.margins_set)
            {
                topMarginText.Text    = size.margin_top.ToString();
                bottomMarginText.Text = size.margin_bottom.ToString();
                leftMarginText.Text   = size.margin_left.ToString();
                rightMarginText.Text  = size.margin_right.ToString();
            }
            else
            {
                topMarginText.Text    = TopMargin.ToString();
                bottomMarginText.Text = BottomMargin.ToString();
                leftMarginText.Text   = LeftMargin.ToString();
                rightMarginText.Text  = RightMargin.ToString();
            }
        }
Esempio n. 8
0
        internal ExcelControlMargin(ExcelControlWithText control)
        {
            _control   = control;
            _vmlHelper = XmlHelperFactory.Create(control._vmlProp.NameSpaceManager, control._vmlProp.TopNode.ParentNode);

            Automatic = _vmlHelper.GetXmlNodeString("@o:insetmode") == "auto";
            var margin = _vmlHelper.GetXmlNodeString("v:textbox/@inset");

            var v = margin.GetCsvPosition(0);

            LeftMargin.SetValue(v);

            v = margin.GetCsvPosition(1);
            TopMargin.SetValue(v);

            v = margin.GetCsvPosition(2);
            RightMargin.SetValue(v);

            v = margin.GetCsvPosition(3);
            BottomMargin.SetValue(v);
        }
Esempio n. 9
0
 /// <summary>
 /// 序列化xml
 /// </summary>
 /// <param name="p_writer"></param>
 public void WriteXml(XmlWriter p_writer)
 {
     p_writer.WriteStartElement("Page");
     // 不保存纸张名称
     //string val = Data.Str("papername");
     //if (val != "IsoA4")
     //    p_writer.WriteAttributeString("papername", val);
     if (Height != _defaultHeight)
     {
         p_writer.WriteAttributeString("height", Height.ToString());
     }
     if (Width != _defaultWidth)
     {
         p_writer.WriteAttributeString("width", Width.ToString());
     }
     if (LeftMargin != _defaultMargin)
     {
         p_writer.WriteAttributeString("leftmargin", LeftMargin.ToString());
     }
     if (TopMargin != _defaultMargin)
     {
         p_writer.WriteAttributeString("topmargin", TopMargin.ToString());
     }
     if (RightMargin != _defaultMargin)
     {
         p_writer.WriteAttributeString("rightmargin", RightMargin.ToString());
     }
     if (BottomMargin != _defaultMargin)
     {
         p_writer.WriteAttributeString("bottommargin", BottomMargin.ToString());
     }
     if (Landscape)
     {
         p_writer.WriteAttributeString("landscape", "True");
     }
     p_writer.WriteEndElement();
 }
Esempio n. 10
0
        /// <summary>
        /// Extracting the data from the stream
        /// </summary>
        public override void extractData()
        {
            BiffHeader bh, latestbiff;
            BOF        firstBOF = null;

            //try
            //{
            while (this.StreamReader.BaseStream.Position < this.StreamReader.BaseStream.Length)
            {
                bh.id     = (RecordType)this.StreamReader.ReadUInt16();
                bh.length = this.StreamReader.ReadUInt16();

                // TraceLogger.DebugInternal("BIFF {0}\t{1}\t", bh.id, bh.length);
                Console.WriteLine("WORKSHEET-BIFF {0}\t{1}\t", bh.id, bh.length);

                switch (bh.id)
                {
                case RecordType.EOF:
                {
                    this.StreamReader.BaseStream.Seek(0, SeekOrigin.End);
                }
                break;

                case RecordType.BOF:
                {
                    var bof = new BOF(this.StreamReader, bh.id, bh.length);

                    switch (bof.docType)
                    {
                    case BOF.DocumentType.WorkbookGlobals:
                    case BOF.DocumentType.Worksheet:
                        firstBOF = bof;
                        break;

                    case BOF.DocumentType.Chart:
                        // parse chart

                        break;

                    default:
                        this.readUnknownFile();
                        break;
                    }
                }
                break;

                case RecordType.LabelSst:
                {
                    var labelsst = new LabelSst(this.StreamReader, bh.id, bh.length);
                    this.bsd.addLabelSST(labelsst);
                }
                break;

                case RecordType.MulRk:
                {
                    var mulrk = new MulRk(this.StreamReader, bh.id, bh.length);
                    this.bsd.addMULRK(mulrk);
                }
                break;

                case RecordType.Number:
                {
                    var number = new Number(this.StreamReader, bh.id, bh.length);
                    this.bsd.addNUMBER(number);
                }
                break;

                case RecordType.RK:
                {
                    var rk = new RK(this.StreamReader, bh.id, bh.length);
                    this.bsd.addRK(rk);
                }
                break;

                case RecordType.MergeCells:
                {
                    var mergecells = new MergeCells(this.StreamReader, bh.id, bh.length);
                    this.bsd.MERGECELLSData = mergecells;
                }
                break;

                case RecordType.Blank:
                {
                    var blankcell = new Blank(this.StreamReader, bh.id, bh.length);
                    this.bsd.addBLANK(blankcell);
                } break;

                case RecordType.MulBlank:
                {
                    var mulblank = new MulBlank(this.StreamReader, bh.id, bh.length);
                    this.bsd.addMULBLANK(mulblank);
                }
                break;

                case RecordType.Formula:
                {
                    var formula = new Formula(this.StreamReader, bh.id, bh.length);
                    this.bsd.addFORMULA(formula);
                    TraceLogger.DebugInternal(formula.ToString());
                }
                break;

                case RecordType.Array:
                {
                    var array = new ARRAY(this.StreamReader, bh.id, bh.length);
                    this.bsd.addARRAY(array);
                }
                break;

                case RecordType.ShrFmla:
                {
                    var shrfmla = new ShrFmla(this.StreamReader, bh.id, bh.length);
                    this.bsd.addSharedFormula(shrfmla);
                }
                break;

                case RecordType.String:
                {
                    var formulaString = new STRING(this.StreamReader, bh.id, bh.length);
                    this.bsd.addFormulaString(formulaString.value);
                }
                break;

                case RecordType.Row:
                {
                    var row = new Row(this.StreamReader, bh.id, bh.length);
                    this.bsd.addRowData(row);
                }
                break;

                case RecordType.ColInfo:
                {
                    var colinfo = new ColInfo(this.StreamReader, bh.id, bh.length);
                    this.bsd.addColData(colinfo);
                }
                break;

                case RecordType.DefColWidth:
                {
                    var defcolwidth = new DefColWidth(this.StreamReader, bh.id, bh.length);
                    this.bsd.addDefaultColWidth(defcolwidth.cchdefColWidth);
                }
                break;

                case RecordType.DefaultRowHeight:
                {
                    var defrowheigth = new DefaultRowHeight(this.StreamReader, bh.id, bh.length);
                    this.bsd.addDefaultRowData(defrowheigth);
                }
                break;

                case RecordType.LeftMargin:
                {
                    var leftm = new LeftMargin(this.StreamReader, bh.id, bh.length);
                    this.bsd.leftMargin = leftm.value;
                }
                break;

                case RecordType.RightMargin:
                {
                    var rightm = new RightMargin(this.StreamReader, bh.id, bh.length);
                    this.bsd.rightMargin = rightm.value;
                }
                break;

                case RecordType.TopMargin:
                {
                    var topm = new TopMargin(this.StreamReader, bh.id, bh.length);
                    this.bsd.topMargin = topm.value;
                }
                break;

                case RecordType.BottomMargin:
                {
                    var bottomm = new BottomMargin(this.StreamReader, bh.id, bh.length);
                    this.bsd.bottomMargin = bottomm.value;
                }
                break;

                case RecordType.Setup:
                {
                    var setup = new Setup(this.StreamReader, bh.id, bh.length);
                    this.bsd.addSetupData(setup);
                }
                break;

                case RecordType.HLink:
                {
                    long oldStreamPos = this.StreamReader.BaseStream.Position;
                    try
                    {
                        var hlink = new HLink(this.StreamReader, bh.id, bh.length);
                        this.bsd.addHyperLinkData(hlink);
                    }
                    catch (Exception ex)
                    {
                        this.StreamReader.BaseStream.Seek(oldStreamPos, System.IO.SeekOrigin.Begin);
                        this.StreamReader.BaseStream.Seek(bh.length, System.IO.SeekOrigin.Current);
                        TraceLogger.Debug("Link parse error");
                        TraceLogger.Error(ex.StackTrace);
                    }
                }
                break;

                case RecordType.MsoDrawing:
                {
                    // Record header has already been read. Reset position to record beginning.
                    this.StreamReader.BaseStream.Position -= 2 * sizeof(ushort);
                    this.bsd.ObjectsSequence = new ObjectsSequence(this.StreamReader);
                }
                break;

                default:
                {
                    // this else statement is used to read BiffRecords which aren't implemented
                    var buffer = new byte[bh.length];
                    buffer = this.StreamReader.ReadBytes(bh.length);
                }
                break;
                }
                latestbiff = bh;
            }
            //}
            //catch (Exception ex)
            //{
            //    TraceLogger.Error(ex.Message);
            //    TraceLogger.Error(ex.StackTrace);
            //    TraceLogger.Debug(ex.ToString());
            //}
        }
Esempio n. 11
0
        void ReleaseDesignerOutlets()
        {
            if (ChallengeImage != null)
            {
                ChallengeImage.Dispose();
                ChallengeImage = null;
            }

            if (ChallengeName != null)
            {
                ChallengeName.Dispose();
                ChallengeName = null;
            }

            if (ChallengeTime != null)
            {
                ChallengeTime.Dispose();
                ChallengeTime = null;
            }

            if (ChellangeRightImage != null)
            {
                ChellangeRightImage.Dispose();
                ChellangeRightImage = null;
            }

            if (ClosedImage != null)
            {
                ClosedImage.Dispose();
                ClosedImage = null;
            }

            if (LeftMargin != null)
            {
                LeftMargin.Dispose();
                LeftMargin = null;
            }

            if (LeftSideView != null)
            {
                LeftSideView.Dispose();
                LeftSideView = null;
            }

            if (NameSeparator != null)
            {
                NameSeparator.Dispose();
                NameSeparator = null;
            }

            if (PointsText != null)
            {
                PointsText.Dispose();
                PointsText = null;
            }

            if (RightMargin != null)
            {
                RightMargin.Dispose();
                RightMargin = null;
            }

            if (SeperatorView != null)
            {
                SeperatorView.Dispose();
                SeperatorView = null;
            }
        }
Esempio n. 12
0
        private static void OnPreferencesGUI(string search)
        {
            scroll = EditorGUILayout.BeginScrollView(scroll, false, false);

            EditorGUILayout.Separator();
            Enabled.DoGUI();
            EditorGUILayout.Separator();
            EditorGUILayout.HelpBox("Each item has a tooltip explaining what it does, keep the mouse over it to see.", MessageType.Info);
            EditorGUILayout.Separator();

            using (Enabled.GetEnabledScope()) {
                using (new GUIIndent("Misc settings")) {
                    using (new GUIIndent("Margins")) {
                        RightMargin.DoGUISlider(-50, 50);
                        using (new GUIEnabled(Reflected.HierarchyArea.Supported)) {
                            LeftMargin.DoGUISlider(-50, 50);
                            Indent.DoGUISlider(0, 35);
                        }
                        if (!Reflected.HierarchyArea.Supported)
                        {
                            EditorGUILayout.HelpBox("Custom Indent and Margins are not supported in this Unity version", MessageType.Warning);
                        }
                    }

                    IconsSize.DoGUISlider(13, 23);
                    TreeOpacity.DoGUISlider(0f, 1f);

                    using (new GUIIndent()) {
                        using (SelectOnTree.GetFadeScope(TreeOpacity.Value > 0.01f))
                            SelectOnTree.DoGUI();
                        using (TreeStemProportion.GetFadeScope(TreeOpacity.Value > 0.01f))
                            TreeStemProportion.DoGUISlider(0f, 1f);
                    }

                    Tooltips.DoGUI();

                    using (new GUIIndent())
                        using (RelevantTooltipsOnly.GetFadeScope(Tooltips))
                            RelevantTooltipsOnly.DoGUI();

                    if (EnhancedSelectionSupported)
                    {
                        EnhancedSelection.DoGUI();
                    }

                    Trailing.DoGUI();
                    ChangeAllSelected.DoGUI();
                    NumericChildExpand.DoGUI();

                    using (new GUIEnabled(Reflected.IconWidthSupported))
                        DisableNativeIcon.DoGUI();

                    using (HideDefaultIcon.GetFadeScope(IsButtonEnabled(new Icons.GameObjectIcon())))
                        HideDefaultIcon.DoGUI();

                    using (OpenScriptsOfLogs.GetFadeScope(IsButtonEnabled(new Icons.Warnings())))
                        OpenScriptsOfLogs.DoGUI();

                    GUI.changed = false;

                    using (AllowSelectingLockedObjects.GetFadeScope(IsButtonEnabled(new Icons.Lock())))
                        AllowSelectingLockedObjects.DoGUI();

                    #if !UNITY_2019_3_OR_NEWER
                    using (new GUIEnabled(false))
                    #endif
                    using (AllowPickingLockedObjects.GetFadeScope(IsButtonEnabled(new Icons.Lock())))
                        AllowPickingLockedObjects.DoGUI();

                    HoverTintColor.DoGUI();
                }

                using (new GUIIndent("Row separators")) {
                    LineSize.DoGUISlider(0, 6);

                    using (LineColor.GetFadeScope(LineSize > 0))
                        LineColor.DoGUI();

                    OddRowColor.DoGUI();
                    EvenRowColor.DoGUI();

                    GUI.changed = false;
                    var rect = EditorGUILayout.GetControlRect(false, rowColorsList.GetHeight());
                    rect.xMin += EditorGUI.indentLevel * 16f;
                    rowColorsList.DoList(rect);
                }

                GUI.changed         = false;
                MiniLabels.Value[0] = EditorGUILayout.Popup("Mini Label Top", MiniLabels.Value[0], minilabelsNames);
                MiniLabels.Value[1] = EditorGUILayout.Popup("Mini Label Bottom", MiniLabels.Value[1], minilabelsNames);

                if (GUI.changed)
                {
                    MiniLabels.ForceSave();
                    RecreateMiniLabelProviders();
                }

                // MiniLabel.DoGUI();
                using (new GUIIndent()) {
                    using (SmallerMiniLabel.GetFadeScope(miniLabelProviders.Length > 0))
                        SmallerMiniLabel.DoGUI();
                    using (HideDefaultTag.GetFadeScope(MiniLabelTagEnabled))
                        HideDefaultTag.DoGUI();
                    using (HideDefaultLayer.GetFadeScope(MiniLabelLayerEnabled))
                        HideDefaultLayer.DoGUI();
                    using (CentralizeMiniLabelWhenPossible.GetFadeScope(miniLabelProviders.Length >= 2))
                        CentralizeMiniLabelWhenPossible.DoGUI();
                }

                LeftSideButtonPref.DoGUI();
                using (new GUIIndent())
                    using (LeftmostButton.GetFadeScope(LeftSideButton != IconBase.none))
                        LeftmostButton.DoGUI();

                using (new GUIIndent("Children behaviour on change")) {
                    using (LockAskMode.GetFadeScope(IsButtonEnabled(new Icons.Lock())))
                        LockAskMode.DoGUI();
                    using (LayerAskMode.GetFadeScope(IsButtonEnabled(new Icons.Layer()) || MiniLabelLayerEnabled))
                        LayerAskMode.DoGUI();
                    using (TagAskMode.GetFadeScope(IsButtonEnabled(new Icons.Tag()) || MiniLabelTagEnabled))
                        TagAskMode.DoGUI();
                    using (StaticAskMode.GetFadeScope(IsButtonEnabled(new Icons.Static())))
                        StaticAskMode.DoGUI();
                    using (IconAskMode.GetFadeScope(IsButtonEnabled(new Icons.GameObjectIcon())))
                        IconAskMode.DoGUI();

                    EditorGUILayout.HelpBox(string.Format("Pressing down {0} while clicking on a button will make it temporary have the opposite children change mode", Utility.CtrlKey), MessageType.Info);
                }

                leftIconsList.displayAdd = LeftIconsMenu.GetItemCount() > 0;
                leftIconsList.DoLayoutList();

                rightIconsList.displayAdd = RightIconsMenu.GetItemCount() > 0;
                rightIconsList.DoLayoutList();

                EditorGUILayout.HelpBox("Alt + Click on child expand toggle makes it expand all the grandchildren too", MessageType.Info);

                if (IsButtonEnabled(new Icons.Memory()))
                {
                    EditorGUILayout.HelpBox("\"Memory Used\" may create garbage and consequently framerate stutterings, leave it disabled if maximum performance is important for your project", MessageType.Warning);
                }

                if (IsButtonEnabled(new Icons.Lock()))
                {
                    EditorGUILayout.HelpBox("Remember to always unlock your game objects when removing or disabling this extension, as you won't be able to unlock without it and may lose scene data", MessageType.Warning);
                }

                GUI.enabled = true;
                EditorGUILayout.EndScrollView();

                using (new EditorGUILayout.HorizontalScope()) {
                    GUILayout.FlexibleSpace();
                    EditorGUILayout.LabelField(versionContent, GUILayout.Width(170f));
                }

                using (new EditorGUILayout.HorizontalScope()) {
                    if (GUILayout.Button(resetSettingsContent, GUILayout.Width(120f)))
                    {
                        onResetPreferences();
                    }

                    // if (GUILayout.Button(unlockAllContent, GUILayout.Width(120f)))
                    //     Utility.UnlockAllObjects();

                    if (GUILayout.Button(mailDeveloperContent, GUILayout.Width(120f)))
                    {
                        OpenSupportEmail();
                    }
                }

                EditorGUILayout.Separator();
                Styles.ReloadTooltips();
                EditorApplication.RepaintHierarchyWindow();
            }
        }
Esempio n. 13
0
        public TableCell ToTableCell()
        {
            TableCell tableCell = new TableCell();

            TableCellProperties tableCellProperties = new TableCellProperties();

            // Specify the width property of the table cell.
            TableCellWidth tableCellWidth = new TableCellWidth()
            {
                Width = Width.ToString(), Type = TableWidthUnitValues.Dxa
            };

            TableCellMargin tableCellMargin = new TableCellMargin();
            LeftMargin      leftMargin      = new LeftMargin()
            {
                Width = "100", Type = TableWidthUnitValues.Dxa
            };
            RightMargin rightMargin = new RightMargin()
            {
                Width = "100", Type = TableWidthUnitValues.Dxa
            };

            tableCellMargin.Append(leftMargin);
            tableCellMargin.Append(rightMargin);
            TableCellVerticalAlignment tableCellVerticalAlignment = new TableCellVerticalAlignment()
            {
                Val = TableVerticalAlignmentValues.Center
            };

            switch (TipoDeCelula)
            {
            case TipoDeCelula.HEADER:
                tableCellProperties.Append(new Shading()
                {
                    Val = ShadingPatternValues.Percent10, Color = "000000", Fill = "auto"
                });
                break;

            case TipoDeCelula.RESUME:
                tableCellProperties.Append(new Shading()
                {
                    Val = ShadingPatternValues.Percent10, Color = "000000", Fill = "auto"
                });
                break;

            default:     // TipoDeCelula.NORMAL
                break;
            }

            tableCellProperties.Append(tableCellWidth);
            tableCellProperties.Append(tableCellMargin);
            tableCellProperties.Append(tableCellVerticalAlignment);

            switch (Merge)
            {
            case TipoDeMerge.RESTART:
                tableCellProperties.Append(new HorizontalMerge()
                {
                    Val = MergedCellValues.Restart
                });
                break;

            case TipoDeMerge.CONTINUE:
                tableCellProperties.Append(new HorizontalMerge()
                {
                    Val = MergedCellValues.Continue
                });
                break;

            default:     // TipoDeMerge.NENHUM
                break;
            }

            tableCell.Append(tableCellProperties);

            Paragraph           paragraph           = new Paragraph();
            ParagraphProperties paragraphProperties = new ParagraphProperties();

            switch (Alinhamento)
            {
            case TipoDeAlinhamento.ESQUERDO:
                paragraphProperties.Append(new ParagraphStyleId()
                {
                    Val = "LeftTextTable"
                });
                paragraphProperties.AppendChild(
                    new RunProperties(new Bold()
                {
                    Val = OnOffValue.FromBoolean(true)
                }));
                break;

            case TipoDeAlinhamento.CENTRO:
                paragraphProperties.Append(new ParagraphStyleId()
                {
                    Val = "CenteredTextTable"
                });
                paragraphProperties.AppendChild(
                    new RunProperties(new Bold()
                {
                    Val = OnOffValue.FromBoolean(true)
                }));
                break;

            case TipoDeAlinhamento.DIREITO:
                paragraphProperties.Append(new ParagraphStyleId()
                {
                    Val = "RightTextTable"
                });
                paragraphProperties.AppendChild(
                    new RunProperties(new Bold()
                {
                    Val = OnOffValue.FromBoolean(true)
                }));
                break;

            default:      //TipoDeAlinhamento.NENHUM:
                paragraphProperties.Append(new ParagraphStyleId()
                {
                    Val = "NormalTextTable"
                });
                paragraphProperties.AppendChild(
                    new RunProperties(new Bold()
                {
                    Val = OnOffValue.FromBoolean(true)
                }));
                break;
            }

            paragraph.AppendChild(paragraphProperties);

            foreach (OpenXmlElement run in _runList)
            {
                switch (TipoDeCelula)
                {
                case TipoDeCelula.HEADER:
                    if (!run.Elements <RunProperties>().Any())
                    {
                        run.AppendChild(new RunProperties());
                    }
                    run.Elements <RunProperties>().First().AppendChild(new Bold()
                    {
                        Val = OnOffValue.FromBoolean(true)
                    });
                    break;

                case TipoDeCelula.RESUME:
                    if (!run.Elements <RunProperties>().Any())
                    {
                        run.AppendChild(new RunProperties());
                    }
                    run.Elements <RunProperties>().First().AppendChild(new Italic()
                    {
                        Val = OnOffValue.FromBoolean(true)
                    });
                    run.Elements <RunProperties>().First().AppendChild(new Bold()
                    {
                        Val = OnOffValue.FromBoolean(true)
                    });
                    break;
                }

                paragraph.AppendChild(run);
            }

            // Write some text in the cell.
            tableCell.Append(paragraph);

            return(tableCell);
        }
Esempio n. 14
0
        public CustomViewSequence(IStreamReader reader)
            : base(reader)
        {
            // CUSTOMVIEW = UserSViewBegin *Selection [HorizontalPageBreaks] [VerticalPageBreaks] [Header]
            //    [Footer] [HCenter] [VCenter] [LeftMargin] [RightMargin] [TopMargin] [BottomMargin]
            //    [Pls] [Setup] [PrintSize] [HeaderFooter] [AUTOFILTER] UserSViewEnd


            // NOTE: UserSViewBegin and UserSViewEnd seem to be optional to!


            // UserSViewBegin
            if (BiffRecord.GetNextRecordType(reader) == RecordType.UserSViewBegin)
            {
                this.UserSViewBegin = (UserSViewBegin)BiffRecord.ReadRecord(reader);
            }

            // *Selection
            this.Selections = new List <Selection>();
            while (BiffRecord.GetNextRecordType(reader) == RecordType.Selection)
            {
                this.Selections.Add((Selection)BiffRecord.ReadRecord(reader));
            }

            // [HorizontalPageBreaks]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.HorizontalPageBreaks)
            {
                this.HorizontalPageBreaks = (HorizontalPageBreaks)BiffRecord.ReadRecord(reader);
            }

            // [VerticalPageBreaks]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.VerticalPageBreaks)
            {
                this.VerticalPageBreaks = (VerticalPageBreaks)BiffRecord.ReadRecord(reader);
            }

            // [Header]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.Header)
            {
                this.Header = (Header)BiffRecord.ReadRecord(reader);
            }

            // [Footer]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.Footer)
            {
                this.Footer = (Footer)BiffRecord.ReadRecord(reader);
            }

            // [HCenter]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.HCenter)
            {
                this.HCenter = (HCenter)BiffRecord.ReadRecord(reader);
            }

            // [VCenter]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.VCenter)
            {
                this.VCenter = (VCenter)BiffRecord.ReadRecord(reader);
            }

            // [LeftMargin]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.LeftMargin)
            {
                this.LeftMargin = (LeftMargin)BiffRecord.ReadRecord(reader);
            }

            // [RightMargin]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.RightMargin)
            {
                this.RightMargin = (RightMargin)BiffRecord.ReadRecord(reader);
            }

            // [TopMargin]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.TopMargin)
            {
                this.TopMargin = (TopMargin)BiffRecord.ReadRecord(reader);
            }

            // [BottomMargin]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.BottomMargin)
            {
                this.BottomMargin = (BottomMargin)BiffRecord.ReadRecord(reader);
            }

            // [Pls]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.Pls)
            {
                this.Pls = (Pls)BiffRecord.ReadRecord(reader);
            }

            // [Setup]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.Setup)
            {
                this.Setup = (Setup)BiffRecord.ReadRecord(reader);
            }

            // [PrintSize]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.PrintSize)
            {
                this.PrintSize = (PrintSize)BiffRecord.ReadRecord(reader);
            }

            // [HeaderFooter]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.HeaderFooter)
            {
                this.HeaderFooter = (HeaderFooter)BiffRecord.ReadRecord(reader);
            }

            // [AUTOFILTER]
            if (BiffRecord.GetNextRecordType(reader) == RecordType.AutoFilterInfo)
            {
                this.AutoFilterSequence = new AutoFilterSequence(reader);
            }

            // UserSViewEnd
            if (BiffRecord.GetNextRecordType(reader) == RecordType.UserSViewEnd)
            {
                this.UserSViewEnd = (UserSViewEnd)BiffRecord.ReadRecord(reader);
            }
        }
Esempio n. 15
0
        private static void OnPreferencesGUI()
        {
            scroll = EditorGUILayout.BeginScrollView(scroll, false, false);

            EditorGUILayout.Separator();
            Enabled.DoGUI();
            EditorGUILayout.Separator();
            EditorGUILayout.HelpBox("Each item has a tooltip explaining what it does, keep the mouse over it to see.", MessageType.Info);
            EditorGUILayout.Separator();

            using (Enabled.GetEnabledScope()) {
                using (new GUIIndent("Misc settings")) {
                    using (new GUIIndent("Margins")) {
                        RightMargin.DoGUISlider(-50, 50);
                        LeftMargin.DoGUISlider(-50, 50);
                        Indent.DoGUISlider(0, 35);
                    }

                    Tree.DoGUI();

                    using (new GUIIndent())
                        using (SelectOnTree.GetFadeScope(Tree))
                            SelectOnTree.DoGUI();

                    Tooltips.DoGUI();

                    using (new GUIIndent())
                        using (RelevantTooltipsOnly.GetFadeScope(Tooltips))
                            RelevantTooltipsOnly.DoGUI();

                    EnhancedSelection.DoGUI();
                    Trailing.DoGUI();
                    ChangeAllSelected.DoGUI();
                    NumericChildExpand.DoGUI();

                    using (HideDefaultIcon.GetFadeScope(IsButtonEnabled(new Icons.GameObjectIcon())))
                        HideDefaultIcon.DoGUI();

                    GUI.changed = false;

                    using (AllowSelectingLocked.GetFadeScope(IsButtonEnabled(new Icons.Lock())))
                        AllowSelectingLocked.DoGUI();

                    using (AllowSelectingLockedSceneView.GetFadeScope(IsButtonEnabled(new Icons.Lock()) && AllowSelectingLocked))
                        AllowSelectingLockedSceneView.DoGUI();

                    if (GUI.changed && EditorUtility.DisplayDialog("Relock all objects",
                                                                   "Would you like to relock all objects?\n" +
                                                                   "This is recommended when changing this setting and might take a few seconds on large scenes" +
                                                                   "\nIt's also recommended to do this on all scenes", "Yes", "No"))
                    {
                        Utility.RelockAllObjects();
                    }

                    HoverTintColor.DoGUI();
                }

                using (new GUIIndent("Row separators")) {
                    LineSize.DoGUISlider(0, 6);

                    using (LineColor.GetFadeScope(LineSize > 0))
                        LineColor.DoGUI();

                    OddRowColor.DoGUI();
                    EvenRowColor.DoGUI();

                    GUI.changed = false;
                    var rect = EditorGUILayout.GetControlRect(false, rowColorsList.GetHeight());
                    rect.xMin += EditorGUI.indentLevel * 16f;
                    rowColorsList.DoList(rect);
                }

                MiniLabel.DoGUI();
                using (new GUIIndent()) {
                    using (SmallerMiniLabel.GetFadeScope(MiniLabel.Value != MiniLabelType.None))
                        SmallerMiniLabel.DoGUI();
                    using (HideDefaultTag.GetFadeScope(MiniLabelTagEnabled))
                        HideDefaultTag.DoGUI();
                    using (HideDefaultLayer.GetFadeScope(MiniLabelLayerEnabled))
                        HideDefaultLayer.DoGUI();
                    using (CentralizeMiniLabelWhenPossible.GetFadeScope((HideDefaultLayer || HideDefaultTag) && (MiniLabel.Value == MiniLabelType.TagAndLayer || MiniLabel.Value == MiniLabelType.LayerAndTag)))
                        CentralizeMiniLabelWhenPossible.DoGUI();
                }

                LeftSideButtonPref.DoGUI();
                using (new GUIIndent())
                    using (LeftmostButton.GetFadeScope(LeftSideButton != IconBase.rightNone))
                        LeftmostButton.DoGUI();

                using (new GUIIndent("Children behaviour on change")) {
                    using (LockAskMode.GetFadeScope(IsButtonEnabled(new Icons.Lock())))
                        LockAskMode.DoGUI();
                    using (LayerAskMode.GetFadeScope(IsButtonEnabled(new Icons.Layer()) || MiniLabelLayerEnabled))
                        LayerAskMode.DoGUI();
                    using (TagAskMode.GetFadeScope(IsButtonEnabled(new Icons.Tag()) || MiniLabelTagEnabled))
                        TagAskMode.DoGUI();
                    using (StaticAskMode.GetFadeScope(IsButtonEnabled(new Icons.Static())))
                        StaticAskMode.DoGUI();
                    using (IconAskMode.GetFadeScope(IsButtonEnabled(new Icons.GameObjectIcon())))
                        IconAskMode.DoGUI();

                    EditorGUILayout.HelpBox(string.Format("Pressing down {0} while clicking on a button will make it temporary have the opposite children change mode", Utility.CtrlKey), MessageType.Info);
                }

                leftIconsList.displayAdd = LeftIconsMenu.GetItemCount() > 0;
                leftIconsList.DoLayoutList();

                rightIconsList.displayAdd = RightIconsMenu.GetItemCount() > 0;
                rightIconsList.DoLayoutList();

                EditorGUILayout.HelpBox("Alt + Click on child expand toggle makes it expand all the grandchildren too", MessageType.Info);

                if (IsButtonEnabled(new Icons.Memory()))
                {
                    EditorGUILayout.HelpBox("\"Memory Used\" may create garbage and consequently framerate stutterings, leave it disabled if maximum performance is important for your project", MessageType.Warning);
                }

                if (IsButtonEnabled(new Icons.Lock()))
                {
                    EditorGUILayout.HelpBox("Remember to always unlock your game objects when removing or disabling this extension, as you won't be able to unlock without it and may lose scene data", MessageType.Warning);
                }

                GUI.enabled = true;
                EditorGUILayout.EndScrollView();

                using (new EditorGUILayout.HorizontalScope()) {
                    GUILayout.FlexibleSpace();
                    EditorGUILayout.LabelField(versionContent, GUILayout.Width(170f));
                }

                using (new EditorGUILayout.HorizontalScope()) {
                    if (GUILayout.Button(resetSettingsContent, GUILayout.Width(120f)))
                    {
                        onResetPreferences();
                    }

                    if (GUILayout.Button(unlockAllContent, GUILayout.Width(120f)))
                    {
                        Utility.UnlockAllObjects();
                    }

                    if (GUILayout.Button(mailDeveloperContent, GUILayout.Width(120f)))
                    {
                        Application.OpenURL(GetEmailURL());
                    }
                }

                EditorGUILayout.Separator();
                Styles.ReloadTooltips();
                EditorApplication.RepaintHierarchyWindow();
            }
        }
Esempio n. 16
0
        /// <summary>
        /// Возвращает ячейку с настройками может применятся для создания строки
        /// </summary>
        /// <param name="paragraph">1 Параграф для добавления в ячейку</param>
        /// <param name="width">Длина ячейки 567 - 1 см </param>
        /// <param name="type">Тип выравнивания</param>
        /// <param name="leftmargin">Левый отступ в пикселях</param>
        /// <param name="rightmargin">Правый отступ в пикселях</param>
        /// <param name="borders">Стиль отражение границы ячейки</param>
        /// <param name="gridNumber">Объединение ячеек</param>
        /// <param name="verticalmerge">1 Начало объединения 2 конец объединения</param>
        /// <param name="colorHex">Цвет ячейки</param>
        /// <returns></returns>
        public static TableCell GenerateCell(Paragraph paragraph, string width, TableWidthUnitValues type, string leftmargin = "0", string rightmargin = "0", TableVerticalAlignmentValues verticalAlignment = TableVerticalAlignmentValues.Bottom, TableCellBorders borders = null, int gridNumber = 0, int verticalmerge = 0, string colorHex = "FFFFFF")
        {
            TableCell           tableCell           = new TableCell();
            TableCellProperties tableCellProperties = new TableCellProperties();
            TableCellWidth      tableCellWidth      = new TableCellWidth()
            {
                Width = width, Type = type
            };
            GridSpan gridSpan = new GridSpan()
            {
                Val = gridNumber
            };
            TableCellVerticalAlignment tcVA = new TableCellVerticalAlignment()
            {
                Val = verticalAlignment
            };

            if (verticalmerge == 1)
            {
                VerticalMerge vertical = new VerticalMerge()
                {
                    Val = MergedCellValues.Restart
                };
                tableCellProperties.Append(vertical);
            }
            if (verticalmerge == 2)
            {
                VerticalMerge vertical = new VerticalMerge()
                {
                    Val = MergedCellValues.Continue
                };
                tableCellProperties.Append(vertical);
            }
            TableCellMargin tableCellMargin = new TableCellMargin();

            if (leftmargin != "0")
            {
                LeftMargin leftMargin = new LeftMargin()
                {
                    Width = leftmargin, Type = TableWidthUnitValues.Dxa
                };
                tableCellMargin.Append(leftMargin);
            }

            if (rightmargin != "0")
            {
                RightMargin rightMargin = new RightMargin()
                {
                    Width = rightmargin, Type = TableWidthUnitValues.Dxa
                };
                tableCellMargin.Append(rightMargin);
            }

            Shading shading = new Shading()
            {
                Color = "auto", Fill = colorHex, Val = ShadingPatternValues.Clear
            };

            tableCellProperties.Append(shading);
            tableCellProperties.Append(tcVA);
            tableCellProperties.Append(tableCellWidth);
            tableCellProperties.Append(tableCellMargin);
            tableCellProperties.Append(gridSpan);

            if (borders != null)
            {
                tableCellProperties.Append(borders);
            }

            tableCell.Append(tableCellProperties);
            tableCell.Append(paragraph);

            return(tableCell);
        }