Adds ReaderPageMap, to optionally show source pages numbers

bump crengine: support for EPUB3 nav toc and page maps
Includes:
- Fix lvRect:isRectInside(rc) with 0-width or 0-height rect
- TOC: parse EPUB3 nav toc, fallback to spine when no toc
- Parse and cache various hardcopy page list maps
- epub.css: hide EPUB3 <span epub:type="pagebreak"> content
cre.cpp: add a few PageMap helper functions.

Adds ReaderPageMap which will add a new menu (under TOC and
Bookmarks) that will allow:
- to list source page numbers (like a TOC)
- to show visible page labels in the right margin
- to use these source page numbers in the footer, the TOC,
  the GoTo and SkimTo widgets, and to use the source page
  number in the standard bookmark and highlight initial text.
This commit is contained in:
poire-z
2020-03-26 14:04:59 +01:00
parent 1cb3be324a
commit 026140f809
12 changed files with 506 additions and 9 deletions

View File

@@ -877,12 +877,45 @@ function CreDocument:buildAlternativeToc()
self._document:buildAlternativeToc()
end
function CreDocument:hasPageMap()
return self._document:hasPageMap()
end
function CreDocument:getPageMap()
return self._document:getPageMap()
end
function CreDocument:getPageMapSource()
return self._document:getPageMapSource()
end
function CreDocument:getPageMapCurrentPageLabel()
return self._document:getPageMapCurrentPageLabel()
end
function CreDocument:getPageMapFirstPageLabel()
return self._document:getPageMapFirstPageLabel()
end
function CreDocument:getPageMapLastPageLabel()
return self._document:getPageMapLastPageLabel()
end
function CreDocument:getPageMapXPointerPageLabel(xp)
return self._document:getPageMapXPointerPageLabel(xp)
end
function CreDocument:getPageMapVisiblePageLabels()
return self._document:getPageMapVisiblePageLabels()
end
function CreDocument:register(registry)
registry:addProvider("azw", "application/vnd.amazon.mobi8-ebook", self, 90)
registry:addProvider("chm", "application/vnd.ms-htmlhelp", self, 90)
registry:addProvider("doc", "application/msword", self, 90)
registry:addProvider("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", self, 90)
registry:addProvider("epub", "application/epub+zip", self, 100)
registry:addProvider("epub3", "application/epub+zip", self, 100)
registry:addProvider("fb2", "application/fb2", self, 90)
registry:addProvider("fb2.zip", "application/zip", self, 90)
registry:addProvider("fb3", "application/fb3", self, 90)
@@ -1184,6 +1217,8 @@ function CreDocument:setupCallCache()
elseif name == "getScreenPositionFromXPointer" then cache_by_tag = true
elseif name == "getXPointer" then cache_by_tag = true
elseif name == "isXPointerInCurrentPage" then cache_by_tag = true
elseif name == "getPageMapCurrentPageLabel" then cache_by_tag = true
elseif name == "getPageMapVisiblePageLabels" then cache_by_tag = true
-- Assume all remaining get* can have their results
-- cached globally by function arguments