Ejemplo n.º 1
0
        private bool AddToTree(TEscherClientDataRecord obj, bool MightNotBeFirst, IRowColSize Workbook)
        {
            TEscherOPTRecord CbObj    = (obj.Parent as TEscherSpContainerRecord).FindRec <TEscherOPTRecord>() as TEscherOPTRecord;
            TClientAnchor    CbAnchor = TDrawing.GetObjectAnchorAbsolute(CbObj, Workbook);

            for (int i = 1; i < Tree.Count; i++) // 0 is desktop
            {
                TEscherOPTRecord GrpObj  = (Tree[i].Group.Parent as TEscherSpContainerRecord).FindRec <TEscherOPTRecord>() as TEscherOPTRecord;
                TClientAnchor    GAnchor = TDrawing.GetObjectAnchorAbsolute(GrpObj, Workbook);

                if ((MightNotBeFirst || Tree[i].Buttons.Count == 0) && GAnchor.Contains(CbAnchor))
                {
                    AddRadioButton(obj, i);
                    return(true);
                }
            }

            if (MightNotBeFirst || Tree[0].Buttons.Count == 0)
            {
                AddRadioButton(obj, 0);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
 private void ProcessCopiedEntries(List <TEscherClientDataRecord> Entries, IRowColSize Workbook)
 {
     for (int i = 0; i < Entries.Count; i++)
     {
         TEscherClientDataRecord obj = Entries[i];
         AddToTree(obj, true, Workbook);
     }
     Entries.Clear();
 }
Ejemplo n.º 3
0
        private void ProcessNewEntries(IRowColSize Workbook)
        {
            Dictionary <int, TEscherClientDataRecord> OtherRb = new Dictionary <int, TEscherClientDataRecord>();

            for (int i = NewEntries.Count - 1; i >= 0; i--)
            {
                TEscherClientDataRecord obj = NewEntries[i];
                if (obj.IsFirstRadioButton)
                {
                    if (AddToTree(obj, false, Workbook))
                    {
                        NewEntries.RemoveAt(i);
                    }
                }
                else
                {
                    OtherRb.Add(obj.ObjId, obj);
                }
            }

            for (int i = 0; i < Tree.Count; i++) //0 is root
            {
                if (Tree[i].Buttons.Count == 1)
                {
                    TEscherClientDataRecord Current = Tree[i].Buttons[0];
                    do
                    {
                        int NextId = Current.NextRbId;
                        if (NextId == 0)
                        {
                            break;              //if not careful, we could have an infinite loop here. for example is NextId = NextNextId, or maybe NextId = NextNextNextId
                        }
                        if (!OtherRb.TryGetValue(NextId, out Current))
                        {
                            break;
                        }
                        OtherRb.Remove(NextId); //to avoid infinite loop commented above.
                        NewEntries.Remove(Current);
                        Tree[i].Buttons.Add(Current);
                        RadioButtonsById[NextId] = Tree[i];
                    } while (true);
                }
            }
        }
Ejemplo n.º 4
0
        internal bool Find(TEscherSpContainerRecord R, out List <TEscherClientDataRecord> BtnGroup, IRowColSize Workbook)
        {
            BtnGroup = null;
            if (R == null)
            {
                return(false);
            }
            TEscherClientDataRecord Cd = R.FindRec <TEscherClientDataRecord>() as TEscherClientDataRecord;

            if (Cd == null)
            {
                return(false);
            }
            BuildTree(Workbook);

            TRadioGroupCache rgc;

            if (!RadioButtonsById.TryGetValue(Cd.ObjId, out rgc))
            {
                return(false);
            }

            BtnGroup = rgc.Buttons;
            return(true);
        }
Ejemplo n.º 5
0
 internal void BuildTree(IRowColSize Workbook)
 {
     ProcessNewEntries(Workbook);
     ProcessCopiedEntries(NewEntries, Workbook); //just in case it was not defined.
     ProcessCopiedEntries(CopiedEntries, Workbook);
 }
Ejemplo n.º 6
0
        private static TFlxFontStyles CachedFontStyle; //STATIC*
#endif

        #region Font0Width
        /// <summary>
        /// Returns the width of the 0 font on Excel. Normally this is 7, but can change depending on
        /// the file. The user might modify it by changing Format->Style->Normal.
        /// </summary>
        /// <param name="Workbook"></param>
        /// <returns></returns>
        public static real GetFont0Width(IRowColSize Workbook)
        {
            TFlxFont Fx = Workbook.GetDefaultFont;

            return(GetFont0Width(Fx));
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Multiply by this number to convert the width of a column from pixels to excel internal units.
 /// Note that the default column width is different, you need to multiply by <see cref="DefColWidthAdapt(int, ExcelFile)"/>
 /// </summary>
 public static real ColMult(IRowColSize Workbook)
 {
     return(FmlaMult(Workbook) * 256F / GetFont0Width(Workbook));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Multiply by this number to convert the height of a row from GraphicsUnit.Display units (1/100 inch)
 /// to Excel internal units.
 /// </summary>
 /// <remarks>
 /// 1 Height unit=1/20 pt. 1pt=1/72 inch. -> 1 Height unit=1/(72*20) inch. -> 1inch/100= 72*20/100= 14.4
 /// PrintPreview on Excel uses different coordinates than the screen.
 /// </remarks>
 //public static readonly real RowMultDisplay= 14.64F;  //14.72F;
 public static real RowMultDisplay(IRowColSize Workbook)
 {
     return(14.83F * Workbook.HeightCorrection);             //14.72F; 83
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Multiply by this number to convert the width of a column from GraphicsUnit.Display units (1/100 inch)
 /// to Excel internal units. Note that the default column width is different, you need to multiply by <see cref="DefColWidthAdapt(int, ExcelFile)"/>
 /// </summary>
 public static real ColMultDisplay(IRowColSize Workbook)
 {
     return((real)(FmlaMult(Workbook) * 33.358 * 7F / GetFont0Width(Workbook) * Workbook.WidthCorrection));
     //33.34F return 256f/GetFont0Width(Workbook);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// When showing/printing the sheet and "Show formula" check box is on, column widths are double of the normal ones.
 /// This method returns 0.5 when "Show formulas" is turned on, and 1 if it is not.
 /// </summary>
 public static real FmlaMult(IRowColSize Workbook)
 {
     return(Workbook.ShowFormulaText? 0.5f: 1f);
 }