diff --git a/PROMS/Volian.Controls.Library/DSOTabPanel.cs b/PROMS/Volian.Controls.Library/DSOTabPanel.cs
index 654ff1b3..d69d1af3 100644
--- a/PROMS/Volian.Controls.Library/DSOTabPanel.cs
+++ b/PROMS/Volian.Controls.Library/DSOTabPanel.cs
@@ -17,7 +17,7 @@ namespace Volian.Controls.Library
#region Private Fields
private DisplayTabControl _MyDisplayTabControl;
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
- private AxDSOFramer.AxFramerControl _MyDSOFramer;
+ private AxEDWordLib.AxEDWord _MyEdWord; // B2017-133 Edraw DSO Framer Replacement
private TransparentPanel _MyTransparentPanel;
private static int _Count = 0;
private DocumentInfo _MyDocumentInfo;
@@ -80,9 +80,10 @@ namespace Volian.Controls.Library
{
get
{
- if (_MyDSOFramer == null) return false;
- LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
- return !doc.Saved;
+ if (_MyEdWord == null) return false; // B2017-133 Edraw Is Dirty Property
+ return _MyEdWord.IsDirty();
+ //LBDocumentClass doc = new LBDocumentClass(_MyEdWord.ActiveDocument());
+ //return !doc.Saved;
}
}
private bool _OverrideClose = false;
@@ -108,16 +109,48 @@ namespace Volian.Controls.Library
_MyDocumentInfo = documentInfo;
SetupDSO();
_RefreshTimer = new Timer(); // Enabled is false and interval is 1/10th of second.
+ _RefreshTimer.Interval = 1000;// B2017-133 Edraw
ClientSizeChanged += new EventHandler(DSOTabPanel_ClientSizeChanged);
_RefreshTimer.Tick += new EventHandler(_RefreshTimer_Tick);
+ _MyEdWord.BeforeDocumentClosed += _MyEdWord_BeforeDocumentClosed;// B2017-133 Edraw
+ _MyEdWord.BeforeDocumentOpened += _MyEdWord_BeforeDocumentOpened;// B2017-133 Edraw
+ _MyEdWord.BeforeDocumentSaved += _MyEdWord_BeforeDocumentSaved;// B2017-133 Edraw
//_frm = new frmPG(_MyDSOFramer);
//_frm.Show();
}
+ void _MyEdWord_BeforeDocumentSaved(object sender, EventArgs e)// B2017-133 Edraw
+ {
+ SaveDSO();
+ }
+ void _MyEdWord_BeforeDocumentOpened(object sender, EventArgs e)// B2017-133 Edraw
+ {
+ _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableClose, true);
+ _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableNew, true);
+ _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisablePrint, true);
+ _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisablePrintPreview, true);
+ _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisablePrintQuick, true);
+ _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableSave, false);
+ _MyEdWord.DisableFileCommand(EDWordLib.WdUIType.wdUIDisableSaveAs, true);
+ _MyEdWord.DisableStandardCommand(EDWordLib.CommandType.cmdTypeSave, true);
+ _MyEdWord.DisableStandardCommand(EDWordLib.CommandType.cmdTypeClose, true);
+ _MyEdWord.DisableStandardCommand(EDWordLib.CommandType.cmdTypePrint, true);
+ _MyEdWord.DisableSaveHotKey(true);
+ _MyEdWord.DisablePrintHotKey(true);
+ }
+ void _MyEdWord_BeforeDocumentClosed(object sender, EventArgs e)// B2017-133 Edraw
+ {
+ Console.WriteLine("B2017-133 Edraw Before Document Closed");
+ }
void _RefreshTimer_Tick(object sender, EventArgs e)
{
_RefreshTimer.Enabled = false;
- if(_MyDSOFramer != null)
- _MyDSOFramer.Focus();
+ if (_MyEdWord != null)// B2017-133 Edraw
+ {
+ _MyEdWord.Focus();
+ _MyEdWord.GotoItem(EDWordLib.WdGoToItem.wdGoToStart, EDWordLib.WdGoToDirection.wdGoToFirst);
+ //_MyEdWord.BringToFront();
+ //_MyEdWord.EndInit();
+ }
}
void DSOTabPanel_ClientSizeChanged(object sender, EventArgs e)
{
@@ -135,13 +168,13 @@ namespace Volian.Controls.Library
_Count++; // Increment the count of open Word documents (Limit = MSWordLimit)
_MyCount = _Count;
this._MyTransparentPanel = new TransparentPanel();
- this._MyDSOFramer = new AxDSOFramer.AxFramerControl();
- ((System.ComponentModel.ISupportInitialize)(this._MyDSOFramer)).BeginInit();
- this.Controls.Add(this._MyDSOFramer);
+ this._MyEdWord = new AxEDWordLib.AxEDWord();// B2017-133 Edraw
+ _MyEdWord.BeginInit();
+ this.Controls.Add(this._MyEdWord);
this.Controls.Add(this._MyTransparentPanel); // A transparent panel is added over top of the DSO Framer window so that
// the related tab can be activated when the user clicks on a Word Document. Since the Word document is actually running
// in a different thread, it does not behave properly with focus events.
- this.components.Add(this._MyDSOFramer);
+ this.components.Add(this._MyEdWord);// B2017-133 Edraw
this.components.Add(this._MyTransparentPanel);
this._MyTransparentPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this._MyTransparentPanel.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
@@ -152,20 +185,20 @@ namespace Volian.Controls.Library
//this._MyTransPanel.Size = new System.Drawing.Size(370, 423);
//this._MyTransPanel.TabIndex = 1;
this._MyTransparentPanel.Click += new EventHandler(_MyTransparentPanel_Click);
- this._MyDSOFramer.Dock = System.Windows.Forms.DockStyle.Fill;
+ this._MyEdWord.Dock = System.Windows.Forms.DockStyle.Fill;
//System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WordDSOTab));
//this._DSOFramer.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("_FC.OcxState")));
- ((System.ComponentModel.ISupportInitialize)(this._MyDSOFramer)).EndInit();
+ _MyEdWord.EndInit();
try
{
try
{
- this._MyDSOFramer.Open(MyDSOFile.MyFile.FullName);
- //this._MyDSOFramer.Open(MyDSOFile.MyFile.FullName,false,"Word.Document","","");
+ this._MyEdWord.LicenseName = "Volian7573291802";// B2017-133 Edraw
+ this._MyEdWord.LicenseCode = "EDW8-5527-1201-AB8A";// B2017-133 Edraw
+ this._MyEdWord.Open(MyDSOFile.MyFile.FullName);
}
catch (Exception ex)
{
- _MyLog.Warn("dso fraimer error", ex); // put exception message in the error log
System.IO.FileStream fs = MyDSOFile.MyFile.Create();
using (DocumentAuditInfoList dail = DocumentAuditInfoList.Get(MyDocumentInfo.DocID))
{
@@ -194,36 +227,14 @@ namespace Volian.Controls.Library
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
fs.Close();
- this._MyDSOFramer.Open(MyDSOFile.MyFile.FullName);
+ this._MyEdWord.Open(MyDSOFile.MyFile.FullName);// B2017-133 Edraw
}
- LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
+ LBDocumentClass doc = new LBDocumentClass(_MyEdWord.ActiveDocument());
Console.WriteLine("Version {0}", doc.Application.Version);
float ver;
if (!float.TryParse(doc.Application.Version, out ver))
ver = 12.0F;
- this._MyDSOFramer.Menubar = ver < 12.0F;
- this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileClose, false);
- this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileNew, false);
- this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFilePageSetup, false);
- this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFilePrint, false);
- this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFilePrintPreview, false);
- this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileProperties, false);
- this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileSave, false);
- this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileSaveAs, false);
- this._MyDSOFramer.Titlebar = false;
- //if (_MyCount < 20)
- // this._MyDSOFramer.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow;
- //this._MyDSOFramer.BeforeDocumentClosed += new AxDSOFramer._DFramerCtlEvents_BeforeDocumentClosedEventHandler(_MyDSOFramer_BeforeDocumentClosed);
- //this._MyDSOFramer.OnSaveCompleted += new AxDSOFramer._DFramerCtlEvents_OnSaveCompletedEventHandler(_MyDSOFramer_OnSaveCompleted);
- //this._MyDSOFramer.LostFocus += new EventHandler(_MyDSOFramer_LostFocus);
- //this._MyDSOFramer.GotFocus += new EventHandler(_MyDSOFramer_GotFocus);
- //this._MyDSOFramer.Enter += new EventHandler(_MyDSOFramer_Enter);
- //this._MyDSOFramer.Leave += new EventHandler(_MyDSOFramer_Leave);
- //this._MyDSOFramer.OnActivationChange += new AxDSOFramer._DFramerCtlEvents_OnActivationChangeEventHandler(_MyDSOFramer_OnActivationChange);
this.Enter += new EventHandler(DSOTabPanel_Enter);
- //this.Leave += new EventHandler(DSOTabPanel_Leave);
- //this.GotFocus += new EventHandler(DSOTabPanel_GotFocus);
- //this.LostFocus += new EventHandler(DSOTabPanel_LostFocus);
Application.DoEvents();
// The following line corrects Symbol characters in MSWord Sections
// CheckForSymbolCharacters(doc);
@@ -240,7 +251,7 @@ namespace Volian.Controls.Library
}
public void FixSymbolCharacters()
{
- CheckForSymbolCharacters(new LBDocumentClass(_MyDSOFramer.ActiveDocument));
+ CheckForSymbolCharacters(new LBDocumentClass(_MyEdWord.ActiveDocument()));// B2017-133 Edraw
}
private void CheckForSymbolCharacters(LBDocumentClass doc)
{
@@ -298,7 +309,7 @@ namespace Volian.Controls.Library
{
if (SearchString == null) return;
// Get the Document
- LBDocumentClass wordDoc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
+ LBDocumentClass wordDoc = new LBDocumentClass(_MyEdWord.ActiveDocument());
//LBSelection sel = wordDoc.Application.Selection;
LBFind find = wordDoc.Application.Selection.Find;
find.ClearFormatting();
@@ -314,7 +325,7 @@ namespace Volian.Controls.Library
{
if (txt == null || txt.Length == 0) return; //nothing to insert
// Get the Document
- LBDocumentClass wordDoc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
+ LBDocumentClass wordDoc = new LBDocumentClass(_MyEdWord.ActiveDocument());
//This will get the selected range or just the current cursor position
LBSelection sel = wordDoc.Application.Selection;
// This will replace the selection or insert at current position
@@ -323,7 +334,7 @@ namespace Volian.Controls.Library
public string GetSelectedString()
{
- LBDocumentClass wordDoc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
+ LBDocumentClass wordDoc = new LBDocumentClass(_MyEdWord.ActiveDocument());
//This will get the selected range or just the current cursor position
LBSelection sel = wordDoc.Application.Selection;
// if the start & end are the same, nothing is selected:
@@ -415,10 +426,10 @@ namespace Volian.Controls.Library
MessageBox.Show("Currently in VIEW mode,\r\n cannot Save " + _MyDisplayTabItem.Tooltip);
return;
}
- LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
- while (doc.Saved = false)
- Application.DoEvents();
- string tmp = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName");
+ LBDocumentClass doc = new LBDocumentClass(_MyEdWord.ActiveDocument());
+ //while (doc.Saved = false)
+ // Application.DoEvents();
+ string tmp = GetReflectiveProperty(_MyEdWord.ActiveDocument(), "FullName");
if (System.IO.File.Exists(tmp))
MyDSOFile.FullName = tmp;
else
@@ -475,6 +486,57 @@ namespace Volian.Controls.Library
_MyLog.Warn("Before Closing Document ", ex);
}
}
+ ///
+ /// Save the contents of the Word Document to a file
+ /// and save the file to the database
+ ///
+ ///
+ public bool SaveDSO()
+ {
+ bool result = true;
+ try
+ {
+ bool stat = _MyEdWord.Save();// B2017-133 Edraw
+ Console.WriteLine("Save = {0}", stat);
+ SaveDSO_Phase2();
+ //_MyDSOFramer_OnSaveCompleted(this, null);
+ // These are handled in the method above
+ //LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
+ //MyDSOFile.FullName = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName");
+ //MyDSOFile.SaveFile(doc.Length, doc.Ascii);
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("SaveDSO", ex);
+ MessageBox.Show(ex.Message, "Error Saving Document", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ result = false;
+ }
+ return result;
+ }
+ ///
+ /// Check to see if a Word document should be saved. If it is dirty ask the user if the
+ /// changes should be changed. Save the changes if the user says "yes".
+ ///
+ ///
+ public bool SaveDirty()
+ {
+ if (OverrideClose)
+ return false;
+ if (IsDirty)
+ {
+ // Unfortunately, the only way to handle view mode for DSO Framer is to not save.
+ if (PanelViewEditMode == E_ViewMode.View || !_AllowedToEdit)
+ {
+ MessageBox.Show("Currently in VIEW mode,\r\n cannot Save " + _MyDisplayTabItem.Tooltip);
+ return false;
+ }
+ //if (MessageBox.Show("Save changes to " + _MyDisplayTabItem.MyItemInfo.TabTitle + "\r\n" + _MyDisplayTabItem.MyItemInfo.TabToolTip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
+ if (MessageBox.Show("Save changes to " + _MyDisplayTabItem.Text + "\r\n" + _MyDisplayTabItem.Tooltip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
+ return SaveDSO();
+ return false;
+ }
+ return true;
+ }
public static bool IgnoreEnter = false;
private bool _In_DSOTabPanel_Enter=false;
///
@@ -503,7 +565,7 @@ namespace Volian.Controls.Library
try
{
//_MyDSOFramer.EventsEnabled = true;
- _MyDSOFramer.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow;
+ //_MyEdWord.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow;
}
catch (Exception ex)
{
@@ -514,62 +576,12 @@ namespace Volian.Controls.Library
_In_DSOTabPanel_Enter = true;
if (MyDisplayTabItem.MyItemInfo != null)
_MyDisplayTabControl.OnItemSelectedChanged(this,new ItemSelectedChangedEventArgs(MyDisplayTabItem.MyItemInfo));
- _MyDSOFramer.Focus();
+ _MyEdWord.Focus();
_In_DSOTabPanel_Enter = false;
_MyDisplayTabControl.SelectedDisplayTabItem = MyDisplayTabItem;
}
#endregion
#region Public Methods
- ///
- /// Save the contents of the Word Document to a file
- /// and save the file to the database
- ///
- ///
- public bool SaveDSO()
- {
- bool result = true;
- try
- {
- _MyDSOFramer.Save();
- SaveDSO_Phase2();
- //_MyDSOFramer_OnSaveCompleted(this, null);
- // These are handled in the method above
- //LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
- //MyDSOFile.FullName = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName");
- //MyDSOFile.SaveFile(doc.Length, doc.Ascii);
- }
- catch (Exception ex)
- {
- if (_MyLog.IsErrorEnabled) _MyLog.Error("SaveDSO", ex);
- MessageBox.Show(ex.Message, "Error Saving Document", MessageBoxButtons.OK, MessageBoxIcon.Error);
- result = false;
- }
- return result;
- }
- ///
- /// Check to see if a Word document should be saved. If it is dirty ask the user if the
- /// changes should be changed. Save the changes if the user says "yes".
- ///
- ///
- public bool SaveDirty()
- {
- if (OverrideClose)
- return false;
- if (IsDirty)
- {
- // Unfortunately, the only way to handle view mode for DSO Framer is to not save.
- if (PanelViewEditMode == E_ViewMode.View || !_AllowedToEdit)
- {
- MessageBox.Show("Currently in VIEW mode,\r\n cannot Save " + _MyDisplayTabItem.Tooltip);
- return false;
- }
- //if (MessageBox.Show("Save changes to " + _MyDisplayTabItem.MyItemInfo.TabTitle + "\r\n" + _MyDisplayTabItem.MyItemInfo.TabToolTip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
- if (MessageBox.Show("Save changes to " + _MyDisplayTabItem.Text + "\r\n" + _MyDisplayTabItem.Tooltip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
- return SaveDSO();
- return false;
- }
- return true;
- }
private bool _IsBeingDeleted = false;
public bool IsBeingDeleted
{
@@ -595,14 +607,14 @@ namespace Volian.Controls.Library
bool result = true;
try
{
- if (_MyDSOFramer != null)
+ if (_MyEdWord != null)
{
SaveDSO_Phase1();
- _MyDSOFramer.Close();
- Controls.Remove(_MyDSOFramer);
- components.Remove(_MyDSOFramer);
- _MyDSOFramer.Dispose();
- _MyDSOFramer = null;
+ _MyEdWord.CloseDoc();
+ Controls.Remove(_MyEdWord);
+ components.Remove(_MyEdWord);
+ _MyEdWord.Dispose();
+ _MyEdWord = null;
_Count--;
}
}
@@ -620,9 +632,9 @@ namespace Volian.Controls.Library
{
try
{
- this._MyDSOFramer.Activate();
- if (_MyCount <= MSWordLimit)
- this._MyDSOFramer.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow;
+ //this._MyEdWord.Activate();
+ //if (_MyCount <= MSWordLimit)
+ // this._MyEdWord.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow;
}
catch (Exception ex)
{