public int Exec()

in src/CopyAsHtml/CopyAsHtml/CommandFilter.cs [67:144]


        public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            bool isCopyHtmlMarkup = false;
            if (pguidCmdGroup == GuidList.CommandSetGuid && nCmdID == 0x100) // Copy Html Markup
            {
                isCopyHtmlMarkup = true;
            }

            // If the command is copy or cut, handle it here, otherwise route through the rest of the
            // command handler chain
            var isCopy = IsCopyCommand(pguidCmdGroup, nCmdID);
            var isCut = IsCutCommand(pguidCmdGroup, nCmdID);
            var isLineCut = nCmdID == (uint)VSConstants.VSStd2KCmdID.CUTLINE;

            // respect the "Apply Cut or Copy commands to blank lines when there is no selection" option
            if (_textView.Selection.IsEmpty)
            {
                if (isCut && !_editorOperations.CanCut)
                {
                    return VSConstants.S_OK;
                }

                if (isCopy || isCopyHtmlMarkup)
                {
                    if (IsPointOnBlankViewLine() && !_editorOptions.GetOptionValue(DefaultTextViewOptions.CutOrCopyBlankLineIfNoSelectionId))
                    {
                        // all conditions are met: no selection, blank line, option off - bail now
                        return VSConstants.S_OK;
                    }
                }
            }

            if (isCopy || isCopyHtmlMarkup || isCut)
            {
                string html = null;
                string rtf = null;
                string text = null;
                NormalizedSnapshotSpanCollection applicabilitySpans = null;
                bool singleLineOperation;
                bool isBoxCopy = _textView.Selection.Mode == TextSelectionMode.Box;

                int tabSize = _editorOptions.GetOptionValue<int>(DefaultOptions.TabSizeOptionId);

                this.GenerateClipboardData(
                    isLineCut,
                    tabSize,
                    out html,
                    out rtf,
                    out text,
                    out applicabilitySpans,
                    out singleLineOperation);

                if (isCut)
                {
                    this.DeleteSpan(applicabilitySpans);
                }

                if (isCopyHtmlMarkup)
                {
                    text = html;
                    html = null;
                    rtf = null;
                    singleLineOperation = false;
                    isBoxCopy = false;
                }

                ClipboardSupport.SetClipboardData(html, rtf, text, singleLineOperation, isBoxCopy);

                if (isCopyHtmlMarkup)
                {
                    _telemetrySession.PostEvent("VS/PPT-CopyAsHTML/Invoked");
                }

                return VSConstants.S_OK;
            }

            return _nextCommandTargetInChain.Exec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
        }