コード例 #1
0
        public CommandMapForm(WordInstance instance)
            : this()
        {
            m_WordInstance = instance;

            FollowWordPosition();
            BuildRibbon();
        }
コード例 #2
0
 public ActivationButton(WordInstance word)
     : this()
 {
     m_WordInstance = word;
     WindowsApi.SetWindowParent(Handle, word.WindowHandle);
 }
コード例 #3
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            m_CommandMapEnabled = GlobalSettings.GetCommandMapEnabled();
            // Inform the ribbon we're using about the current application
            if (m_BlankRibbon != null) {
                m_BlankRibbon.Application = Application;
            } else if (m_NormalRibbon != null) {
                m_NormalRibbon.Application = Application;
            }

            // Create a WordInstance
            m_Word = new WordInstance(Application);

            #if LOGGING
            string logPath = GlobalSettings.GetLogPath();
            if (!string.IsNullOrEmpty(logPath)) {
                Log.StartLogging(logPath);
            }
            #endif

            if (m_CommandMapEnabled) {
                // Spawn the on-screen activation button, and attach it to the Word window.
                m_ActivationButton = new ActivationButton(m_Word);
                m_ActivationButton.Click += m_ActivationButton_Click;
                m_ActivationButton.Show();

                // Spawn the CommandMap form, and attach it to the Word window.
                m_CommandMap = new CommandMapForm(m_Word);
                m_CommandMap.Show();
                m_CommandMap.Hide();
            }

            // Hook mouse events for logging
            HookManager.MouseDown += HookManager_MouseDown;
            HookManager.MouseUp += HookManager_MouseUp;

            // Hook keyboard events
            HookManager.KeyDown += HookManager_KeyDown;
            HookManager.KeyUp += HookManager_KeyUp;
        }