diff --git a/PlotDirector.NativeCompanion/Vsto/NativeRibbon.cs b/PlotDirector.NativeCompanion/Vsto/NativeRibbon.cs index 9013d664..cebb61d4 100644 --- a/PlotDirector.NativeCompanion/Vsto/NativeRibbon.cs +++ b/PlotDirector.NativeCompanion/Vsto/NativeRibbon.cs @@ -56,19 +56,12 @@ namespace PlotDirector.WordAddIn displayed[id] = value; } - public bool CanOpenBook(Office.IRibbonControl control) => adapter()?.HasRibbonBook == true; - // Non-breaking padding keeps the native group wide even before Word reports a title. - private static string TitleLabel(string title) + public void RestoreTitle(Office.IRibbonControl control, string text) { - const int width = 58; - if (title.Length <= width) return title.PadRight(width, '\u00a0'); - var end = char.IsHighSurrogate(title[width - 2]) ? width - 2 : width - 1; - return title.Substring(0, end) + "…"; + ui?.InvalidateControl(control.Id); } - public string GetBook(Office.IRibbonControl control) => TitleLabel(GetBookTip(control)); - public string GetChapter(Office.IRibbonControl control) => TitleLabel(GetChapterTip(control)); - public string GetScene(Office.IRibbonControl control) => TitleLabel(GetSceneTip(control)); + public bool CanOpenBook(Office.IRibbonControl control) => adapter()?.HasRibbonBook == true; public string GetBookTip(Office.IRibbonControl control) => adapter()?.RibbonBook ?? "No linked book"; public string GetChapterTip(Office.IRibbonControl control) => adapter()?.RibbonChapter ?? "Chapter unverified"; public string GetSceneTip(Office.IRibbonControl control) => adapter()?.RibbonScene ?? "Scene unverified"; diff --git a/PlotDirector.NativeCompanion/Vsto/Ribbon.xml b/PlotDirector.NativeCompanion/Vsto/Ribbon.xml index 407a3213..61947727 100644 --- a/PlotDirector.NativeCompanion/Vsto/Ribbon.xml +++ b/PlotDirector.NativeCompanion/Vsto/Ribbon.xml @@ -3,9 +3,9 @@ - - - + + +