Info tool - named destinations

This commit is contained in:
Jakub Melka
2020-10-07 18:57:34 +02:00
parent 71cf448cb3
commit 300a893f5d
8 changed files with 338 additions and 41 deletions

View File

@@ -401,7 +401,7 @@ PDFToolApplicationStorage* PDFToolApplicationStorage::getInstance()
return &storage;
}
std::vector<pdf::PDFInteger> PDFToolOptions::getPageRange(pdf::PDFInteger pageCount, QString& errorMessage) const
std::vector<pdf::PDFInteger> PDFToolOptions::getPageRange(pdf::PDFInteger pageCount, QString& errorMessage, bool zeroBased) const
{
QStringList parts;
@@ -433,8 +433,15 @@ std::vector<pdf::PDFInteger> PDFToolOptions::getPageRange(pdf::PDFInteger pageCo
}
QString partsString = parts.join(",");
pdf::PDFClosedIntervalSet result = pdf::PDFClosedIntervalSet::parse(0, pageCount, partsString, &errorMessage);
return result.unfold();
pdf::PDFClosedIntervalSet result = pdf::PDFClosedIntervalSet::parse(1, pageCount, partsString, &errorMessage);
std::vector<pdf::PDFInteger> pageIndices = result.unfold();
if (zeroBased)
{
std::for_each(pageIndices.begin(), pageIndices.end(), [](auto& index) { --index; });
}
return pageIndices;
}
} // pdftool