Provides information for the command that needs to be run when the user sets a visual attribute in the Ribbon.
See RunCommandEventArgs for information about how NodeXL sends commands from one UI object to another.

The first event handler that sets the specified visual attribute should set the VisualAttributeSet property to true, and other event handlers should then ignore the event.

Наследование: RunCommandEventArgs
Пример #1
0
        SetVisualAttribute
        (
            RunSetVisualAttributeCommandEventArgs e,
            Range selectedRange,
            String colorColumnName,
            String alphaColumnName
        )
        {
            Debug.Assert(e != null);
            Debug.Assert(selectedRange != null);
            Debug.Assert(ExcelUtil.WorksheetIsActive(m_oWorksheet.InnerObject));
            AssertValid();

            if (e.VisualAttribute == VisualAttributes.Color &&
                colorColumnName != null)
            {
                String sColor;

                // Get a color from the user.

                if (NodeXLWorkbookUtil.TryGetColor(out sColor))
                {
                    ExcelTableUtil.SetVisibleSelectedTableColumnData(
                        m_oTable.InnerObject, selectedRange, colorColumnName,
                        sColor);

                    e.VisualAttributeSet = true;
                }
            }
        }
Пример #2
0
        SetVisualAttribute
        (
            RunSetVisualAttributeCommandEventArgs e
        )
        {
            Debug.Assert(e != null);
            AssertValid();

            Microsoft.Office.Interop.Excel.Range oSelectedRange;

            if (e.VisualAttributeSet ||
                !m_oSheets1And2Helper.TryGetSelectedRange(out oSelectedRange))
            {
                return;
            }

            // See if the specified attribute is set by the helper class.

            m_oSheets1And2Helper.SetVisualAttribute(e, oSelectedRange,
                                                    EdgeTableColumnNames.Color, CommonTableColumnNames.Alpha);

            if (e.VisualAttributeSet)
            {
                return;
            }

            if (e.VisualAttribute == VisualAttributes.EdgeWidth)
            {
                EdgeWidthDialog oEdgeWidthDialog = new EdgeWidthDialog();

                if (oEdgeWidthDialog.ShowDialog() == DialogResult.OK)
                {
                    ExcelTableUtil.SetVisibleSelectedTableColumnData(
                        this.Edges.InnerObject, oSelectedRange,
                        EdgeTableColumnNames.Width, oEdgeWidthDialog.EdgeWidth);

                    e.VisualAttributeSet = true;
                }
            }
            else if (e.VisualAttribute == VisualAttributes.EdgeVisibility)
            {
                Debug.Assert(e.AttributeValue is EdgeWorksheetReader.Visibility);

                ExcelTableUtil.SetVisibleSelectedTableColumnData(
                    this.Edges.InnerObject, oSelectedRange,
                    CommonTableColumnNames.Visibility,

                    (new EdgeVisibilityConverter()).GraphToWorkbook(
                        (EdgeWorksheetReader.Visibility)e.AttributeValue)
                    );

                e.VisualAttributeSet = true;
            }
        }
Пример #3
0
    SetVisualAttribute
    (
        RunSetVisualAttributeCommandEventArgs e
    )
    {
        Debug.Assert(e != null);
        AssertValid();

        Microsoft.Office.Interop.Excel.Range oSelectedRange;

        if ( e.VisualAttributeSet ||
            !m_oSheets1And2Helper.TryGetSelectedRange(out oSelectedRange) )
        {
            return;
        }

        // See if the specified attribute is set by the helper class.

        m_oSheets1And2Helper.SetVisualAttribute(e, oSelectedRange,
            EdgeTableColumnNames.Color, CommonTableColumnNames.Alpha);

        if (e.VisualAttributeSet)
        {
            return;
        }

        if (e.VisualAttribute == VisualAttributes.EdgeWidth)
        {
            EdgeWidthDialog oEdgeWidthDialog = new EdgeWidthDialog();

            if (oEdgeWidthDialog.ShowDialog() == DialogResult.OK)
            {
                ExcelTableUtil.SetVisibleSelectedTableColumnData(
                    this.Edges.InnerObject, oSelectedRange,
                    EdgeTableColumnNames.Width, oEdgeWidthDialog.EdgeWidth);

                e.VisualAttributeSet = true;
            }
        }
        else if (e.VisualAttribute == VisualAttributes.EdgeVisibility)
        {
            Debug.Assert(e.AttributeValue is EdgeWorksheetReader.Visibility);

            ExcelTableUtil.SetVisibleSelectedTableColumnData(
                this.Edges.InnerObject, oSelectedRange,
                CommonTableColumnNames.Visibility,

                ( new EdgeVisibilityConverter() ).GraphToWorkbook(
                    (EdgeWorksheetReader.Visibility)e.AttributeValue)
                );

            e.VisualAttributeSet = true;
        }
    }
Пример #4
0
        SetVisualAttribute
        (
            RunSetVisualAttributeCommandEventArgs e
        )
        {
            Debug.Assert(e != null);
            AssertValid();

            Microsoft.Office.Interop.Excel.Range oSelectedRange;

            if (e.VisualAttributeSet ||
                !m_oSheetHelper.TryGetSelectedRange(out oSelectedRange))
            {
                return;
            }

            // See if the specified attribute is set by the helper class.

            m_oSheetHelper.SetVisualAttribute(e, oSelectedRange,
                                              GroupTableColumnNames.VertexColor, null);

            if (e.VisualAttributeSet)
            {
                return;
            }

            if (e.VisualAttribute == VisualAttributes.VertexShape)
            {
                Debug.Assert(e.AttributeValue is VertexShape);

                ExcelTableUtil.SetVisibleSelectedTableColumnData(
                    this.Groups.InnerObject, oSelectedRange,
                    GroupTableColumnNames.VertexShape,

                    (new VertexShapeConverter()).GraphToWorkbook(
                        (VertexShape)e.AttributeValue)
                    );

                e.VisualAttributeSet = true;
            }
        }
Пример #5
0
        SetVisualAttribute
        (
            RunSetVisualAttributeCommandEventArgs e,
            Range selectedRange,
            String colorColumnName,
            String alphaColumnName
        )
        {
            Debug.Assert(e != null);
            Debug.Assert(selectedRange != null);
            Debug.Assert(ExcelUtil.WorksheetIsActive(m_oWorksheet.InnerObject));
            AssertValid();

            base.SetVisualAttribute(e, selectedRange, colorColumnName,
                                    alphaColumnName);

            if (e.VisualAttributeSet)
            {
                return;
            }

            if (e.VisualAttribute == VisualAttributes.Alpha &&
                alphaColumnName != null)
            {
                AlphaDialog oAlphaDialog = new AlphaDialog();

                if (oAlphaDialog.ShowDialog() == DialogResult.OK)
                {
                    ExcelTableUtil.SetVisibleSelectedTableColumnData(
                        m_oTable.InnerObject, selectedRange, alphaColumnName,
                        oAlphaDialog.Alpha);

                    e.VisualAttributeSet = true;
                }
            }
        }
    SetVisualAttribute
    (
        RunSetVisualAttributeCommandEventArgs e,
        Range selectedRange,
        String colorColumnName,
        String alphaColumnName
    )
    {
        Debug.Assert(e != null);
        Debug.Assert(selectedRange != null);
        Debug.Assert( ExcelUtil.WorksheetIsActive(m_oWorksheet.InnerObject) );
        AssertValid();

        base.SetVisualAttribute(e, selectedRange, colorColumnName,
            alphaColumnName);

        if (e.VisualAttributeSet)
        {
            return;
        }

        if (e.VisualAttribute == VisualAttributes.Alpha &&
            alphaColumnName != null)
        {
            AlphaDialog oAlphaDialog = new AlphaDialog();

            if (oAlphaDialog.ShowDialog() == DialogResult.OK)
            {
                ExcelTableUtil.SetVisibleSelectedTableColumnData(
                    m_oTable.InnerObject, selectedRange, alphaColumnName,
                    oAlphaDialog.Alpha);

                e.VisualAttributeSet = true;
            }
        }
    }
Пример #7
0
    SetVisualAttribute
    (
        RunSetVisualAttributeCommandEventArgs e
    )
    {
        Debug.Assert(e != null);
        AssertValid();

        Microsoft.Office.Interop.Excel.Range oSelectedRange;

        if ( e.VisualAttributeSet ||
            !m_oSheetHelper.TryGetSelectedRange(out oSelectedRange) )
        {
            return;
        }

        // See if the specified attribute is set by the helper class.

        m_oSheetHelper.SetVisualAttribute(e, oSelectedRange,
            GroupTableColumnNames.VertexColor, null);

        if (e.VisualAttributeSet)
        {
            return;
        }

        if (e.VisualAttribute == VisualAttributes.VertexShape)
        {
            Debug.Assert(e.AttributeValue is VertexShape);

            ExcelTableUtil.SetVisibleSelectedTableColumnData(
                this.Groups.InnerObject, oSelectedRange,
                GroupTableColumnNames.VertexShape,

                ( new VertexShapeConverter() ).GraphToWorkbook(
                    (VertexShape)e.AttributeValue)
                );

            e.VisualAttributeSet = true;
        }
    }