Ejemplo n.º 1
0
        /// <summary>
        /// 保存処理本体
        /// </summary>
        /// <param name="Pres">Presentation情報</param>
        /// <param name="Cancel">保存フラグ</param>
        /// <param name="SaveAsUI">キャンセルフラグ</param>
        public void PresentationSave(Microsoft.Office.Interop.PowerPoint.Presentation Pres, ref bool Cancel, bool SaveAsUI)
        {
            // PowerPoint画面が表示されていない場合は設定画面を表示しない
            if (this.Application.Visible == Microsoft.Office.Core.MsoTriState.msoFalse)
            {
                return;
            }

            // プロパティ情報取得
            PowerPointAddInSAB.SettingForm frmSet = new PowerPointAddInSAB.SettingForm();
            frmSet.propPres = Pres;

            // 共通設定エラー時処理
            if (frmSet.commonFileReadCompleted == false)
            {
                return;
            }

            // スライド数が0のときは登録不要
            if (frmSet.GetSlideCount() <= 0)
            {
                return;
            }

            string strFilePropertySecrecyLevel = string.Empty; // ファイルプロパティ情報 機密区分
            string strFilePropertyClassNo      = string.Empty; // ファイルプロパティ情報 事業所コード
            string strFilePropertyOfficeCode   = string.Empty; // ファイルプロパティ情報 事業所コード

            // プロパティのタグを取得
            frmSet.GetDocumentProperty(ref strFilePropertySecrecyLevel, ref strFilePropertyClassNo, ref strFilePropertyOfficeCode); // プロパティ情報取得

            // プロパティにSAB情報は未設定の場合は設定画面を表示
            if (frmSet.IsSecrecyInfoRegistered() == false)
            {
                // 必須登録モードON
                frmSet.MustRegistMode = true;

                frmSet.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
                frmSet.ShowDialog();
            }
            else
            {
                // ファイルの事業所コードと設定値の事業所コードを比較
                if (strFilePropertyOfficeCode == frmSet.clsCommonSettting.strOfficeCode)
                {
                    // プロパティに情報を書込み
                    frmSet.SetDocumentProperty(strFilePropertySecrecyLevel);
                }
                else
                {
                    // 修正を押下された場合は、設定画面を表示する
                    frmSet.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
                    frmSet.ShowDialog();
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 有効な保存個所チェック
        /// </summary>
        private bool IsEnableStorage(string Path, PowerPoint.Presentation Pres)
        {
            // プロパティ情報取得
            PowerPointAddInSAB.SettingForm frmSet = new PowerPointAddInSAB.SettingForm();
            frmSet.propPres = Pres;

            try
            {
                string strFilePropertySecrecyLevel = string.Empty; // ファイルプロパティ情報 機密区分
                string strFilePropertyClassNo      = string.Empty; // ファイルプロパティ情報 事業所コード
                string strFilePropertyOfficeCode   = string.Empty; // ファイルプロパティ情報 事業所コード

                // プロパティのタグを取得
                frmSet.GetDocumentProperty(ref strFilePropertySecrecyLevel, ref strFilePropertyClassNo, ref strFilePropertyOfficeCode); // プロパティ情報取得

                // プロパティにSAB情報は未設定の場合は設定画面を表示
                if (frmSet.IsSecrecyInfoRegistered() == false)
                {
                    // 必須登録モードON
                    frmSet.MustRegistMode = true;

                    frmSet.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
                    frmSet.ShowDialog();

                    frmSet.GetDocumentProperty(ref strFilePropertySecrecyLevel, ref strFilePropertyClassNo, ref strFilePropertyOfficeCode); // プロパティ情報取得​
                }

                // S秘・A秘なら保存場所の確認を行う
                if ((strFilePropertySecrecyLevel == AddInsLibrary.InfomationForm.SECRECY_PROPERTY_S) ||
                    (strFilePropertySecrecyLevel == AddInsLibrary.InfomationForm.SECRECY_PROPERTY_A))
                {
                    List <string> lstTarGetSecureFolder = frmSet.clsCommonSettting.lstSecureFolder;
                    string        result = lstTarGetSecureFolder.FirstOrDefault(x => Path.Contains(x));

                    if (result == null)
                    {
                        // 正しい場所に保存されてない場合
                        return(false);
                    }
                }
            }
            catch
            {
                // 共通設定が読み込めない場合はそもそもセキュアチェックができない為チェックを行わないでスルーする
            }

            return(true);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// アドイン起動時処理
        /// </summary>
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            // 言語設定読込み  // step2
            PowerPointAddInSAB.SettingForm frmSet = new PowerPointAddInSAB.SettingForm();
            CultureInfo culture = CultureInfo.GetCultureInfo(frmSet.clsCommonSettting.strCulture);

            Thread.CurrentThread.CurrentUICulture = culture;

            // 保存時のイベントを登録
            this.Application.PresentationBeforeSave +=
                new Microsoft.Office.Interop.PowerPoint.EApplication_PresentationBeforeSaveEventHandler(ApplicationPresentationBeforeSave);

            // 保存後イベント
            this.Application.PresentationSave += Application_PresentationSave;

            // 終了直前イベント
            this.Application.PresentationBeforeClose += Application_PresentationBeforeClose;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// カスタムリボンローカライズ
        /// </summary>
        private void Localizable()
        {
            PowerPointAddInSAB.SettingForm   frmSet  = new PowerPointAddInSAB.SettingForm();
            System.Globalization.CultureInfo culture = System.Globalization.CultureInfo.GetCultureInfo(frmSet.clsCommonSettting.strCulture);

            System.Threading.Thread.CurrentThread.CurrentUICulture = culture;
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RibbonDocumentManagement));

            foreach (var tab in this.Tabs)
            {
                System.Diagnostics.Debug.WriteLine(tab.Name);
                resources.ApplyResources(tab, tab.Name, culture);
                foreach (var grp in tab.Groups)
                {
                    System.Diagnostics.Debug.WriteLine(grp.Name);
                    resources.ApplyResources(grp, grp.Name, culture);
                    foreach (var item in grp.Items)
                    {
                        System.Diagnostics.Debug.WriteLine(item.Name);
                        resources.ApplyResources(item, item.Name, culture);
                    }
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 保存後イベント
        /// </summary>
        private void Application_PresentationSave(PowerPoint.Presentation Pres)
        {
            if (Pres != this.Application.ActivePresentation)
            {
                return;
            }

            // PowerPoint画面が表示されていない場合は設定画面を表示しない
            if (this.Application.Visible == Microsoft.Office.Core.MsoTriState.msoFalse)
            {
                return;
            }

            // プロパティ情報取得
            PowerPointAddInSAB.SettingForm frmSet = new PowerPointAddInSAB.SettingForm();
            frmSet.propPres = Pres;

            // 共通設定エラー時処理
            if (frmSet.commonFileReadCompleted == false)
            {
                return;
            }

            // スライド数が0のときは登録不要
            if (frmSet.GetSlideCount() <= 0)
            {
                return;
            }

            string strFilePropertySecrecyLevel = string.Empty; // ファイルプロパティ情報 機密区分
            string strFilePropertyClassNo      = string.Empty; // ファイルプロパティ情報 事業所コード
            string strFilePropertyOfficeCode   = string.Empty; // ファイルプロパティ情報 事業所コード

            // プロパティのタグを取得
            frmSet.GetDocumentProperty(ref strFilePropertySecrecyLevel, ref strFilePropertyClassNo, ref strFilePropertyOfficeCode); // プロパティ情報取得

            if (lstPresPath.Contains(Path.Combine(Pres.Path, Pres.Name)))
            {
                lstPresPath.Remove(Path.Combine(Pres.Path, Pres.Name));
            }

            // S秘・A秘なら保存場所の確認を行う
            if ((strFilePropertySecrecyLevel == AddInsLibrary.InfomationForm.SECRECY_PROPERTY_S) ||
                (strFilePropertySecrecyLevel == AddInsLibrary.InfomationForm.SECRECY_PROPERTY_A))
            {
                string PresPath = Pres.Path;
                string FileName = Pres.Name;

                List <string> lstTarGetSecureFolder = frmSet.clsCommonSettting.lstSecureFolder;

                // セキュアフォルダと同一なら保存
                string result = lstTarGetSecureFolder.FirstOrDefault(x => PresPath.Contains(x));
                if (result == null)
                {
                    // セキュアフォルダではない
                    MessageBox.Show(AddInsLibrary.Properties.Resources.msg_warning_save_not_secure, AddInsLibrary.Properties.Resources.msgError, MessageBoxButtons.OK, MessageBoxIcon.Hand);

                    string FullPath = Path.Combine(PresPath, FileName);
                    lstPresPath.Add(FullPath);

                    ExecuteSaveAs();

                    return;
                }
            }

            ClearListPath();
        }