upgrade libHaru to 2.3.0; make UTF-8 encoding default; some internal modifications and fixes

This commit is contained in:
Alex Fabijanic
2017-11-21 20:42:14 -06:00
parent 1724e8ba53
commit e067b19903
100 changed files with 8241 additions and 1179 deletions

View File

@@ -36,9 +36,7 @@ Document::Document(const std::string fileName,
_pRawData(0),
_size(0)
{
compression(COMPRESSION_ALL);
for (Poco::UInt32 i = 0; i < pageCount; ++i)
addPage(pageSize, orientation);
init(pageCount, pageSize, orientation);
}
@@ -49,9 +47,7 @@ Document::Document(Poco::UInt32 pageCount,
_pRawData(0),
_size(0)
{
compression(COMPRESSION_ALL);
for (Poco::UInt32 i = 0; i < pageCount; ++i)
addPage();
init(pageCount, pageSize, orientation);
}
@@ -62,6 +58,16 @@ Document::~Document()
}
void Document::init(Poco::UInt32 pageCount,
Page::Size pageSize, Page::Orientation orientation)
{
useUTF8Encoding();
compression(COMPRESSION_ALL);
for (Poco::UInt32 i = 0; i < pageCount; ++i)
addPage(pageSize, orientation);
}
void Document::createNew(bool resetAll)
{
reset(resetAll);
@@ -99,7 +105,7 @@ Document::SizeType Document::size()
const Page& Document::addPage(Page::Size pageSize, Page::Orientation orientation)
{
Page page(&_pdf, HPDF_AddPage(_pdf), pageSize);
Page page(this, HPDF_AddPage(_pdf), pageSize);
page.setSizeAndOrientation(pageSize, orientation);
_pages.push_back(page);
return _pages.back();
@@ -114,7 +120,7 @@ const Page& Document::insertPage(int index,
poco_assert (index < _pages.size());
HPDF_Page target = *((HPDF_Page*) HPDF_List_ItemAt(_pdf->page_list, static_cast<HPDF_UINT>(index)));
return *_pages.insert(_pages.begin() + index,
Page(&_pdf,
Page(this,
HPDF_InsertPage(_pdf, target),
pageSize,
orientation));
@@ -123,7 +129,7 @@ const Page& Document::insertPage(int index,
const Page& Document::getCurrentPage()
{
Page p(&_pdf, HPDF_GetCurrentPage(_pdf));
Page p(this, HPDF_GetCurrentPage(_pdf));
PageContainer::iterator it = _pages.begin();
PageContainer::iterator end = _pages.end();
for (;it != end; ++it)