internal ApplicationEvents(Ribbon rm, IDictionary<Word.Window, CustomTaskPane> dictTaskPanes) { //store the application and Ribbon objects //m_buttonMapping = rm.toggleButtonMapping; m_ribbon = rm; m_dictTaskPanes = dictTaskPanes; //store MDI/SDI state m_fLastSdiMode = Globals.ThisAddIn.Application.ShowWindowsInTaskbar; log.Debug("ShowWindowsInTaskbar? " + m_fLastSdiMode); //capture the necessary app events m_ehDocumentChange = new Microsoft.Office.Interop.Word.ApplicationEvents4_DocumentChangeEventHandler(app_DocumentChange); m_ehWindowActivate = new Microsoft.Office.Interop.Word.ApplicationEvents4_WindowActivateEventHandler(app_WindowActivate); Globals.ThisAddIn.Application.DocumentChange += m_ehDocumentChange; Globals.ThisAddIn.Application.WindowActivate += m_ehWindowActivate; }