/// <summary> /// Initializes a new instance of the <see cref="SetOpenXmlParagraphNumerationForm"/> class. /// </summary> /// <param name="documentVisualEditor">The Office document visual editor.</param> public SetOpenXmlParagraphNumerationForm(OfficeDocumentVisualEditor documentVisualEditor) : this() { _documentVisualEditor = documentVisualEditor; _documentEditor = documentVisualEditor.CreateDocumentEditor(); UpdateUI(); }
/// <summary> /// Handles the ActiveInteractionControllerChanged event of VisualTool object. /// </summary> private void VisualTool_ActiveInteractionControllerChanged(object sender, Vintasoft.Imaging.PropertyChangedEventArgs <IInteractionController> e) { OfficeDocumentVisualEditor visualEditor = null; if (e.NewValue != null) { visualEditor = CompositeInteractionController.FindInteractionController <OfficeDocumentVisualEditor>(e.NewValue); } VisualEditor = visualEditor; }
/// <summary> /// Shows the chart form. /// </summary> /// <param name="visualEditor">The visual editor for Office document.</param> private void ShowChartForm(OfficeDocumentVisualEditor visualEditor) { OpenXmlDocumentChartDataForm chartForm = new OpenXmlDocumentChartDataForm(); chartForm.VisualEditor = visualEditor; if (Owner != null) { chartForm.Location = Owner.Location; } else { chartForm.Location = Location; } chartForm.ShowDialog(); }
/// <summary> /// Handles the Interaction event of the OfficeDocumentInteractionController. /// </summary> private void _officeDocumentInteractionController_Interaction(object sender, InteractionEventArgs e) { // if mouse is double clicked if (e.MouseClickCount == 2) { // find visual editor OfficeDocumentVisualEditor visualEditor = CompositeInteractionController.FindInteractionController <OfficeDocumentVisualEditor>(e.InteractionController); // if visual editor is found and has charts if (visualEditor != null && visualEditor.HasCharts) { // create document editor using (DocxDocumentEditor editor = visualEditor.CreateDocumentEditor()) { // if document has chart(s) and don't have text if (editor.Charts.Length > 0 && string.IsNullOrEmpty(editor.Body.Text.Trim('\n'))) { // open chart editor form ShowChartForm(visualEditor); e.InteractionOccured(false); } } } } }
/// <summary> /// Handles the ActiveInteractionControllerChanged event of the VisualTool. /// </summary> private void VisualTool_ActiveInteractionControllerChanged(object sender, Vintasoft.Imaging.PropertyChangedEventArgs <IInteractionController> e) { // if interaction controller exists if (e.NewValue != null) { // find visual editor in current interaction controller VisualEditor = CompositeInteractionController.FindInteractionController <OfficeDocumentVisualEditor>(e.NewValue); } else { VisualEditor = null; } // if visual editor exists if (VisualEditor != null) { // set current OfficeDocumentInteractionController OfficeDocumentInteractionController = e.NewValue; } else { OfficeDocumentInteractionController = null; } // if visual editor is not found or disabled if (VisualEditor == null || !VisualEditor.IsEnabled) { // if this form is visible if (Visible) { // hide this form Hide(); } } else { // if this form is not visible if (!Visible) { try { // if owner form is specified if (Owner != null) { // if owner form is moved if (_ownerLastLocation != Owner.Location) { // reset location _ownerLastLocation = Owner.Location; int x = LocationOffsetFromOwnerForm.X; if (x < 0) { x += Owner.Size.Width - Size.Width; } int y = LocationOffsetFromOwnerForm.Y; if (y < 0) { y += Owner.Size.Height - Size.Height; } Location = new Point(Owner.Location.X + x, Owner.Location.Y + y); } // show form Show(); // set focus to owner form Owner.Focus(); } else { // show form Show(); } } catch { } } } }