/// <summary> /// Renumber this node and all following pages of the same kind starting from this number. /// </summary> public override CompositeCommand RenumberCommand(ProjectView.ProjectView view, PageNumber from) { if (mRole == Role.Page && mPageNumber.Kind == from.Kind) { CompositeCommand k = base.RenumberCommand(view, from.NextPageNumber()); if (k == null) { k = Presentation.CommandFactory.CreateCompositeCommand(); k.ShortDescription = string.Format(Localizer.Message("renumber_pages"), Localizer.Message(string.Format("{0}_pages", from.Kind.ToString()))); } k.ChildCommands.Insert(k.ChildCommands.Count, new Commands.Node.SetPageNumber(view, this, from)); return(k); } else { return(base.RenumberCommand(view, from)); } }
protected override void XukInNodeProperties() { base.XukInNodeProperties(); if (Role_ != Role.Plain) { return; } try { XmlProperty xmlProp = this.GetProperty <XmlProperty>(); if (xmlProp != null) { urakawa.property.xml.XmlAttribute attrRole = xmlProp.GetAttribute(XUK_ATTR_NAME_ROLE); if (attrRole != null) { string role = attrRole.Value; if (role != null) { mRole = role == Role.Custom.ToString() ? Role.Custom : role == Role.Heading.ToString() ? Role.Heading : role == Role.Page.ToString() ? Role.Page : role == Role.Silence.ToString() ? Role.Silence : Role.Plain; } if (role != null && role != mRole.ToString()) { throw new Exception("Unknown kind: " + role); } if (mRole == Role.Custom) { mCustomRole = xmlProp.GetAttribute(XUK_ATTR_NAME_CUSTOM).Value; } //System.Windows.Forms.MessageBox.Show(mRole.ToString()); if (mRole == Role.Heading) { if (!AncestorAs <SectionNode>().DidSetHeading(this)) { mRole = Role.Plain; } } else if (mRole == Role.Page) { string pageKind = xmlProp.GetAttribute(XUK_ATTR_NAME_PAGE_KIND).Value; if (pageKind != null) { string page = xmlProp.GetAttribute(XUK_ATTR_NAME_PAGE).Value; int number = SafeParsePageNumber(page); if (pageKind == "Front") { if (number == 0) { throw new Exception(string.Format("Invalid front page number \"{0}\".", page)); } mPageNumber = new PageNumber(number, PageKind.Front); } else if (pageKind == "Normal") { if (number == 0) { throw new Exception(string.Format("Invalid page number \"{0}\".", page)); } mPageNumber = new PageNumber(number); } else if (pageKind == "Special") { if (page == null || page == "") { throw new Exception("Invalid empty special page number."); } mPageNumber = new PageNumber(page); } else { throw new Exception(string.Format("Invalid page kind \"{0}\".", pageKind)); } } } if (mRole != Role.Custom && mCustomRole != null) { throw new Exception("Extraneous `custom' attribute."); } else if (mRole == Role.Custom && mCustomRole == null) { throw new Exception("Missing `custom' attribute."); } // add it to the presentation ((ObiPresentation)Presentation).AddCustomClass(mCustomRole, this); string todo = xmlProp.GetAttribute(XUK_ATTR_NAME_TODO).Value; if (todo != null) { mTODO = todo == "True"; } } } } catch (System.Exception ex) { System.Windows.Forms.MessageBox.Show(this.ToString() + " " + ex.ToString()); } }
/// <summary> /// Get a command to renumber this node and all following nodes from this number. /// </summary> public virtual CompositeCommand RenumberCommand(ProjectView.ProjectView view, PageNumber from) { ObiNode n = FollowingNode; return(n == null ? null : n.RenumberCommand(view, from)); }