C# Class Bloom.Book.Book

Exibir arquivo Open project: BloomBooks/BloomDesktop Class Usage Examples

Public Properties

Property Type Description
CoverColors Color[]
TypeOverrideForUnitTests BookType

Private Properties

Property Type Description
AddChildBookContentsToFolio void
AddCoverColor void
AddCreationTypeAttribute void
AddFillerTextToEmptyEditDivs void
AddJavaScriptForEditing void
AddPreviewJavascript void
BringBookUpToDate void
BringXmatterHtmlUpToDate void
BuildPageCache void
CanRelocatePageAsRequested bool
ClearPagesCache void
ConvertTagsToMetaData void
CreatePageDecriptor IPage
DeletePages void
FindPageDiv XmlElement
FixBookIdAndLineageIfNeeded void
GetBookDomWithStyleSheets HtmlDom
GetErrorDom HtmlDom
GetFileLocator IFileLocator
GetHtmlDomWithJustOnePage HtmlDom
GetIndexLastFrontkMatterPage int
GetIndexOfFirstBackMatterPage int
GetIndexOfPage int
GetLastPageForInsertingNewContent XmlElement
GetOrCreateUserModifiedStyleElementFromStorage XmlElement
GetPageCount int
GetPageElements XmlNodeList
GetPageFromStorage XmlElement
GetPageIdFromDiv string
GetPageLabelFromDiv string
GetPageToShowAfterDeletion IPage
GetThumbnailXmlDocumentForPage HtmlDom
HasContentInLang bool
HideEverythingButFirstPageAndRemoveScripts void
InjectStringListingActiveLanguagesOfBook void
RemoveAudioMarkup void
UpdateDivInsidePage void
UpdateImageMetadataAttributes void
UpdateMultilingualSettings void
UpdatePageFromFactoryTemplates void

Public Methods

Method Description
Book ( ) : System
Book ( BookInfo info, IBookStorage storage, ITemplateFinder templateFinder, CollectionSettings collectionSettings, PageSelection pageSelection, PageListChangedEvent pageListChangedEvent, BookRefreshEvent bookRefreshEvent ) : System
BringBookUpToDate ( IProgress progress ) : void
BringPageUpToDate ( XmlElement page ) : void

Bring the page up to date. Currently this is used to switch various old page types to new versions based on Custom Page (so they can actually be customized).

CheckBook ( IProgress progress, string pathToFolderOfReplacementImages = null ) : void
CheckForErrors ( ) : string
CopyImageMetadataToWholeBookAndSave ( Metadata metadata, IProgress progress ) : void

This is used when the user elects to apply the same image metadata to all images.

DeletePage ( IPage page ) : void
DuplicatePage ( IPage page ) : void
ExportXHtml ( string path ) : void
FindTemplateBook ( ) : Book
GetBookLineage ( ) : string
GetDataItem ( string name ) : MultiTextBase
GetDefaultBookletLayout ( ) : PublishModel.BookletLayoutMethod
GetDomForPrinting ( PublishModel bookletPortion, BookCollection currentBookCollection, BookServer bookServer ) : HtmlDom
GetEditableHtmlDomForPage ( IPage page ) : HtmlDom
GetErrorsIfNotCheckedBefore ( ) : string
GetHtmlDomReadyToAddPages ( HtmlDom inputDom ) : HtmlDom
GetHtmlDomWithJustOnePage ( XmlElement divNodeForThisPage ) : HtmlDom
GetLayout ( ) : Layout
GetLayoutChoices ( ) : IEnumerable
GetLicenseMetadata ( ) : Metadata
GetPageByIndex ( int pageIndex ) : IPage
GetPages ( ) : IEnumerable
GetPathHtmlFile ( ) : string

this is used for configuration, where we do want to offer up the original file.

GetPreviewHtmlFileForWholeBook ( ) : HtmlDom
GetPreviewXmlDocumentForFirstPage ( ) : HtmlDom
GetPreviewXmlDocumentForPage ( IPage page ) : HtmlDom
GetTemplatePagesIdDictionary ( ) : IPage>.Dictionary
HtmlHasLockedDownFlag ( HtmlDom dom ) : bool
InitCoverColor ( ) : void
InsertPageAfter ( IPage pageBefore, IPage templatePage ) : void
InvokeContentsChanged ( EventArgs e ) : void
PrepareForEditing ( ) : void

Under normal conditions, this isn't needed, because it is done when a book is first created. But thing might have changed: *changing xmatter pack, and update to it, changing the languages, etc. *the book was dragged from another project *the editing language was changed. Under those conditions, if we didn't, for example, do a PrepareElementsInPageOrDocument, we would end up with no editable items, because there are no elements in our language.

PrettyPrintLanguage ( string code ) : string
RecordAsLockedDown ( HtmlDom dom, bool locked ) : void
RelocatePage ( IPage page, int indexOfItemAfterRelocation ) : bool

Move a page to somewhere else in the book

RemoveXmlMarkup ( string input ) : string
Save ( ) : void
SavePage ( HtmlDom editedPageDom ) : void

Earlier, we handed out a single-page version of the document. Now it has been edited, so we now we need to fold changes back in

SelectNextCoverColor ( ) : void

This just increments the color index so that the next book to be constructed that doesn't already have a color will use it

SetLayout ( Layout layout ) : void
SetMetadata ( Metadata metadata ) : void
SetMultilingualContentLanguages ( string language2Code, string language3Code ) : void
SetTitle ( string name ) : void
SetTopic ( string englishTopicAsKey ) : void

This gets called as a result of a UI action. It sets the new topic in our data, but doesn't do anything related to how it is displayed on the page. The way to think about this is that we're aiming for a more react™-style flow.

UpdateEditableAreasOfElement ( HtmlDom dom ) : void

This is called both for the whole book, and for individual pages when the user uses Origami to make changes to the layout of the page. It would be nicer in the HtmlDom, but it uses knowledge about the collection and book languages that the DOM doesn't have.

UpdatePageToTemplate ( HtmlDom pageDom, XmlElement templatePageDiv, string pageId ) : void
UpdateTextsNewlyChangedToRequiresParagraph ( HtmlDom bookDom ) : void
_storage_FolderPathChanged ( object sender, EventArgs e ) : void

Private Methods

Method Description
AddChildBookContentsToFolio ( HtmlDom printingDom, BookCollection currentBookCollection, BookServer bookServer ) : void

used when this book is a "master"/"folio" book that is used to bring together a number of other books in the collection

AddCoverColor ( HtmlDom dom, Color coverColor ) : void
AddCreationTypeAttribute ( HtmlDom htmlDom ) : void
AddFillerTextToEmptyEditDivs ( HtmlDom pageDom ) : void
AddJavaScriptForEditing ( HtmlDom dom ) : void
AddPreviewJavascript ( HtmlDom dom ) : void

Make stuff readonly, which isn't doable via css, surprisingly

BringBookUpToDate ( HtmlDom bookDOM, IProgress progress ) : void

As the bloom format evolves, including structure and classes and other attributes, this makes changes to old books. It needs to be very fast, because currently we dont' have a real way to detect the need for migration. So we do it all the time. Yes, we have format version number, but, for example, one overhaul of the common xmatter html introduced a new class, "frontCover". Hardly enough to justify bumping the version number and making older Blooms unable to read new books. But because this is run, the xmatter will be migrated to the new template.

BringXmatterHtmlUpToDate ( HtmlDom bookDOM ) : void
BuildPageCache ( ) : void
CanRelocatePageAsRequested ( int indexOfItemAfterRelocation ) : bool
ClearPagesCache ( ) : void
ConvertTagsToMetaData ( string oldTagsPath, BookInfo bookMetaData ) : void
CreatePageDecriptor ( XmlElement pageNode, string caption, string captionI18nId ) : IPage
DeletePages ( XmlDocument bookDom, bool>.Func pageSelectingPredicate ) : void
FindPageDiv ( IPage page ) : XmlElement
FixBookIdAndLineageIfNeeded ( ) : void
GetBookDomWithStyleSheets ( ) : HtmlDom
GetErrorDom ( string extraMessages = "" ) : HtmlDom
GetFileLocator ( ) : IFileLocator
GetHtmlDomWithJustOnePage ( IPage page ) : HtmlDom
GetIndexLastFrontkMatterPage ( ) : int
GetIndexOfFirstBackMatterPage ( ) : int
GetIndexOfPage ( XmlElement pageElement ) : int
GetLastPageForInsertingNewContent ( HtmlDom printingDom ) : XmlElement
GetOrCreateUserModifiedStyleElementFromStorage ( ) : XmlElement

/// Gets the first element with the given tag & id, within the page-div with the given id. ///

The