public void CopyAllSelected(DiagramEntityContainer container)

        /* ============================================================
         *      Function :		CDiagramClipboardHandler::CopyAllSelected
         *      Description :	Clones all selected object to the paste
         *                                      array.
         *      Access :		Public
         *
         *      Return :		void
         *      Parameters :	none
         *
         *      Usage :			Call to copy all selected objects to the
         *                                      clipboard. "Paste" will put them on screen.
         *
         * ============================================================*/
        {
            ClearPaste();
            List <object> arr = container.GetData();


            int max = arr.Count;

            for (int t = 0; t < max; t++)
            {
                DiagramEntity obj = (DiagramEntity)(arr[t]);
                if (obj.Selected)
                {
                    DiagramEntity newobj = obj.Clone();
                    newobj.Selected = (true);
                    newobj.MoveRect(10, 10);
                    newobj.GroupID = (obj.GroupID);
                    m_paste.Add(newobj);
                }
            }
        }
        public List <DiagramEntity> Paste(DiagramEntityContainer container)

        /* ============================================================
         *      Function :		CDiagramClipboardHandler::Paste
         *      Description :	Clones the contents of the paste array
         *                                      into the container data array.
         *      Access :		Public
         *
         *      Return :		void
         *      Parameters :	none
         *
         *      Usage :			Call to paste the contents of the clipboard
         *                                      to screen.
         *
         * ============================================================*/
        {
            List <int> oldgroup = new List <int>();
            List <int> newgroup = new List <int>();

            int max = m_paste.Count;

            for (int t = 0; t < max; t++)
            {
                DiagramEntity obj = (DiagramEntity)(m_paste[t]);
                if (obj.GroupID != 0)
                {
                    int  size  = oldgroup.Count;
                    bool found = false;
                    for (int i = 0; i < size; i++)
                    {
                        if (obj.GroupID == (int)(oldgroup[i]))
                        {
                            found = true;
                        }
                    }

                    if (!found)
                    {
                        oldgroup.Add(obj.GroupID);
                        newgroup.Add(GroupFactory.GetNewGroup());
                    }
                }
            }

            List <DiagramEntity> pastedObjs = new List <DiagramEntity>();

            for (int t = 0; t < max; t++)
            {
                DiagramEntity obj   = ( DiagramEntity)(m_paste[t]);
                DiagramEntity clone = obj.Clone();

                int group = 0;
                if (obj.GroupID != 0)
                {
                    int size = oldgroup.Count;
                    for (int i = 0; i < size; i++)
                    {
                        if (obj.GroupID == (int)(oldgroup[i]))
                        {
                            group = newgroup[i];
                        }
                    }
                }

                clone.GroupID = (group);
                clone.setID(DiagramEntity.createNewGUID());
                container.Add(clone);
                pastedObjs.Add(clone);
            }

            return(pastedObjs);
        }