mirror of https://github.com/JakubMelka/PDF4QT.git
Qbs: fix build clang, mingw
This commit is contained in:
parent
0a35c95aa7
commit
92f4055d05
|
@ -984,7 +984,7 @@ QStringList GeneratedBase::getFormattedTextWithLayout(QString firstPrefix, QStri
|
||||||
int usedLength = indent + qMax(firstPrefix.length(), prefix.length());
|
int usedLength = indent + qMax(firstPrefix.length(), prefix.length());
|
||||||
int length = 80 - usedLength;
|
int length = 80 - usedLength;
|
||||||
QString testText(length, QChar('A'));
|
QString testText(length, QChar('A'));
|
||||||
int width = fontMetrics.width(testText);
|
int width = fontMetrics.horizontalAdvance(testText);
|
||||||
|
|
||||||
QTextLayout layout(text, font);
|
QTextLayout layout(text, font);
|
||||||
layout.setCacheEnabled(false);
|
layout.setCacheEnabled(false);
|
||||||
|
|
|
@ -101,12 +101,12 @@ void MainWindow::on_actionAdd_JBIG2_image_triggered()
|
||||||
{
|
{
|
||||||
QImage image(imageData.getWidth(), imageData.getHeight(), QImage::Format_Mono);
|
QImage image(imageData.getWidth(), imageData.getHeight(), QImage::Format_Mono);
|
||||||
const uchar* sourceData = reinterpret_cast<const uchar*>(imageData.getData().constData());
|
const uchar* sourceData = reinterpret_cast<const uchar*>(imageData.getData().constData());
|
||||||
Q_ASSERT(imageData.getData().size() == image.byteCount());
|
Q_ASSERT(imageData.getData().size() == image.sizeInBytes());
|
||||||
std::transform(sourceData, sourceData + imageData.getData().size(), image.bits(), [](const uchar value) { return value; });
|
std::transform(sourceData, sourceData + imageData.getData().size(), image.bits(), [](const uchar value) { return value; });
|
||||||
addImage(file.fileName() + QString(", Decoded in %1 [msec]").arg(time), qMove(image));
|
addImage(file.fileName() + QString(", Decoded in %1 [msec]").arg(time), qMove(image));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (pdf::PDFException exception)
|
catch (const pdf::PDFException& exception)
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("Error"), exception.getMessage());
|
QMessageBox::critical(this, tr("Error"), exception.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,17 +9,20 @@ Pdf4QtLibrary {
|
||||||
Depends { name: "openjpeg" }
|
Depends { name: "openjpeg" }
|
||||||
Depends { name: "lcms" }
|
Depends { name: "lcms" }
|
||||||
Depends {
|
Depends {
|
||||||
condition: qbs.toolchain.contains("gcc")
|
condition: qbs.toolchain.contains("gcc") && !qbs.toolchain.contains("mingw")
|
||||||
name: "tbb"
|
name: "tbb"
|
||||||
}
|
}
|
||||||
Depends {
|
Depends {
|
||||||
condition: qbs.hostOS.contains("linux")
|
condition: qbs.hostOS.contains("linux")
|
||||||
name: "fontconfig"
|
name: "fontconfig"
|
||||||
}
|
}
|
||||||
|
Properties {
|
||||||
|
condition: qbs.toolchain.contains("msvc") || qbs.toolchain.contains("clang")
|
||||||
|
cpp.cxxFlags: "/bigobj"
|
||||||
|
}
|
||||||
Properties {
|
Properties {
|
||||||
condition: qbs.hostOS.contains("windows")
|
condition: qbs.hostOS.contains("windows")
|
||||||
cpp.defines: "PDF4QTLIB_LIBRARY"
|
cpp.defines: "PDF4QTLIB_LIBRARY"
|
||||||
cpp.cxxFlags: "/bigobj"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
files: [
|
files: [
|
||||||
|
@ -38,7 +41,7 @@ Pdf4QtLibrary {
|
||||||
Depends { name: "openjpeg" }
|
Depends { name: "openjpeg" }
|
||||||
Depends { name: "lcms" }
|
Depends { name: "lcms" }
|
||||||
Depends {
|
Depends {
|
||||||
condition: qbs.toolchain.contains("gcc")
|
condition: qbs.toolchain.contains("gcc") && !qbs.toolchain.contains("mingw")
|
||||||
name: "tbb"
|
name: "tbb"
|
||||||
}
|
}
|
||||||
Depends {
|
Depends {
|
||||||
|
|
|
@ -164,7 +164,7 @@ PDFAlgorithmLongestCommonSubsequenceBase::SequenceItemRanges PDFAlgorithmLongest
|
||||||
|
|
||||||
PDFAlgorithmLongestCommonSubsequenceBase::SequenceItemFlags PDFAlgorithmLongestCommonSubsequenceBase::collectFlags(const SequenceItemRange& range)
|
PDFAlgorithmLongestCommonSubsequenceBase::SequenceItemFlags PDFAlgorithmLongestCommonSubsequenceBase::collectFlags(const SequenceItemRange& range)
|
||||||
{
|
{
|
||||||
SequenceItemFlags flags = 0;
|
SequenceItemFlags flags = SequenceItemFlags();
|
||||||
|
|
||||||
for (auto it = range.first; it != range.second; ++it)
|
for (auto it = range.first; it != range.second; ++it)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1410,7 +1410,7 @@ void PDFAnnotationManager::drawAnnotation(const PageAnnotation& annotation,
|
||||||
drawAnnotationUsingAppearanceStream(annotation, appearanceStreamObject, pagePointToDevicePointMatrix, page, cms, painter);
|
drawAnnotationUsingAppearanceStream(annotation, appearanceStreamObject, pagePointToDevicePointMatrix, page, cms, painter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (PDFException exception)
|
catch (const PDFException& exception)
|
||||||
{
|
{
|
||||||
errors.push_back(PDFRenderError(RenderErrorType::Error, exception.getMessage()));
|
errors.push_back(PDFRenderError(RenderErrorType::Error, exception.getMessage()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -684,7 +684,7 @@ PDFDocumentSecurityStore PDFDocumentSecurityStore::parse(const PDFObject& object
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (PDFException)
|
catch (const PDFException&)
|
||||||
{
|
{
|
||||||
return PDFDocumentSecurityStore();
|
return PDFDocumentSecurityStore();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1491,7 +1491,7 @@ void PDFCMSManager::setDocument(const PDFDocument* document)
|
||||||
content = m_document->getDecodedStream(outputProfileObject.getStream());
|
content = m_document->getDecodedStream(outputProfileObject.getStream());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (PDFException)
|
catch (const PDFException&)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -642,4 +642,15 @@ std::vector<QByteArray> PDFDocumentDataLoaderDecorator::readStringArray(const PD
|
||||||
return std::vector<QByteArray>();
|
return std::vector<QByteArray>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const PDFObject& PDFObjectStorage::getObject(const PDFObject& object) const
|
||||||
|
{
|
||||||
|
if (object.isReference())
|
||||||
|
{
|
||||||
|
// Try to dereference the object
|
||||||
|
return getObject(object.getReference());
|
||||||
|
}
|
||||||
|
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace pdf
|
} // namespace pdf
|
||||||
|
|
|
@ -598,18 +598,6 @@ const PDFObject& PDFDocument::getObjectByReference(PDFObjectReference reference)
|
||||||
return m_pdfObjectStorage.getObject(reference);
|
return m_pdfObjectStorage.getObject(reference);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
|
||||||
const PDFObject& PDFObjectStorage::getObject(const PDFObject& object) const
|
|
||||||
{
|
|
||||||
if (object.isReference())
|
|
||||||
{
|
|
||||||
// Try to dereference the object
|
|
||||||
return getObject(object.getReference());
|
|
||||||
}
|
|
||||||
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
inline
|
||||||
const PDFDictionary* PDFObjectStorage::getDictionaryFromObject(const PDFObject& object) const
|
const PDFDictionary* PDFObjectStorage::getDictionaryFromObject(const PDFObject& object) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -91,7 +91,7 @@ PDFOperationResult PDFDocumentManipulator::assemble(const AssembledPages& pages)
|
||||||
// Optimize document - remove unused objects and shrink object storage
|
// Optimize document - remove unused objects and shrink object storage
|
||||||
finalizeDocument(&mergedDocument);
|
finalizeDocument(&mergedDocument);
|
||||||
}
|
}
|
||||||
catch (PDFException exception)
|
catch (const PDFException& exception)
|
||||||
{
|
{
|
||||||
return exception.getMessage();
|
return exception.getMessage();
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ void PDFDocumentReader::checkHeader(const QByteArray& buffer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const PDFInteger PDFDocumentReader::findXrefTableOffset(const QByteArray& buffer)
|
PDFInteger PDFDocumentReader::findXrefTableOffset(const QByteArray& buffer)
|
||||||
{
|
{
|
||||||
const int startXRefPosition = findFromEnd(PDF_START_OF_XREF_MARK, buffer, PDF_FOOTER_SCAN_LIMIT);
|
const int startXRefPosition = findFromEnd(PDF_START_OF_XREF_MARK, buffer, PDF_FOOTER_SCAN_LIMIT);
|
||||||
if (startXRefPosition == FIND_NOT_FOUND_RESULT)
|
if (startXRefPosition == FIND_NOT_FOUND_RESULT)
|
||||||
|
@ -271,7 +271,7 @@ PDFObject PDFDocumentReader::readDamagedTrailerDictionary() const
|
||||||
object = PDFObjectManipulator::merge(object, trailerDictionaryObject, PDFObjectManipulator::RemoveNullObjects);
|
object = PDFObjectManipulator::merge(object, trailerDictionaryObject, PDFObjectManipulator::RemoveNullObjects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (PDFException)
|
catch (const PDFException&)
|
||||||
{
|
{
|
||||||
// Do nothing...
|
// Do nothing...
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ PDFDocumentReader::Result PDFDocumentReader::processReferenceTableEntries(PDFXRe
|
||||||
QMutexLocker lock(&m_mutex);
|
QMutexLocker lock(&m_mutex);
|
||||||
objects[entry.reference.objectNumber] = PDFObjectStorage::Entry(entry.reference.generation, object);
|
objects[entry.reference.objectNumber] = PDFObjectStorage::Entry(entry.reference.generation, object);
|
||||||
}
|
}
|
||||||
catch (PDFException exception)
|
catch (const PDFException& exception)
|
||||||
{
|
{
|
||||||
QMutexLocker lock(&m_mutex);
|
QMutexLocker lock(&m_mutex);
|
||||||
|
|
||||||
|
@ -518,7 +518,7 @@ void PDFDocumentReader::processObjectStreams(PDFXRefTable* xrefTable, PDFObjectS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (PDFException exception)
|
catch (const PDFException& exception)
|
||||||
{
|
{
|
||||||
QMutexLocker lock(&m_mutex);
|
QMutexLocker lock(&m_mutex);
|
||||||
m_result = Result::Failed;
|
m_result = Result::Failed;
|
||||||
|
@ -711,7 +711,7 @@ bool PDFDocumentReader::restoreObjects(std::map<PDFObjectReference, PDFObject>&
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (PDFException)
|
catch (const PDFException&)
|
||||||
{
|
{
|
||||||
// Do nothing
|
// Do nothing
|
||||||
succesfull = false;
|
succesfull = false;
|
||||||
|
|
|
@ -98,7 +98,7 @@ private:
|
||||||
|
|
||||||
void checkFooter(const QByteArray& buffer);
|
void checkFooter(const QByteArray& buffer);
|
||||||
void checkHeader(const QByteArray& buffer);
|
void checkHeader(const QByteArray& buffer);
|
||||||
const PDFInteger findXrefTableOffset(const QByteArray& buffer);
|
PDFInteger findXrefTableOffset(const QByteArray& buffer);
|
||||||
Result processReferenceTableEntries(PDFXRefTable* xrefTable, const std::vector<PDFXRefTable::Entry>& occupiedEntries, PDFObjectStorage::PDFObjects& objects);
|
Result processReferenceTableEntries(PDFXRefTable* xrefTable, const std::vector<PDFXRefTable::Entry>& occupiedEntries, PDFObjectStorage::PDFObjects& objects);
|
||||||
Result processSecurityHandler(const PDFObject& trailerDictionaryObject, const std::vector<PDFXRefTable::Entry>& occupiedEntries, PDFObjectStorage::PDFObjects& objects);
|
Result processSecurityHandler(const PDFObject& trailerDictionaryObject, const std::vector<PDFXRefTable::Entry>& occupiedEntries, PDFObjectStorage::PDFObjects& objects);
|
||||||
void processObjectStreams(PDFXRefTable* xrefTable, PDFObjectStorage::PDFObjects& objects);
|
void processObjectStreams(PDFXRefTable* xrefTable, PDFObjectStorage::PDFObjects& objects);
|
||||||
|
|
|
@ -2146,7 +2146,7 @@ QByteArray PDFEncoding::convertToEncoding(const QString& string, Encoding encodi
|
||||||
ushort unicode = character.unicode();
|
ushort unicode = character.unicode();
|
||||||
unsigned char converted = 0;
|
unsigned char converted = 0;
|
||||||
|
|
||||||
for (int i = 0; i < table->size(); ++i)
|
for (size_t i = 0; i < table->size(); ++i)
|
||||||
{
|
{
|
||||||
if (unicode == (*table)[static_cast<unsigned char>(i)])
|
if (unicode == (*table)[static_cast<unsigned char>(i)])
|
||||||
{
|
{
|
||||||
|
@ -2353,6 +2353,9 @@ const encoding::EncodingTable* PDFEncoding::getTableForEncoding(Encoding encodin
|
||||||
|
|
||||||
case Encoding::MacOsRoman:
|
case Encoding::MacOsRoman:
|
||||||
return &pdf::encoding::MAC_OS_ENCODING_CONVERSION_TABLE;
|
return &pdf::encoding::MAC_OS_ENCODING_CONVERSION_TABLE;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unknown encoding?
|
// Unknown encoding?
|
||||||
|
|
|
@ -315,7 +315,7 @@ public:
|
||||||
GlyphIndices glyphIndices);
|
GlyphIndices glyphIndices);
|
||||||
virtual ~PDFSimpleFont() override = default;
|
virtual ~PDFSimpleFont() override = default;
|
||||||
|
|
||||||
const PDFEncoding::Encoding getEncodingType() const { return m_encodingType; }
|
PDFEncoding::Encoding getEncodingType() const { return m_encodingType; }
|
||||||
const encoding::EncodingTable* getEncoding() const { return &m_encoding; }
|
const encoding::EncodingTable* getEncoding() const { return &m_encoding; }
|
||||||
const GlyphIndices* getGlyphIndices() const { return &m_glyphIndices; }
|
const GlyphIndices* getGlyphIndices() const { return &m_glyphIndices; }
|
||||||
|
|
||||||
|
|
|
@ -404,7 +404,7 @@ private:
|
||||||
PDFFormField::FieldFlags m_flags;
|
PDFFormField::FieldFlags m_flags;
|
||||||
|
|
||||||
Options m_options;
|
Options m_options;
|
||||||
Qt::Alignment m_textAlignment = 0;
|
Qt::Alignment m_textAlignment = Qt::Alignment();
|
||||||
int m_topIndex = 0;
|
int m_topIndex = 0;
|
||||||
int m_currentIndex = 0;
|
int m_currentIndex = 0;
|
||||||
std::set<int> m_selection;
|
std::set<int> m_selection;
|
||||||
|
@ -828,7 +828,7 @@ PDFFormFieldPointer PDFFormField::parse(const PDFObjectStorage* storage, PDFObje
|
||||||
{
|
{
|
||||||
PDFInteger maxLengthDefault = 0;
|
PDFInteger maxLengthDefault = 0;
|
||||||
QByteArray defaultAppearance;
|
QByteArray defaultAppearance;
|
||||||
Qt::Alignment alignment = 0;
|
Qt::Alignment alignment = Qt::Alignment();
|
||||||
|
|
||||||
if (PDFFormFieldText* parentTextField = dynamic_cast<PDFFormFieldText*>(parentField))
|
if (PDFFormFieldText* parentTextField = dynamic_cast<PDFFormFieldText*>(parentField))
|
||||||
{
|
{
|
||||||
|
@ -3776,7 +3776,7 @@ void PDFListBoxPseudowidget::draw(AnnotationDrawParameters& parameters, bool edi
|
||||||
QColor highlightColor = getAdjustedColor(palette.color(QPalette::Highlight));
|
QColor highlightColor = getAdjustedColor(palette.color(QPalette::Highlight));
|
||||||
|
|
||||||
QRectF rect(0, 0, m_widgetRect.width(), m_lineSpacing);
|
QRectF rect(0, 0, m_widgetRect.width(), m_lineSpacing);
|
||||||
for (int i = m_topIndex; i < m_options.size(); ++i)
|
for (int i = m_topIndex; i < int(m_options.size()); ++i)
|
||||||
{
|
{
|
||||||
if (m_selection.count(i))
|
if (m_selection.count(i))
|
||||||
{
|
{
|
||||||
|
@ -3912,7 +3912,7 @@ bool PDFListBoxPseudowidget::hasContinuousSelection() const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return *m_selection.rbegin() - *m_selection.begin() + 1 == m_selection.size();
|
return *m_selection.rbegin() - *m_selection.begin() + 1 == int(m_selection.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
int PDFListBoxPseudowidget::getValidIndex(int index) const
|
int PDFListBoxPseudowidget::getValidIndex(int index) const
|
||||||
|
|
|
@ -351,7 +351,7 @@ private:
|
||||||
QByteArray m_defaultAppearance;
|
QByteArray m_defaultAppearance;
|
||||||
|
|
||||||
/// Text field alignment
|
/// Text field alignment
|
||||||
Qt::Alignment m_alignment = 0;
|
Qt::Alignment m_alignment = Qt::Alignment();
|
||||||
|
|
||||||
/// Default style
|
/// Default style
|
||||||
QString m_defaultStyle;
|
QString m_defaultStyle;
|
||||||
|
|
|
@ -1865,7 +1865,7 @@ PDFFunction::FunctionResult PDFPostScriptFunction::apply(const_iterator x_1, con
|
||||||
return PDFTranslationContext::tr("Stack contains more values, than output size (%1 remains) (PostScript function).").arg(stack.size());
|
return PDFTranslationContext::tr("Stack contains more values, than output size (%1 remains) (PostScript function).").arg(stack.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (PDFPostScriptFunction::PDFPostScriptFunctionException exception)
|
catch (const PDFPostScriptFunction::PDFPostScriptFunctionException& exception)
|
||||||
{
|
{
|
||||||
return exception.getMessage();
|
return exception.getMessage();
|
||||||
}
|
}
|
||||||
|
|
|
@ -368,8 +368,8 @@ QVariant PDFOutlineTreeItemModel::data(const QModelIndex& index, int role) const
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
return outlineItem->getTitle();
|
return outlineItem->getTitle();
|
||||||
|
|
||||||
case Qt::TextColorRole:
|
case Qt::ForegroundRole:
|
||||||
return outlineItem->getTextColor();
|
return QBrush(outlineItem->getTextColor());
|
||||||
|
|
||||||
case Qt::FontRole:
|
case Qt::FontRole:
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
namespace pdf
|
namespace pdf
|
||||||
{
|
{
|
||||||
|
|
||||||
static constexpr const std::array glyphNameToUnicode = {
|
static constexpr const std::array<std::pair<QChar, const char*>, 4285> glyphNameToUnicode = {
|
||||||
std::pair<QChar, const char*>{ QChar(0x0041), "A" }, // Character 'A' Letter, Uppercase
|
std::pair<QChar, const char*>{ QChar(0x0041), "A" }, // Character 'A' Letter, Uppercase
|
||||||
std::pair<QChar, const char*>{ QChar(0x00C6), "AE" }, // Character 'Æ' Letter, Uppercase
|
std::pair<QChar, const char*>{ QChar(0x00C6), "AE" }, // Character 'Æ' Letter, Uppercase
|
||||||
std::pair<QChar, const char*>{ QChar(0x01FC), "AEacute" }, // Character 'Ǽ' Letter, Uppercase
|
std::pair<QChar, const char*>{ QChar(0x01FC), "AEacute" }, // Character 'Ǽ' Letter, Uppercase
|
||||||
|
|
|
@ -278,7 +278,7 @@ void PDFPageContentProcessor::initializeProcessor()
|
||||||
m_deviceRGBColorSpace = PDFAbstractColorSpace::createDeviceColorSpaceByName(m_colorSpaceDictionary, m_document, COLOR_SPACE_NAME_DEVICE_RGB);
|
m_deviceRGBColorSpace = PDFAbstractColorSpace::createDeviceColorSpaceByName(m_colorSpaceDictionary, m_document, COLOR_SPACE_NAME_DEVICE_RGB);
|
||||||
m_deviceCMYKColorSpace = PDFAbstractColorSpace::createDeviceColorSpaceByName(m_colorSpaceDictionary, m_document, COLOR_SPACE_NAME_DEVICE_CMYK);
|
m_deviceCMYKColorSpace = PDFAbstractColorSpace::createDeviceColorSpaceByName(m_colorSpaceDictionary, m_document, COLOR_SPACE_NAME_DEVICE_CMYK);
|
||||||
}
|
}
|
||||||
catch (PDFException exception)
|
catch (const PDFException& exception)
|
||||||
{
|
{
|
||||||
m_errorList.append(PDFRenderError(RenderErrorType::Error, exception.getMessage()));
|
m_errorList.append(PDFRenderError(RenderErrorType::Error, exception.getMessage()));
|
||||||
|
|
||||||
|
@ -687,7 +687,7 @@ void PDFPageContentProcessor::processContent(const QByteArray& content)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (PDFException exception)
|
catch (const PDFException& exception)
|
||||||
{
|
{
|
||||||
// If we get exception when parsing, and parser position is not advanced,
|
// If we get exception when parsing, and parser position is not advanced,
|
||||||
// then we must advance it manually, otherwise we get infinite loop.
|
// then we must advance it manually, otherwise we get infinite loop.
|
||||||
|
@ -715,7 +715,7 @@ void PDFPageContentProcessor::processContentStream(const PDFStream* stream)
|
||||||
|
|
||||||
processContent(content);
|
processContent(content);
|
||||||
}
|
}
|
||||||
catch (PDFException exception)
|
catch (const PDFException& exception)
|
||||||
{
|
{
|
||||||
m_operands.clear();
|
m_operands.clear();
|
||||||
m_errorList.append(PDFRenderError(RenderErrorType::Error, exception.getMessage()));
|
m_errorList.append(PDFRenderError(RenderErrorType::Error, exception.getMessage()));
|
||||||
|
@ -904,7 +904,8 @@ void PDFPageContentProcessor::processPathPainting(const QPainterPath& path, bool
|
||||||
const PDFLineDashPattern& lineDashPattern = m_graphicState.getLineDashPattern();
|
const PDFLineDashPattern& lineDashPattern = m_graphicState.getLineDashPattern();
|
||||||
if (!lineDashPattern.isSolid())
|
if (!lineDashPattern.isSolid())
|
||||||
{
|
{
|
||||||
stroker.setDashPattern(QVector<PDFReal>::fromStdVector(lineDashPattern.getDashArray()));
|
const auto& dashArray = lineDashPattern.getDashArray();
|
||||||
|
stroker.setDashPattern(QVector<PDFReal>(dashArray.begin(), dashArray.end()));
|
||||||
stroker.setDashOffset(lineDashPattern.getDashOffset());
|
stroker.setDashOffset(lineDashPattern.getDashOffset());
|
||||||
}
|
}
|
||||||
QPainterPath strokedPath = stroker.createStroke(path);
|
QPainterPath strokedPath = stroker.createStroke(path);
|
||||||
|
@ -951,7 +952,8 @@ void PDFPageContentProcessor::processPathPainting(const QPainterPath& path, bool
|
||||||
const PDFLineDashPattern& lineDashPattern = m_graphicState.getLineDashPattern();
|
const PDFLineDashPattern& lineDashPattern = m_graphicState.getLineDashPattern();
|
||||||
if (!lineDashPattern.isSolid())
|
if (!lineDashPattern.isSolid())
|
||||||
{
|
{
|
||||||
stroker.setDashPattern(QVector<PDFReal>::fromStdVector(lineDashPattern.getDashArray()));
|
const auto& dashArray = lineDashPattern.getDashArray();
|
||||||
|
stroker.setDashPattern(QVector<PDFReal>(dashArray.begin(), dashArray.end()));
|
||||||
stroker.setDashOffset(lineDashPattern.getDashOffset());
|
stroker.setDashOffset(lineDashPattern.getDashOffset());
|
||||||
}
|
}
|
||||||
QPainterPath strokedPath = stroker.createStroke(path);
|
QPainterPath strokedPath = stroker.createStroke(path);
|
||||||
|
@ -2698,7 +2700,7 @@ void PDFPageContentProcessor::operatorTextSetFontAndFontSize(PDFOperandName font
|
||||||
m_graphicState.setTextFontSize(fontSize);
|
m_graphicState.setTextFontSize(fontSize);
|
||||||
updateGraphicState();
|
updateGraphicState();
|
||||||
}
|
}
|
||||||
catch (PDFException)
|
catch (const PDFException&)
|
||||||
{
|
{
|
||||||
m_graphicState.setTextFont(nullptr);
|
m_graphicState.setTextFont(nullptr);
|
||||||
m_graphicState.setTextFontSize(fontSize);
|
m_graphicState.setTextFontSize(fontSize);
|
||||||
|
@ -3977,7 +3979,7 @@ PDFPageContentProcessor::PDFSoftMaskDefinition PDFPageContentProcessor::PDFSoftM
|
||||||
{
|
{
|
||||||
result.m_transferFunction = PDFFunction::createFunction(processor->getDocument(), softMask->get("TR"));
|
result.m_transferFunction = PDFFunction::createFunction(processor->getDocument(), softMask->get("TR"));
|
||||||
}
|
}
|
||||||
catch (PDFException)
|
catch (const PDFException&)
|
||||||
{
|
{
|
||||||
processor->reportRenderError(RenderErrorType::Error, PDFTranslationContext::tr("Invalid soft mask transfer function."));
|
processor->reportRenderError(RenderErrorType::Error, PDFTranslationContext::tr("Invalid soft mask transfer function."));
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,9 @@ QPen PDFPainterBase::getCurrentPenImpl() const
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pen.setStyle(Qt::CustomDashLine);
|
pen.setStyle(Qt::CustomDashLine);
|
||||||
pen.setDashPattern(QVector<PDFReal>::fromStdVector(lineDashPattern.getDashArray()));
|
|
||||||
|
const auto& dashArray = lineDashPattern.getDashArray();
|
||||||
|
pen.setDashPattern(QVector<PDFReal>(dashArray.begin(), dashArray.end()));
|
||||||
pen.setDashOffset(lineDashPattern.getDashOffset());
|
pen.setDashOffset(lineDashPattern.getDashOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -787,6 +787,7 @@ PDFObject PDFParser::getObject()
|
||||||
shift();
|
shift();
|
||||||
return PDFObject::createArray(std::move(arraySharedPointer));
|
return PDFObject::createArray(std::move(arraySharedPointer));
|
||||||
}
|
}
|
||||||
|
return PDFObject::createNull();
|
||||||
}
|
}
|
||||||
case PDFLexicalAnalyzer::TokenType::DictionaryStart:
|
case PDFLexicalAnalyzer::TokenType::DictionaryStart:
|
||||||
{
|
{
|
||||||
|
@ -902,6 +903,7 @@ PDFObject PDFParser::getObject()
|
||||||
shift();
|
shift();
|
||||||
return PDFObject::createDictionary(std::move(dictionarySharedPointer));
|
return PDFObject::createDictionary(std::move(dictionarySharedPointer));
|
||||||
}
|
}
|
||||||
|
return PDFObject::createNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
case PDFLexicalAnalyzer::TokenType::Null:
|
case PDFLexicalAnalyzer::TokenType::Null:
|
||||||
|
|
|
@ -1484,7 +1484,7 @@ PDFMesh PDFRadialShading::createMesh(const PDFMeshQualitySettings& settings, con
|
||||||
QLineF xAxisLine(p1m.x(), 0, p2m.x(), 0);
|
QLineF xAxisLine(p1m.x(), 0, p2m.x(), 0);
|
||||||
|
|
||||||
QPointF intersectionPoint;
|
QPointF intersectionPoint;
|
||||||
if (radiusInterpolationLine.intersect(xAxisLine, &intersectionPoint) != QLineF::NoIntersection)
|
if (radiusInterpolationLine.intersects(xAxisLine, &intersectionPoint) != QLineF::NoIntersection)
|
||||||
{
|
{
|
||||||
xl = qBound(meshingRectangle.left() - r1, intersectionPoint.x(), xl);
|
xl = qBound(meshingRectangle.left() - r1, intersectionPoint.x(), xl);
|
||||||
}
|
}
|
||||||
|
@ -1509,7 +1509,7 @@ PDFMesh PDFRadialShading::createMesh(const PDFMeshQualitySettings& settings, con
|
||||||
QLineF xAxisLine(p1m.x(), 0, p2m.x(), 0);
|
QLineF xAxisLine(p1m.x(), 0, p2m.x(), 0);
|
||||||
|
|
||||||
QPointF intersectionPoint;
|
QPointF intersectionPoint;
|
||||||
if (radiusInterpolationLine.intersect(xAxisLine, &intersectionPoint) != QLineF::NoIntersection)
|
if (radiusInterpolationLine.intersects(xAxisLine, &intersectionPoint) != QLineF::NoIntersection)
|
||||||
{
|
{
|
||||||
xr = qBound(xr, intersectionPoint.x(), meshingRectangle.right() + r2);
|
xr = qBound(xr, intersectionPoint.x(), meshingRectangle.right() + r2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2033,7 +2033,7 @@ void pdf::PDFPublicKeySignatureHandler::addTrustedCertificates(X509_STORE* store
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
if (m_parameters.useSystemCertificateStore)
|
if (m_parameters.useSystemCertificateStore)
|
||||||
{
|
{
|
||||||
HCERTSTORE certStore = CertOpenSystemStore(NULL, L"ROOT");
|
HCERTSTORE certStore = CertOpenSystemStore(0, L"ROOT");
|
||||||
PCCERT_CONTEXT context = nullptr;
|
PCCERT_CONTEXT context = nullptr;
|
||||||
if (certStore)
|
if (certStore)
|
||||||
{
|
{
|
||||||
|
@ -2059,7 +2059,7 @@ pdf::PDFCertificateStore::CertificateEntries pdf::PDFCertificateStore::getSystem
|
||||||
CertificateEntries result;
|
CertificateEntries result;
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
HCERTSTORE certStore = CertOpenSystemStore(NULL, L"ROOT");
|
HCERTSTORE certStore = CertOpenSystemStore(0, L"ROOT");
|
||||||
PCCERT_CONTEXT context = nullptr;
|
PCCERT_CONTEXT context = nullptr;
|
||||||
if (certStore)
|
if (certStore)
|
||||||
{
|
{
|
||||||
|
|
|
@ -359,13 +359,6 @@ QByteArray PDFLzwDecodeFilter::apply(const QByteArray& data,
|
||||||
{
|
{
|
||||||
const PDFDictionary* dictionary = dereferencedParameters.getDictionary();
|
const PDFDictionary* dictionary = dereferencedParameters.getDictionary();
|
||||||
|
|
||||||
PDFInteger predictor = 1;
|
|
||||||
const PDFObject& predictorObject = objectFetcher(dictionary->get("Predictor"));
|
|
||||||
if (predictorObject.isInt())
|
|
||||||
{
|
|
||||||
predictor = predictorObject.getInteger();
|
|
||||||
}
|
|
||||||
|
|
||||||
const PDFObject& earlyChangeObject = objectFetcher(dictionary->get("EarlyChange"));
|
const PDFObject& earlyChangeObject = objectFetcher(dictionary->get("EarlyChange"));
|
||||||
if (earlyChangeObject.isInt())
|
if (earlyChangeObject.isInt())
|
||||||
{
|
{
|
||||||
|
@ -385,19 +378,6 @@ QByteArray PDFFlateDecodeFilter::apply(const QByteArray& data,
|
||||||
{
|
{
|
||||||
Q_UNUSED(securityHandler);
|
Q_UNUSED(securityHandler);
|
||||||
|
|
||||||
const PDFObject& dereferencedParameters = objectFetcher(parameters);
|
|
||||||
if (dereferencedParameters.isDictionary())
|
|
||||||
{
|
|
||||||
const PDFDictionary* dictionary = dereferencedParameters.getDictionary();
|
|
||||||
|
|
||||||
PDFInteger predictor = 1;
|
|
||||||
const PDFObject& predictorObject = objectFetcher(dictionary->get("Predictor"));
|
|
||||||
if (predictorObject.isInt())
|
|
||||||
{
|
|
||||||
predictor = predictorObject.getInteger();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PDFStreamPredictor predictor = PDFStreamPredictor::createPredictor(objectFetcher, parameters);
|
PDFStreamPredictor predictor = PDFStreamPredictor::createPredictor(objectFetcher, parameters);
|
||||||
return predictor.apply(uncompress(data));
|
return predictor.apply(uncompress(data));
|
||||||
}
|
}
|
||||||
|
|
|
@ -3229,7 +3229,7 @@ void PDFInkMapper::createSpotColors(bool activate)
|
||||||
{
|
{
|
||||||
colorSpacePointer = PDFAbstractColorSpace::createColorSpace(colorSpaceDictionary, m_document, m_document->getObject(colorSpaceDictionary->getValue(csIndex)));
|
colorSpacePointer = PDFAbstractColorSpace::createColorSpace(colorSpaceDictionary, m_document, m_document->getObject(colorSpaceDictionary->getValue(csIndex)));
|
||||||
}
|
}
|
||||||
catch (PDFException)
|
catch (const PDFException&)
|
||||||
{
|
{
|
||||||
// Ignore invalid color spaces
|
// Ignore invalid color spaces
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -254,8 +254,14 @@ class PDFIntegerRange
|
||||||
public:
|
public:
|
||||||
explicit inline constexpr PDFIntegerRange(T begin, T end) : m_begin(begin), m_end(end) { }
|
explicit inline constexpr PDFIntegerRange(T begin, T end) : m_begin(begin), m_end(end) { }
|
||||||
|
|
||||||
struct Iterator : public std::iterator<std::random_access_iterator_tag, T, ptrdiff_t, T*, T&>
|
struct Iterator
|
||||||
{
|
{
|
||||||
|
using iterator_category = std::random_access_iterator_tag;
|
||||||
|
using difference_type = ptrdiff_t;
|
||||||
|
using value_type = T;
|
||||||
|
using pointer = T*;
|
||||||
|
using reference = T&;
|
||||||
|
|
||||||
inline Iterator() : value(T(0)) { }
|
inline Iterator() : value(T(0)) { }
|
||||||
inline Iterator(T value) : value(value) { }
|
inline Iterator(T value) : value(value) { }
|
||||||
|
|
||||||
|
|
|
@ -11466,7 +11466,7 @@ void PDFXFAEngineImpl::setDocument(const PDFModifiedDocument& document, PDFForm*
|
||||||
m_template = xfa::XFA_template::parse(document.firstChildElement("template"));
|
m_template = xfa::XFA_template::parse(document.firstChildElement("template"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (PDFException)
|
catch (const PDFException&)
|
||||||
{
|
{
|
||||||
// Just clear once again - if some errorneous data
|
// Just clear once again - if some errorneous data
|
||||||
// were read, we want to clear them.
|
// were read, we want to clear them.
|
||||||
|
|
|
@ -55,7 +55,7 @@ pdf::PDFOperationResult AudioBookCreator::createAudioBook(const Settings& settin
|
||||||
QString trimmedText = item.text.trimmed();
|
QString trimmedText = item.text.trimmed();
|
||||||
if (!trimmedText.isEmpty())
|
if (!trimmedText.isEmpty())
|
||||||
{
|
{
|
||||||
textStream << trimmedText << endl;
|
textStream << trimmedText << Qt::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,9 +49,9 @@ AudioBookPlugin::AudioBookPlugin() :
|
||||||
m_actionMoveSelectionUp(nullptr),
|
m_actionMoveSelectionUp(nullptr),
|
||||||
m_actionMoveSelectionDown(nullptr),
|
m_actionMoveSelectionDown(nullptr),
|
||||||
m_actionCreateAudioBook(nullptr),
|
m_actionCreateAudioBook(nullptr),
|
||||||
|
m_actionClear(nullptr),
|
||||||
m_audioTextStreamDockWidget(nullptr),
|
m_audioTextStreamDockWidget(nullptr),
|
||||||
m_audioTextStreamEditorModel(nullptr),
|
m_audioTextStreamEditorModel(nullptr)
|
||||||
m_actionClear(nullptr)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -308,6 +308,8 @@ QVariant InkCoverageStatisticsModel::data(const QModelIndex& index, int role) co
|
||||||
Q_ASSERT(false);
|
Q_ASSERT(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Qt::BackgroundColorRole:
|
case Qt::BackgroundColorRole:
|
||||||
|
|
|
@ -355,7 +355,7 @@ void OutputPreviewWidget::paintEvent(QPaintEvent* event)
|
||||||
|
|
||||||
QString textCoverage = QString("%1 %").arg(locale.toString(coverage * 100.0, 'f', 2));
|
QString textCoverage = QString("%1 %").arg(locale.toString(coverage * 100.0, 'f', 2));
|
||||||
const int textRight = triangleLeft - rowHeight / 4;
|
const int textRight = triangleLeft - rowHeight / 4;
|
||||||
const int textWidth = painter.fontMetrics().width(textCoverage);
|
const int textWidth = painter.fontMetrics().horizontalAdvance(textCoverage);
|
||||||
const int textStart = textRight - textWidth;
|
const int textStart = textRight - textWidth;
|
||||||
|
|
||||||
QRect textRect(textStart, yCoordinate - halfHeight, textWidth + 1, rowHeight);
|
QRect textRect(textStart, yCoordinate - halfHeight, textWidth + 1, rowHeight);
|
||||||
|
|
|
@ -362,7 +362,7 @@ int PDFToolAudioBook::createAudioBook(const PDFToolOptions& options, pdf::PDFDoc
|
||||||
{
|
{
|
||||||
if (item.flags.testFlag(pdf::PDFDocumentTextFlow::PageStart) && options.textSpeechMarkPageNumbers)
|
if (item.flags.testFlag(pdf::PDFDocumentTextFlow::PageStart) && options.textSpeechMarkPageNumbers)
|
||||||
{
|
{
|
||||||
textStream << QString("<bookmark mark=\"%1\"/>").arg(item.text) << endl;
|
textStream << QString("<bookmark mark=\"%1\"/>").arg(item.text) << Qt::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!item.text.isEmpty())
|
if (!item.text.isEmpty())
|
||||||
|
|
|
@ -215,7 +215,7 @@ int PDFToolFetchImages::execute(const PDFToolOptions& options)
|
||||||
formatter.writeTableColumn("page-no", locale.toString(image.pageIndex + 1), Qt::AlignRight);
|
formatter.writeTableColumn("page-no", locale.toString(image.pageIndex + 1), Qt::AlignRight);
|
||||||
formatter.writeTableColumn("width", locale.toString(image.image.width()), Qt::AlignRight);
|
formatter.writeTableColumn("width", locale.toString(image.image.width()), Qt::AlignRight);
|
||||||
formatter.writeTableColumn("height", locale.toString(image.image.height()), Qt::AlignRight);
|
formatter.writeTableColumn("height", locale.toString(image.image.height()), Qt::AlignRight);
|
||||||
formatter.writeTableColumn("size", locale.toString(image.image.byteCount()), Qt::AlignRight);
|
formatter.writeTableColumn("size", locale.toString(image.image.sizeInBytes()), Qt::AlignRight);
|
||||||
formatter.writeTableColumn("stored-to", image.fileName);
|
formatter.writeTableColumn("stored-to", image.fileName);
|
||||||
|
|
||||||
formatter.endTableRow();
|
formatter.endTableRow();
|
||||||
|
@ -259,7 +259,7 @@ PDFToolAbstractApplication::Options PDFToolFetchImages::getOptionsFlags() const
|
||||||
void PDFToolFetchImages::onImageExtracted(pdf::PDFInteger pageIndex, pdf::PDFInteger order, const QImage& image)
|
void PDFToolFetchImages::onImageExtracted(pdf::PDFInteger pageIndex, pdf::PDFInteger order, const QImage& image)
|
||||||
{
|
{
|
||||||
QCryptographicHash hasher(QCryptographicHash::Sha512);
|
QCryptographicHash hasher(QCryptographicHash::Sha512);
|
||||||
hasher.addData(reinterpret_cast<const char*>(image.bits()), image.byteCount());
|
hasher.addData(reinterpret_cast<const char*>(image.bits()), image.sizeInBytes());
|
||||||
QByteArray hash = hasher.result();
|
QByteArray hash = hasher.result();
|
||||||
|
|
||||||
QMutexLocker lock(&m_mutex);
|
QMutexLocker lock(&m_mutex);
|
||||||
|
|
Loading…
Reference in New Issue