mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Form field manager (beginnings)
This commit is contained in:
@ -25,6 +25,7 @@
|
||||
#include "pdfpagecontentprocessor.h"
|
||||
#include "pdfparser.h"
|
||||
#include "pdfdrawwidget.h"
|
||||
#include "pdfform.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QApplication>
|
||||
@ -897,6 +898,7 @@ PDFAnnotationManager::PDFAnnotationManager(PDFFontCache* fontCache,
|
||||
m_fontCache(fontCache),
|
||||
m_cmsManager(cmsManager),
|
||||
m_optionalActivity(optionalActivity),
|
||||
m_formManager(nullptr),
|
||||
m_meshQualitySettings(meshQualitySettings),
|
||||
m_features(features),
|
||||
m_target(target)
|
||||
@ -1081,6 +1083,22 @@ void PDFAnnotationManager::drawPage(QPainter* painter,
|
||||
if (!oc.isValid() || !pdfPainter.isContentSuppressedByOC(oc))
|
||||
{
|
||||
pdfPainter.processForm(AA, formBoundingBox, resources, transparencyGroup, content);
|
||||
|
||||
// Is it a form field?
|
||||
if (m_formManager && annotation.annotation->getType() == AnnotationType::Widget)
|
||||
{
|
||||
const PDFFormManager::FormAppearanceFlags flags = m_formManager->getAppearanceFlags();
|
||||
if (flags.testFlag(PDFFormManager::HighlightFields) || flags.testFlag(PDFFormManager::HighlightRequiredFields))
|
||||
{
|
||||
const PDFFormField* formField = m_formManager->getFormFieldForWidget(annotation.annotation->getSelfReference());
|
||||
if (!formField)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
s
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (PDFException exception)
|
||||
@ -1168,6 +1186,16 @@ bool PDFAnnotationManager::hasAnyPageAnnotation(const std::vector<PDFInteger>& p
|
||||
return std::any_of(pageIndices.cbegin(), pageIndices.cend(), std::bind(&PDFAnnotationManager::hasAnnotation, this, std::placeholders::_1));
|
||||
}
|
||||
|
||||
PDFFormManager* PDFAnnotationManager::getFormManager() const
|
||||
{
|
||||
return m_formManager;
|
||||
}
|
||||
|
||||
void PDFAnnotationManager::setFormManager(PDFFormManager* formManager)
|
||||
{
|
||||
m_formManager = formManager;
|
||||
}
|
||||
|
||||
PDFRenderer::Features PDFAnnotationManager::getFeatures() const
|
||||
{
|
||||
return m_features;
|
||||
@ -1336,7 +1364,8 @@ void PDFWidgetAnnotationManager::updateFromMouseEvent(QMouseEvent* event)
|
||||
}
|
||||
|
||||
const PDFAction* linkAction = nullptr;
|
||||
if (pageAnnotation.annotation->getType() == AnnotationType::Link)
|
||||
const AnnotationType annotationType = pageAnnotation.annotation->getType();
|
||||
if (annotationType == AnnotationType::Link)
|
||||
{
|
||||
const PDFLinkAnnotation* linkAnnotation = dynamic_cast<const PDFLinkAnnotation*>(pageAnnotation.annotation.data());
|
||||
Q_ASSERT(linkAnnotation);
|
||||
@ -1350,6 +1379,10 @@ void PDFWidgetAnnotationManager::updateFromMouseEvent(QMouseEvent* event)
|
||||
linkAction = linkAnnotation->getAction();
|
||||
}
|
||||
}
|
||||
if (annotationType == AnnotationType::Widget)
|
||||
{
|
||||
m_cursor = QCursor(Qt::ArrowCursor);
|
||||
}
|
||||
|
||||
// Generate popup window
|
||||
if (event->type() == QEvent::MouseButtonPress && event->button() == Qt::LeftButton)
|
||||
|
Reference in New Issue
Block a user