public DocumentController(MainController mainController, Document document) { this.mainController = mainController; this.document = document; documentProperties = (DocumentProperties) document.CustomDocumentProperties; var documentStyleTitle = GetDocumentStyleTitle(); style = mainController.FindStyleByTitle(documentStyleTitle) ?? mainController.DefaultStyle; }
public CiteProcRunner(StyleInfo style, GetDatabaseDelegate databaseProvider): this() { this.databaseProvider = databaseProvider; this.style = style; try { engine = Call(CreateEngineCommand, this.style.GetXml()); if (engine == null) throw new InvalidOperationException(); } catch { throw new FailedToCreateCiteProcEngineForStyleException(style); } }
public static StyleInfo LoadFromFile(string filename) { var styleFileInfo = new FileInfo(filename); var doc = new XmlDocument(); var xmlNamespaceManager = new XmlNamespaceManager(doc.NameTable); xmlNamespaceManager.AddNamespace("x", StyleXmlNamespace); var styleInfo = new StyleInfo { FileInfo = styleFileInfo }; var node = doc.SelectSingleNode(TitleXPath, xmlNamespaceManager); styleInfo.Title = node == null ? string.Empty : node.InnerText; node = doc.SelectSingleNode(SummaryXPath, xmlNamespaceManager); styleInfo.Summary = node == null ? string.Empty : node.InnerText; return styleInfo; }
public static List<StyleInfo> GetStylesInfo(string path = null) { try { var result = new List<StyleInfo>(); var doc = new XmlDocument(); var xmlNamespaceManager = new XmlNamespaceManager(doc.NameTable); xmlNamespaceManager.AddNamespace("x", StyleXmlNamespace); foreach (var styleFileInfo in GetStyleFiles(path)) { try { doc.Load(styleFileInfo.FullName); var styleInfo = new StyleInfo { FileInfo = styleFileInfo }; var node = doc.SelectSingleNode(TitleXPath, xmlNamespaceManager); styleInfo.Title = node == null ? string.Empty : node.InnerText; node = doc.SelectSingleNode(SummaryXPath, xmlNamespaceManager); styleInfo.Summary = node == null ? string.Empty : node.InnerText; result.Add(styleInfo); } catch {} } return result; } catch { return new List<StyleInfo>(); } }
public FailedToCreateCiteProcEngineForStyleException(StyleInfo style): base("A CiteProc engine could not be created from the style.") { this.style = style; }
bool IsValidStyle(StyleInfo style) { return(styles.Contains(style)); }
bool IsValidStyle(StyleInfo style) { return styles.Contains(style); }
/// <summary> /// Called when user changes style from dropdown list. /// </summary> /// <param name="newStyle"></param> public void TryChangeStyle(StyleInfo newStyle) { Debug.Assert(currentDocumentController != null); if (newStyle == null) { Process.Start(StyleHelper.FindMoreCitationStylesUrl); addinModule.SetSelectedStyle(currentDocumentController.Style); return; } if (IsValidStyle(newStyle)) { currentDocumentController.Style = newStyle; DefaultStyle = newStyle; } addinModule.SetSelectedStyle(currentDocumentController.Style); addinModule.UpdateState(new SelectionManager(currentDocumentController)); }
public FailedToCreateCiteProcEngineForStyleException(StyleInfo style) : base("A CiteProc engine could not be created from the style.") { this.style = style; }
public void SetSelectedStyle(StyleInfo style) { if (style == null) { rcbStyle.Text = StyleHelper.FindMoreCitationStyles.Title; ccbStyle.Text = StyleHelper.FindMoreCitationStyles.Title; return; } rcbStyle.Text = style.Title; ccbStyle.Text = style.Title; }
ADXRibbonItem CreateRibbonItemForStyle(StyleInfo style) { return new ADXRibbonItem(components) { Caption = style.Title, ScreenTip = style.Title, SuperTip = style.Summary, }; }