/// <summary> /// Tags with the default value (the presentation's current value or /// false if the presentation has no current value or there is no /// current presentation) iff there is currently NO value tagged. /// </summary> private void NormalizeShapeTags(PowerPoint.Tags tags) { IDictionary tagDict = new PPTLibrary.TagDictionary(tags, true, this.UniqueName); if (!tagDict.Contains(PANE_TAG)) { tagDict[PANE_TAG] = DEFAULT_MODE; } }
/// <summary> /// Get the modes of the given presentation tag. /// </summary> /// <remarks>if it is so far /// entirely untagged, defaults to DEFAULT_MODE</remarks> private string[] GetShapeModes(PowerPoint.Tags tags) { // Tag if necessary. this.NormalizeShapeTags(tags); IDictionary tagDict = new PPTLibrary.TagDictionary(tags, true, this.UniqueName); // Discover what mode this is currently tagged as being in. return(((string)tagDict[PANE_TAG]).Split(',')); }
/// <summary> /// Get the mode of the given presentation tag. /// </summary> /// <remarks>if it is so far /// entirely untagged, Defaults to DEFAULT_MODE</remarks> private string GetPresentationMode(PowerPoint.Tags tags) { // Tag if necessary. this.NormalizePresentationTags(tags); IDictionary tagDict = new PPTLibrary.TagDictionary(tags, true, this.UniqueName); // Discover what mode this is currently tagged as being in. return((string)tagDict[PANE_TAG]); }
/// <summary> /// Tags with the given value, adding the mode if it is anything but default and resetting to that /// mode if it is default. /// </summary> private void SetShapeMode(PowerPoint.Tags tags, string mode) { this.NormalizeShapeTags(tags); IDictionary tagDict = new PPTLibrary.TagDictionary(tags, true, this.UniqueName); string oldModes = (string)tagDict[PANE_TAG]; // HACK: theoretically, this should disallow the default mode ever ending up in a list with other modes. That's assumed, but it could be more explicitly monitored. if (mode == DEFAULT_MODE || oldModes == DEFAULT_MODE || oldModes == "") { tagDict[PANE_TAG] = mode; } else if (System.Array.IndexOf(oldModes.Split(','), mode) == -1) { tagDict[PANE_TAG] = oldModes + "," + mode; } // Otherwise, do nothing b/c the mode is already there. }
/// <summary> /// Creates a dictionary wrapping a tags object /// </summary> /// <param name="tags">the tags object to wrap</param> /// <param name="allowLower">should keys be allowed to use lower-case letters</param> /// <param name="name">a name to use for this tag dictionary; should be all uppercase (will cause /// an exception if allowLower is false and otherwise will be uppercased); only /// entries under this name will be affected by operations on this tag dictionary</param> /// <remarks>if keys are not allowed to use lower-case, lower-case letters will cause an exception; otherwise, they will be transformed to upper-case</remarks> public TagDictionary(PowerPoint.Tags tags, bool allowLower, string name) { this.myTags = tags; this.myAllowLower = allowLower; this.myName = this.CheckOrMakeUpper(name); }
/// <summary> /// Tags with the given value. /// </summary> private void SetPresentationMode(PowerPoint.Tags tags, string mode) { new PPTLibrary.TagDictionary(tags, true, this.UniqueName)[PANE_TAG] = mode; }