protected virtual string[] getOpenFileNames()
        {
            string[] fileNames = null;

            if (_officeVersion > OfficeVersion.Office2000 && _officeVersion != OfficeVersion.Office2010)
            {
                LateBindingObject fileDialog = _application.Invoke("FileDialog", MsoFileDialogType.msoFileDialogFilePicker);

                // allow multiple file opening
                fileDialog.SetBool("AllowMultiSelect", true);

                // add filter for ODT files
                fileDialog.Invoke("Filters").Invoke("Clear");
                fileDialog.Invoke("Filters").Invoke("Add", this._addinLib.GetString(this.OdfFileType), this.ImportOdfFileFilter, Type.Missing);
                fileDialog.Invoke("Filters").Invoke("Add", this._addinLib.GetString(ALL_FILE_TYPE), this.ImportAllFileFilter, Type.Missing);
                // set title
                fileDialog.SetString("Title", this._addinLib.GetString(IMPORT_LABEL));
                // display the dialog
                fileDialog.Invoke("Show");

                if (fileDialog.Invoke("SelectedItems").GetInt32("Count") > 0)
                {
                    fileNames = new string[fileDialog.Invoke("SelectedItems").GetInt32("Count")];
                    // process the chosen documents
                    for (int i = 0; i < fileDialog.Invoke("SelectedItems").GetInt32("Count"); i++)
                    {
                        // retrieve file name
                        fileNames[i] = fileDialog.Invoke("SelectedItems").Invoke("Item", i + 1).ToString();
                    }
                }
            }
            else
            {
                // Office 2000 does not provide its own file open dialog
                // using windows forms instead
                System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();

                ofd.CheckPathExists = true;
                ofd.CheckFileExists = true;
                ofd.Multiselect     = true;
                ofd.SupportMultiDottedExtensions = true;
                ofd.DefaultExt = "odt";
                ofd.Filter     = this._addinLib.GetString(this.OdfFileType) + this.ExportOdfFileFilter
                                 + this._addinLib.GetString(ALL_FILE_TYPE) + this.ExportAllFileFilter;

                ofd.Title = this._addinLib.GetString(IMPORT_LABEL);

                // process the chosen documents
                if (System.Windows.Forms.DialogResult.OK == ofd.ShowDialog())
                {
                    fileNames = ofd.FileNames;
                }
            }

            return(fileNames);
        }
        /// <summary>
        ///      Implements the OnStartupComplete method of the IDTExtensibility2 interface.
        ///      Receives notification that the host application has completed loading.
        /// </summary>
        /// <param term='custom'>
        ///      Array of parameters that are host application specific.
        /// </param>
        /// <seealso class='IDTExtensibility2' />
        public virtual void OnStartupComplete(ref System.Array custom)
        {
            if (_officeVersion < OfficeVersion.Office2007)
            {
                // Add menu item
                // first retrieve "File" menu
                LateBindingObject commandBar = _application.Invoke("CommandBars", "File");

                // Add import button
                try
                {
                    // if item already exists, use it (should never happen)
                    _importButton = commandBar.Invoke("Controls", this._addinLib.GetString("OdfImportLabel"));
                }
                catch (Exception)
                {
                    // otherwise, create a new one
                    _importButton = commandBar.Invoke("Controls")
                                    .Invoke("Add", MsoControlType.msoControlButton, Type.Missing, Type.Missing, 3, true);
                }
                // set item's label
                _importButton.SetString("Caption", this._addinLib.GetString("OdfImportLabel"));
                _importButton.SetString("Tag", this._addinLib.GetString("OdfImportLabel"));

                // set action
                _importButton.SetString("OnAction", "!<" + this.ConnectClassName + ">");
                _importButton.SetBool("Visible", true);

                _importButton.AddClickEventHandler(new CommandBarButtonEvents_ClickEventHandler(this.importButton_Click));

                // Add export button
                try
                {
                    // if item already exists, use it (should never happen)
                    _exportButton = commandBar.Invoke("Controls", this._addinLib.GetString("OdfExportLabel"));
                }
                catch (Exception)
                {
                    // otherwise, create a new one
                    _exportButton = commandBar.Invoke("Controls")
                                    .Invoke("Add", MsoControlType.msoControlButton, Type.Missing, Type.Missing, 4, true);
                }
                // set item's label
                _exportButton.SetString("Caption", this._addinLib.GetString("OdfExportLabel"));
                _exportButton.SetString("Tag", this._addinLib.GetString("OdfExportLabel"));
                // set action
                _exportButton.SetString("OnAction", "!<" + this.ConnectClassName + ">");
                _exportButton.SetBool("Visible", true);
                _exportButton.SetBool("Enabled", true);
                _exportButton.AddClickEventHandler(new CommandBarButtonEvents_ClickEventHandler(this.exportButton_Click));

                // Add options button
                try
                {
                    // if item already exists, use it (should never happen)
                    _optionsButton = commandBar.Invoke("Controls", this._addinLib.GetString("OdfOptionsLabel"));
                }
                catch (Exception)
                {
                    // otherwise, create a new one
                    _optionsButton = commandBar.Invoke("Controls")
                                     .Invoke("Add", MsoControlType.msoControlButton, Type.Missing, Type.Missing, 5, true);
                }
                // set item's label
                _optionsButton.SetString("Caption", this._addinLib.GetString("OdfOptionsLabel"));
                _optionsButton.SetString("Tag", this._addinLib.GetString("OdfOptionsLabel"));
                // set action
                _optionsButton.SetString("OnAction", "!<" + this.ConnectClassName + ">");
                _optionsButton.SetBool("Visible", true);
                _optionsButton.SetBool("Enabled", true);
                _optionsButton.AddClickEventHandler(new CommandBarButtonEvents_ClickEventHandler(this.odfOptionsButton_Click));
            }

            this.InitializeAddin();
        }