/// <summary>
        /// Get the text to copy or use for drag and drop operations
        /// </summary>
        /// <returns>The text to use or null if there is nothing to copy</returns>
        private string GetTextToCopy()
        {
            EntityReference r          = tvEntities.SelectedItem as EntityReference;
            string          textToCopy = null;

            if (r != null)
            {
                switch (r.EntityType)
                {
                case EntityType.File:
                    // Not useable
                    break;

                case EntityType.Token:
                    Token t = (Token)r.Tag;
                    textToCopy = t.ToToken();
                    break;

                case EntityType.Image:
                    ImageReference ir = (ImageReference)r.Tag;

                    if (rbMediaLink.IsChecked.Value)
                    {
                        textToCopy = ir.ToMediaLink();
                    }
                    else
                    if (rbMediaLinkInline.IsChecked.Value)
                    {
                        textToCopy = ir.ToMediaLinkInline();
                    }
                    else
                    if (rbExternalLink.IsChecked.Value)
                    {
                        textToCopy = ir.ToExternalLink();
                    }
                    else
                    {
                        textToCopy = ir.ToImageLink();
                    }
                    break;

                case EntityType.CodeSnippet:
                    CodeReference cr = (CodeReference)r.Tag;
                    textToCopy = cr.ToCodeReference();
                    break;

                case EntityType.TocEntry:
                    TocEntry toc = (TocEntry)r.Tag;

                    // MAML topic?
                    if (!String.IsNullOrEmpty(toc.Id))
                    {
                        if (rbMamlLink.IsChecked.Value)
                        {
                            textToCopy = String.Format(CultureInfo.InvariantCulture,
                                                       "<link xlink:href=\"{0}\" />", (toc.Id ?? "[Unknown ID]"));
                        }
                        else
                        if (rbConceptualLink.IsChecked.Value)
                        {
                            textToCopy = String.Format(CultureInfo.InvariantCulture,
                                                       "<conceptualLink target=\"{0}\" />", (toc.Id ?? "[Unknown ID]"));
                        }
                        else
                        {
                            textToCopy = String.Format(CultureInfo.InvariantCulture,
                                                       "<a href=\"html/{0}.htm\">{1}</a>", toc.Id, toc.Title);
                        }
                    }
                    else
                    {
                        textToCopy = toc.ToAnchor(toc.Title);
                    }
                    break;

                default:        // Code entity reference
                    CodeEntityReference ce = (CodeEntityReference)r.Tag;

                    if (rbCodeEntityRef.IsChecked.Value)
                    {
                        textToCopy = ce.ToCodeEntityReference();
                    }
                    else
                    {
                        textToCopy = ce.ToSee();
                    }
                    break;
                }
            }

            return(textToCopy);
        }