Пример #1
0
        TryCollapseOrExpandSelectedGroups
        (
            Microsoft.Office.Interop.Excel.Workbook oWorkbook,
            Boolean bCollapse
        )
        {
            Debug.Assert(oWorkbook != null);

            ListObject oGroupTable;
            Range      oSelectedTableRange;

            if (ExcelTableUtil.TryGetSelectedTableRange(oWorkbook,
                                                        WorksheetNames.Groups, TableNames.Groups, out oGroupTable,
                                                        out oSelectedTableRange))
            {
                // Store the new collapsed state in the group table.

                ExcelTableUtil.SetVisibleSelectedTableColumnData(oGroupTable,
                                                                 oSelectedTableRange, GroupTableColumnNames.Collapsed,
                                                                 (new BooleanConverter()).GraphToWorkbook(bCollapse));

                return(true);
            }

            return(false);
        }
Пример #2
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;
                }
            }
        }
Пример #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;
                }
            }
        }