Exemplo n.º 1
0
 internal void FixLinks(ExcelFile Workbook, int ActiveSheet)
 {
     BuildTree(Workbook);
     for (int i = 0; i < Tree.Count; i++)
     {
         if (Tree[i].Buttons.Count > 0)
         {
             TMsObj ms = Tree[i].Buttons[0].ClientData as TMsObj;
             if (ms != null)
             {
                 TCellAddress LinkedCell = ms.GetObjectLink(Workbook);
                 if (LinkedCell != null)
                 {
                     CheckRadioButtons(Workbook, ActiveSheet, i, LinkedCell);
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
        internal void Remove(TEscherClientDataRecord ms)
        {
            TMsObj obj = ms.ClientData as TMsObj;

            if (obj == null)
            {
                return;
            }
            switch ((TObjectType)(obj.ObjType))
            {
            case TObjectType.GroupBox:
                //remove from RadioButtonsById; and send all of those to copied.
                for (int i = Tree.Count - 1; i >= 1; i--)
                {
                    if (Tree[i].Group == ms)
                    {
                        for (int k = 0; k < Tree[i].Buttons.Count; k++)
                        {
                            RadioButtonsById.Remove(Tree[i].Buttons[k].ObjId);
                            CopiedEntries.Add(Tree[i].Buttons[k]);
                        }
                        Tree.RemoveAt(i);
                        return;
                    }
                }
                return;

            case TObjectType.OptionButton:
                for (int i = NewEntries.Count - 1; i >= 0; i--)
                {
                    if (NewEntries[i] == ms)
                    {
                        NewEntries.RemoveAt(i);
                        return;
                    }
                }
                for (int i = CopiedEntries.Count - 1; i >= 0; i--)
                {
                    if (CopiedEntries[i] == ms)
                    {
                        CopiedEntries.RemoveAt(i);
                        return;
                    }
                }

                TRadioGroupCache rb;
                if (RadioButtonsById.TryGetValue(ms.ObjId, out rb))
                {
                    RadioButtonsById.Remove(ms.ObjId);
                    for (int i = rb.Buttons.Count - 1; i >= 0; i--)
                    {
                        if (rb.Buttons[i] == ms)
                        {
                            rb.Buttons.RemoveAt(i);
                            break;
                        }
                    }
                }
                return;
            }
        }