Issue #118: Continuation

This commit is contained in:
Jakub Melka 2023-12-04 20:04:40 +01:00
parent bc8be2198b
commit edd100d3b8
78 changed files with 873 additions and 823 deletions

View File

@ -34,7 +34,6 @@ add_library(Pdf4QtLibCore SHARED
sources/pdffile.cpp sources/pdffile.cpp
sources/pdfform.cpp sources/pdfform.cpp
sources/pdficontheme.cpp sources/pdficontheme.cpp
sources/pdfitemmodels.cpp
sources/pdfjavascriptscanner.cpp sources/pdfjavascriptscanner.cpp
sources/pdfjbig2decoder.cpp sources/pdfjbig2decoder.cpp
sources/pdfmultimedia.cpp sources/pdfmultimedia.cpp
@ -44,7 +43,6 @@ add_library(Pdf4QtLibCore SHARED
sources/pdfoptimizer.cpp sources/pdfoptimizer.cpp
sources/pdfoptionalcontent.cpp sources/pdfoptionalcontent.cpp
sources/pdfoutline.cpp sources/pdfoutline.cpp
sources/pdfpagecontentelements.cpp
sources/pdfpagenavigation.cpp sources/pdfpagenavigation.cpp
sources/pdfpagetransition.cpp sources/pdfpagetransition.cpp
sources/pdfpainterutils.cpp sources/pdfpainterutils.cpp
@ -92,7 +90,7 @@ include(GenerateExportHeader)
GENERATE_EXPORT_HEADER(Pdf4QtLibCore GENERATE_EXPORT_HEADER(Pdf4QtLibCore
EXPORT_MACRO_NAME EXPORT_MACRO_NAME
PDF4QTLIBSHARED_EXPORT PDF4QTLIBCORESHARED_EXPORT
EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/pdf4qtlibcore_export.h") EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/pdf4qtlibcore_export.h")
target_link_libraries(Pdf4QtLibCore PRIVATE Qt6::Core Qt6::Gui Qt6::Xml Qt6::Svg) target_link_libraries(Pdf4QtLibCore PRIVATE Qt6::Core Qt6::Gui Qt6::Xml Qt6::Svg)
@ -103,6 +101,10 @@ target_link_libraries(Pdf4QtLibCore PRIVATE freetype)
target_link_libraries(Pdf4QtLibCore PRIVATE openjp2) target_link_libraries(Pdf4QtLibCore PRIVATE openjp2)
target_link_libraries(Pdf4QtLibCore PRIVATE JPEG::JPEG) target_link_libraries(Pdf4QtLibCore PRIVATE JPEG::JPEG)
if(PDF4QT_ENABLE_OPENGL)
target_link_libraries(Pdf4QtLibCore PRIVATE Qt6::OpenGL)
endif()
if(LINUX_GCC) if(LINUX_GCC)
target_link_libraries(Pdf4QtLibCore PUBLIC TBB::tbb) target_link_libraries(Pdf4QtLibCore PUBLIC TBB::tbb)
endif() endif()

View File

@ -79,7 +79,7 @@ enum class DestinationType
/// destination has almost exactly same syntax as page destination, it should be checked, /// destination has almost exactly same syntax as page destination, it should be checked,
/// if indirect reference returned by function \p getPageReference references really page, /// if indirect reference returned by function \p getPageReference references really page,
/// or some structure element. /// or some structure element.
class PDF4QTLIBSHARED_EXPORT PDFDestination class PDF4QTLIBCORESHARED_EXPORT PDFDestination
{ {
public: public:
explicit inline PDFDestination() = default; explicit inline PDFDestination() = default;
@ -144,7 +144,7 @@ private:
using PDFActionPtr = QSharedPointer<PDFAction>; using PDFActionPtr = QSharedPointer<PDFAction>;
/// Base class for action types. /// Base class for action types.
class PDF4QTLIBSHARED_EXPORT PDFAction class PDF4QTLIBCORESHARED_EXPORT PDFAction
{ {
public: public:
explicit PDFAction() = default; explicit PDFAction() = default;
@ -186,7 +186,7 @@ private:
/// Regular go-to action. Can contain also structure destinations, both regular page destination /// Regular go-to action. Can contain also structure destinations, both regular page destination
/// and structure destination are present, because if structure destination fails, then /// and structure destination are present, because if structure destination fails, then
/// page destination can be used as fallback resolution. /// page destination can be used as fallback resolution.
class PDF4QTLIBSHARED_EXPORT PDFActionGoTo : public PDFAction class PDF4QTLIBCORESHARED_EXPORT PDFActionGoTo : public PDFAction
{ {
public: public:
explicit inline PDFActionGoTo(PDFDestination destination, PDFDestination structureDestination) : explicit inline PDFActionGoTo(PDFDestination destination, PDFDestination structureDestination) :

View File

@ -21,27 +21,14 @@
#include "pdfpainter.h" #include "pdfpainter.h"
#include "pdfdrawspacecontroller.h" #include "pdfdrawspacecontroller.h"
#include "pdfcms.h" #include "pdfcms.h"
#include "pdfwidgetutils.h"
#include "pdfpagecontentprocessor.h" #include "pdfpagecontentprocessor.h"
#include "pdfparser.h" #include "pdfparser.h"
#include "pdfdrawwidget.h"
#include "pdfform.h" #include "pdfform.h"
#include "pdfpainterutils.h" #include "pdfpainterutils.h"
#include "pdfdocumentbuilder.h" #include "pdfdocumentbuilder.h"
#include "pdfobjecteditorwidget.h"
#include "pdfselectpagesdialog.h"
#include "pdfdbgheap.h" #include "pdfdbgheap.h"
#include <QMenu> #include <QIcon>
#include <QDialog>
#include <QApplication>
#include <QMouseEvent>
#include <QGroupBox>
#include <QScrollArea>
#include <QTextEdit>
#include <QVBoxLayout>
#include <QLabel>
#include <QStyleOptionButton>
namespace pdf namespace pdf
{ {
@ -1257,7 +1244,7 @@ QTransform PDFAnnotationManager::prepareTransformations(const QTransform& pagePo
// be exactly zoom squared. Also, we will adjust to target device logical DPI, // be exactly zoom squared. Also, we will adjust to target device logical DPI,
// if we, for example are using 4K, or 8K monitors. // if we, for example are using 4K, or 8K monitors.
qreal zoom = 1.0 / qSqrt(qAbs(pagePointToDevicePointMatrix.determinant())); qreal zoom = 1.0 / qSqrt(qAbs(pagePointToDevicePointMatrix.determinant()));
zoom = PDFWidgetUtils::scaleDPI_x(device, zoom); zoom = device->logicalDpiX() / 96.0;
QRectF unzoomedRect(annotationRectangle.bottomLeft(), annotationRectangle.size() * zoom); QRectF unzoomedRect(annotationRectangle.bottomLeft(), annotationRectangle.size() * zoom);
unzoomedRect.translate(0, -unzoomedRect.height()); unzoomedRect.translate(0, -unzoomedRect.height());
@ -1709,483 +1696,6 @@ void PDFAnnotationManager::setTarget(Target target)
m_target = target; m_target = target;
} }
PDFWidgetAnnotationManager::PDFWidgetAnnotationManager(PDFDrawWidgetProxy* proxy, QObject* parent) :
BaseClass(proxy->getFontCache(), proxy->getCMSManager(), proxy->getOptionalContentActivity(), proxy->getMeshQualitySettings(), proxy->getFeatures(), Target::View, parent),
m_proxy(proxy)
{
Q_ASSERT(proxy);
m_proxy->registerDrawInterface(this);
}
PDFWidgetAnnotationManager::~PDFWidgetAnnotationManager()
{
m_proxy->unregisterDrawInterface(this);
}
void PDFWidgetAnnotationManager::setDocument(const PDFModifiedDocument& document)
{
BaseClass::setDocument(document);
if (document.hasReset() || document.getFlags().testFlag(PDFModifiedDocument::Annotation))
{
m_editableAnnotation = PDFObjectReference();
m_editableAnnotationPage = PDFObjectReference();
}
}
void PDFWidgetAnnotationManager::shortcutOverrideEvent(QWidget* widget, QKeyEvent* event)
{
Q_UNUSED(widget);
Q_UNUSED(event);
}
void PDFWidgetAnnotationManager::keyPressEvent(QWidget* widget, QKeyEvent* event)
{
Q_UNUSED(widget);
Q_UNUSED(event);
}
void PDFWidgetAnnotationManager::keyReleaseEvent(QWidget* widget, QKeyEvent* event)
{
Q_UNUSED(widget);
Q_UNUSED(event);
}
void PDFWidgetAnnotationManager::mousePressEvent(QWidget* widget, QMouseEvent* event)
{
Q_UNUSED(widget);
updateFromMouseEvent(event);
// Show context menu?
if (event->button() == Qt::RightButton)
{
PDFWidget* pdfWidget = m_proxy->getWidget();
std::vector<PDFInteger> currentPages = pdfWidget->getDrawWidget()->getCurrentPages();
if (!hasAnyPageAnnotation(currentPages))
{
// All pages doesn't have annotation
return;
}
m_editableAnnotation = PDFObjectReference();
m_editableAnnotationPage = PDFObjectReference();
for (PDFInteger pageIndex : currentPages)
{
PageAnnotations& pageAnnotations = getPageAnnotations(pageIndex);
for (PageAnnotation& pageAnnotation : pageAnnotations.annotations)
{
if (!pageAnnotation.isHovered)
{
continue;
}
if (!PDFAnnotation::isTypeEditable(pageAnnotation.annotation->getType()))
{
continue;
}
m_editableAnnotation = pageAnnotation.annotation->getSelfReference();
m_editableAnnotationPage = pageAnnotation.annotation->getPageReference();
if (!m_editableAnnotationPage.isValid())
{
m_editableAnnotationPage = m_document->getCatalog()->getPage(pageIndex)->getPageReference();
}
break;
}
}
if (m_editableAnnotation.isValid())
{
QMenu menu(tr("Annotation"), pdfWidget);
QAction* showPopupAction = menu.addAction(tr("Show Popup Window"));
QAction* copyAction = menu.addAction(tr("Copy to Multiple Pages"));
QAction* editAction = menu.addAction(tr("Edit"));
QAction* deleteAction = menu.addAction(tr("Delete"));
connect(showPopupAction, &QAction::triggered, this, &PDFWidgetAnnotationManager::onShowPopupAnnotation);
connect(copyAction, &QAction::triggered, this, &PDFWidgetAnnotationManager::onCopyAnnotation);
connect(editAction, &QAction::triggered, this, &PDFWidgetAnnotationManager::onEditAnnotation);
connect(deleteAction, &QAction::triggered, this, &PDFWidgetAnnotationManager::onDeleteAnnotation);
m_editableAnnotationGlobalPosition = pdfWidget->mapToGlobal(event->pos());
menu.exec(m_editableAnnotationGlobalPosition);
}
}
}
void PDFWidgetAnnotationManager::mouseDoubleClickEvent(QWidget* widget, QMouseEvent* event)
{
Q_UNUSED(widget);
Q_UNUSED(event);
}
void PDFWidgetAnnotationManager::mouseReleaseEvent(QWidget* widget, QMouseEvent* event)
{
Q_UNUSED(widget);
updateFromMouseEvent(event);
}
void PDFWidgetAnnotationManager::mouseMoveEvent(QWidget* widget, QMouseEvent* event)
{
Q_UNUSED(widget);
updateFromMouseEvent(event);
}
void PDFWidgetAnnotationManager::wheelEvent(QWidget* widget, QWheelEvent* event)
{
Q_UNUSED(widget);
Q_UNUSED(event);
}
void PDFWidgetAnnotationManager::updateFromMouseEvent(QMouseEvent* event)
{
PDFWidget* widget = m_proxy->getWidget();
std::vector<PDFInteger> currentPages = widget->getDrawWidget()->getCurrentPages();
if (!hasAnyPageAnnotation(currentPages))
{
// All pages doesn't have annotation
return;
}
m_tooltip = QString();
m_cursor = std::nullopt;
bool appearanceChanged = false;
// We must update appearance states, and update tooltip
PDFWidgetSnapshot snapshot = m_proxy->getSnapshot();
const bool isDown = event->buttons().testFlag(Qt::LeftButton);
const PDFAppeareanceStreams::Appearance hoverAppearance = isDown ? PDFAppeareanceStreams::Appearance::Down : PDFAppeareanceStreams::Appearance::Rollover;
for (const PDFWidgetSnapshot::SnapshotItem& snapshotItem : snapshot.items)
{
PageAnnotations& pageAnnotations = getPageAnnotations(snapshotItem.pageIndex);
for (PageAnnotation& pageAnnotation : pageAnnotations.annotations)
{
if (pageAnnotation.annotation->isReplyTo())
{
// Annotation is reply to another annotation, do not interact with it
continue;
}
const PDFAppeareanceStreams::Appearance oldAppearance = pageAnnotation.appearance;
QRectF annotationRect = pageAnnotation.annotation->getRectangle();
QTransform matrix = prepareTransformations(snapshotItem.pageToDeviceMatrix, widget, pageAnnotation.annotation->getEffectiveFlags(), m_document->getCatalog()->getPage(snapshotItem.pageIndex), annotationRect);
QPainterPath path;
path.addRect(annotationRect);
path = matrix.map(path);
if (path.contains(event->pos()))
{
pageAnnotation.appearance = hoverAppearance;
pageAnnotation.isHovered = true;
// Generate tooltip
if (m_tooltip.isEmpty())
{
const PDFMarkupAnnotation* markupAnnotation = pageAnnotation.annotation->asMarkupAnnotation();
if (markupAnnotation)
{
QString title = markupAnnotation->getWindowTitle();
if (title.isEmpty())
{
title = markupAnnotation->getSubject();
}
if (title.isEmpty())
{
title = PDFTranslationContext::tr("Info");
}
const size_t repliesCount = pageAnnotations.getReplies(pageAnnotation).size();
if (repliesCount > 0)
{
title = PDFTranslationContext::tr("%1 (%2 replies)").arg(title).arg(repliesCount);
}
m_tooltip = QString("<p><b>%1</b></p><p>%2</p>").arg(title, markupAnnotation->getContents());
}
}
const PDFAction* linkAction = nullptr;
const AnnotationType annotationType = pageAnnotation.annotation->getType();
if (annotationType == AnnotationType::Link)
{
const PDFLinkAnnotation* linkAnnotation = dynamic_cast<const PDFLinkAnnotation*>(pageAnnotation.annotation.data());
Q_ASSERT(linkAnnotation);
// We must check, if user clicked to the link area
QPainterPath activationPath = linkAnnotation->getActivationRegion().getPath();
activationPath = snapshotItem.pageToDeviceMatrix.map(activationPath);
if (activationPath.contains(event->pos()) && linkAnnotation->getAction())
{
m_cursor = QCursor(Qt::PointingHandCursor);
linkAction = linkAnnotation->getAction();
}
}
if (annotationType == AnnotationType::Widget)
{
if (m_formManager && m_formManager->hasFormFieldWidgetText(pageAnnotation.annotation->getSelfReference()))
{
m_cursor = QCursor(Qt::IBeamCursor);
}
else
{
m_cursor = QCursor(Qt::ArrowCursor);
}
}
// Generate popup window
if (event->type() == QEvent::MouseButtonPress && event->button() == Qt::LeftButton)
{
const PDFMarkupAnnotation* markupAnnotation = pageAnnotation.annotation->asMarkupAnnotation();
if (markupAnnotation)
{
QDialog* dialog = createDialogForMarkupAnnotations(widget, pageAnnotation, pageAnnotations);
// Set proper dialog position - according to the popup annotation. If we
// do not have popup annotation, then try to use annotations rectangle.
if (const PageAnnotation* popupAnnotation = pageAnnotations.getPopupAnnotation(pageAnnotation))
{
QPoint popupPoint = snapshotItem.pageToDeviceMatrix.map(popupAnnotation->annotation->getRectangle().bottomLeft()).toPoint();
popupPoint = widget->mapToGlobal(popupPoint);
dialog->move(popupPoint);
}
else if (markupAnnotation->getRectangle().isValid())
{
QPoint popupPoint = snapshotItem.pageToDeviceMatrix.map(markupAnnotation->getRectangle().bottomRight()).toPoint();
popupPoint = widget->mapToGlobal(popupPoint);
dialog->move(popupPoint);
}
dialog->exec();
}
if (linkAction)
{
Q_EMIT actionTriggered(linkAction);
}
}
}
else
{
pageAnnotation.appearance = PDFAppeareanceStreams::Appearance::Normal;
pageAnnotation.isHovered = false;
}
const bool currentAppearanceChanged = oldAppearance != pageAnnotation.appearance;
if (currentAppearanceChanged)
{
// We have changed appearance - we must mark stream as dirty
pageAnnotation.appearanceStream.dirty();
appearanceChanged = true;
}
}
}
// If appearance has changed, then we must redraw the page
if (appearanceChanged)
{
Q_EMIT widget->getDrawWidgetProxy()->repaintNeeded();
}
}
void PDFWidgetAnnotationManager::onShowPopupAnnotation()
{
PDFWidgetSnapshot snapshot = m_proxy->getSnapshot();
for (const PDFWidgetSnapshot::SnapshotItem& snapshotItem : snapshot.items)
{
PageAnnotations& pageAnnotations = getPageAnnotations(snapshotItem.pageIndex);
for (PageAnnotation& pageAnnotation : pageAnnotations.annotations)
{
if (pageAnnotation.annotation->isReplyTo())
{
// Annotation is reply to another annotation, do not interact with it
continue;
}
if (pageAnnotation.annotation->getSelfReference() == m_editableAnnotation)
{
QDialog* dialog = createDialogForMarkupAnnotations(m_proxy->getWidget(), pageAnnotation, pageAnnotations);
dialog->move(m_editableAnnotationGlobalPosition);
dialog->exec();
return;
}
}
}
}
void PDFWidgetAnnotationManager::onCopyAnnotation()
{
pdf::PDFSelectPagesDialog dialog(tr("Copy Annotation"), tr("Copy Annotation onto Multiple Pages"),
m_document->getCatalog()->getPageCount(), m_proxy->getWidget()->getDrawWidget()->getCurrentPages(), m_proxy->getWidget());
if (dialog.exec() == QDialog::Accepted)
{
std::vector<PDFInteger> pages = dialog.getSelectedPages();
const PDFInteger currentPageIndex = m_document->getCatalog()->getPageIndexFromPageReference(m_editableAnnotationPage);
for (PDFInteger& pageIndex : pages)
{
--pageIndex;
}
auto it = std::find(pages.begin(), pages.end(), currentPageIndex);
if (it != pages.end())
{
pages.erase(it);
}
if (pages.empty())
{
return;
}
PDFDocumentModifier modifier(m_document);
modifier.markAnnotationsChanged();
for (const PDFInteger pageIndex : pages)
{
modifier.getBuilder()->copyAnnotation(m_document->getCatalog()->getPage(pageIndex)->getPageReference(), m_editableAnnotation);
}
if (modifier.finalize())
{
Q_EMIT documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
}
}
void PDFWidgetAnnotationManager::onEditAnnotation()
{
PDFEditObjectDialog dialog(EditObjectType::Annotation, m_proxy->getWidget());
PDFObject originalObject = m_document->getObjectByReference(m_editableAnnotation);
dialog.setObject(originalObject);
if (dialog.exec() == PDFEditObjectDialog::Accepted)
{
PDFObject object = dialog.getObject();
if (object != originalObject)
{
PDFDocumentModifier modifier(m_document);
modifier.markAnnotationsChanged();
modifier.getBuilder()->setObject(m_editableAnnotation, object);
modifier.getBuilder()->updateAnnotationAppearanceStreams(m_editableAnnotation);
if (modifier.finalize())
{
Q_EMIT documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
}
}
}
void PDFWidgetAnnotationManager::onDeleteAnnotation()
{
if (m_editableAnnotation.isValid())
{
PDFDocumentModifier modifier(m_document);
modifier.markAnnotationsChanged();
modifier.getBuilder()->removeAnnotation(m_editableAnnotationPage, m_editableAnnotation);
if (modifier.finalize())
{
Q_EMIT documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
}
}
QDialog* PDFWidgetAnnotationManager::createDialogForMarkupAnnotations(PDFWidget* widget,
const PageAnnotation& pageAnnotation,
const PageAnnotations& pageAnnotations)
{
QDialog* dialog = new QDialog(widget->getDrawWidget()->getWidget(), Qt::Popup);
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
createWidgetsForMarkupAnnotations(dialog, pageAnnotation, pageAnnotations);
return dialog;
}
void PDFWidgetAnnotationManager::createWidgetsForMarkupAnnotations(QWidget* parentWidget,
const PageAnnotation& pageAnnotation,
const PageAnnotations& pageAnnotations)
{
std::vector<const PageAnnotation*> replies = pageAnnotations.getReplies(pageAnnotation);
replies.insert(replies.begin(), &pageAnnotation);
QScrollArea* scrollArea = new QScrollArea(parentWidget);
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
QVBoxLayout* layout = new QVBoxLayout(parentWidget);
layout->addWidget(scrollArea);
layout->setContentsMargins(QMargins());
QWidget* frameWidget = new QWidget(scrollArea);
QVBoxLayout* frameLayout = new QVBoxLayout(frameWidget);
frameLayout->setSpacing(0);
scrollArea->setWidget(frameWidget);
const PDFMarkupAnnotation* markupMainAnnotation = pageAnnotation.annotation->asMarkupAnnotation();
QColor color = markupMainAnnotation->getDrawColorFromAnnotationColor(markupMainAnnotation->getColor(), 1.0);
QColor titleColor = QColor::fromHslF(color.hueF(), color.saturationF(), 0.2f, 1.0f);
QColor backgroundColor = QColor::fromHslF(color.hueF(), color.saturationF(), 0.9f, 1.0f);
QString style = "QGroupBox { "
"border: 2px solid black; "
"border-color: rgb(%4, %5, %6); "
"margin-top: 3ex; "
"background-color: rgb(%1, %2, %3); "
"}"
"QGroupBox::title { "
"subcontrol-origin: margin; "
"subcontrol-position: top center; "
"padding: 0px 8192px; "
"background-color: rgb(%4, %5, %6); "
"color: #FFFFFF;"
"}";
style = style.arg(backgroundColor.red()).arg(backgroundColor.green()).arg(backgroundColor.blue()).arg(titleColor.red()).arg(titleColor.green()).arg(titleColor.blue());
for (const PageAnnotation* annotation : replies)
{
const PDFMarkupAnnotation* markupAnnotation = annotation->annotation->asMarkupAnnotation();
if (!markupAnnotation)
{
// This should not happen...
continue;
}
QGroupBox* groupBox = new QGroupBox(scrollArea);
frameLayout->addWidget(groupBox);
QString title = markupAnnotation->getWindowTitle();
if (title.isEmpty())
{
title = markupAnnotation->getSubject();
}
QString dateTimeString = QLocale::system().toString(markupAnnotation->getCreationDate().toLocalTime(), QLocale::LongFormat);
title = QString("%1 (%2)").arg(title, dateTimeString).trimmed();
groupBox->setStyleSheet(style);
groupBox->setTitle(title);
QVBoxLayout* groupBoxLayout = new QVBoxLayout(groupBox);
QLabel* label = new QLabel(groupBox);
label->setTextInteractionFlags(Qt::TextBrowserInteraction);
label->setWordWrap(true);
label->setText(markupAnnotation->getContents());
label->setFixedWidth(PDFWidgetUtils::scaleDPI_x(label, 250));
label->setMinimumHeight(label->sizeHint().height());
groupBoxLayout->addWidget(label);
}
frameWidget->setFixedSize(frameWidget->minimumSizeHint());
parentWidget->setFixedSize(scrollArea->sizeHint());
}
void PDFSimpleGeometryAnnotation::draw(AnnotationDrawParameters& parameters) const void PDFSimpleGeometryAnnotation::draw(AnnotationDrawParameters& parameters) const
{ {
@ -2326,7 +1836,7 @@ void PDFTextAnnotation::draw(AnnotationDrawParameters& parameters) const
// Draw the ellipse // Draw the ellipse
painter.drawEllipse(ellipseRectangle); painter.drawEllipse(ellipseRectangle);
QFont font = QApplication::font(); QFont font = painter.font();
font.setPixelSize(16.0); font.setPixelSize(16.0);
QString text = getTextForIcon(m_iconName); QString text = getTextForIcon(m_iconName);
@ -2363,7 +1873,7 @@ QIcon PDFTextAnnotation::createIcon(QString key, QSize size)
QString text = getTextForIcon(key); QString text = getTextForIcon(key);
QFont font = QApplication::font(); QFont font = painter.font();
font.setPixelSize(size.height() * 0.75); font.setPixelSize(size.height() * 0.75);
QPainterPath textPath; QPainterPath textPath;
@ -2772,7 +2282,7 @@ void PDFAnnotation::drawLine(const PDFAnnotation::LineGeometryInfo& info,
if (drawText) if (drawText)
{ {
QFont font = QApplication::font(); QFont font = painter.font();
font.setPixelSize(12.0); font.setPixelSize(12.0);
QFontMetricsF fontMetrics(font, painter.device()); QFontMetricsF fontMetrics(font, painter.device());
@ -3457,7 +2967,7 @@ void PDFAnnotation::drawCharacterSymbol(QString text, PDFReal opacity, Annotatio
QRectF rectangle = getRectangle(); QRectF rectangle = getRectangle();
rectangle.setSize(QSizeF(rectSize, rectSize)); rectangle.setSize(QSizeF(rectSize, rectSize));
QFont font = QApplication::font(); QFont font = painter.font();
font.setPixelSize(16.0); font.setPixelSize(16.0);
QPainterPath textPath; QPainterPath textPath;
@ -3643,26 +3153,12 @@ void PDFWidgetAnnotation::draw(AnnotationDrawParameters& parameters) const
painter->scale(1.0, -1.0); painter->scale(1.0, -1.0);
painter->setFont(font); painter->setFont(font);
QStyleOptionButton option; // Draw border
option.state = QStyle::State_Enabled; QRectF drawRect(0, 0, rectangle.width(), rectangle.height());
option.rect = QRect(0, 0, qFloor(rectangle.width()), qFloor(rectangle.height())); painter->setPen(getPen());
option.palette = QApplication::palette(); painter->setBrush(QBrush(Qt::lightGray));
painter->drawRect(drawRect);
if (parameters.key.first == PDFAppeareanceStreams::Appearance::Rollover) painter->drawText(drawRect, Qt::AlignCenter, getContents());
{
option.state |= QStyle::State_MouseOver;
}
if (parameters.key.first == PDFAppeareanceStreams::Appearance::Down)
{
option.state |= QStyle::State_Sunken;
}
option.features = QStyleOptionButton::None;
option.text = getContents();
option.fontMetrics = fontMetrics;
QApplication::style()->drawControl(QStyle::CE_PushButton, &option, painter, nullptr);
} }
else else
{ {
@ -3714,42 +3210,52 @@ void PDFWidgetAnnotation::draw(AnnotationDrawParameters& parameters) const
} }
case PDFFormFieldButton::ButtonType::RadioButton: case PDFFormFieldButton::ButtonType::RadioButton:
{
QRectF rectangle = getRectangle();
QPainter* painter = parameters.painter;
rectangle.setWidth(rectangle.height());
painter->setPen(Qt::black);
painter->setBrush(Qt::NoBrush);
painter->drawEllipse(rectangle);
if (parameters.key.second != "Off")
{
QRectF rectangleMark = rectangle;
rectangleMark.setWidth(rectangle.width() * 0.75);
rectangleMark.setHeight(rectangle.height() * 0.75);
rectangleMark.moveCenter(rectangle.center());
painter->setPen(Qt::NoPen);
painter->setBrush(QBrush(Qt::black));
painter->drawEllipse(rectangleMark);
}
break;
}
case PDFFormFieldButton::ButtonType::CheckBox: case PDFFormFieldButton::ButtonType::CheckBox:
{ {
QRectF rectangle = getRectangle(); QRectF rectangle = getRectangle();
QPainter* painter = parameters.painter; QPainter* painter = parameters.painter;
painter->translate(rectangle.bottomLeft());
painter->scale(1.0, -1.0);
QStyleOptionButton option; rectangle.setWidth(rectangle.height());
option.state = QStyle::State_Enabled;
option.rect = QRect(0, 0, qFloor(rectangle.width()), qFloor(rectangle.height()));
option.palette = QApplication::palette();
if (parameters.key.first == PDFAppeareanceStreams::Appearance::Rollover) painter->setPen(Qt::black);
{ painter->setBrush(Qt::NoBrush);
option.state |= QStyle::State_MouseOver; painter->drawRect(rectangle);
}
if (parameters.key.first == PDFAppeareanceStreams::Appearance::Down)
{
option.state |= QStyle::State_Sunken;
}
if (parameters.key.second != "Off") if (parameters.key.second != "Off")
{ {
option.state |= QStyle::State_On; QRectF rectangleMark = rectangle;
} rectangleMark.setWidth(rectangle.width() * 0.75);
else rectangleMark.setHeight(rectangle.height() * 0.75);
{ rectangleMark.moveCenter(rectangle.center());
option.state |= QStyle::State_Off;
}
option.features = QStyleOptionButton::None; painter->drawLine(rectangleMark.topLeft(), rectangleMark.bottomRight());
option.text = QString(); painter->drawLine(rectangleMark.bottomLeft(), rectangleMark.topRight());
}
QStyle::PrimitiveElement element = (button->getButtonType() == PDFFormFieldButton::ButtonType::CheckBox) ? QStyle::PE_IndicatorCheckBox : QStyle::PE_IndicatorRadioButton;
QApplication::style()->drawPrimitive(element, &option, painter, nullptr);
break; break;
} }

View File

@ -44,7 +44,6 @@ namespace pdf
{ {
class PDFWidget; class PDFWidget;
class PDFObjectStorage; class PDFObjectStorage;
class PDFDrawWidgetProxy;
class PDFFontCache; class PDFFontCache;
class PDFFormManager; class PDFFormManager;
class PDFModifiedDocument; class PDFModifiedDocument;
@ -783,7 +782,7 @@ enum class TextAnnotationIcon
/// as if flag NoZoom and NoRotate were set). When this annotation is opened, /// as if flag NoZoom and NoRotate were set). When this annotation is opened,
/// it displays popup window containing the text of the note, font and size /// it displays popup window containing the text of the note, font and size
/// is implementation dependent by viewer application. /// is implementation dependent by viewer application.
class PDF4QTLIBSHARED_EXPORT PDFTextAnnotation : public PDFMarkupAnnotation class PDF4QTLIBCORESHARED_EXPORT PDFTextAnnotation : public PDFMarkupAnnotation
{ {
public: public:
inline explicit PDFTextAnnotation() = default; inline explicit PDFTextAnnotation() = default;
@ -1104,7 +1103,7 @@ enum class StampIntent
/// Annotation for stamps. Displays text or graphics intended to look /// Annotation for stamps. Displays text or graphics intended to look
/// as if they were stamped on the paper. /// as if they were stamped on the paper.
class PDF4QTLIBSHARED_EXPORT PDFStampAnnotation : public PDFMarkupAnnotation class PDF4QTLIBCORESHARED_EXPORT PDFStampAnnotation : public PDFMarkupAnnotation
{ {
public: public:
inline explicit PDFStampAnnotation() = default; inline explicit PDFStampAnnotation() = default;
@ -1433,7 +1432,7 @@ private:
/// this object builds annotation's appearance streams, if necessary. This /// this object builds annotation's appearance streams, if necessary. This
/// manager is intended to non-gui rendering. If widget annotation manager is used, /// manager is intended to non-gui rendering. If widget annotation manager is used,
/// then this object is not thread safe. /// then this object is not thread safe.
class PDF4QTLIBSHARED_EXPORT PDFAnnotationManager : public QObject, public IDocumentDrawInterface class PDF4QTLIBCORESHARED_EXPORT PDFAnnotationManager : public QObject, public IDocumentDrawInterface
{ {
Q_OBJECT Q_OBJECT
@ -1623,76 +1622,6 @@ protected:
Target m_target = Target::View; Target m_target = Target::View;
}; };
/// Annotation manager for GUI rendering, it also manages annotations widgets
/// for parent widget.
class PDF4QTLIBSHARED_EXPORT PDFWidgetAnnotationManager : public PDFAnnotationManager, public IDrawWidgetInputInterface
{
Q_OBJECT
private:
using BaseClass = PDFAnnotationManager;
public:
explicit PDFWidgetAnnotationManager(PDFDrawWidgetProxy* proxy, QObject* parent);
virtual ~PDFWidgetAnnotationManager() override;
virtual void setDocument(const PDFModifiedDocument& document) override;
virtual void shortcutOverrideEvent(QWidget* widget, QKeyEvent* event) override;
virtual void keyPressEvent(QWidget* widget, QKeyEvent* event) override;
virtual void keyReleaseEvent(QWidget* widget, QKeyEvent* event) override;
virtual void mousePressEvent(QWidget* widget, QMouseEvent* event) override;
virtual void mouseDoubleClickEvent(QWidget* widget, QMouseEvent* event) override;
virtual void mouseReleaseEvent(QWidget* widget, QMouseEvent* event) override;
virtual void mouseMoveEvent(QWidget* widget, QMouseEvent* event) override;
virtual void wheelEvent(QWidget* widget, QWheelEvent* event) override;
/// Returns tooltip generated from annotation
virtual QString getTooltip() const override { return m_tooltip; }
/// Returns current cursor
virtual const std::optional<QCursor>& getCursor() const override { return m_cursor; }
virtual int getInputPriority() const override { return AnnotationPriority; }
signals:
void actionTriggered(const PDFAction* action);
void documentModified(PDFModifiedDocument document);
private:
void updateFromMouseEvent(QMouseEvent* event);
void onShowPopupAnnotation();
void onCopyAnnotation();
void onEditAnnotation();
void onDeleteAnnotation();
/// Creates dialog for markup annotations. This function is used only for markup annotations,
/// do not use them for other annotations (function can crash).
/// \param widget Dialog's parent widget
/// \param pageAnnotation Markup annotation
/// \param pageAnnotations Page annotations
QDialog* createDialogForMarkupAnnotations(PDFWidget* widget,
const PageAnnotation& pageAnnotation,
const PageAnnotations& pageAnnotations);
/// Creates widgets for markup annotation main popup widget. Also sets
/// default size of parent widget.
/// \param parentWidget Parent widget, where widgets are created
/// \param pageAnnotation Markup annotation
/// \param pageAnnotations Page annotations
void createWidgetsForMarkupAnnotations(QWidget* parentWidget,
const PageAnnotation& pageAnnotation,
const PageAnnotations& pageAnnotations);
PDFDrawWidgetProxy* m_proxy;
QString m_tooltip;
std::optional<QCursor> m_cursor;
QPoint m_editableAnnotationGlobalPosition; ///< Position, where action on annotation was executed
PDFObjectReference m_editableAnnotation; ///< Annotation to be edited or deleted
PDFObjectReference m_editableAnnotationPage; ///< Page of annotation above
};
} // namespace pdf } // namespace pdf
#endif // PDFANNOTATION_H #endif // PDFANNOTATION_H

View File

@ -236,7 +236,7 @@ private:
/// Document security store. Contains certificates, CRLs, OCSPs, and /// Document security store. Contains certificates, CRLs, OCSPs, and
/// other data for signature validation. /// other data for signature validation.
class PDF4QTLIBSHARED_EXPORT PDFDocumentSecurityStore class PDF4QTLIBCORESHARED_EXPORT PDFDocumentSecurityStore
{ {
public: public:
explicit inline PDFDocumentSecurityStore() = default; explicit inline PDFDocumentSecurityStore() = default;
@ -301,7 +301,7 @@ private:
/// Document extensions. Contains information about developer's extensions /// Document extensions. Contains information about developer's extensions
/// used in document. /// used in document.
class PDF4QTLIBSHARED_EXPORT PDFDeveloperExtensions class PDF4QTLIBCORESHARED_EXPORT PDFDeveloperExtensions
{ {
public: public:
explicit PDFDeveloperExtensions() = default; explicit PDFDeveloperExtensions() = default;
@ -330,7 +330,7 @@ private:
}; };
/// Web capture info /// Web capture info
class PDF4QTLIBSHARED_EXPORT PDFWebCaptureInfo class PDF4QTLIBCORESHARED_EXPORT PDFWebCaptureInfo
{ {
public: public:
explicit PDFWebCaptureInfo() = default; explicit PDFWebCaptureInfo() = default;
@ -349,7 +349,7 @@ private:
std::vector<PDFObjectReference> m_commands; std::vector<PDFObjectReference> m_commands;
}; };
class PDF4QTLIBSHARED_EXPORT PDFOutputIntentICCProfileInfo class PDF4QTLIBCORESHARED_EXPORT PDFOutputIntentICCProfileInfo
{ {
public: public:
explicit PDFOutputIntentICCProfileInfo() = default; explicit PDFOutputIntentICCProfileInfo() = default;
@ -377,7 +377,7 @@ private:
}; };
/// Output intent /// Output intent
class PDF4QTLIBSHARED_EXPORT PDFOutputIntent class PDF4QTLIBCORESHARED_EXPORT PDFOutputIntent
{ {
public: public:
explicit PDFOutputIntent() = default; explicit PDFOutputIntent() = default;
@ -411,7 +411,7 @@ private:
}; };
/// Legal attestations /// Legal attestations
class PDF4QTLIBSHARED_EXPORT PDFLegalAttestation class PDF4QTLIBCORESHARED_EXPORT PDFLegalAttestation
{ {
public: public:
explicit inline PDFLegalAttestation() = default; explicit inline PDFLegalAttestation() = default;
@ -459,7 +459,7 @@ private:
/// Document can contain requirements for viewer application. This class /// Document can contain requirements for viewer application. This class
/// verifies, if this library and viewer application satisfies these requirements /// verifies, if this library and viewer application satisfies these requirements
/// and returns result. /// and returns result.
class PDF4QTLIBSHARED_EXPORT PDFDocumentRequirements class PDF4QTLIBCORESHARED_EXPORT PDFDocumentRequirements
{ {
public: public:
@ -564,7 +564,7 @@ private:
std::array<PDFActionPtr, End> m_actions; std::array<PDFActionPtr, End> m_actions;
}; };
class PDF4QTLIBSHARED_EXPORT PDFCatalog class PDF4QTLIBCORESHARED_EXPORT PDFCatalog
{ {
public: public:
inline PDFCatalog() = default; inline PDFCatalog() = default;

View File

@ -26,7 +26,7 @@
namespace pdf namespace pdf
{ {
class PDF4QTLIBSHARED_EXPORT PDFCertificateManager class PDF4QTLIBCORESHARED_EXPORT PDFCertificateManager
{ {
public: public:
PDFCertificateManager(); PDFCertificateManager();
@ -55,7 +55,7 @@ public:
static bool isCertificateValid(QString fileName, QString password); static bool isCertificateValid(QString fileName, QString password);
}; };
class PDF4QTLIBSHARED_EXPORT PDFSignatureFactory class PDF4QTLIBCORESHARED_EXPORT PDFSignatureFactory
{ {
public: public:
static bool sign(QString certificateName, QString password, QByteArray data, QByteArray& result); static bool sign(QString certificateName, QString password, QByteArray data, QByteArray& result);

View File

@ -264,7 +264,7 @@ public:
using PDFCMSPointer = QSharedPointer<PDFCMS>; using PDFCMSPointer = QSharedPointer<PDFCMS>;
class PDF4QTLIBSHARED_EXPORT PDFCMSGeneric : public PDFCMS class PDF4QTLIBCORESHARED_EXPORT PDFCMSGeneric : public PDFCMS
{ {
public: public:
explicit inline PDFCMSGeneric() = default; explicit inline PDFCMSGeneric() = default;
@ -356,7 +356,7 @@ using PDFColorProfileIdentifiers = std::vector<PDFColorProfileIdentifier>;
/// It also handles settings, and it's changes. Constant functions /// It also handles settings, and it's changes. Constant functions
/// is save to call from multiple threads, this also holds for some /// is save to call from multiple threads, this also holds for some
/// non-constant functions - manager is protected by mutexes. /// non-constant functions - manager is protected by mutexes.
class PDF4QTLIBSHARED_EXPORT PDFCMSManager : public QObject class PDF4QTLIBCORESHARED_EXPORT PDFCMSManager : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@ -30,7 +30,7 @@ namespace pdf
/// \brief Performs color conversions in the RGB color space. /// \brief Performs color conversions in the RGB color space.
/// This class supports multiple modes of operation, making it /// This class supports multiple modes of operation, making it
/// useful for accessibility purposes, particularly for visually impaired users. /// useful for accessibility purposes, particularly for visually impaired users.
class PDF4QTLIBSHARED_EXPORT PDFColorConvertor class PDF4QTLIBCORESHARED_EXPORT PDFColorConvertor
{ {
public: public:
PDFColorConvertor(); PDFColorConvertor();

View File

@ -308,7 +308,7 @@ using PDFColorComponentMatrix_3x3 = PDFColorComponentMatrix<3, 3>;
/// Represents PDF's color space (abstract class). Contains functions for parsing /// Represents PDF's color space (abstract class). Contains functions for parsing
/// color spaces. /// color spaces.
class PDF4QTLIBSHARED_EXPORT PDFAbstractColorSpace class PDF4QTLIBCORESHARED_EXPORT PDFAbstractColorSpace
{ {
public: public:
explicit PDFAbstractColorSpace() = default; explicit PDFAbstractColorSpace() = default;

View File

@ -148,7 +148,7 @@ private:
std::map<PDFInteger, CompileTask> m_tasks; std::map<PDFInteger, CompileTask> m_tasks;
}; };
class PDF4QTLIBSHARED_EXPORT PDFAsynchronousTextLayoutCompiler : public QObject class PDF4QTLIBCORESHARED_EXPORT PDFAsynchronousTextLayoutCompiler : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@ -38,7 +38,7 @@ namespace pdf
struct PDFDiffPageContext; struct PDFDiffPageContext;
class PDF4QTLIBSHARED_EXPORT PDFDiffResult class PDF4QTLIBCORESHARED_EXPORT PDFDiffResult
{ {
public: public:
explicit PDFDiffResult(); explicit PDFDiffResult();
@ -236,7 +236,7 @@ private:
}; };
/// Class for result navigation, can go to next, or previous result. /// Class for result navigation, can go to next, or previous result.
class PDF4QTLIBSHARED_EXPORT PDFDiffResultNavigator : public QObject class PDF4QTLIBCORESHARED_EXPORT PDFDiffResultNavigator : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -283,7 +283,7 @@ private:
}; };
/// Diff engine for comparing two pdf documents. /// Diff engine for comparing two pdf documents.
class PDF4QTLIBSHARED_EXPORT PDFDiff : public QObject class PDF4QTLIBCORESHARED_EXPORT PDFDiff : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@ -37,7 +37,7 @@ class PDFDocumentBuilder;
/// Storage for objects. This class is not thread safe for writing (calling non-const functions). Caller must ensure /// Storage for objects. This class is not thread safe for writing (calling non-const functions). Caller must ensure
/// locking, if this object is used from multiple threads. Calling const functions should be thread safe. /// locking, if this object is used from multiple threads. Calling const functions should be thread safe.
class PDF4QTLIBSHARED_EXPORT PDFObjectStorage class PDF4QTLIBCORESHARED_EXPORT PDFObjectStorage
{ {
public: public:
inline PDFObjectStorage() = default; inline PDFObjectStorage() = default;
@ -146,7 +146,7 @@ private:
/// then if object with valid data is not found, default value is used, and second one, /// then if object with valid data is not found, default value is used, and second one,
/// without default value, if valid data are not found, then exception is thrown. /// without default value, if valid data are not found, then exception is thrown.
/// This class uses Decorator design pattern. /// This class uses Decorator design pattern.
class PDF4QTLIBSHARED_EXPORT PDFDocumentDataLoaderDecorator class PDF4QTLIBCORESHARED_EXPORT PDFDocumentDataLoaderDecorator
{ {
public: public:
explicit PDFDocumentDataLoaderDecorator(const PDFDocument* document); explicit PDFDocumentDataLoaderDecorator(const PDFDocument* document);
@ -402,7 +402,7 @@ private:
}; };
/// PDF document main class. /// PDF document main class.
class PDF4QTLIBSHARED_EXPORT PDFDocument class PDF4QTLIBCORESHARED_EXPORT PDFDocument
{ {
Q_DECLARE_TR_FUNCTIONS(pdf::PDFDocument) Q_DECLARE_TR_FUNCTIONS(pdf::PDFDocument)

View File

@ -92,7 +92,7 @@ struct WrapEmptyArray { };
/// Factory for creating various PDF objects, such as simple objects, /// Factory for creating various PDF objects, such as simple objects,
/// dictionaries, arrays etc. /// dictionaries, arrays etc.
class PDF4QTLIBSHARED_EXPORT PDFObjectFactory class PDF4QTLIBCORESHARED_EXPORT PDFObjectFactory
{ {
public: public:
inline explicit PDFObjectFactory() = default; inline explicit PDFObjectFactory() = default;
@ -207,7 +207,7 @@ private:
/// to draw graphics elements on it. Content stream can have various /// to draw graphics elements on it. Content stream can have various
/// resources, which can, if selected be dereferenced, so content /// resources, which can, if selected be dereferenced, so content
/// stream is encapsulated and doesn't contain references. /// stream is encapsulated and doesn't contain references.
class PDF4QTLIBSHARED_EXPORT PDFContentStreamBuilder class PDF4QTLIBCORESHARED_EXPORT PDFContentStreamBuilder
{ {
public: public:
@ -264,7 +264,7 @@ private:
/// to draw graphics elements on it. Content stream can have various /// to draw graphics elements on it. Content stream can have various
/// resources, which can, if selected be dereferenced, so content /// resources, which can, if selected be dereferenced, so content
/// stream is encapsulated and doesn't contain references. /// stream is encapsulated and doesn't contain references.
class PDF4QTLIBSHARED_EXPORT PDFPageContentStreamBuilder class PDF4QTLIBCORESHARED_EXPORT PDFPageContentStreamBuilder
{ {
public: public:
@ -314,7 +314,7 @@ private:
Mode m_mode; Mode m_mode;
}; };
class PDF4QTLIBSHARED_EXPORT PDFDocumentBuilder class PDF4QTLIBCORESHARED_EXPORT PDFDocumentBuilder
{ {
public: public:
/// Creates a new blank document (with no pages) /// Creates a new blank document (with no pages)
@ -1588,7 +1588,7 @@ private:
/// This class serves for document modification. While document is modified, /// This class serves for document modification. While document is modified,
/// modification flags are gathered. At the end of the modification, it is checked, /// modification flags are gathered. At the end of the modification, it is checked,
/// if document was really changed. /// if document was really changed.
class PDF4QTLIBSHARED_EXPORT PDFDocumentModifier class PDF4QTLIBCORESHARED_EXPORT PDFDocumentModifier
{ {
public: public:
explicit PDFDocumentModifier(const PDFDocument* originalDocument); explicit PDFDocumentModifier(const PDFDocument* originalDocument);

View File

@ -33,7 +33,7 @@ namespace pdf
class PDFPrecompiledPage; class PDFPrecompiledPage;
class PDFTextLayoutGetter; class PDFTextLayoutGetter;
class PDF4QTLIBSHARED_EXPORT IDocumentDrawInterface class PDF4QTLIBCORESHARED_EXPORT IDocumentDrawInterface
{ {
public: public:
explicit inline IDocumentDrawInterface() = default; explicit inline IDocumentDrawInterface() = default;

View File

@ -30,7 +30,7 @@ namespace pdf
/// to a new document, where pages are inserted/removed/moved, or joined /// to a new document, where pages are inserted/removed/moved, or joined
/// from another documents, or blank pages/image pages inserted. Document /// from another documents, or blank pages/image pages inserted. Document
/// is also optimized. /// is also optimized.
class PDF4QTLIBSHARED_EXPORT PDFDocumentManipulator class PDF4QTLIBCORESHARED_EXPORT PDFDocumentManipulator
{ {
Q_DECLARE_TR_FUNCTIONS(pdf::PDFDocumentManipulator) Q_DECLARE_TR_FUNCTIONS(pdf::PDFDocumentManipulator)

View File

@ -35,7 +35,7 @@ class PDFParsingContext;
/// This class is a reader of PDF document from various devices (file, io device, /// This class is a reader of PDF document from various devices (file, io device,
/// byte buffer). This class doesn't throw exceptions, to check errors, use /// byte buffer). This class doesn't throw exceptions, to check errors, use
/// appropriate functions. /// appropriate functions.
class PDF4QTLIBSHARED_EXPORT PDFDocumentReader class PDF4QTLIBCORESHARED_EXPORT PDFDocumentReader
{ {
Q_DECLARE_TR_FUNCTIONS(pdf::PDFDocumentReader) Q_DECLARE_TR_FUNCTIONS(pdf::PDFDocumentReader)

View File

@ -27,7 +27,7 @@ class PDFAnnotation;
/// Class for sanitizing documents. Can remove sensitive content from the document, /// Class for sanitizing documents. Can remove sensitive content from the document,
/// except the content streams. Sanitization is configurable, user can specify, /// except the content streams. Sanitization is configurable, user can specify,
/// which content should be removed. /// which content should be removed.
class PDF4QTLIBSHARED_EXPORT PDFDocumentSanitizer : public QObject class PDF4QTLIBCORESHARED_EXPORT PDFDocumentSanitizer : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@ -29,7 +29,7 @@ class PDFDocument;
/// Text flow extracted from document. Text flow can be created \p PDFDocumentTextFlowFactory. /// Text flow extracted from document. Text flow can be created \p PDFDocumentTextFlowFactory.
/// Flow can contain various items, not just text ones. Also, some manipulation functions /// Flow can contain various items, not just text ones. Also, some manipulation functions
/// are available, they can modify text flow by various content. /// are available, they can modify text flow by various content.
class PDF4QTLIBSHARED_EXPORT PDFDocumentTextFlow class PDF4QTLIBCORESHARED_EXPORT PDFDocumentTextFlow
{ {
public: public:
@ -104,7 +104,7 @@ private:
}; };
/// This factory creates text flow for whole document /// This factory creates text flow for whole document
class PDF4QTLIBSHARED_EXPORT PDFDocumentTextFlowFactory class PDF4QTLIBCORESHARED_EXPORT PDFDocumentTextFlowFactory
{ {
public: public:
explicit PDFDocumentTextFlowFactory() = default; explicit PDFDocumentTextFlowFactory() = default;
@ -150,7 +150,7 @@ private:
/// Editor which can edit document text flow, modify user text, /// Editor which can edit document text flow, modify user text,
/// change order of text items, restore original state of a text flow, /// change order of text items, restore original state of a text flow,
/// and many other features. /// and many other features.
class PDF4QTLIBSHARED_EXPORT PDFDocumentTextFlowEditor class PDF4QTLIBCORESHARED_EXPORT PDFDocumentTextFlowEditor
{ {
public: public:
inline PDFDocumentTextFlowEditor() = default; inline PDFDocumentTextFlowEditor() = default;

View File

@ -27,7 +27,7 @@ namespace pdf
{ {
class PDFDocumentTextFlowEditor; class PDFDocumentTextFlowEditor;
class PDF4QTLIBSHARED_EXPORT PDFDocumentTextFlowEditorModel : public QAbstractTableModel class PDF4QTLIBCORESHARED_EXPORT PDFDocumentTextFlowEditorModel : public QAbstractTableModel
{ {
Q_OBJECT Q_OBJECT

View File

@ -29,7 +29,7 @@ namespace pdf
/// Class used for writing PDF documents to the desired target device (or file, /// Class used for writing PDF documents to the desired target device (or file,
/// buffer, etc.). If writing is not successful, then error message is returned. /// buffer, etc.). If writing is not successful, then error message is returned.
class PDF4QTLIBSHARED_EXPORT PDFDocumentWriter class PDF4QTLIBCORESHARED_EXPORT PDFDocumentWriter
{ {
Q_DECLARE_TR_FUNCTIONS(pdf::PDFDocumentWriter) Q_DECLARE_TR_FUNCTIONS(pdf::PDFDocumentWriter)

View File

@ -194,7 +194,7 @@ struct PDFWidgetSnapshot
/// This is a proxy class to draw space controller using widget. We have two spaces, pixel space /// This is a proxy class to draw space controller using widget. We have two spaces, pixel space
/// (on the controlled widget) and device space (device is draw space controller). /// (on the controlled widget) and device space (device is draw space controller).
class PDF4QTLIBSHARED_EXPORT PDFDrawWidgetProxy : public QObject class PDF4QTLIBCORESHARED_EXPORT PDFDrawWidgetProxy : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@ -35,7 +35,7 @@ using EncodingTable = std::array<QChar, 256>;
/// This class can convert byte stream to the QString in unicode encoding. /// This class can convert byte stream to the QString in unicode encoding.
/// PDF has several encodings, see PDF Reference 1.7, Appendix D. /// PDF has several encodings, see PDF Reference 1.7, Appendix D.
class PDF4QTLIBSHARED_EXPORT PDFEncoding class PDF4QTLIBCORESHARED_EXPORT PDFEncoding
{ {
public: public:
explicit PDFEncoding() = delete; explicit PDFEncoding() = delete;

View File

@ -33,7 +33,7 @@ struct PDFExecutionPolicyHolder;
/// Defines thread execution policy based on settings and actual number of page content /// Defines thread execution policy based on settings and actual number of page content
/// streams being processed. It can regulate number of threads executed at each /// streams being processed. It can regulate number of threads executed at each
/// point, where execution policy is used. /// point, where execution policy is used.
class PDF4QTLIBSHARED_EXPORT PDFExecutionPolicy class PDF4QTLIBCORESHARED_EXPORT PDFExecutionPolicy
{ {
public: public:

View File

@ -31,7 +31,7 @@ class PDFObjectStorage;
/// Each identifier consists of two parts - permanent identifier, which /// Each identifier consists of two parts - permanent identifier, which
/// is unique identifier based on original document, and changing identifier, /// is unique identifier based on original document, and changing identifier,
/// which is updated when document is being modified. /// which is updated when document is being modified.
class PDF4QTLIBSHARED_EXPORT PDFFileIdentifier class PDF4QTLIBCORESHARED_EXPORT PDFFileIdentifier
{ {
public: public:
explicit inline PDFFileIdentifier() = default; explicit inline PDFFileIdentifier() = default;
@ -49,7 +49,7 @@ private:
/// Provides description of collection item property field. It describes it's /// Provides description of collection item property field. It describes it's
/// kind, data type, if content of the property should be presented to the user, /// kind, data type, if content of the property should be presented to the user,
/// and ordering, visibility and editability. /// and ordering, visibility and editability.
class PDF4QTLIBSHARED_EXPORT PDFCollectionField class PDF4QTLIBCORESHARED_EXPORT PDFCollectionField
{ {
public: public:
explicit inline PDFCollectionField() = default; explicit inline PDFCollectionField() = default;
@ -96,7 +96,7 @@ private:
/// Collection schema. Contains a list of defined fields. /// Collection schema. Contains a list of defined fields.
/// Schema can be queried for field definition. /// Schema can be queried for field definition.
class PDF4QTLIBSHARED_EXPORT PDFCollectionSchema class PDF4QTLIBCORESHARED_EXPORT PDFCollectionSchema
{ {
public: public:
explicit inline PDFCollectionSchema() = default; explicit inline PDFCollectionSchema() = default;
@ -123,7 +123,7 @@ private:
/// Collection of file attachments. In the PDF file, attached files /// Collection of file attachments. In the PDF file, attached files
/// can be grouped in collection (if they are related to each other). /// can be grouped in collection (if they are related to each other).
class PDF4QTLIBSHARED_EXPORT PDFCollection class PDF4QTLIBCORESHARED_EXPORT PDFCollection
{ {
public: public:
explicit inline PDFCollection() = default; explicit inline PDFCollection() = default;
@ -242,7 +242,7 @@ private:
}; };
/// Collection folder. Can contain subfolders and files. /// Collection folder. Can contain subfolders and files.
class PDF4QTLIBSHARED_EXPORT PDFCollectionFolder class PDF4QTLIBCORESHARED_EXPORT PDFCollectionFolder
{ {
public: public:
explicit inline PDFCollectionFolder() = default; explicit inline PDFCollectionFolder() = default;
@ -277,7 +277,7 @@ private:
/// Collection item. Contains properties of the collection item, /// Collection item. Contains properties of the collection item,
/// for example, embedded file. /// for example, embedded file.
class PDF4QTLIBSHARED_EXPORT PDFCollectionItem class PDF4QTLIBCORESHARED_EXPORT PDFCollectionItem
{ {
public: public:
explicit inline PDFCollectionItem() = default; explicit inline PDFCollectionItem() = default;
@ -316,7 +316,7 @@ private:
/// Collection navigator. It contains modes of display. Interactive /// Collection navigator. It contains modes of display. Interactive
/// PDF processor should display first layout it is capable of. /// PDF processor should display first layout it is capable of.
class PDF4QTLIBSHARED_EXPORT PDFCollectionNavigator class PDF4QTLIBCORESHARED_EXPORT PDFCollectionNavigator
{ {
public: public:
explicit inline PDFCollectionNavigator() = default; explicit inline PDFCollectionNavigator() = default;
@ -347,7 +347,7 @@ private:
Layouts m_layouts = None; Layouts m_layouts = None;
}; };
class PDF4QTLIBSHARED_EXPORT PDFEmbeddedFile class PDF4QTLIBCORESHARED_EXPORT PDFEmbeddedFile
{ {
public: public:
explicit PDFEmbeddedFile() = default; explicit PDFEmbeddedFile() = default;
@ -372,7 +372,7 @@ private:
}; };
/// File specification /// File specification
class PDF4QTLIBSHARED_EXPORT PDFFileSpecification class PDF4QTLIBCORESHARED_EXPORT PDFFileSpecification
{ {
public: public:
explicit PDFFileSpecification() = default; explicit PDFFileSpecification() = default;

View File

@ -171,14 +171,14 @@ static constexpr PDFEncoding::Encoding getEncodingForStandardFont(StandardFontTy
} }
} }
struct PDF4QTLIBSHARED_EXPORT CIDSystemInfo struct PDF4QTLIBCORESHARED_EXPORT CIDSystemInfo
{ {
QByteArray registry; QByteArray registry;
QByteArray ordering; QByteArray ordering;
int supplement = 0; int supplement = 0;
}; };
struct PDF4QTLIBSHARED_EXPORT FontDescriptor struct PDF4QTLIBCORESHARED_EXPORT FontDescriptor
{ {
bool isEmbedded() const { return !fontFile.isEmpty() || !fontFile2.isEmpty() || !fontFile3.isEmpty(); } bool isEmbedded() const { return !fontFile.isEmpty() || !fontFile2.isEmpty() || !fontFile3.isEmpty(); }
@ -245,7 +245,7 @@ using CharacterInfos = std::vector<CharacterInfo>;
/// Font, which has fixed pixel size. It is programmed as PIMPL, because we need /// Font, which has fixed pixel size. It is programmed as PIMPL, because we need
/// to remove FreeType types from the interface (so we do not include FreeType in the interface). /// to remove FreeType types from the interface (so we do not include FreeType in the interface).
class PDF4QTLIBSHARED_EXPORT PDFRealizedFont class PDF4QTLIBCORESHARED_EXPORT PDFRealizedFont
{ {
public: public:
~PDFRealizedFont(); ~PDFRealizedFont();
@ -281,7 +281,7 @@ private:
}; };
/// Base class representing font in the PDF file /// Base class representing font in the PDF file
class PDF4QTLIBSHARED_EXPORT PDFFont class PDF4QTLIBCORESHARED_EXPORT PDFFont
{ {
public: public:
explicit PDFFont(CIDSystemInfo CIDSystemInfo, FontDescriptor fontDescriptor); explicit PDFFont(CIDSystemInfo CIDSystemInfo, FontDescriptor fontDescriptor);
@ -404,7 +404,7 @@ public:
/// Font cache which caches both fonts, and realized fonts. Cache has individual limit /// Font cache which caches both fonts, and realized fonts. Cache has individual limit
/// for fonts, and realized fonts. /// for fonts, and realized fonts.
class PDF4QTLIBSHARED_EXPORT PDFFontCache class PDF4QTLIBCORESHARED_EXPORT PDFFontCache
{ {
public: public:
inline explicit PDFFontCache(size_t fontCacheLimit, size_t realizedFontCacheLimit) : inline explicit PDFFontCache(size_t fontCacheLimit, size_t realizedFontCacheLimit) :
@ -511,7 +511,7 @@ private:
}; };
/// Represents a font CMAP (mapping of CIDs) /// Represents a font CMAP (mapping of CIDs)
class PDF4QTLIBSHARED_EXPORT PDFFontCMap class PDF4QTLIBCORESHARED_EXPORT PDFFontCMap
{ {
public: public:
explicit PDFFontCMap() = default; explicit PDFFontCMap() = default;
@ -663,7 +663,7 @@ private:
}; };
/// Repository with predefined CMaps /// Repository with predefined CMaps
class PDF4QTLIBSHARED_EXPORT PDFFontCMapRepository class PDF4QTLIBCORESHARED_EXPORT PDFFontCMapRepository
{ {
public: public:
/// Returns instance of CMAP repository /// Returns instance of CMAP repository

View File

@ -413,7 +413,7 @@ private:
/// Fields forms tree-like structure, where leafs are usually widgets. Fields include /// Fields forms tree-like structure, where leafs are usually widgets. Fields include
/// ordinary widgets, such as buttons, check boxes, combo boxes and text fields, and one /// ordinary widgets, such as buttons, check boxes, combo boxes and text fields, and one
/// special - signature field, which represents digital signature. /// special - signature field, which represents digital signature.
class PDF4QTLIBSHARED_EXPORT PDFForm class PDF4QTLIBCORESHARED_EXPORT PDFForm
{ {
public: public:
explicit inline PDFForm() = default; explicit inline PDFForm() = default;
@ -534,7 +534,7 @@ protected:
/// Form manager. Manages all form widgets functionality - triggers actions, /// Form manager. Manages all form widgets functionality - triggers actions,
/// edits fields, updates annotation appearances, etc. Valid pointer to annotation /// edits fields, updates annotation appearances, etc. Valid pointer to annotation
/// manager is requirement. /// manager is requirement.
class PDF4QTLIBSHARED_EXPORT PDFFormManager : public QObject, public IDrawWidgetInputInterface class PDF4QTLIBCORESHARED_EXPORT PDFFormManager : public QObject, public IDrawWidgetInputInterface
{ {
Q_OBJECT Q_OBJECT

View File

@ -46,7 +46,7 @@ using PDFFunctionPtr = std::shared_ptr<PDFFunction>;
/// Function has domain and range, values outside of domain and range are clamped /// Function has domain and range, values outside of domain and range are clamped
/// to the nearest values. This class is fully thread safe (if constant functions /// to the nearest values. This class is fully thread safe (if constant functions
/// are called). /// are called).
class PDF4QTLIBSHARED_EXPORT PDFFunction class PDF4QTLIBCORESHARED_EXPORT PDFFunction
{ {
public: public:
@ -131,7 +131,7 @@ protected:
}; };
/// Identity function /// Identity function
class PDF4QTLIBSHARED_EXPORT PDFIdentityFunction : public PDFFunction class PDF4QTLIBCORESHARED_EXPORT PDFIdentityFunction : public PDFFunction
{ {
public: public:
explicit PDFIdentityFunction(); explicit PDFIdentityFunction();
@ -148,7 +148,7 @@ public:
/// Sampled function (Type 0 function). /// Sampled function (Type 0 function).
/// \note Order is ignored, linear interpolation is always performed. No cubic spline /// \note Order is ignored, linear interpolation is always performed. No cubic spline
/// interpolation occurs. /// interpolation occurs.
class PDF4QTLIBSHARED_EXPORT PDFSampledFunction : public PDFFunction class PDF4QTLIBCORESHARED_EXPORT PDFSampledFunction : public PDFFunction
{ {
public: public:
@ -217,7 +217,7 @@ private:
/// is defined as f(x) = c0 + x^exponent * (c1 - c0). If exponent is 1.0, then linear interpolation /// is defined as f(x) = c0 + x^exponent * (c1 - c0). If exponent is 1.0, then linear interpolation
/// is performed as f(x) = c0 * (1 - x) + x * c1. To be more precise, if exponent is nearly 1.0, /// is performed as f(x) = c0 * (1 - x) + x * c1. To be more precise, if exponent is nearly 1.0,
/// then linear interpolation is used instead. /// then linear interpolation is used instead.
class PDF4QTLIBSHARED_EXPORT PDFExponentialFunction : public PDFFunction class PDF4QTLIBCORESHARED_EXPORT PDFExponentialFunction : public PDFFunction
{ {
public: public:
/// Construct new exponential function. /// Construct new exponential function.
@ -254,7 +254,7 @@ private:
/// Stitching function (Type 3 function) /// Stitching function (Type 3 function)
/// This type of function has always exactly one input. Transformation of this function /// This type of function has always exactly one input. Transformation of this function
/// is defined via k subfunctions which are used in defined intervals of the input value. /// is defined via k subfunctions which are used in defined intervals of the input value.
class PDF4QTLIBSHARED_EXPORT PDFStitchingFunction : public PDFFunction class PDF4QTLIBCORESHARED_EXPORT PDFStitchingFunction : public PDFFunction
{ {
public: public:
struct PartialFunction struct PartialFunction
@ -313,7 +313,7 @@ private:
/// Postscript function (Type 4 function) /// Postscript function (Type 4 function)
/// Implements subset of postscript language /// Implements subset of postscript language
class PDF4QTLIBSHARED_EXPORT PDFPostScriptFunction : public PDFFunction class PDF4QTLIBCORESHARED_EXPORT PDFPostScriptFunction : public PDFFunction
{ {
public: public:

View File

@ -25,13 +25,13 @@
#include <tuple> #include <tuple>
#include <array> #include <array>
#include <pdf4qtlib_export.h> #include <pdf4qtlibcore_export.h>
#if !defined(PDF4QTLIBSHARED_EXPORT) #if !defined(PDF4QTLIBCORESHARED_EXPORT)
#if defined(PDF4QTLIB_LIBRARY) #if defined(PDF4QTLIBCORE_LIBRARY)
# define PDF4QTLIBSHARED_EXPORT Q_DECL_EXPORT # define PDF4QTLIBCORESHARED_EXPORT Q_DECL_EXPORT
#else #else
# define PDF4QTLIBSHARED_EXPORT Q_DECL_IMPORT # define PDF4QTLIBCORESHARED_EXPORT Q_DECL_IMPORT
#endif #endif
#endif #endif

View File

@ -27,7 +27,7 @@ namespace pdf
/// Theme icon provider. Can provide icons from custom directory, /// Theme icon provider. Can provide icons from custom directory,
/// so user can use their own icon theme. /// so user can use their own icon theme.
class PDF4QTLIBSHARED_EXPORT PDFIconTheme class PDF4QTLIBCORESHARED_EXPORT PDFIconTheme
{ {
public: public:
explicit PDFIconTheme() = default; explicit PDFIconTheme() = default;

View File

@ -55,7 +55,7 @@ private:
bool m_defaultForPrinting = false; bool m_defaultForPrinting = false;
}; };
class PDF4QTLIBSHARED_EXPORT PDFImage class PDF4QTLIBCORESHARED_EXPORT PDFImage
{ {
public: public:
PDFImage() = default; PDFImage() = default;

View File

@ -27,7 +27,7 @@ namespace pdf
/// This class facilitates various image conversions, /// This class facilitates various image conversions,
/// including transforming colored images into monochromatic (or bitonal) formats. /// including transforming colored images into monochromatic (or bitonal) formats.
class PDF4QTLIBSHARED_EXPORT PDFImageConversion class PDF4QTLIBCORESHARED_EXPORT PDFImageConversion
{ {
public: public:
PDFImageConversion(); PDFImageConversion();

View File

@ -57,7 +57,7 @@ struct PDFJavaScriptEntry
/// Scans document for all javascript presence (in actions). Several option /// Scans document for all javascript presence (in actions). Several option
/// can be set, for example, scan only document actions, or stop scanning, /// can be set, for example, scan only document actions, or stop scanning,
/// when first javascript is found. /// when first javascript is found.
class PDF4QTLIBSHARED_EXPORT PDFJavaScriptScanner class PDF4QTLIBCORESHARED_EXPORT PDFJavaScriptScanner
{ {
public: public:
explicit PDFJavaScriptScanner(const PDFDocument* document); explicit PDFJavaScriptScanner(const PDFDocument* document);

View File

@ -73,7 +73,7 @@ struct PDFJBIG2HuffmanTableEntry
/// state is stored as 8-bit value, where only 7 bits are used. 6 bits are used /// state is stored as 8-bit value, where only 7 bits are used. 6 bits are used
/// to store Qe value index (current row in the table, number 0-46), and lowest 1 bit /// to store Qe value index (current row in the table, number 0-46), and lowest 1 bit
/// is used to store current MPS value (most probable symbol - 0/1). /// is used to store current MPS value (most probable symbol - 0/1).
class PDF4QTLIBSHARED_EXPORT PDFJBIG2ArithmeticDecoderState class PDF4QTLIBCORESHARED_EXPORT PDFJBIG2ArithmeticDecoderState
{ {
public: public:
explicit inline PDFJBIG2ArithmeticDecoderState() = default; explicit inline PDFJBIG2ArithmeticDecoderState() = default;
@ -139,7 +139,7 @@ private:
/// of decoder described in document ISO/IEC 14492:2001, T.88, annex G (arithmetic decoding /// of decoder described in document ISO/IEC 14492:2001, T.88, annex G (arithmetic decoding
/// procedure). It uses 32-bit fixed point arithmetic instead of 16-bit fixed point /// procedure). It uses 32-bit fixed point arithmetic instead of 16-bit fixed point
/// arithmetic described in the specification (it is much faster). /// arithmetic described in the specification (it is much faster).
class PDF4QTLIBSHARED_EXPORT PDFJBIG2ArithmeticDecoder class PDF4QTLIBCORESHARED_EXPORT PDFJBIG2ArithmeticDecoder
{ {
public: public:
explicit inline PDFJBIG2ArithmeticDecoder(PDFBitReader* reader) : explicit inline PDFJBIG2ArithmeticDecoder(PDFBitReader* reader) :
@ -323,7 +323,7 @@ private:
std::vector<PDFJBIG2HuffmanTableEntry> m_entries; std::vector<PDFJBIG2HuffmanTableEntry> m_entries;
}; };
class PDF4QTLIBSHARED_EXPORT PDFJBIG2Bitmap : public PDFJBIG2Segment class PDF4QTLIBCORESHARED_EXPORT PDFJBIG2Bitmap : public PDFJBIG2Segment
{ {
public: public:
explicit PDFJBIG2Bitmap(); explicit PDFJBIG2Bitmap();
@ -427,7 +427,7 @@ using PDFJBIG2ATPositions = std::array<PDFJBIG2ATPosition, 4>;
/// Decoder of JBIG2 data streams. Decodes the black/white monochrome image. /// Decoder of JBIG2 data streams. Decodes the black/white monochrome image.
/// Handles also global segments. Decoder decodes data using the specification /// Handles also global segments. Decoder decodes data using the specification
/// ISO/IEC 14492:2001, T.88. /// ISO/IEC 14492:2001, T.88.
class PDF4QTLIBSHARED_EXPORT PDFJBIG2Decoder class PDF4QTLIBCORESHARED_EXPORT PDFJBIG2Decoder
{ {
public: public:
explicit inline PDFJBIG2Decoder(QByteArray data, QByteArray globalData, PDFRenderErrorReporter* errorReporter) : explicit inline PDFJBIG2Decoder(QByteArray data, QByteArray globalData, PDFRenderErrorReporter* errorReporter) :

View File

@ -27,7 +27,7 @@
namespace pdf namespace pdf
{ {
class PDF4QTLIBSHARED_EXPORT PDFNameToUnicode class PDF4QTLIBCORESHARED_EXPORT PDFNameToUnicode
{ {
public: public:
explicit PDFNameToUnicode() = delete; explicit PDFNameToUnicode() = delete;

View File

@ -112,7 +112,7 @@ struct PDFInplaceString
}; };
/// Reference to the string implementations /// Reference to the string implementations
struct PDF4QTLIBSHARED_EXPORT PDFStringRef struct PDF4QTLIBCORESHARED_EXPORT PDFStringRef
{ {
const PDFInplaceString* inplaceString = nullptr; const PDFInplaceString* inplaceString = nullptr;
const PDFString* memoryString = nullptr; const PDFString* memoryString = nullptr;
@ -122,7 +122,7 @@ struct PDF4QTLIBSHARED_EXPORT PDFStringRef
/// This class represents string, which can be inplace string (no memory allocation), /// This class represents string, which can be inplace string (no memory allocation),
/// or classic byte array string, if not enough space for embedded string. /// or classic byte array string, if not enough space for embedded string.
class PDF4QTLIBSHARED_EXPORT PDFInplaceOrMemoryString class PDF4QTLIBCORESHARED_EXPORT PDFInplaceOrMemoryString
{ {
public: public:
constexpr PDFInplaceOrMemoryString() = default; constexpr PDFInplaceOrMemoryString() = default;
@ -158,7 +158,7 @@ private:
std::variant<typename std::monostate, PDFInplaceString, QByteArray> m_value; std::variant<typename std::monostate, PDFInplaceString, QByteArray> m_value;
}; };
class PDF4QTLIBSHARED_EXPORT PDFObject class PDF4QTLIBCORESHARED_EXPORT PDFObject
{ {
public: public:
enum class Type : uint8_t enum class Type : uint8_t
@ -311,7 +311,7 @@ private:
}; };
/// Represents an array of objects in the PDF file. /// Represents an array of objects in the PDF file.
class PDF4QTLIBSHARED_EXPORT PDFArray : public PDFObjectContent class PDF4QTLIBCORESHARED_EXPORT PDFArray : public PDFObjectContent
{ {
public: public:
inline PDFArray() = default; inline PDFArray() = default;
@ -353,7 +353,7 @@ private:
/// an array of pairs key-value, where key is name object and value is any /// an array of pairs key-value, where key is name object and value is any
/// PDF object. For this reason, we use QByteArray for key. We do not use /// PDF object. For this reason, we use QByteArray for key. We do not use
/// map, because dictionaries are usually small. /// map, because dictionaries are usually small.
class PDF4QTLIBSHARED_EXPORT PDFDictionary : public PDFObjectContent class PDF4QTLIBCORESHARED_EXPORT PDFDictionary : public PDFObjectContent
{ {
public: public:
using DictionaryEntry = std::pair<PDFInplaceOrMemoryString, PDFObject>; using DictionaryEntry = std::pair<PDFInplaceOrMemoryString, PDFObject>;
@ -464,7 +464,7 @@ private:
/// Represents a stream object in the PDF file. Stream consists of dictionary /// Represents a stream object in the PDF file. Stream consists of dictionary
/// and stream content - byte array. /// and stream content - byte array.
class PDF4QTLIBSHARED_EXPORT PDFStream : public PDFObjectContent class PDF4QTLIBCORESHARED_EXPORT PDFStream : public PDFObjectContent
{ {
public: public:
inline explicit PDFStream() = default; inline explicit PDFStream() = default;
@ -493,7 +493,7 @@ private:
QByteArray m_content; QByteArray m_content;
}; };
class PDF4QTLIBSHARED_EXPORT PDFObjectManipulator class PDF4QTLIBCORESHARED_EXPORT PDFObjectManipulator
{ {
public: public:
explicit PDFObjectManipulator() = delete; explicit PDFObjectManipulator() = delete;

View File

@ -121,7 +121,7 @@ struct PDFObjectEditorModelAttribute
bool selectorAttributeValue = false; bool selectorAttributeValue = false;
}; };
class PDF4QTLIBSHARED_EXPORT PDFObjectEditorAbstractModel : public QObject class PDF4QTLIBCORESHARED_EXPORT PDFObjectEditorAbstractModel : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -230,7 +230,7 @@ protected:
std::map<size_t, std::vector<size_t>> m_similarAttributes; std::map<size_t, std::vector<size_t>> m_similarAttributes;
}; };
class PDF4QTLIBSHARED_EXPORT PDFObjectEditorAnnotationsModel : public PDFObjectEditorAbstractModel class PDF4QTLIBCORESHARED_EXPORT PDFObjectEditorAnnotationsModel : public PDFObjectEditorAbstractModel
{ {
Q_OBJECT Q_OBJECT

View File

@ -32,7 +32,7 @@ class PDFObjectStorage;
class PDFDocument; class PDFDocument;
/// Utilities for manipulation with objects /// Utilities for manipulation with objects
class PDF4QTLIBSHARED_EXPORT PDFObjectUtils class PDF4QTLIBCORESHARED_EXPORT PDFObjectUtils
{ {
public: public:
/// Returns a list of references referenced by \p objects. So, all references, which are present /// Returns a list of references referenced by \p objects. So, all references, which are present
@ -111,7 +111,7 @@ private:
/// Classifies objects according to their type. Some heuristic is used /// Classifies objects according to their type. Some heuristic is used
/// when object type is missing or document is not well-formed. /// when object type is missing or document is not well-formed.
class PDF4QTLIBSHARED_EXPORT PDFObjectClassifier class PDF4QTLIBCORESHARED_EXPORT PDFObjectClassifier
{ {
public: public:

View File

@ -29,7 +29,7 @@ namespace pdf
/// and remove unused objects, merge same objects, or even recompress some streams /// and remove unused objects, merge same objects, or even recompress some streams
/// to achieve better optimization ratio. Optimization is configurable, user can specify, /// to achieve better optimization ratio. Optimization is configurable, user can specify,
/// which optimization steps should be done and which not. /// which optimization steps should be done and which not.
class PDF4QTLIBSHARED_EXPORT PDFOptimizer : public QObject class PDF4QTLIBCORESHARED_EXPORT PDFOptimizer : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@ -155,7 +155,7 @@ private:
}; };
/// Activeness of the optional content /// Activeness of the optional content
class PDF4QTLIBSHARED_EXPORT PDFOptionalContentActivity : public QObject class PDF4QTLIBCORESHARED_EXPORT PDFOptionalContentActivity : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@ -31,7 +31,7 @@ namespace pdf
class PDFDocument; class PDFDocument;
/// Outline item /// Outline item
class PDF4QTLIBSHARED_EXPORT PDFOutlineItem class PDF4QTLIBCORESHARED_EXPORT PDFOutlineItem
{ {
public: public:
explicit PDFOutlineItem() = default; explicit PDFOutlineItem() = default;

View File

@ -139,7 +139,7 @@ private:
/// Object representing page in PDF document. Contains different page properties, such as /// Object representing page in PDF document. Contains different page properties, such as
/// media box, crop box, rotation, etc. and also page content, resources. /// media box, crop box, rotation, etc. and also page content, resources.
class PDF4QTLIBSHARED_EXPORT PDFPage class PDF4QTLIBCORESHARED_EXPORT PDFPage
{ {
public: public:
explicit PDFPage() = default; explicit PDFPage() = default;

View File

@ -80,7 +80,7 @@ private:
}; };
/// Process the contents of the page. /// Process the contents of the page.
class PDF4QTLIBSHARED_EXPORT PDFPageContentProcessor : public PDFRenderErrorReporter class PDF4QTLIBCORESHARED_EXPORT PDFPageContentProcessor : public PDFRenderErrorReporter
{ {
public: public:
explicit PDFPageContentProcessor(const PDFPage* page, explicit PDFPageContentProcessor(const PDFPage* page,
@ -706,7 +706,7 @@ protected:
/// Returns optional content activity /// Returns optional content activity
const PDFOptionalContentActivity* getOptionalContentActivity() const { return m_optionalContentActivity; } const PDFOptionalContentActivity* getOptionalContentActivity() const { return m_optionalContentActivity; }
class PDF4QTLIBSHARED_EXPORT PDFTransparencyGroupGuard class PDF4QTLIBCORESHARED_EXPORT PDFTransparencyGroupGuard
{ {
public: public:
explicit PDFTransparencyGroupGuard(PDFPageContentProcessor* processor, PDFTransparencyGroup&& group); explicit PDFTransparencyGroupGuard(PDFPageContentProcessor* processor, PDFTransparencyGroup&& group);

View File

@ -60,7 +60,7 @@ private:
/// Navigation object, which helps to navigate trough document. /// Navigation object, which helps to navigate trough document.
/// It also handles subpage navigation, if subpage navigation /// It also handles subpage navigation, if subpage navigation
/// steps are present. /// steps are present.
class PDF4QTLIBSHARED_EXPORT PDFPageNavigation : public QObject class PDF4QTLIBCORESHARED_EXPORT PDFPageNavigation : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@ -364,7 +364,7 @@ private:
/// Processor, which processes PDF's page commands and writes them to the precompiled page. /// Processor, which processes PDF's page commands and writes them to the precompiled page.
/// Precompiled page then can be used to execute these commands on QPainter. /// Precompiled page then can be used to execute these commands on QPainter.
class PDF4QTLIBSHARED_EXPORT PDFPrecompiledPageGenerator : public PDFPainterBase class PDF4QTLIBCORESHARED_EXPORT PDFPrecompiledPageGenerator : public PDFPainterBase
{ {
using BaseClass = PDFPainterBase; using BaseClass = PDFPainterBase;

View File

@ -44,7 +44,7 @@ private:
QPainter* m_painter; QPainter* m_painter;
}; };
class PDF4QTLIBSHARED_EXPORT PDFPainterHelper class PDF4QTLIBCORESHARED_EXPORT PDFPainterHelper
{ {
public: public:
/// Draws bubble using painter. Bubble is aligned to the point, colored with color /// Draws bubble using painter. Bubble is aligned to the point, colored with color

View File

@ -78,7 +78,7 @@ constexpr const char* PDF_REFERENCE_COMMAND = "R";
constexpr const char* PDF_STREAM_START_COMMAND = "stream"; constexpr const char* PDF_STREAM_START_COMMAND = "stream";
constexpr const char* PDF_STREAM_END_COMMAND = "endstream"; constexpr const char* PDF_STREAM_END_COMMAND = "endstream";
class PDF4QTLIBSHARED_EXPORT PDFLexicalAnalyzer class PDF4QTLIBCORESHARED_EXPORT PDFLexicalAnalyzer
{ {
Q_GADGET Q_GADGET
Q_DECLARE_TR_FUNCTIONS(pdf::PDFLexicalAnalyzer) Q_DECLARE_TR_FUNCTIONS(pdf::PDFLexicalAnalyzer)
@ -283,7 +283,7 @@ private:
/// Class for parsing objects. Checks cyclical references. If /// Class for parsing objects. Checks cyclical references. If
/// the object cannot be obtained from the stream, exception is thrown. /// the object cannot be obtained from the stream, exception is thrown.
class PDF4QTLIBSHARED_EXPORT PDFParser class PDF4QTLIBCORESHARED_EXPORT PDFParser
{ {
Q_DECLARE_TR_FUNCTIONS(pdf::PDFParser) Q_DECLARE_TR_FUNCTIONS(pdf::PDFParser)

View File

@ -34,7 +34,7 @@ namespace pdf
class PDFWidget; class PDFWidget;
class PDFCMSManager; class PDFCMSManager;
struct PDF4QTLIBSHARED_EXPORT PDFPluginInfo struct PDF4QTLIBCORESHARED_EXPORT PDFPluginInfo
{ {
QString name; QString name;
QString author; QString author;
@ -69,7 +69,7 @@ public:
virtual VoiceSettings getVoiceSettings() const = 0; virtual VoiceSettings getVoiceSettings() const = 0;
}; };
class PDF4QTLIBSHARED_EXPORT PDFPlugin : public QObject class PDF4QTLIBCORESHARED_EXPORT PDFPlugin : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@ -33,7 +33,7 @@ struct ProgressStartupInfo
QString text; QString text;
}; };
class PDF4QTLIBSHARED_EXPORT PDFProgress : public QObject class PDF4QTLIBCORESHARED_EXPORT PDFProgress : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@ -27,7 +27,7 @@ namespace pdf
/// Create redacted document from the document, which have redact annotations. /// Create redacted document from the document, which have redact annotations.
/// Redacted document has removed content marked by these annotations, and /// Redacted document has removed content marked by these annotations, and
/// annotations themselfs are removed. /// annotations themselfs are removed.
class PDF4QTLIBSHARED_EXPORT PDFRedact class PDF4QTLIBCORESHARED_EXPORT PDFRedact
{ {
public: public:
explicit PDFRedact(const PDFDocument* document, explicit PDFRedact(const PDFDocument* document,

View File

@ -46,7 +46,7 @@ class PDFPrecompiledPage;
class PDFAnnotationManager; class PDFAnnotationManager;
class PDFOptionalContentActivity; class PDFOptionalContentActivity;
class PDF4QTLIBSHARED_EXPORT PDFRendererInfo class PDF4QTLIBCORESHARED_EXPORT PDFRendererInfo
{ {
public: public:
PDFRendererInfo() = delete; PDFRendererInfo() = delete;
@ -71,7 +71,7 @@ private:
}; };
/// Renders the PDF page on the painter, or onto an image. /// Renders the PDF page on the painter, or onto an image.
class PDF4QTLIBSHARED_EXPORT PDFRenderer class PDF4QTLIBCORESHARED_EXPORT PDFRenderer
{ {
public: public:
@ -169,7 +169,7 @@ private:
/// if it is enabled, if this is the case, offscreen rendering to framebuffer /// if it is enabled, if this is the case, offscreen rendering to framebuffer
/// is used. /// is used.
/// \note Construct this object only in main GUI thread /// \note Construct this object only in main GUI thread
class PDF4QTLIBSHARED_EXPORT PDFRasterizer : public QObject class PDF4QTLIBCORESHARED_EXPORT PDFRasterizer : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -246,7 +246,7 @@ struct PDFRenderedPageImage
/// render page images asynchronously. You can use this object in two ways - /// render page images asynchronously. You can use this object in two ways -
/// first one is as standard object pool, second one is to directly render /// first one is as standard object pool, second one is to directly render
/// page images asynchronously. /// page images asynchronously.
class PDF4QTLIBSHARED_EXPORT PDFRasterizerPool : public QObject class PDF4QTLIBCORESHARED_EXPORT PDFRasterizerPool : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -328,7 +328,7 @@ private:
}; };
/// Settings object for image writer /// Settings object for image writer
class PDF4QTLIBSHARED_EXPORT PDFImageWriterSettings class PDF4QTLIBCORESHARED_EXPORT PDFImageWriterSettings
{ {
public: public:
explicit PDFImageWriterSettings(); explicit PDFImageWriterSettings();
@ -380,7 +380,7 @@ private:
}; };
/// This class is for setup of page image exporter /// This class is for setup of page image exporter
class PDF4QTLIBSHARED_EXPORT PDFPageImageExportSettings class PDF4QTLIBCORESHARED_EXPORT PDFPageImageExportSettings
{ {
public: public:
explicit PDFPageImageExportSettings() : PDFPageImageExportSettings(nullptr) { } explicit PDFPageImageExportSettings() : PDFPageImageExportSettings(nullptr) { }

View File

@ -445,7 +445,7 @@ private:
}; };
/// Factory, which creates security handler based on settings. /// Factory, which creates security handler based on settings.
class PDF4QTLIBSHARED_EXPORT PDFSecurityHandlerFactory class PDF4QTLIBCORESHARED_EXPORT PDFSecurityHandlerFactory
{ {
Q_DECLARE_TR_FUNCTIONS(pdf::PDFSecurityHandlerFactory) Q_DECLARE_TR_FUNCTIONS(pdf::PDFSecurityHandlerFactory)

View File

@ -153,7 +153,7 @@ private:
}; };
/// Info about certificate, various details etc. /// Info about certificate, various details etc.
class PDF4QTLIBSHARED_EXPORT PDFCertificateInfo class PDF4QTLIBCORESHARED_EXPORT PDFCertificateInfo
{ {
public: public:
explicit inline PDFCertificateInfo() = default; explicit inline PDFCertificateInfo() = default;
@ -270,7 +270,7 @@ private:
using PDFCertificateInfos = std::vector<PDFCertificateInfo>; using PDFCertificateInfos = std::vector<PDFCertificateInfo>;
class PDF4QTLIBSHARED_EXPORT PDFSignatureVerificationResult class PDF4QTLIBCORESHARED_EXPORT PDFSignatureVerificationResult
{ {
public: public:
explicit PDFSignatureVerificationResult() = default; explicit PDFSignatureVerificationResult() = default;
@ -428,7 +428,7 @@ private:
}; };
/// Signature handler. Can verify both certificate and signature validity. /// Signature handler. Can verify both certificate and signature validity.
class PDF4QTLIBSHARED_EXPORT PDFSignatureHandler class PDF4QTLIBCORESHARED_EXPORT PDFSignatureHandler
{ {
public: public:
explicit PDFSignatureHandler() = default; explicit PDFSignatureHandler() = default;
@ -465,7 +465,7 @@ private:
/// Trusted certificate store. Contains list of trusted certificates. Store /// Trusted certificate store. Contains list of trusted certificates. Store
/// can be persisted to the persistent storage trough serialization/deserialization. /// can be persisted to the persistent storage trough serialization/deserialization.
/// Persisting method is versioned. /// Persisting method is versioned.
class PDF4QTLIBSHARED_EXPORT PDFCertificateStore class PDF4QTLIBCORESHARED_EXPORT PDFCertificateStore
{ {
public: public:
explicit inline PDFCertificateStore() = default; explicit inline PDFCertificateStore() = default;

View File

@ -17,7 +17,6 @@
#include "pdfsnapper.h" #include "pdfsnapper.h"
#include "pdfcompiler.h" #include "pdfcompiler.h"
#include "pdfwidgetutils.h"
#include "pdfdrawspacecontroller.h" #include "pdfdrawspacecontroller.h"
#include "pdfdbgheap.h" #include "pdfdbgheap.h"

View File

@ -137,7 +137,7 @@ private:
int m_stride = 0; int m_stride = 0;
}; };
class PDF4QTLIBSHARED_EXPORT PDFStreamFilter class PDF4QTLIBCORESHARED_EXPORT PDFStreamFilter
{ {
public: public:
explicit PDFStreamFilter() = default; explicit PDFStreamFilter() = default;
@ -164,7 +164,7 @@ public:
virtual PDFInteger getStreamDataLength(const QByteArray& data, PDFInteger offset) const; virtual PDFInteger getStreamDataLength(const QByteArray& data, PDFInteger offset) const;
}; };
class PDF4QTLIBSHARED_EXPORT PDFAsciiHexDecodeFilter : public PDFStreamFilter class PDF4QTLIBCORESHARED_EXPORT PDFAsciiHexDecodeFilter : public PDFStreamFilter
{ {
public: public:
explicit PDFAsciiHexDecodeFilter() = default; explicit PDFAsciiHexDecodeFilter() = default;
@ -176,7 +176,7 @@ public:
const PDFSecurityHandler* securityHandler) const override; const PDFSecurityHandler* securityHandler) const override;
}; };
class PDF4QTLIBSHARED_EXPORT PDFAscii85DecodeFilter : public PDFStreamFilter class PDF4QTLIBCORESHARED_EXPORT PDFAscii85DecodeFilter : public PDFStreamFilter
{ {
public: public:
explicit PDFAscii85DecodeFilter() = default; explicit PDFAscii85DecodeFilter() = default;
@ -188,7 +188,7 @@ public:
const PDFSecurityHandler* securityHandler) const override; const PDFSecurityHandler* securityHandler) const override;
}; };
class PDF4QTLIBSHARED_EXPORT PDFLzwDecodeFilter : public PDFStreamFilter class PDF4QTLIBCORESHARED_EXPORT PDFLzwDecodeFilter : public PDFStreamFilter
{ {
public: public:
explicit PDFLzwDecodeFilter() = default; explicit PDFLzwDecodeFilter() = default;
@ -200,7 +200,7 @@ public:
const PDFSecurityHandler* securityHandler) const override; const PDFSecurityHandler* securityHandler) const override;
}; };
class PDF4QTLIBSHARED_EXPORT PDFFlateDecodeFilter : public PDFStreamFilter class PDF4QTLIBCORESHARED_EXPORT PDFFlateDecodeFilter : public PDFStreamFilter
{ {
public: public:
explicit PDFFlateDecodeFilter() = default; explicit PDFFlateDecodeFilter() = default;
@ -226,7 +226,7 @@ private:
static QByteArray uncompress(const QByteArray& data); static QByteArray uncompress(const QByteArray& data);
}; };
class PDF4QTLIBSHARED_EXPORT PDFRunLengthDecodeFilter : public PDFStreamFilter class PDF4QTLIBCORESHARED_EXPORT PDFRunLengthDecodeFilter : public PDFStreamFilter
{ {
public: public:
explicit PDFRunLengthDecodeFilter() = default; explicit PDFRunLengthDecodeFilter() = default;
@ -238,7 +238,7 @@ public:
const PDFSecurityHandler* securityHandler) const override; const PDFSecurityHandler* securityHandler) const override;
}; };
class PDF4QTLIBSHARED_EXPORT PDFCryptFilter : public PDFStreamFilter class PDF4QTLIBCORESHARED_EXPORT PDFCryptFilter : public PDFStreamFilter
{ {
public: public:
explicit PDFCryptFilter() = default; explicit PDFCryptFilter() = default;

View File

@ -35,7 +35,7 @@ class PDFStructureElement;
class PDFStructureMarkedContentReference; class PDFStructureMarkedContentReference;
class PDFStructureObjectReference; class PDFStructureObjectReference;
class PDF4QTLIBSHARED_EXPORT PDFStructureTreeAbstractVisitor class PDF4QTLIBCORESHARED_EXPORT PDFStructureTreeAbstractVisitor
{ {
public: public:
inline PDFStructureTreeAbstractVisitor() = default; inline PDFStructureTreeAbstractVisitor() = default;
@ -50,7 +50,7 @@ protected:
void acceptChildren(const PDFStructureItem* item); void acceptChildren(const PDFStructureItem* item);
}; };
class PDF4QTLIBSHARED_EXPORT PDFStructureTreeAttribute class PDF4QTLIBCORESHARED_EXPORT PDFStructureTreeAttribute
{ {
public: public:
@ -251,7 +251,7 @@ class PDFStructureMarkedContentReference;
using PDFStructureItemPointer = QSharedPointer<PDFStructureItem>; using PDFStructureItemPointer = QSharedPointer<PDFStructureItem>;
/// Root class for all structure tree items /// Root class for all structure tree items
class PDF4QTLIBSHARED_EXPORT PDFStructureItem class PDF4QTLIBCORESHARED_EXPORT PDFStructureItem
{ {
public: public:
explicit inline PDFStructureItem(PDFStructureItem* parent, PDFStructureTree* root) : explicit inline PDFStructureItem(PDFStructureItem* parent, PDFStructureTree* root) :
@ -345,7 +345,7 @@ protected:
}; };
/// Structure tree namespace /// Structure tree namespace
class PDF4QTLIBSHARED_EXPORT PDFStructureTreeNamespace class PDF4QTLIBCORESHARED_EXPORT PDFStructureTreeNamespace
{ {
public: public:
explicit inline PDFStructureTreeNamespace() = default; explicit inline PDFStructureTreeNamespace() = default;
@ -367,7 +367,7 @@ private:
using PDFStructureTreeNamespaces = std::vector<PDFStructureTreeNamespace>; using PDFStructureTreeNamespaces = std::vector<PDFStructureTreeNamespace>;
/// Structure tree, contains structure element hierarchy /// Structure tree, contains structure element hierarchy
class PDF4QTLIBSHARED_EXPORT PDFStructureTree : public PDFStructureItem class PDF4QTLIBCORESHARED_EXPORT PDFStructureTree : public PDFStructureItem
{ {
public: public:
explicit inline PDFStructureTree() : PDFStructureItem(nullptr, this) { } explicit inline PDFStructureTree() : PDFStructureItem(nullptr, this) { }
@ -447,7 +447,7 @@ private:
}; };
/// Structure element /// Structure element
class PDF4QTLIBSHARED_EXPORT PDFStructureElement : public PDFStructureItem class PDF4QTLIBCORESHARED_EXPORT PDFStructureElement : public PDFStructureItem
{ {
public: public:
explicit inline PDFStructureElement(PDFStructureItem* parent, PDFStructureTree* root) : explicit inline PDFStructureElement(PDFStructureItem* parent, PDFStructureTree* root) :
@ -539,7 +539,7 @@ private:
}; };
/// Structure marked content reference /// Structure marked content reference
class PDF4QTLIBSHARED_EXPORT PDFStructureMarkedContentReference : public PDFStructureItem class PDF4QTLIBCORESHARED_EXPORT PDFStructureMarkedContentReference : public PDFStructureItem
{ {
public: public:
explicit inline PDFStructureMarkedContentReference(PDFStructureItem* parent, PDFStructureTree* root) : explicit inline PDFStructureMarkedContentReference(PDFStructureItem* parent, PDFStructureTree* root) :
@ -577,7 +577,7 @@ private:
}; };
/// Structure object reference /// Structure object reference
class PDF4QTLIBSHARED_EXPORT PDFStructureObjectReference : public PDFStructureItem class PDF4QTLIBCORESHARED_EXPORT PDFStructureObjectReference : public PDFStructureItem
{ {
public: public:
explicit inline PDFStructureObjectReference(PDFStructureItem* parent, PDFStructureTree* root) : explicit inline PDFStructureObjectReference(PDFStructureItem* parent, PDFStructureTree* root) :

View File

@ -21,7 +21,7 @@
#include <QStyle> #include <QStyle>
#include <QKeyEvent> #include <QKeyEvent>
#include <QMouseEvent> #include <QMouseEvent>
#include <QApplication> #include <QCoreApplication>
#include <QClipboard> #include <QClipboard>
namespace pdf namespace pdf
@ -35,7 +35,7 @@ PDFTextEditPseudowidget::PDFTextEditPseudowidget(PDFFormField::FieldFlags flags)
m_maxTextLength(0) m_maxTextLength(0)
{ {
m_textLayout.setCacheEnabled(true); m_textLayout.setCacheEnabled(true);
m_passwordReplacementCharacter = QChar(QApplication::style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter)); m_passwordReplacementCharacter = QChar(QCoreApplication::style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter));
} }
void PDFTextEditPseudowidget::shortcutOverrideEvent(QWidget* widget, QKeyEvent* event) void PDFTextEditPseudowidget::shortcutOverrideEvent(QWidget* widget, QKeyEvent* event)

View File

@ -226,7 +226,7 @@ using PDFTextSelectionColoredItems = std::vector<PDFTextSelectionColoredItem>;
/// Text selection, can be used across multiple pages. Also defines color /// Text selection, can be used across multiple pages. Also defines color
/// for each text selection. /// for each text selection.
class PDF4QTLIBSHARED_EXPORT PDFTextSelection class PDF4QTLIBCORESHARED_EXPORT PDFTextSelection
{ {
public: public:
explicit PDFTextSelection() = default; explicit PDFTextSelection() = default;
@ -285,7 +285,7 @@ using PDFTextFlows = std::vector<PDFTextFlow>;
/// This class represents a portion of continuous text on the page. It can /// This class represents a portion of continuous text on the page. It can
/// consists of multiple blocks (which follow reading order). /// consists of multiple blocks (which follow reading order).
class PDF4QTLIBSHARED_EXPORT PDFTextFlow class PDF4QTLIBCORESHARED_EXPORT PDFTextFlow
{ {
public: public:
@ -351,7 +351,7 @@ private:
/// Text layout of single page. Can handle various fonts, various angles of lines /// Text layout of single page. Can handle various fonts, various angles of lines
/// and vertically oriented text. It performs the "docstrum" algorithm. /// and vertically oriented text. It performs the "docstrum" algorithm.
class PDF4QTLIBSHARED_EXPORT PDFTextLayout class PDF4QTLIBCORESHARED_EXPORT PDFTextLayout
{ {
public: public:
explicit PDFTextLayout(); explicit PDFTextLayout();
@ -436,7 +436,7 @@ private:
}; };
/// Cache for storing single text layout /// Cache for storing single text layout
class PDF4QTLIBSHARED_EXPORT PDFTextLayoutCache class PDF4QTLIBCORESHARED_EXPORT PDFTextLayoutCache
{ {
public: public:
explicit PDFTextLayoutCache(std::function<PDFTextLayout(PDFInteger)> textLayoutGetter); explicit PDFTextLayoutCache(std::function<PDFTextLayout(PDFInteger)> textLayoutGetter);
@ -456,7 +456,7 @@ private:
PDFTextLayout m_layout; PDFTextLayout m_layout;
}; };
class PDF4QTLIBSHARED_EXPORT PDFTextLayoutGetter class PDF4QTLIBCORESHARED_EXPORT PDFTextLayoutGetter
{ {
public: public:
explicit inline PDFTextLayoutGetter(PDFTextLayoutCache* cache, PDFInteger pageIndex) : explicit inline PDFTextLayoutGetter(PDFTextLayoutCache* cache, PDFInteger pageIndex) :
@ -505,7 +505,7 @@ private:
}; };
/// Paints text selection on various pages using page to device point matrix /// Paints text selection on various pages using page to device point matrix
class PDF4QTLIBSHARED_EXPORT PDFTextSelectionPainter class PDF4QTLIBCORESHARED_EXPORT PDFTextSelectionPainter
{ {
public: public:
explicit inline PDFTextSelectionPainter(const PDFTextSelection* selection) : explicit inline PDFTextSelectionPainter(const PDFTextSelection* selection) :
@ -540,7 +540,7 @@ private:
/// For writing, mutex is used to synchronize asynchronous writes, for reading /// For writing, mutex is used to synchronize asynchronous writes, for reading
/// no mutex is used at all. For this reason, both reading/writing at the same time /// no mutex is used at all. For this reason, both reading/writing at the same time
/// is prohibited, it is not thread safe. /// is prohibited, it is not thread safe.
class PDF4QTLIBSHARED_EXPORT PDFTextLayoutStorage class PDF4QTLIBCORESHARED_EXPORT PDFTextLayoutStorage
{ {
public: public:
explicit inline PDFTextLayoutStorage() = default; explicit inline PDFTextLayoutStorage() = default;

View File

@ -137,7 +137,7 @@ private:
/// Represents float bitmap with arbitrary color channel count. Bitmap can also /// Represents float bitmap with arbitrary color channel count. Bitmap can also
/// have auxiliary channels, such as shape and opacity channels. /// have auxiliary channels, such as shape and opacity channels.
class PDF4QTLIBSHARED_EXPORT PDFFloatBitmap class PDF4QTLIBCORESHARED_EXPORT PDFFloatBitmap
{ {
public: public:
explicit PDFFloatBitmap(); explicit PDFFloatBitmap();
@ -319,7 +319,7 @@ private:
}; };
/// Float bitmap with color space /// Float bitmap with color space
class PDF4QTLIBSHARED_EXPORT PDFFloatBitmapWithColorSpace : public PDFFloatBitmap class PDF4QTLIBCORESHARED_EXPORT PDFFloatBitmapWithColorSpace : public PDFFloatBitmap
{ {
public: public:
explicit PDFFloatBitmapWithColorSpace(); explicit PDFFloatBitmapWithColorSpace();
@ -365,7 +365,7 @@ struct PDFInkMapping
}; };
/// Ink mapper for mapping device inks (device colors) and spot inks (spot colors). /// Ink mapper for mapping device inks (device colors) and spot inks (spot colors).
class PDF4QTLIBSHARED_EXPORT PDFInkMapper class PDF4QTLIBCORESHARED_EXPORT PDFInkMapper
{ {
public: public:
explicit PDFInkMapper(const PDFCMSManager* manager, const PDFDocument* document); explicit PDFInkMapper(const PDFCMSManager* manager, const PDFDocument* document);
@ -633,7 +633,7 @@ struct PDFTransparencyRendererSettings
/// page blending space and device blending space. So, painted graphics is being /// page blending space and device blending space. So, painted graphics is being
/// blended to the page blending space, and then converted to the device blending /// blended to the page blending space, and then converted to the device blending
/// space. /// space.
class PDF4QTLIBSHARED_EXPORT PDFTransparencyRenderer : public PDFPageContentProcessor class PDF4QTLIBCORESHARED_EXPORT PDFTransparencyRenderer : public PDFPageContentProcessor
{ {
private: private:
using BaseClass = PDFPageContentProcessor; using BaseClass = PDFPageContentProcessor;
@ -927,7 +927,7 @@ private:
/// Ink coverage calculator. Calculates ink coverage for a given /// Ink coverage calculator. Calculates ink coverage for a given
/// page range. Calculates ink coverage of both cmyk colors and spot colors. /// page range. Calculates ink coverage of both cmyk colors and spot colors.
class PDF4QTLIBSHARED_EXPORT PDFInkCoverageCalculator class PDF4QTLIBCORESHARED_EXPORT PDFInkCoverageCalculator
{ {
public: public:
PDFInkCoverageCalculator(const PDFDocument* document, PDFInkCoverageCalculator(const PDFDocument* document,

View File

@ -109,7 +109,7 @@ private:
/// Bit-reader, which can read n-bit unsigned integers from the stream. /// Bit-reader, which can read n-bit unsigned integers from the stream.
/// Number of bits can be set in the constructor and is constant. /// Number of bits can be set in the constructor and is constant.
class PDF4QTLIBSHARED_EXPORT PDFBitReader class PDF4QTLIBCORESHARED_EXPORT PDFBitReader
{ {
public: public:
using Value = uint64_t; using Value = uint64_t;
@ -190,7 +190,7 @@ private:
}; };
/// Bit writer /// Bit writer
class PDF4QTLIBSHARED_EXPORT PDFBitWriter class PDF4QTLIBCORESHARED_EXPORT PDFBitWriter
{ {
public: public:
using Value = uint64_t; using Value = uint64_t;
@ -386,7 +386,7 @@ inline constexpr uint8_t log2ceil(uint32_t value)
return logarithm; return logarithm;
} }
struct PDF4QTLIBSHARED_EXPORT PDFDependentLibraryInfo struct PDF4QTLIBCORESHARED_EXPORT PDFDependentLibraryInfo
{ {
Q_DECLARE_TR_FUNCTIONS(pdf::PDFDependentLibraryInfo) Q_DECLARE_TR_FUNCTIONS(pdf::PDFDependentLibraryInfo)
@ -657,7 +657,7 @@ private:
}; };
/// Get system information /// Get system information
class PDF4QTLIBSHARED_EXPORT PDFSysUtils class PDF4QTLIBCORESHARED_EXPORT PDFSysUtils
{ {
public: public:
@ -665,7 +665,7 @@ public:
}; };
/// Set of closed intervals /// Set of closed intervals
class PDF4QTLIBSHARED_EXPORT PDFClosedIntervalSet class PDF4QTLIBCORESHARED_EXPORT PDFClosedIntervalSet
{ {
public: public:
explicit inline PDFClosedIntervalSet() = default; explicit inline PDFClosedIntervalSet() = default;
@ -827,7 +827,7 @@ QDataStream& operator<<(QDataStream& stream, const std::set<T>& set)
/// Color scale represents hot-to-cold color scale. It maps value /// Color scale represents hot-to-cold color scale. It maps value
/// to the color from blue trough green to red. /// to the color from blue trough green to red.
class PDF4QTLIBSHARED_EXPORT PDFColorScale class PDF4QTLIBCORESHARED_EXPORT PDFColorScale
{ {
public: public:
explicit PDFColorScale(); explicit PDFColorScale();

View File

@ -32,7 +32,7 @@ namespace pdf
{ {
/// Abstract visitor, can iterate trough object tree /// Abstract visitor, can iterate trough object tree
class PDF4QTLIBSHARED_EXPORT PDFAbstractVisitor class PDF4QTLIBCORESHARED_EXPORT PDFAbstractVisitor
{ {
public: public:
@ -81,7 +81,7 @@ protected:
/// Statistics visitor, collects statistics about PDF object, can be /// Statistics visitor, collects statistics about PDF object, can be
/// invoked from multiple threads. /// invoked from multiple threads.
class PDF4QTLIBSHARED_EXPORT PDFStatisticsCollector : public PDFAbstractVisitor class PDF4QTLIBCORESHARED_EXPORT PDFStatisticsCollector : public PDFAbstractVisitor
{ {
public: public:
explicit PDFStatisticsCollector(); explicit PDFStatisticsCollector();

View File

@ -47,13 +47,19 @@ add_library(Pdf4QtLibWidgets SHARED
sources/pdfselectpagesdialog.h sources/pdfselectpagesdialog.h
sources/pdfselectpagesdialog.cpp sources/pdfselectpagesdialog.cpp
sources/pdfselectpagesdialog.ui sources/pdfselectpagesdialog.ui
sources/pdfwidgetannotation.h
sources/pdfwidgetannotation.cpp
sources/pdfpagecontentelements.cpp
sources/pdfpagecontentelements.h
sources/pdfitemmodels.cpp
sources/pdfitemmodels.h
) )
include(GenerateExportHeader) include(GenerateExportHeader)
GENERATE_EXPORT_HEADER(Pdf4QtLibWidgets GENERATE_EXPORT_HEADER(Pdf4QtLibWidgets
EXPORT_MACRO_NAME EXPORT_MACRO_NAME
PDF4QTLIBSHARED_EXPORT PDF4QTLIBCORESHARED_EXPORT
EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/pdf4qtlibwidgets_export.h") EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/pdf4qtlibwidgets_export.h")
if(PDF4QT_ENABLE_OPENGL) if(PDF4QT_ENABLE_OPENGL)

View File

@ -29,7 +29,7 @@ namespace pdf
/// Tool that creates 'sticky note' annotations. Multiple types of sticky /// Tool that creates 'sticky note' annotations. Multiple types of sticky
/// notes are available, user can select a type of sticky note. When /// notes are available, user can select a type of sticky note. When
/// user select a point, popup window appears and user can enter a text. /// user select a point, popup window appears and user can enter a text.
class PDF4QTLIBSHARED_EXPORT PDFCreateStickyNoteTool : public PDFWidgetTool class PDF4QTLIBCORESHARED_EXPORT PDFCreateStickyNoteTool : public PDFWidgetTool
{ {
Q_OBJECT Q_OBJECT
@ -52,7 +52,7 @@ private:
TextAnnotationIcon m_icon; TextAnnotationIcon m_icon;
}; };
class PDF4QTLIBSHARED_EXPORT PDFCreateAnnotationTool : public PDFWidgetTool class PDF4QTLIBCORESHARED_EXPORT PDFCreateAnnotationTool : public PDFWidgetTool
{ {
Q_OBJECT Q_OBJECT
@ -69,7 +69,7 @@ protected:
/// Tool that creates url link annotation. Multiple types of link highlights /// Tool that creates url link annotation. Multiple types of link highlights
/// are available, user can select a link highlight. When link annotation /// are available, user can select a link highlight. When link annotation
/// is clicked, url address is triggered. /// is clicked, url address is triggered.
class PDF4QTLIBSHARED_EXPORT PDFCreateHyperlinkTool : public PDFCreateAnnotationTool class PDF4QTLIBCORESHARED_EXPORT PDFCreateHyperlinkTool : public PDFCreateAnnotationTool
{ {
Q_OBJECT Q_OBJECT
@ -91,7 +91,7 @@ private:
}; };
/// Tool that creates free text note without callout line. /// Tool that creates free text note without callout line.
class PDF4QTLIBSHARED_EXPORT PDFCreateFreeTextTool : public PDFCreateAnnotationTool class PDF4QTLIBCORESHARED_EXPORT PDFCreateFreeTextTool : public PDFCreateAnnotationTool
{ {
Q_OBJECT Q_OBJECT
@ -109,7 +109,7 @@ private:
}; };
/// Tool that creates line/polyline/polygon annotations. /// Tool that creates line/polyline/polygon annotations.
class PDF4QTLIBSHARED_EXPORT PDFCreateLineTypeTool : public PDFCreateAnnotationTool class PDF4QTLIBCORESHARED_EXPORT PDFCreateLineTypeTool : public PDFCreateAnnotationTool
{ {
Q_OBJECT Q_OBJECT
@ -160,7 +160,7 @@ private:
}; };
/// Tool that creates ellipse annotation. /// Tool that creates ellipse annotation.
class PDF4QTLIBSHARED_EXPORT PDFCreateEllipseTool : public PDFCreateAnnotationTool class PDF4QTLIBCORESHARED_EXPORT PDFCreateEllipseTool : public PDFCreateAnnotationTool
{ {
Q_OBJECT Q_OBJECT
@ -196,7 +196,7 @@ private:
QColor m_fillColor; QColor m_fillColor;
}; };
class PDF4QTLIBSHARED_EXPORT PDFCreateFreehandCurveTool : public PDFCreateAnnotationTool class PDF4QTLIBCORESHARED_EXPORT PDFCreateFreehandCurveTool : public PDFCreateAnnotationTool
{ {
Q_OBJECT Q_OBJECT
@ -234,7 +234,7 @@ private:
/// Tool that creates 'stamp' annotations. Multiple types of stamps /// Tool that creates 'stamp' annotations. Multiple types of stamps
/// are available, user can select a type of stamp (text). /// are available, user can select a type of stamp (text).
class PDF4QTLIBSHARED_EXPORT PDFCreateStampTool : public PDFWidgetTool class PDF4QTLIBCORESHARED_EXPORT PDFCreateStampTool : public PDFWidgetTool
{ {
Q_OBJECT Q_OBJECT
@ -267,7 +267,7 @@ private:
}; };
/// Tool for highlighting of text in document /// Tool for highlighting of text in document
class PDF4QTLIBSHARED_EXPORT PDFCreateHighlightTextTool : public PDFWidgetTool class PDF4QTLIBCORESHARED_EXPORT PDFCreateHighlightTextTool : public PDFWidgetTool
{ {
Q_OBJECT Q_OBJECT
@ -319,7 +319,7 @@ private:
/// Tool that creates redaction annotation from rectangle. Rectangle is not /// Tool that creates redaction annotation from rectangle. Rectangle is not
/// selected from the text, it is just any rectangle. /// selected from the text, it is just any rectangle.
class PDF4QTLIBSHARED_EXPORT PDFCreateRedactRectangleTool : public PDFCreateAnnotationTool class PDF4QTLIBCORESHARED_EXPORT PDFCreateRedactRectangleTool : public PDFCreateAnnotationTool
{ {
Q_OBJECT Q_OBJECT
@ -337,7 +337,7 @@ private:
}; };
/// Tool for redaction of text in document. Creates redaction annotation from text selection. /// Tool for redaction of text in document. Creates redaction annotation from text selection.
class PDF4QTLIBSHARED_EXPORT PDFCreateRedactTextTool : public PDFWidgetTool class PDF4QTLIBCORESHARED_EXPORT PDFCreateRedactTextTool : public PDFWidgetTool
{ {
Q_OBJECT Q_OBJECT

View File

@ -33,7 +33,7 @@ class PDFCertificateManagerDialog;
namespace pdf namespace pdf
{ {
class PDF4QTLIBSHARED_EXPORT PDFCertificateManagerDialog : public QDialog class PDF4QTLIBCORESHARED_EXPORT PDFCertificateManagerDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT

View File

@ -30,7 +30,7 @@ class PDFCreateCertificateDialog;
namespace pdf namespace pdf
{ {
class PDF4QTLIBSHARED_EXPORT PDFCreateCertificateDialog : public QDialog class PDF4QTLIBCORESHARED_EXPORT PDFCreateCertificateDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT

View File

@ -54,7 +54,7 @@ public:
virtual bool doEvent(QEvent* event) = 0; virtual bool doEvent(QEvent* event) = 0;
}; };
class PDF4QTLIBSHARED_EXPORT PDFWidget : public QWidget class PDF4QTLIBCORESHARED_EXPORT PDFWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT

View File

@ -39,7 +39,7 @@ class PDFDrawWidgetProxy;
class PDFDestination; class PDFDestination;
/// Represents tree item in the GUI tree /// Represents tree item in the GUI tree
class PDF4QTLIBSHARED_EXPORT PDFTreeItem class PDF4QTLIBCORESHARED_EXPORT PDFTreeItem
{ {
public: public:
inline explicit PDFTreeItem() = default; inline explicit PDFTreeItem() = default;
@ -89,7 +89,7 @@ private:
/// Root of all tree item models. Reimplementations of this model /// Root of all tree item models. Reimplementations of this model
/// must handle "soft" document updates, such as only annotations changed etc. /// must handle "soft" document updates, such as only annotations changed etc.
/// Model should be rebuilded only, if it is neccessary. /// Model should be rebuilded only, if it is neccessary.
class PDF4QTLIBSHARED_EXPORT PDFTreeItemModel : public QAbstractItemModel class PDF4QTLIBCORESHARED_EXPORT PDFTreeItemModel : public QAbstractItemModel
{ {
public: public:
explicit PDFTreeItemModel(QObject* parent); explicit PDFTreeItemModel(QObject* parent);
@ -132,7 +132,7 @@ private:
bool m_locked; ///< Node is locked (user can't change it) bool m_locked; ///< Node is locked (user can't change it)
}; };
class PDF4QTLIBSHARED_EXPORT PDFOptionalContentTreeItemModel : public PDFTreeItemModel class PDF4QTLIBCORESHARED_EXPORT PDFOptionalContentTreeItemModel : public PDFTreeItemModel
{ {
Q_OBJECT Q_OBJECT
public: public:
@ -167,7 +167,7 @@ private:
QSharedPointer<PDFOutlineItem> m_outlineItem; QSharedPointer<PDFOutlineItem> m_outlineItem;
}; };
class PDF4QTLIBSHARED_EXPORT PDFOutlineTreeItemModel : public PDFTreeItemModel class PDF4QTLIBCORESHARED_EXPORT PDFOutlineTreeItemModel : public PDFTreeItemModel
{ {
Q_OBJECT Q_OBJECT
public: public:
@ -221,7 +221,7 @@ private:
mutable QSharedPointer<PDFOutlineItem> m_dragDropItem; mutable QSharedPointer<PDFOutlineItem> m_dragDropItem;
}; };
class PDF4QTLIBSHARED_EXPORT PDFSelectableOutlineTreeItemModel : public PDFOutlineTreeItemModel class PDF4QTLIBCORESHARED_EXPORT PDFSelectableOutlineTreeItemModel : public PDFOutlineTreeItemModel
{ {
Q_OBJECT Q_OBJECT
@ -264,7 +264,7 @@ private:
std::unique_ptr<PDFFileSpecification> m_fileSpecification; std::unique_ptr<PDFFileSpecification> m_fileSpecification;
}; };
class PDF4QTLIBSHARED_EXPORT PDFAttachmentsTreeItemModel : public PDFTreeItemModel class PDF4QTLIBCORESHARED_EXPORT PDFAttachmentsTreeItemModel : public PDFTreeItemModel
{ {
Q_OBJECT Q_OBJECT
public: public:
@ -289,7 +289,7 @@ public:
const PDFFileSpecification* getFileSpecification(const QModelIndex& index) const; const PDFFileSpecification* getFileSpecification(const QModelIndex& index) const;
}; };
class PDF4QTLIBSHARED_EXPORT PDFThumbnailsItemModel : public QAbstractItemModel class PDF4QTLIBCORESHARED_EXPORT PDFThumbnailsItemModel : public QAbstractItemModel
{ {
Q_OBJECT Q_OBJECT

View File

@ -38,7 +38,7 @@ namespace pdf
{ {
class PDFPageContentElement; class PDFPageContentElement;
class PDF4QTLIBSHARED_EXPORT PDFPageContentEditorStyleSettings : public QWidget class PDF4QTLIBCORESHARED_EXPORT PDFPageContentEditorStyleSettings : public QWidget
{ {
Q_OBJECT Q_OBJECT

View File

@ -33,7 +33,7 @@ class PDFPageContentElementRectangle;
class PDFPageContentElementFreehandCurve; class PDFPageContentElementFreehandCurve;
class PDFTextEditPseudowidget; class PDFTextEditPseudowidget;
class PDF4QTLIBSHARED_EXPORT PDFCreatePCElementTool : public PDFWidgetTool class PDF4QTLIBCORESHARED_EXPORT PDFCreatePCElementTool : public PDFWidgetTool
{ {
Q_OBJECT Q_OBJECT
public: public:
@ -58,7 +58,7 @@ protected:
}; };
/// Tool that creates rectangle element. /// Tool that creates rectangle element.
class PDF4QTLIBSHARED_EXPORT PDFCreatePCElementRectangleTool : public PDFCreatePCElementTool class PDF4QTLIBCORESHARED_EXPORT PDFCreatePCElementRectangleTool : public PDFCreatePCElementTool
{ {
Q_OBJECT Q_OBJECT
@ -91,7 +91,7 @@ private:
}; };
/// Tool that displays SVG image (or raster image) /// Tool that displays SVG image (or raster image)
class PDF4QTLIBSHARED_EXPORT PDFCreatePCElementImageTool : public PDFCreatePCElementTool class PDF4QTLIBCORESHARED_EXPORT PDFCreatePCElementImageTool : public PDFCreatePCElementTool
{ {
Q_OBJECT Q_OBJECT
@ -131,7 +131,7 @@ private:
}; };
/// Tool that creates line element. /// Tool that creates line element.
class PDF4QTLIBSHARED_EXPORT PDFCreatePCElementLineTool : public PDFCreatePCElementTool class PDF4QTLIBCORESHARED_EXPORT PDFCreatePCElementLineTool : public PDFCreatePCElementTool
{ {
Q_OBJECT Q_OBJECT
@ -167,7 +167,7 @@ private:
}; };
/// Tool that creates dot element. /// Tool that creates dot element.
class PDF4QTLIBSHARED_EXPORT PDFCreatePCElementDotTool : public PDFCreatePCElementTool class PDF4QTLIBCORESHARED_EXPORT PDFCreatePCElementDotTool : public PDFCreatePCElementTool
{ {
Q_OBJECT Q_OBJECT
@ -199,7 +199,7 @@ private:
}; };
/// Tool that creates freehand curve element. /// Tool that creates freehand curve element.
class PDF4QTLIBSHARED_EXPORT PDFCreatePCElementFreehandCurveTool : public PDFCreatePCElementTool class PDF4QTLIBCORESHARED_EXPORT PDFCreatePCElementFreehandCurveTool : public PDFCreatePCElementTool
{ {
Q_OBJECT Q_OBJECT
@ -237,7 +237,7 @@ private:
}; };
/// Tool that displays SVG image /// Tool that displays SVG image
class PDF4QTLIBSHARED_EXPORT PDFCreatePCElementTextTool : public PDFCreatePCElementTool class PDF4QTLIBCORESHARED_EXPORT PDFCreatePCElementTextTool : public PDFCreatePCElementTool
{ {
Q_OBJECT Q_OBJECT

View File

@ -38,7 +38,7 @@ class PDFPageContentScene;
class PDFPageContentElement; class PDFPageContentElement;
class PDFPageContentEditorStyleSettings; class PDFPageContentEditorStyleSettings;
class PDF4QTLIBSHARED_EXPORT PDFPageContentEditorWidget : public QDockWidget class PDF4QTLIBCORESHARED_EXPORT PDFPageContentEditorWidget : public QDockWidget
{ {
Q_OBJECT Q_OBJECT

View File

@ -36,7 +36,7 @@ class PDFWidget;
class PDFDocument; class PDFDocument;
class PDFPageContentScene; class PDFPageContentScene;
class PDF4QTLIBSHARED_EXPORT PDFPageContentElement class PDF4QTLIBCORESHARED_EXPORT PDFPageContentElement
{ {
public: public:
explicit PDFPageContentElement() = default; explicit PDFPageContentElement() = default;
@ -117,7 +117,7 @@ protected:
PDFInteger m_pageIndex = -1; PDFInteger m_pageIndex = -1;
}; };
class PDF4QTLIBSHARED_EXPORT PDFPageContentStyledElement : public PDFPageContentElement class PDF4QTLIBCORESHARED_EXPORT PDFPageContentStyledElement : public PDFPageContentElement
{ {
public: public:
explicit PDFPageContentStyledElement() = default; explicit PDFPageContentStyledElement() = default;
@ -134,7 +134,7 @@ protected:
QBrush m_brush; QBrush m_brush;
}; };
class PDF4QTLIBSHARED_EXPORT PDFPageContentElementRectangle : public PDFPageContentStyledElement class PDF4QTLIBCORESHARED_EXPORT PDFPageContentElementRectangle : public PDFPageContentStyledElement
{ {
public: public:
virtual ~PDFPageContentElementRectangle() = default; virtual ~PDFPageContentElementRectangle() = default;
@ -167,7 +167,7 @@ private:
QRectF m_rectangle; QRectF m_rectangle;
}; };
class PDF4QTLIBSHARED_EXPORT PDFPageContentElementLine : public PDFPageContentStyledElement class PDF4QTLIBCORESHARED_EXPORT PDFPageContentElementLine : public PDFPageContentStyledElement
{ {
public: public:
virtual ~PDFPageContentElementLine() = default; virtual ~PDFPageContentElementLine() = default;
@ -207,7 +207,7 @@ private:
QLineF m_line; QLineF m_line;
}; };
class PDF4QTLIBSHARED_EXPORT PDFPageContentElementDot : public PDFPageContentStyledElement class PDF4QTLIBCORESHARED_EXPORT PDFPageContentElementDot : public PDFPageContentStyledElement
{ {
public: public:
virtual ~PDFPageContentElementDot() = default; virtual ~PDFPageContentElementDot() = default;
@ -236,7 +236,7 @@ private:
QPointF m_point; QPointF m_point;
}; };
class PDF4QTLIBSHARED_EXPORT PDFPageContentElementFreehandCurve : public PDFPageContentStyledElement class PDF4QTLIBCORESHARED_EXPORT PDFPageContentElementFreehandCurve : public PDFPageContentStyledElement
{ {
public: public:
virtual ~PDFPageContentElementFreehandCurve() = default; virtual ~PDFPageContentElementFreehandCurve() = default;
@ -270,7 +270,7 @@ private:
QPainterPath m_curve; QPainterPath m_curve;
}; };
class PDF4QTLIBSHARED_EXPORT PDFPageContentImageElement : public PDFPageContentElement class PDF4QTLIBCORESHARED_EXPORT PDFPageContentImageElement : public PDFPageContentElement
{ {
public: public:
PDFPageContentImageElement(); PDFPageContentImageElement();
@ -306,7 +306,7 @@ private:
std::unique_ptr<QSvgRenderer> m_renderer; std::unique_ptr<QSvgRenderer> m_renderer;
}; };
class PDF4QTLIBSHARED_EXPORT PDFPageContentElementTextBox : public PDFPageContentStyledElement class PDF4QTLIBCORESHARED_EXPORT PDFPageContentElementTextBox : public PDFPageContentStyledElement
{ {
public: public:
virtual ~PDFPageContentElementTextBox() = default; virtual ~PDFPageContentElementTextBox() = default;
@ -351,7 +351,7 @@ private:
Qt::Alignment m_alignment = Qt::AlignCenter; Qt::Alignment m_alignment = Qt::AlignCenter;
}; };
class PDF4QTLIBSHARED_EXPORT PDFPageContentElementManipulator : public QObject class PDF4QTLIBCORESHARED_EXPORT PDFPageContentElementManipulator : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -463,7 +463,7 @@ private:
QPointF m_lastUpdatedPoint; QPointF m_lastUpdatedPoint;
}; };
class PDF4QTLIBSHARED_EXPORT PDFPageContentScene : public QObject, class PDF4QTLIBCORESHARED_EXPORT PDFPageContentScene : public QObject,
public IDocumentDrawInterface, public IDocumentDrawInterface,
public IDrawWidgetInputInterface public IDrawWidgetInputInterface
{ {

View File

@ -31,7 +31,7 @@ namespace pdf
{ {
class PDFWidget; class PDFWidget;
class PDF4QTLIBSHARED_EXPORT PDFRenderingErrorsWidget : public QDialog class PDF4QTLIBWIDGETSSHARED_EXPORT PDFRenderingErrorsWidget : public QDialog
{ {
Q_OBJECT Q_OBJECT

View File

@ -30,7 +30,7 @@ class PDFSelectPagesDialog;
namespace pdf namespace pdf
{ {
class PDF4QTLIBSHARED_EXPORT PDFSelectPagesDialog : public QDialog class PDF4QTLIBWIDGETSSHARED_EXPORT PDFSelectPagesDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT

View File

@ -0,0 +1,513 @@
// Copyright (C) 2023 Jakub Melka
//
// This file is part of PDF4QT.
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
#include "pdfdrawwidget.h"
#include "pdfwidgetutils.h"
#include <QMenu>
#include <QDialog>
#include <QApplication>
#include <QMouseEvent>
#include <QGroupBox>
#include <QScrollArea>
#include <QTextEdit>
#include <QVBoxLayout>
#include <QLabel>
#include <QStyleOptionButton>
namespace pdf
{
PDFWidgetAnnotationManager::PDFWidgetAnnotationManager(PDFDrawWidgetProxy* proxy, QObject* parent) :
BaseClass(proxy->getFontCache(), proxy->getCMSManager(), proxy->getOptionalContentActivity(), proxy->getMeshQualitySettings(), proxy->getFeatures(), Target::View, parent),
m_proxy(proxy)
{
Q_ASSERT(proxy);
m_proxy->registerDrawInterface(this);
}
PDFWidgetAnnotationManager::~PDFWidgetAnnotationManager()
{
m_proxy->unregisterDrawInterface(this);
}
void PDFWidgetAnnotationManager::setDocument(const PDFModifiedDocument& document)
{
BaseClass::setDocument(document);
if (document.hasReset() || document.getFlags().testFlag(PDFModifiedDocument::Annotation))
{
m_editableAnnotation = PDFObjectReference();
m_editableAnnotationPage = PDFObjectReference();
}
}
void PDFWidgetAnnotationManager::shortcutOverrideEvent(QWidget* widget, QKeyEvent* event)
{
Q_UNUSED(widget);
Q_UNUSED(event);
}
void PDFWidgetAnnotationManager::keyPressEvent(QWidget* widget, QKeyEvent* event)
{
Q_UNUSED(widget);
Q_UNUSED(event);
}
void PDFWidgetAnnotationManager::keyReleaseEvent(QWidget* widget, QKeyEvent* event)
{
Q_UNUSED(widget);
Q_UNUSED(event);
}
void PDFWidgetAnnotationManager::mousePressEvent(QWidget* widget, QMouseEvent* event)
{
Q_UNUSED(widget);
updateFromMouseEvent(event);
// Show context menu?
if (event->button() == Qt::RightButton)
{
PDFWidget* pdfWidget = m_proxy->getWidget();
std::vector<PDFInteger> currentPages = pdfWidget->getDrawWidget()->getCurrentPages();
if (!hasAnyPageAnnotation(currentPages))
{
// All pages doesn't have annotation
return;
}
m_editableAnnotation = PDFObjectReference();
m_editableAnnotationPage = PDFObjectReference();
for (PDFInteger pageIndex : currentPages)
{
PageAnnotations& pageAnnotations = getPageAnnotations(pageIndex);
for (PageAnnotation& pageAnnotation : pageAnnotations.annotations)
{
if (!pageAnnotation.isHovered)
{
continue;
}
if (!PDFAnnotation::isTypeEditable(pageAnnotation.annotation->getType()))
{
continue;
}
m_editableAnnotation = pageAnnotation.annotation->getSelfReference();
m_editableAnnotationPage = pageAnnotation.annotation->getPageReference();
if (!m_editableAnnotationPage.isValid())
{
m_editableAnnotationPage = m_document->getCatalog()->getPage(pageIndex)->getPageReference();
}
break;
}
}
if (m_editableAnnotation.isValid())
{
QMenu menu(tr("Annotation"), pdfWidget);
QAction* showPopupAction = menu.addAction(tr("Show Popup Window"));
QAction* copyAction = menu.addAction(tr("Copy to Multiple Pages"));
QAction* editAction = menu.addAction(tr("Edit"));
QAction* deleteAction = menu.addAction(tr("Delete"));
connect(showPopupAction, &QAction::triggered, this, &PDFWidgetAnnotationManager::onShowPopupAnnotation);
connect(copyAction, &QAction::triggered, this, &PDFWidgetAnnotationManager::onCopyAnnotation);
connect(editAction, &QAction::triggered, this, &PDFWidgetAnnotationManager::onEditAnnotation);
connect(deleteAction, &QAction::triggered, this, &PDFWidgetAnnotationManager::onDeleteAnnotation);
m_editableAnnotationGlobalPosition = pdfWidget->mapToGlobal(event->pos());
menu.exec(m_editableAnnotationGlobalPosition);
}
}
}
void PDFWidgetAnnotationManager::mouseDoubleClickEvent(QWidget* widget, QMouseEvent* event)
{
Q_UNUSED(widget);
Q_UNUSED(event);
}
void PDFWidgetAnnotationManager::mouseReleaseEvent(QWidget* widget, QMouseEvent* event)
{
Q_UNUSED(widget);
updateFromMouseEvent(event);
}
void PDFWidgetAnnotationManager::mouseMoveEvent(QWidget* widget, QMouseEvent* event)
{
Q_UNUSED(widget);
updateFromMouseEvent(event);
}
void PDFWidgetAnnotationManager::wheelEvent(QWidget* widget, QWheelEvent* event)
{
Q_UNUSED(widget);
Q_UNUSED(event);
}
void PDFWidgetAnnotationManager::updateFromMouseEvent(QMouseEvent* event)
{
PDFWidget* widget = m_proxy->getWidget();
std::vector<PDFInteger> currentPages = widget->getDrawWidget()->getCurrentPages();
if (!hasAnyPageAnnotation(currentPages))
{
// All pages doesn't have annotation
return;
}
m_tooltip = QString();
m_cursor = std::nullopt;
bool appearanceChanged = false;
// We must update appearance states, and update tooltip
PDFWidgetSnapshot snapshot = m_proxy->getSnapshot();
const bool isDown = event->buttons().testFlag(Qt::LeftButton);
const PDFAppeareanceStreams::Appearance hoverAppearance = isDown ? PDFAppeareanceStreams::Appearance::Down : PDFAppeareanceStreams::Appearance::Rollover;
for (const PDFWidgetSnapshot::SnapshotItem& snapshotItem : snapshot.items)
{
PageAnnotations& pageAnnotations = getPageAnnotations(snapshotItem.pageIndex);
for (PageAnnotation& pageAnnotation : pageAnnotations.annotations)
{
if (pageAnnotation.annotation->isReplyTo())
{
// Annotation is reply to another annotation, do not interact with it
continue;
}
const PDFAppeareanceStreams::Appearance oldAppearance = pageAnnotation.appearance;
QRectF annotationRect = pageAnnotation.annotation->getRectangle();
QTransform matrix = prepareTransformations(snapshotItem.pageToDeviceMatrix, widget, pageAnnotation.annotation->getEffectiveFlags(), m_document->getCatalog()->getPage(snapshotItem.pageIndex), annotationRect);
QPainterPath path;
path.addRect(annotationRect);
path = matrix.map(path);
if (path.contains(event->pos()))
{
pageAnnotation.appearance = hoverAppearance;
pageAnnotation.isHovered = true;
// Generate tooltip
if (m_tooltip.isEmpty())
{
const PDFMarkupAnnotation* markupAnnotation = pageAnnotation.annotation->asMarkupAnnotation();
if (markupAnnotation)
{
QString title = markupAnnotation->getWindowTitle();
if (title.isEmpty())
{
title = markupAnnotation->getSubject();
}
if (title.isEmpty())
{
title = PDFTranslationContext::tr("Info");
}
const size_t repliesCount = pageAnnotations.getReplies(pageAnnotation).size();
if (repliesCount > 0)
{
title = PDFTranslationContext::tr("%1 (%2 replies)").arg(title).arg(repliesCount);
}
m_tooltip = QString("<p><b>%1</b></p><p>%2</p>").arg(title, markupAnnotation->getContents());
}
}
const PDFAction* linkAction = nullptr;
const AnnotationType annotationType = pageAnnotation.annotation->getType();
if (annotationType == AnnotationType::Link)
{
const PDFLinkAnnotation* linkAnnotation = dynamic_cast<const PDFLinkAnnotation*>(pageAnnotation.annotation.data());
Q_ASSERT(linkAnnotation);
// We must check, if user clicked to the link area
QPainterPath activationPath = linkAnnotation->getActivationRegion().getPath();
activationPath = snapshotItem.pageToDeviceMatrix.map(activationPath);
if (activationPath.contains(event->pos()) && linkAnnotation->getAction())
{
m_cursor = QCursor(Qt::PointingHandCursor);
linkAction = linkAnnotation->getAction();
}
}
if (annotationType == AnnotationType::Widget)
{
if (m_formManager && m_formManager->hasFormFieldWidgetText(pageAnnotation.annotation->getSelfReference()))
{
m_cursor = QCursor(Qt::IBeamCursor);
}
else
{
m_cursor = QCursor(Qt::ArrowCursor);
}
}
// Generate popup window
if (event->type() == QEvent::MouseButtonPress && event->button() == Qt::LeftButton)
{
const PDFMarkupAnnotation* markupAnnotation = pageAnnotation.annotation->asMarkupAnnotation();
if (markupAnnotation)
{
QDialog* dialog = createDialogForMarkupAnnotations(widget, pageAnnotation, pageAnnotations);
// Set proper dialog position - according to the popup annotation. If we
// do not have popup annotation, then try to use annotations rectangle.
if (const PageAnnotation* popupAnnotation = pageAnnotations.getPopupAnnotation(pageAnnotation))
{
QPoint popupPoint = snapshotItem.pageToDeviceMatrix.map(popupAnnotation->annotation->getRectangle().bottomLeft()).toPoint();
popupPoint = widget->mapToGlobal(popupPoint);
dialog->move(popupPoint);
}
else if (markupAnnotation->getRectangle().isValid())
{
QPoint popupPoint = snapshotItem.pageToDeviceMatrix.map(markupAnnotation->getRectangle().bottomRight()).toPoint();
popupPoint = widget->mapToGlobal(popupPoint);
dialog->move(popupPoint);
}
dialog->exec();
}
if (linkAction)
{
Q_EMIT actionTriggered(linkAction);
}
}
}
else
{
pageAnnotation.appearance = PDFAppeareanceStreams::Appearance::Normal;
pageAnnotation.isHovered = false;
}
const bool currentAppearanceChanged = oldAppearance != pageAnnotation.appearance;
if (currentAppearanceChanged)
{
// We have changed appearance - we must mark stream as dirty
pageAnnotation.appearanceStream.dirty();
appearanceChanged = true;
}
}
}
// If appearance has changed, then we must redraw the page
if (appearanceChanged)
{
Q_EMIT widget->getDrawWidgetProxy()->repaintNeeded();
}
}
void PDFWidgetAnnotationManager::onShowPopupAnnotation()
{
PDFWidgetSnapshot snapshot = m_proxy->getSnapshot();
for (const PDFWidgetSnapshot::SnapshotItem& snapshotItem : snapshot.items)
{
PageAnnotations& pageAnnotations = getPageAnnotations(snapshotItem.pageIndex);
for (PageAnnotation& pageAnnotation : pageAnnotations.annotations)
{
if (pageAnnotation.annotation->isReplyTo())
{
// Annotation is reply to another annotation, do not interact with it
continue;
}
if (pageAnnotation.annotation->getSelfReference() == m_editableAnnotation)
{
QDialog* dialog = createDialogForMarkupAnnotations(m_proxy->getWidget(), pageAnnotation, pageAnnotations);
dialog->move(m_editableAnnotationGlobalPosition);
dialog->exec();
return;
}
}
}
}
void PDFWidgetAnnotationManager::onCopyAnnotation()
{
pdf::PDFSelectPagesDialog dialog(tr("Copy Annotation"), tr("Copy Annotation onto Multiple Pages"),
m_document->getCatalog()->getPageCount(), m_proxy->getWidget()->getDrawWidget()->getCurrentPages(), m_proxy->getWidget());
if (dialog.exec() == QDialog::Accepted)
{
std::vector<PDFInteger> pages = dialog.getSelectedPages();
const PDFInteger currentPageIndex = m_document->getCatalog()->getPageIndexFromPageReference(m_editableAnnotationPage);
for (PDFInteger& pageIndex : pages)
{
--pageIndex;
}
auto it = std::find(pages.begin(), pages.end(), currentPageIndex);
if (it != pages.end())
{
pages.erase(it);
}
if (pages.empty())
{
return;
}
PDFDocumentModifier modifier(m_document);
modifier.markAnnotationsChanged();
for (const PDFInteger pageIndex : pages)
{
modifier.getBuilder()->copyAnnotation(m_document->getCatalog()->getPage(pageIndex)->getPageReference(), m_editableAnnotation);
}
if (modifier.finalize())
{
Q_EMIT documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
}
}
void PDFWidgetAnnotationManager::onEditAnnotation()
{
PDFEditObjectDialog dialog(EditObjectType::Annotation, m_proxy->getWidget());
PDFObject originalObject = m_document->getObjectByReference(m_editableAnnotation);
dialog.setObject(originalObject);
if (dialog.exec() == PDFEditObjectDialog::Accepted)
{
PDFObject object = dialog.getObject();
if (object != originalObject)
{
PDFDocumentModifier modifier(m_document);
modifier.markAnnotationsChanged();
modifier.getBuilder()->setObject(m_editableAnnotation, object);
modifier.getBuilder()->updateAnnotationAppearanceStreams(m_editableAnnotation);
if (modifier.finalize())
{
Q_EMIT documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
}
}
}
void PDFWidgetAnnotationManager::onDeleteAnnotation()
{
if (m_editableAnnotation.isValid())
{
PDFDocumentModifier modifier(m_document);
modifier.markAnnotationsChanged();
modifier.getBuilder()->removeAnnotation(m_editableAnnotationPage, m_editableAnnotation);
if (modifier.finalize())
{
Q_EMIT documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
}
}
QDialog* PDFWidgetAnnotationManager::createDialogForMarkupAnnotations(PDFWidget* widget,
const PageAnnotation& pageAnnotation,
const PageAnnotations& pageAnnotations)
{
QDialog* dialog = new QDialog(widget->getDrawWidget()->getWidget(), Qt::Popup);
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
createWidgetsForMarkupAnnotations(dialog, pageAnnotation, pageAnnotations);
return dialog;
}
void PDFWidgetAnnotationManager::createWidgetsForMarkupAnnotations(QWidget* parentWidget,
const PageAnnotation& pageAnnotation,
const PageAnnotations& pageAnnotations)
{
std::vector<const PageAnnotation*> replies = pageAnnotations.getReplies(pageAnnotation);
replies.insert(replies.begin(), &pageAnnotation);
QScrollArea* scrollArea = new QScrollArea(parentWidget);
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
QVBoxLayout* layout = new QVBoxLayout(parentWidget);
layout->addWidget(scrollArea);
layout->setContentsMargins(QMargins());
QWidget* frameWidget = new QWidget(scrollArea);
QVBoxLayout* frameLayout = new QVBoxLayout(frameWidget);
frameLayout->setSpacing(0);
scrollArea->setWidget(frameWidget);
const PDFMarkupAnnotation* markupMainAnnotation = pageAnnotation.annotation->asMarkupAnnotation();
QColor color = markupMainAnnotation->getDrawColorFromAnnotationColor(markupMainAnnotation->getColor(), 1.0);
QColor titleColor = QColor::fromHslF(color.hueF(), color.saturationF(), 0.2f, 1.0f);
QColor backgroundColor = QColor::fromHslF(color.hueF(), color.saturationF(), 0.9f, 1.0f);
QString style = "QGroupBox { "
"border: 2px solid black; "
"border-color: rgb(%4, %5, %6); "
"margin-top: 3ex; "
"background-color: rgb(%1, %2, %3); "
"}"
"QGroupBox::title { "
"subcontrol-origin: margin; "
"subcontrol-position: top center; "
"padding: 0px 8192px; "
"background-color: rgb(%4, %5, %6); "
"color: #FFFFFF;"
"}";
style = style.arg(backgroundColor.red()).arg(backgroundColor.green()).arg(backgroundColor.blue()).arg(titleColor.red()).arg(titleColor.green()).arg(titleColor.blue());
for (const PageAnnotation* annotation : replies)
{
const PDFMarkupAnnotation* markupAnnotation = annotation->annotation->asMarkupAnnotation();
if (!markupAnnotation)
{
// This should not happen...
continue;
}
QGroupBox* groupBox = new QGroupBox(scrollArea);
frameLayout->addWidget(groupBox);
QString title = markupAnnotation->getWindowTitle();
if (title.isEmpty())
{
title = markupAnnotation->getSubject();
}
QString dateTimeString = QLocale::system().toString(markupAnnotation->getCreationDate().toLocalTime(), QLocale::LongFormat);
title = QString("%1 (%2)").arg(title, dateTimeString).trimmed();
groupBox->setStyleSheet(style);
groupBox->setTitle(title);
QVBoxLayout* groupBoxLayout = new QVBoxLayout(groupBox);
QLabel* label = new QLabel(groupBox);
label->setTextInteractionFlags(Qt::TextBrowserInteraction);
label->setWordWrap(true);
label->setText(markupAnnotation->getContents());
label->setFixedWidth(PDFWidgetUtils::scaleDPI_x(label, 250));
label->setMinimumHeight(label->sizeHint().height());
groupBoxLayout->addWidget(label);
}
frameWidget->setFixedSize(frameWidget->minimumSizeHint());
parentWidget->setFixedSize(scrollArea->sizeHint());
}
} // namespace pdf

View File

@ -0,0 +1,95 @@
// Copyright (C) 2023 Jakub Melka
//
// This file is part of PDF4QT.
//
// PDF4QT is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
//
// PDF4QT is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
#include "pdfannotation.h"
namespace pdf
{
class PDFDrawWidgetProxy;
/// Annotation manager for GUI rendering, it also manages annotations widgets
/// for parent widget.
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFWidgetAnnotationManager : public PDFAnnotationManager, public IDrawWidgetInputInterface
{
Q_OBJECT
private:
using BaseClass = PDFAnnotationManager;
public:
explicit PDFWidgetAnnotationManager(PDFDrawWidgetProxy* proxy, QObject* parent);
virtual ~PDFWidgetAnnotationManager() override;
virtual void setDocument(const PDFModifiedDocument& document) override;
virtual void shortcutOverrideEvent(QWidget* widget, QKeyEvent* event) override;
virtual void keyPressEvent(QWidget* widget, QKeyEvent* event) override;
virtual void keyReleaseEvent(QWidget* widget, QKeyEvent* event) override;
virtual void mousePressEvent(QWidget* widget, QMouseEvent* event) override;
virtual void mouseDoubleClickEvent(QWidget* widget, QMouseEvent* event) override;
virtual void mouseReleaseEvent(QWidget* widget, QMouseEvent* event) override;
virtual void mouseMoveEvent(QWidget* widget, QMouseEvent* event) override;
virtual void wheelEvent(QWidget* widget, QWheelEvent* event) override;
/// Returns tooltip generated from annotation
virtual QString getTooltip() const override { return m_tooltip; }
/// Returns current cursor
virtual const std::optional<QCursor>& getCursor() const override { return m_cursor; }
virtual int getInputPriority() const override { return AnnotationPriority; }
signals:
void actionTriggered(const PDFAction* action);
void documentModified(PDFModifiedDocument document);
private:
void updateFromMouseEvent(QMouseEvent* event);
void onShowPopupAnnotation();
void onCopyAnnotation();
void onEditAnnotation();
void onDeleteAnnotation();
/// Creates dialog for markup annotations. This function is used only for markup annotations,
/// do not use them for other annotations (function can crash).
/// \param widget Dialog's parent widget
/// \param pageAnnotation Markup annotation
/// \param pageAnnotations Page annotations
QDialog* createDialogForMarkupAnnotations(PDFWidget* widget,
const PageAnnotation& pageAnnotation,
const PageAnnotations& pageAnnotations);
/// Creates widgets for markup annotation main popup widget. Also sets
/// default size of parent widget.
/// \param parentWidget Parent widget, where widgets are created
/// \param pageAnnotation Markup annotation
/// \param pageAnnotations Page annotations
void createWidgetsForMarkupAnnotations(QWidget* parentWidget,
const PageAnnotation& pageAnnotation,
const PageAnnotations& pageAnnotations);
PDFDrawWidgetProxy* m_proxy;
QString m_tooltip;
std::optional<QCursor> m_cursor;
QPoint m_editableAnnotationGlobalPosition; ///< Position, where action on annotation was executed
PDFObjectReference m_editableAnnotation; ///< Annotation to be edited or deleted
PDFObjectReference m_editableAnnotationPage; ///< Page of annotation above
};
} // namespace pdf

View File

@ -34,7 +34,7 @@ namespace pdf
/// Base class for various widget tools (for example, searching, text selection, /// Base class for various widget tools (for example, searching, text selection,
/// screenshots, zoom tool etc.). Each tool can have subtools (for example, /// screenshots, zoom tool etc.). Each tool can have subtools (for example,
/// screenshot tool is picking screenshot rectangle). /// screenshot tool is picking screenshot rectangle).
class PDF4QTLIBSHARED_EXPORT PDFWidgetTool : public QObject, public IDocumentDrawInterface class PDF4QTLIBWIDGETSSHARED_EXPORT PDFWidgetTool : public QObject, public IDocumentDrawInterface
{ {
Q_OBJECT Q_OBJECT
@ -273,7 +273,7 @@ private:
}; };
/// Tool to magnify specific area in the drawing widget /// Tool to magnify specific area in the drawing widget
class PDF4QTLIBSHARED_EXPORT PDFMagnifierTool : public PDFWidgetTool class PDF4QTLIBWIDGETSSHARED_EXPORT PDFMagnifierTool : public PDFWidgetTool
{ {
Q_OBJECT Q_OBJECT
@ -308,7 +308,7 @@ private:
}; };
/// Tools for picking various items on page - points, rectangles, images etc. /// Tools for picking various items on page - points, rectangles, images etc.
class PDF4QTLIBSHARED_EXPORT PDFPickTool : public PDFWidgetTool class PDF4QTLIBWIDGETSSHARED_EXPORT PDFPickTool : public PDFWidgetTool
{ {
Q_OBJECT Q_OBJECT
@ -433,7 +433,7 @@ private:
/// Tool that makes screenshot of page area and copies it to the clipboard, /// Tool that makes screenshot of page area and copies it to the clipboard,
/// using current client area to determine image size. /// using current client area to determine image size.
class PDF4QTLIBSHARED_EXPORT PDFScreenshotTool : public PDFWidgetTool class PDF4QTLIBWIDGETSSHARED_EXPORT PDFScreenshotTool : public PDFWidgetTool
{ {
Q_OBJECT Q_OBJECT
@ -455,7 +455,7 @@ private:
/// Tool that extracts image from page and copies it to the clipboard, /// Tool that extracts image from page and copies it to the clipboard,
/// using image original size (not zoomed size from widget area) /// using image original size (not zoomed size from widget area)
class PDF4QTLIBSHARED_EXPORT PDFExtractImageTool : public PDFWidgetTool class PDF4QTLIBWIDGETSSHARED_EXPORT PDFExtractImageTool : public PDFWidgetTool
{ {
Q_OBJECT Q_OBJECT
@ -481,7 +481,7 @@ private:
/// Manager used for managing tools, their activity, availability /// Manager used for managing tools, their activity, availability
/// and other settings. It also defines a predefined set of tools, /// and other settings. It also defines a predefined set of tools,
/// available for various purposes (text searching, magnifier tool etc.) /// available for various purposes (text searching, magnifier tool etc.)
class PDF4QTLIBSHARED_EXPORT PDFToolManager : public QObject, public IDrawWidgetInputInterface class PDF4QTLIBWIDGETSSHARED_EXPORT PDFToolManager : public QObject, public IDrawWidgetInputInterface
{ {
Q_OBJECT Q_OBJECT

View File

@ -26,7 +26,7 @@
namespace pdf namespace pdf
{ {
class PDF4QTLIBSHARED_EXPORT PDFWidgetUtils class PDF4QTLIBWIDGETSSHARED_EXPORT PDFWidgetUtils
{ {
public: public:
PDFWidgetUtils() = delete; PDFWidgetUtils() = delete;