/// ------------------------------------------------------------------------------------ /// <summary> /// Creates a publication and adds it to a collection of Publications on the /// CmMajorObject AnnotationDefs. /// </summary> /// <param name="pageHeight">Height of the page.</param> /// <param name="pageWidth">Width of the page.</param> /// <param name="fIsLandscape">if set to <c>true</c> the publication is landscape.</param> /// <param name="name">The name of the publication.</param> /// <param name="gutterMargin">The gutter margin.</param> /// <param name="bindingSide">The side on which the publication will be bound (i.e., the /// gutter location).</param> /// <param name="footnoteSepWidth">Width of the footnote seperator.</param> /// <returns>the new publication</returns> /// <remarks>Adds the publication to AnnotationDefs because we need a /// CmMajorObject where we can attach the Publication and Scripture is not visible here. /// </remarks> /// ------------------------------------------------------------------------------------ private IPublication CreatePublication(int pageHeight, int pageWidth, bool fIsLandscape, string name, int gutterMargin, BindingSide bindingSide, int footnoteSepWidth) { IPublication pub = Cache.ServiceLocator.GetInstance <IPublicationFactory>().Create(); Cache.LanguageProject.AnnotationDefsOA.PublicationsOC.Add(pub); pub.PageHeight = pageHeight; pub.PageWidth = pageWidth; pub.IsLandscape = fIsLandscape; pub.Name = name; pub.GutterMargin = gutterMargin; pub.BindingEdge = bindingSide; pub.FootnoteSepWidth = footnoteSepWidth; return(pub); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates a publication and adds it to a collection of Publications on the /// CmMajorObject AnnotationDefs. /// </summary> /// <param name="pageHeight">Height of the page.</param> /// <param name="pageWidth">Width of the page.</param> /// <param name="fIsLandscape">if set to <c>true</c> the publication is landscape.</param> /// <param name="name">The name of the publication.</param> /// <param name="gutterMargin">The gutter margin.</param> /// <param name="bindingSide">The side on which the publication will be bound (i.e., the /// gutter location).</param> /// <param name="footnoteSepWidth">Width of the footnote seperator.</param> /// <returns>the new publication</returns> /// <remarks>Adds the publication to AnnotationDefs because we need a /// CmMajorObject where we can attach the Publication and Scripture is not visible here. /// </remarks> /// ------------------------------------------------------------------------------------ private IPublication CreatePublication(int pageHeight, int pageWidth, bool fIsLandscape, string name, int gutterMargin, BindingSide bindingSide, int footnoteSepWidth) { IPublication pub = Cache.ServiceLocator.GetInstance<IPublicationFactory>().Create(); Cache.LanguageProject.AnnotationDefsOA.PublicationsOC.Add(pub); pub.PageHeight = pageHeight; pub.PageWidth = pageWidth; pub.IsLandscape = fIsLandscape; pub.Name = name; pub.GutterMargin = gutterMargin; pub.BindingEdge = bindingSide; pub.FootnoteSepWidth = footnoteSepWidth; return pub; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Exposes the <see cref="TePublicationsInit.GetGutterLoc"/> method /// </summary> /// <param name="attributes">The collection of attributes.</param> /// <param name="attrName">Name of the attribute containing the gutter location</param> /// <param name="defaultVal">The default val.</param> /// <returns></returns> /// ------------------------------------------------------------------------------------ internal new BindingSide GetGutterLoc(XmlAttributeCollection attributes, string attrName, BindingSide defaultVal) { return base.GetGutterLoc(attributes, attrName, defaultVal); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates a publication and adds it to a collection of Publications on the /// CmMajorObject AnnotationDefs. /// </summary> /// <param name="pageHeight">Height of the page.</param> /// <param name="pageWidth">Width of the page.</param> /// <param name="fIsLandscape">if set to <c>true</c> the publication is landscape.</param> /// <param name="name">The name of the publication.</param> /// <param name="gutterMargin">The gutter margin.</param> /// <param name="bindingSide">The side on which the publication will be bound (i.e., the /// gutter location).</param> /// <param name="footnoteSepWidth">Width of the footnote seperator.</param> /// <returns>the new publication</returns> /// <remarks>Adds the publication to AnnotationDefs because we need a /// CmMajorObject where we can attach the Publication and Scripture is not visible here. /// </remarks> /// ------------------------------------------------------------------------------------ public IPublication CreatePublication(int pageHeight, int pageWidth, bool fIsLandscape, string name, int gutterMargin, BindingSide bindingSide, int footnoteSepWidth) { Debug.Assert(Cache.LangProject != null, "The language project is null"); Debug.Assert(Cache.LangProject.AnnotationDefsOA != null, "The annotation definitions are null."); Publication pub = new Publication(); Cache.LangProject.AnnotationDefsOA.PublicationsOC.Add(pub); pub.PageHeight = pageHeight; pub.PageWidth = pageWidth; pub.IsLandscape = fIsLandscape; pub.Name = name; pub.GutterMargin = gutterMargin; pub.BindingEdge = bindingSide; pub.FootnoteSepWidth = footnoteSepWidth; return (IPublication)pub; }
/// ------------------------------------------------------------------------------------- /// <summary> /// Returns a GutterLocation from the named attribute. /// </summary> /// <param name="attributes">collection of XML attributes for current tag</param> /// <param name="attrName">name of the attribute</param> /// <param name="defaultVal">a default to be used if no value present in the XML</param> /// <returns>the GutterLocation enum</returns> /// ------------------------------------------------------------------------------------- protected BindingSide GetGutterLoc(XmlAttributeCollection attributes, string attrName, BindingSide defaultVal) { XmlNode gutterLocAttrib = attributes.GetNamedItem(attrName); if (gutterLocAttrib != null && gutterLocAttrib.Value != string.Empty) { try { return (BindingSide)Enum.Parse(typeof(BindingSide), gutterLocAttrib.Value, true); } catch { string message; #if DEBUG message = "Error reading TePublications.xml: Unrecognized GutterLocation attribute: " + attrName + "=\"" + gutterLocAttrib.Value + "\""; #else message = TeResourceHelper.GetResourceString("kstidInvalidInstallation"); #endif throw new Exception(message); } } else return defaultVal; }