Exemple #1
0
        public void btnPreviewOsql_Click(Office.IRibbonControl control)
        {
            _isForceDisablePreviewOsql = false;
            Document doc = Wkl.MainCtrl.CommonCtrl.CommonProfile.ActiveDoc;

            try
            {
                //Validate document
                string mgrKey = string.Empty;
                Pdw.WKL.Profiler.Manager.ManagerProfile mgrPro = Wkl.MainCtrl.ManagerCtrl.CreateProfile(out mgrKey);
                mgrPro.WdColorIndex   = DefineColors.GetColor(selectedColor).Color;
                mgrPro.IsSaveDocument = false;

                ContextValidator validator = new ContextValidator(doc);
                validator.ValidateBeforeSave(mgrKey);

                //If document has invalid bookmarks
                if (!mgrPro.IsCorrect)
                {
                    //Ask user to remove invalid bookmarks
                    mgrPro.WDoc = doc;
                    Hcl.SaveMessageDialog saveNotify  = new Hcl.SaveMessageDialog(mgrKey);
                    DialogResult          userConfirm = saveNotify.ShowDialog();

                    if (userConfirm != DialogResult.OK || !HasSelectIBM())
                    {
                        return;
                    }
                }

                //Build and show osql
                PdwInfo pdwInfo = GetPdwInfo(doc);

                ChecksumInfo checkSum = ProntoDoc.Framework.Utils.ObjectSerializeHelper.Deserialize <ChecksumInfo>(pdwInfo.ChecksumString);
                OsqlXml      osqlXml = ProntoDoc.Framework.Utils.ObjectSerializeHelper.Deserialize <OsqlXml>(pdwInfo.OsqlString);
                string       renderArgument, jRenderArgument;
                GetRenderArguments(checkSum, out renderArgument, out jRenderArgument);

                Pdw.PreviewOsql.PreviewOsqlForm previewDialog = new Pdw.PreviewOsql.PreviewOsqlForm();
                previewDialog.Osql            = osqlXml.GetOsql("/*------------------------------------*/");
                previewDialog.JOsql           = osqlXml.GetJsql("/*------------------------------------*/");
                previewDialog.Xsl             = pdwInfo.XsltString;
                previewDialog.RenderArgument  = renderArgument;
                previewDialog.JRenderArgument = jRenderArgument;
                previewDialog.CheckSumInfo    = checkSum;
                previewDialog.OsqlXml         = osqlXml;
                previewDialog.ShowDialog();
            }
            catch { }
        }
Exemple #2
0
        private bool ValidateDocument(WdColorIndex color)
        {
            if (Wkl.MainCtrl.CommonCtrl.CommonProfile.Bookmarks.Count > 0)
            {
                ContextManager contextMgr = new ContextManager();
                string         mgrKey     = string.Empty;
                Pdw.WKL.Profiler.Manager.ManagerProfile mgrPro = Wkl.MainCtrl.ManagerCtrl.CreateProfile(out mgrKey);
                mgrPro.WdColorIndex   = color;
                mgrPro.IsSaveDocument = false;
                contextMgr.ValidateDocument(mgrKey);

                return(mgrPro.IsCorrect);
            }
            return(false);
        }
Exemple #3
0
        public void btnHighlightBookmark_Click(Office.IRibbonControl control)
        {
            try
            {
                TemplateInfo templateInfo = Wkl.MainCtrl.CommonCtrl.CommonProfile.CurrentTemplateInfo;
                if (templateInfo != null && templateInfo.InternalBookmark != null &&
                    templateInfo.DomainNames != null &&
                    templateInfo.DomainNames.Count > 0)
                {
                    DomainSelector domainSelector = new DomainSelector();
                    domainSelector.ShowDialog();
                    Dictionary <string, string> selectedDomains = domainSelector.DataTagColor;
                    bool   isHighlight = domainSelector.IsHighlight;
                    string colorNameDS = domainSelector.DocumentSpecificConditionColor;
                    DefineColors.DefineColor colorDS = DefineColors.GetColor(colorNameDS, false);
                    foreach (KeyValuePair <string, string> selectedDomain in selectedDomains)
                    {
                        InternalBookmarkDomain ibmDomain = templateInfo.InternalBookmark.GetInternalBookmarkDomain(selectedDomain.Key);
                        if (ibmDomain != null && ibmDomain.InternalBookmarkItems != null)
                        {
                            string colorNameDT = selectedDomain.Value;
                            DefineColors.DefineColor colorDT = DefineColors.GetColor(colorNameDT, false);

                            foreach (InternalBookmarkItem ibmItem in ibmDomain.InternalBookmarkItems)
                            {
                                string key = string.Empty;
                                Pdw.WKL.Profiler.Manager.ManagerProfile profile = Wkl.MainCtrl.ManagerCtrl.CreateProfile(out key);
                                profile.HighlightBookmarkName = ibmItem.Key;
                                Managers.DataIntegration.DataIntegrationManager bmMgr = new Managers.DataIntegration.DataIntegrationManager();
                                bool isDocumentSpecific = MarkupUtilities.IsProntoDocDocumentSpecificBookmark(ibmItem.Key);
                                if (isDocumentSpecific)
                                {
                                    if (colorDS != null)
                                    {
                                        profile.WdColorIndex = colorDS.Color;
                                    }
                                }
                                else
                                {
                                    if (colorDT != null)
                                    {
                                        profile.WdColorIndex = colorDT.Color;
                                    }
                                }

                                if (isHighlight)
                                {
                                    bmMgr.HighLightBookmark(key);
                                }
                                else
                                {
                                    bmMgr.UnHighLightBookmark(key);
                                }
                            }
                            ibmDomain.Color = isHighlight ? colorNameDT : string.Empty;
                            templateInfo.InternalBookmark.DocumentSpecificColor = isHighlight ? colorNameDS : string.Empty;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogUtils.Log("chkHighlightBookmark_Click", ex);
            }
        }