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/pdfform.cpp
sources/pdficontheme.cpp
sources/pdfitemmodels.cpp
sources/pdfjavascriptscanner.cpp
sources/pdfjbig2decoder.cpp
sources/pdfmultimedia.cpp
@@ -44,7 +43,6 @@ add_library(Pdf4QtLibCore SHARED
sources/pdfoptimizer.cpp
sources/pdfoptionalcontent.cpp
sources/pdfoutline.cpp
sources/pdfpagecontentelements.cpp
sources/pdfpagenavigation.cpp
sources/pdfpagetransition.cpp
sources/pdfpainterutils.cpp
@@ -92,7 +90,7 @@ include(GenerateExportHeader)
GENERATE_EXPORT_HEADER(Pdf4QtLibCore
EXPORT_MACRO_NAME
PDF4QTLIBSHARED_EXPORT
PDF4QTLIBCORESHARED_EXPORT
EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/pdf4qtlibcore_export.h")
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 JPEG::JPEG)
if(PDF4QT_ENABLE_OPENGL)
target_link_libraries(Pdf4QtLibCore PRIVATE Qt6::OpenGL)
endif()
if(LINUX_GCC)
target_link_libraries(Pdf4QtLibCore PUBLIC TBB::tbb)
endif()

View File

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

View File

@@ -21,27 +21,14 @@
#include "pdfpainter.h"
#include "pdfdrawspacecontroller.h"
#include "pdfcms.h"
#include "pdfwidgetutils.h"
#include "pdfpagecontentprocessor.h"
#include "pdfparser.h"
#include "pdfdrawwidget.h"
#include "pdfform.h"
#include "pdfpainterutils.h"
#include "pdfdocumentbuilder.h"
#include "pdfobjecteditorwidget.h"
#include "pdfselectpagesdialog.h"
#include "pdfdbgheap.h"
#include <QMenu>
#include <QDialog>
#include <QApplication>
#include <QMouseEvent>
#include <QGroupBox>
#include <QScrollArea>
#include <QTextEdit>
#include <QVBoxLayout>
#include <QLabel>
#include <QStyleOptionButton>
#include <QIcon>
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,
// if we, for example are using 4K, or 8K monitors.
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);
unzoomedRect.translate(0, -unzoomedRect.height());
@@ -1709,483 +1696,6 @@ void PDFAnnotationManager::setTarget(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
{
@@ -2326,7 +1836,7 @@ void PDFTextAnnotation::draw(AnnotationDrawParameters& parameters) const
// Draw the ellipse
painter.drawEllipse(ellipseRectangle);
QFont font = QApplication::font();
QFont font = painter.font();
font.setPixelSize(16.0);
QString text = getTextForIcon(m_iconName);
@@ -2363,7 +1873,7 @@ QIcon PDFTextAnnotation::createIcon(QString key, QSize size)
QString text = getTextForIcon(key);
QFont font = QApplication::font();
QFont font = painter.font();
font.setPixelSize(size.height() * 0.75);
QPainterPath textPath;
@@ -2772,7 +2282,7 @@ void PDFAnnotation::drawLine(const PDFAnnotation::LineGeometryInfo& info,
if (drawText)
{
QFont font = QApplication::font();
QFont font = painter.font();
font.setPixelSize(12.0);
QFontMetricsF fontMetrics(font, painter.device());
@@ -3457,7 +2967,7 @@ void PDFAnnotation::drawCharacterSymbol(QString text, PDFReal opacity, Annotatio
QRectF rectangle = getRectangle();
rectangle.setSize(QSizeF(rectSize, rectSize));
QFont font = QApplication::font();
QFont font = painter.font();
font.setPixelSize(16.0);
QPainterPath textPath;
@@ -3643,26 +3153,12 @@ void PDFWidgetAnnotation::draw(AnnotationDrawParameters& parameters) const
painter->scale(1.0, -1.0);
painter->setFont(font);
QStyleOptionButton option;
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)
{
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);
// Draw border
QRectF drawRect(0, 0, rectangle.width(), rectangle.height());
painter->setPen(getPen());
painter->setBrush(QBrush(Qt::lightGray));
painter->drawRect(drawRect);
painter->drawText(drawRect, Qt::AlignCenter, getContents());
}
else
{
@@ -3714,42 +3210,52 @@ void PDFWidgetAnnotation::draw(AnnotationDrawParameters& parameters) const
}
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:
{
QRectF rectangle = getRectangle();
QPainter* painter = parameters.painter;
painter->translate(rectangle.bottomLeft());
painter->scale(1.0, -1.0);
QStyleOptionButton option;
option.state = QStyle::State_Enabled;
option.rect = QRect(0, 0, qFloor(rectangle.width()), qFloor(rectangle.height()));
option.palette = QApplication::palette();
rectangle.setWidth(rectangle.height());
if (parameters.key.first == PDFAppeareanceStreams::Appearance::Rollover)
{
option.state |= QStyle::State_MouseOver;
}
if (parameters.key.first == PDFAppeareanceStreams::Appearance::Down)
{
option.state |= QStyle::State_Sunken;
}
painter->setPen(Qt::black);
painter->setBrush(Qt::NoBrush);
painter->drawRect(rectangle);
if (parameters.key.second != "Off")
{
option.state |= QStyle::State_On;
}
else
{
option.state |= QStyle::State_Off;
}
QRectF rectangleMark = rectangle;
rectangleMark.setWidth(rectangle.width() * 0.75);
rectangleMark.setHeight(rectangle.height() * 0.75);
rectangleMark.moveCenter(rectangle.center());
option.features = QStyleOptionButton::None;
option.text = QString();
QStyle::PrimitiveElement element = (button->getButtonType() == PDFFormFieldButton::ButtonType::CheckBox) ? QStyle::PE_IndicatorCheckBox : QStyle::PE_IndicatorRadioButton;
QApplication::style()->drawPrimitive(element, &option, painter, nullptr);
painter->drawLine(rectangleMark.topLeft(), rectangleMark.bottomRight());
painter->drawLine(rectangleMark.bottomLeft(), rectangleMark.topRight());
}
break;
}

View File

@@ -44,7 +44,6 @@ namespace pdf
{
class PDFWidget;
class PDFObjectStorage;
class PDFDrawWidgetProxy;
class PDFFontCache;
class PDFFormManager;
class PDFModifiedDocument;
@@ -783,7 +782,7 @@ enum class TextAnnotationIcon
/// 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
/// is implementation dependent by viewer application.
class PDF4QTLIBSHARED_EXPORT PDFTextAnnotation : public PDFMarkupAnnotation
class PDF4QTLIBCORESHARED_EXPORT PDFTextAnnotation : public PDFMarkupAnnotation
{
public:
inline explicit PDFTextAnnotation() = default;
@@ -1104,7 +1103,7 @@ enum class StampIntent
/// Annotation for stamps. Displays text or graphics intended to look
/// as if they were stamped on the paper.
class PDF4QTLIBSHARED_EXPORT PDFStampAnnotation : public PDFMarkupAnnotation
class PDF4QTLIBCORESHARED_EXPORT PDFStampAnnotation : public PDFMarkupAnnotation
{
public:
inline explicit PDFStampAnnotation() = default;
@@ -1433,7 +1432,7 @@ private:
/// this object builds annotation's appearance streams, if necessary. This
/// manager is intended to non-gui rendering. If widget annotation manager is used,
/// 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
@@ -1623,76 +1622,6 @@ protected:
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
#endif // PDFANNOTATION_H

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -38,7 +38,7 @@ namespace pdf
struct PDFDiffPageContext;
class PDF4QTLIBSHARED_EXPORT PDFDiffResult
class PDF4QTLIBCORESHARED_EXPORT PDFDiffResult
{
public:
explicit PDFDiffResult();
@@ -236,7 +236,7 @@ private:
};
/// 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
@@ -283,7 +283,7 @@ private:
};
/// Diff engine for comparing two pdf documents.
class PDF4QTLIBSHARED_EXPORT PDFDiff : public QObject
class PDF4QTLIBCORESHARED_EXPORT PDFDiff : public QObject
{
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
/// 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:
inline PDFObjectStorage() = default;
@@ -146,7 +146,7 @@ private:
/// 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.
/// This class uses Decorator design pattern.
class PDF4QTLIBSHARED_EXPORT PDFDocumentDataLoaderDecorator
class PDF4QTLIBCORESHARED_EXPORT PDFDocumentDataLoaderDecorator
{
public:
explicit PDFDocumentDataLoaderDecorator(const PDFDocument* document);
@@ -402,7 +402,7 @@ private:
};
/// PDF document main class.
class PDF4QTLIBSHARED_EXPORT PDFDocument
class PDF4QTLIBCORESHARED_EXPORT 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,
/// dictionaries, arrays etc.
class PDF4QTLIBSHARED_EXPORT PDFObjectFactory
class PDF4QTLIBCORESHARED_EXPORT PDFObjectFactory
{
public:
inline explicit PDFObjectFactory() = default;
@@ -207,7 +207,7 @@ private:
/// to draw graphics elements on it. Content stream can have various
/// resources, which can, if selected be dereferenced, so content
/// stream is encapsulated and doesn't contain references.
class PDF4QTLIBSHARED_EXPORT PDFContentStreamBuilder
class PDF4QTLIBCORESHARED_EXPORT PDFContentStreamBuilder
{
public:
@@ -264,7 +264,7 @@ private:
/// to draw graphics elements on it. Content stream can have various
/// resources, which can, if selected be dereferenced, so content
/// stream is encapsulated and doesn't contain references.
class PDF4QTLIBSHARED_EXPORT PDFPageContentStreamBuilder
class PDF4QTLIBCORESHARED_EXPORT PDFPageContentStreamBuilder
{
public:
@@ -314,7 +314,7 @@ private:
Mode m_mode;
};
class PDF4QTLIBSHARED_EXPORT PDFDocumentBuilder
class PDF4QTLIBCORESHARED_EXPORT PDFDocumentBuilder
{
public:
/// Creates a new blank document (with no pages)
@@ -1588,7 +1588,7 @@ private:
/// This class serves for document modification. While document is modified,
/// modification flags are gathered. At the end of the modification, it is checked,
/// if document was really changed.
class PDF4QTLIBSHARED_EXPORT PDFDocumentModifier
class PDF4QTLIBCORESHARED_EXPORT PDFDocumentModifier
{
public:
explicit PDFDocumentModifier(const PDFDocument* originalDocument);

View File

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

View File

@@ -30,7 +30,7 @@ namespace pdf
/// to a new document, where pages are inserted/removed/moved, or joined
/// from another documents, or blank pages/image pages inserted. Document
/// is also optimized.
class PDF4QTLIBSHARED_EXPORT PDFDocumentManipulator
class PDF4QTLIBCORESHARED_EXPORT 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,
/// byte buffer). This class doesn't throw exceptions, to check errors, use
/// appropriate functions.
class PDF4QTLIBSHARED_EXPORT PDFDocumentReader
class PDF4QTLIBCORESHARED_EXPORT 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,
/// except the content streams. Sanitization is configurable, user can specify,
/// which content should be removed.
class PDF4QTLIBSHARED_EXPORT PDFDocumentSanitizer : public QObject
class PDF4QTLIBCORESHARED_EXPORT PDFDocumentSanitizer : public QObject
{
Q_OBJECT

View File

@@ -29,7 +29,7 @@ class PDFDocument;
/// 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
/// are available, they can modify text flow by various content.
class PDF4QTLIBSHARED_EXPORT PDFDocumentTextFlow
class PDF4QTLIBCORESHARED_EXPORT PDFDocumentTextFlow
{
public:
@@ -104,7 +104,7 @@ private:
};
/// This factory creates text flow for whole document
class PDF4QTLIBSHARED_EXPORT PDFDocumentTextFlowFactory
class PDF4QTLIBCORESHARED_EXPORT PDFDocumentTextFlowFactory
{
public:
explicit PDFDocumentTextFlowFactory() = default;
@@ -150,7 +150,7 @@ private:
/// Editor which can edit document text flow, modify user text,
/// change order of text items, restore original state of a text flow,
/// and many other features.
class PDF4QTLIBSHARED_EXPORT PDFDocumentTextFlowEditor
class PDF4QTLIBCORESHARED_EXPORT PDFDocumentTextFlowEditor
{
public:
inline PDFDocumentTextFlowEditor() = default;

View File

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

View File

@@ -29,7 +29,7 @@ namespace pdf
/// 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.
class PDF4QTLIBSHARED_EXPORT PDFDocumentWriter
class PDF4QTLIBCORESHARED_EXPORT 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
/// (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

View File

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

View File

@@ -33,7 +33,7 @@ struct PDFExecutionPolicyHolder;
/// 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
/// point, where execution policy is used.
class PDF4QTLIBSHARED_EXPORT PDFExecutionPolicy
class PDF4QTLIBCORESHARED_EXPORT PDFExecutionPolicy
{
public:

View File

@@ -31,7 +31,7 @@ class PDFObjectStorage;
/// Each identifier consists of two parts - permanent identifier, which
/// is unique identifier based on original document, and changing identifier,
/// which is updated when document is being modified.
class PDF4QTLIBSHARED_EXPORT PDFFileIdentifier
class PDF4QTLIBCORESHARED_EXPORT PDFFileIdentifier
{
public:
explicit inline PDFFileIdentifier() = default;
@@ -49,7 +49,7 @@ private:
/// 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,
/// and ordering, visibility and editability.
class PDF4QTLIBSHARED_EXPORT PDFCollectionField
class PDF4QTLIBCORESHARED_EXPORT PDFCollectionField
{
public:
explicit inline PDFCollectionField() = default;
@@ -96,7 +96,7 @@ private:
/// Collection schema. Contains a list of defined fields.
/// Schema can be queried for field definition.
class PDF4QTLIBSHARED_EXPORT PDFCollectionSchema
class PDF4QTLIBCORESHARED_EXPORT PDFCollectionSchema
{
public:
explicit inline PDFCollectionSchema() = default;
@@ -123,7 +123,7 @@ private:
/// Collection of file attachments. In the PDF file, attached files
/// can be grouped in collection (if they are related to each other).
class PDF4QTLIBSHARED_EXPORT PDFCollection
class PDF4QTLIBCORESHARED_EXPORT PDFCollection
{
public:
explicit inline PDFCollection() = default;
@@ -242,7 +242,7 @@ private:
};
/// Collection folder. Can contain subfolders and files.
class PDF4QTLIBSHARED_EXPORT PDFCollectionFolder
class PDF4QTLIBCORESHARED_EXPORT PDFCollectionFolder
{
public:
explicit inline PDFCollectionFolder() = default;
@@ -277,7 +277,7 @@ private:
/// Collection item. Contains properties of the collection item,
/// for example, embedded file.
class PDF4QTLIBSHARED_EXPORT PDFCollectionItem
class PDF4QTLIBCORESHARED_EXPORT PDFCollectionItem
{
public:
explicit inline PDFCollectionItem() = default;
@@ -316,7 +316,7 @@ private:
/// Collection navigator. It contains modes of display. Interactive
/// PDF processor should display first layout it is capable of.
class PDF4QTLIBSHARED_EXPORT PDFCollectionNavigator
class PDF4QTLIBCORESHARED_EXPORT PDFCollectionNavigator
{
public:
explicit inline PDFCollectionNavigator() = default;
@@ -347,7 +347,7 @@ private:
Layouts m_layouts = None;
};
class PDF4QTLIBSHARED_EXPORT PDFEmbeddedFile
class PDF4QTLIBCORESHARED_EXPORT PDFEmbeddedFile
{
public:
explicit PDFEmbeddedFile() = default;
@@ -372,7 +372,7 @@ private:
};
/// File specification
class PDF4QTLIBSHARED_EXPORT PDFFileSpecification
class PDF4QTLIBCORESHARED_EXPORT PDFFileSpecification
{
public:
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 ordering;
int supplement = 0;
};
struct PDF4QTLIBSHARED_EXPORT FontDescriptor
struct PDF4QTLIBCORESHARED_EXPORT FontDescriptor
{
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
/// 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:
~PDFRealizedFont();
@@ -281,7 +281,7 @@ private:
};
/// Base class representing font in the PDF file
class PDF4QTLIBSHARED_EXPORT PDFFont
class PDF4QTLIBCORESHARED_EXPORT PDFFont
{
public:
explicit PDFFont(CIDSystemInfo CIDSystemInfo, FontDescriptor fontDescriptor);
@@ -404,7 +404,7 @@ public:
/// Font cache which caches both fonts, and realized fonts. Cache has individual limit
/// for fonts, and realized fonts.
class PDF4QTLIBSHARED_EXPORT PDFFontCache
class PDF4QTLIBCORESHARED_EXPORT PDFFontCache
{
public:
inline explicit PDFFontCache(size_t fontCacheLimit, size_t realizedFontCacheLimit) :
@@ -511,7 +511,7 @@ private:
};
/// Represents a font CMAP (mapping of CIDs)
class PDF4QTLIBSHARED_EXPORT PDFFontCMap
class PDF4QTLIBCORESHARED_EXPORT PDFFontCMap
{
public:
explicit PDFFontCMap() = default;
@@ -663,7 +663,7 @@ private:
};
/// Repository with predefined CMaps
class PDF4QTLIBSHARED_EXPORT PDFFontCMapRepository
class PDF4QTLIBCORESHARED_EXPORT PDFFontCMapRepository
{
public:
/// Returns instance of CMAP repository

View File

@@ -413,7 +413,7 @@ private:
/// 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
/// special - signature field, which represents digital signature.
class PDF4QTLIBSHARED_EXPORT PDFForm
class PDF4QTLIBCORESHARED_EXPORT PDFForm
{
public:
explicit inline PDFForm() = default;
@@ -534,7 +534,7 @@ protected:
/// Form manager. Manages all form widgets functionality - triggers actions,
/// edits fields, updates annotation appearances, etc. Valid pointer to annotation
/// manager is requirement.
class PDF4QTLIBSHARED_EXPORT PDFFormManager : public QObject, public IDrawWidgetInputInterface
class PDF4QTLIBCORESHARED_EXPORT PDFFormManager : public QObject, public IDrawWidgetInputInterface
{
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
/// to the nearest values. This class is fully thread safe (if constant functions
/// are called).
class PDF4QTLIBSHARED_EXPORT PDFFunction
class PDF4QTLIBCORESHARED_EXPORT PDFFunction
{
public:
@@ -131,7 +131,7 @@ protected:
};
/// Identity function
class PDF4QTLIBSHARED_EXPORT PDFIdentityFunction : public PDFFunction
class PDF4QTLIBCORESHARED_EXPORT PDFIdentityFunction : public PDFFunction
{
public:
explicit PDFIdentityFunction();
@@ -148,7 +148,7 @@ public:
/// Sampled function (Type 0 function).
/// \note Order is ignored, linear interpolation is always performed. No cubic spline
/// interpolation occurs.
class PDF4QTLIBSHARED_EXPORT PDFSampledFunction : public PDFFunction
class PDF4QTLIBCORESHARED_EXPORT PDFSampledFunction : public PDFFunction
{
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 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.
class PDF4QTLIBSHARED_EXPORT PDFExponentialFunction : public PDFFunction
class PDF4QTLIBCORESHARED_EXPORT PDFExponentialFunction : public PDFFunction
{
public:
/// Construct new exponential function.
@@ -254,7 +254,7 @@ private:
/// Stitching function (Type 3 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.
class PDF4QTLIBSHARED_EXPORT PDFStitchingFunction : public PDFFunction
class PDF4QTLIBCORESHARED_EXPORT PDFStitchingFunction : public PDFFunction
{
public:
struct PartialFunction
@@ -313,7 +313,7 @@ private:
/// Postscript function (Type 4 function)
/// Implements subset of postscript language
class PDF4QTLIBSHARED_EXPORT PDFPostScriptFunction : public PDFFunction
class PDF4QTLIBCORESHARED_EXPORT PDFPostScriptFunction : public PDFFunction
{
public:

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -1,332 +0,0 @@
// Copyright (C) 2019-2021 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/>.
#ifndef PDFITEMMODELS_H
#define PDFITEMMODELS_H
#include "pdfglobal.h"
#include "pdfobject.h"
#include <QIcon>
#include <QPixmapCache>
#include <QAbstractItemModel>
#include <set>
namespace pdf
{
class PDFAction;
class PDFDocument;
class PDFOutlineItem;
class PDFModifiedDocument;
class PDFFileSpecification;
class PDFOptionalContentActivity;
class PDFDrawWidgetProxy;
class PDFDestination;
/// Represents tree item in the GUI tree
class PDF4QTLIBSHARED_EXPORT PDFTreeItem
{
public:
inline explicit PDFTreeItem() = default;
inline explicit PDFTreeItem(PDFTreeItem* parent) : m_parent(parent) { }
virtual ~PDFTreeItem();
template<typename T, typename... Arguments>
inline T* addChild(Arguments&&... arguments)
{
T* item = new T(this, std::forward(arguments)...);
m_children.push_back(item);
return item;
}
template<typename T, typename... Arguments>
inline T* insertChild(int position, Arguments&&... arguments)
{
T* item = new T(this, std::forward(arguments)...);
m_children.insert(std::next(m_children.begin(), position), item);
return item;
}
void insertCreatedChild(int position, PDFTreeItem* item)
{
item->m_parent = this;
m_children.insert(std::next(m_children.begin(), position), item);
}
void addCreatedChild(PDFTreeItem* item)
{
item->m_parent = this;
m_children.push_back(item);
}
int getRow() const { return m_parent->m_children.indexOf(const_cast<PDFTreeItem*>(this)); }
int getChildCount() const { return m_children.size(); }
const PDFTreeItem* getChild(int index) const { return m_children.at(index); }
PDFTreeItem* getChild(int index) { return m_children.at(index); }
const PDFTreeItem* getParent() const { return m_parent; }
PDFTreeItem* takeChild(int index);
private:
PDFTreeItem* m_parent = nullptr;
QList<PDFTreeItem*> m_children;
};
/// Root of all tree item models. Reimplementations of this model
/// must handle "soft" document updates, such as only annotations changed etc.
/// Model should be rebuilded only, if it is neccessary.
class PDF4QTLIBSHARED_EXPORT PDFTreeItemModel : public QAbstractItemModel
{
public:
explicit PDFTreeItemModel(QObject* parent);
void setDocument(const PDFModifiedDocument& document);
bool isEmpty() const;
virtual QModelIndex index(int row, int column, const QModelIndex& parent) const override;
virtual QModelIndex parent(const QModelIndex& child) const override;
virtual int rowCount(const QModelIndex& parent) const override;
virtual bool hasChildren(const QModelIndex& parent) const override;
virtual Qt::ItemFlags flags(const QModelIndex& index) const override;
virtual void update() = 0;
protected:
const PDFDocument* m_document;
std::unique_ptr<PDFTreeItem> m_rootItem;
};
class PDFOptionalContentTreeItem : public PDFTreeItem
{
public:
inline explicit PDFOptionalContentTreeItem(PDFOptionalContentTreeItem* parent, PDFObjectReference reference, QString text, bool locked) :
PDFTreeItem(parent),
m_reference(reference),
m_text(qMove(text)),
m_locked(locked)
{
}
PDFObjectReference getReference() const { return m_reference; }
QString getText() const;
bool isLocked() const { return m_locked; }
private:
PDFObjectReference m_reference; ///< Reference to optional content group
QString m_text; ///< Node display name
bool m_locked; ///< Node is locked (user can't change it)
};
class PDF4QTLIBSHARED_EXPORT PDFOptionalContentTreeItemModel : public PDFTreeItemModel
{
Q_OBJECT
public:
inline explicit PDFOptionalContentTreeItemModel(QObject* parent) :
PDFTreeItemModel(parent),
m_activity(nullptr)
{
}
void setActivity(PDFOptionalContentActivity* activity);
virtual int columnCount(const QModelIndex& parent) const override;
virtual QVariant data(const QModelIndex& index, int role) const override;
virtual void update() override;
virtual Qt::ItemFlags flags(const QModelIndex& index) const override;
virtual bool setData(const QModelIndex& index, const QVariant& value, int role) override;
private:
PDFOptionalContentActivity* m_activity;
};
class PDFOutlineTreeItem : public PDFTreeItem
{
public:
explicit PDFOutlineTreeItem(PDFOutlineTreeItem* parent, QSharedPointer<PDFOutlineItem> outlineItem);
const PDFOutlineItem* getOutlineItem() const { return m_outlineItem.data(); }
PDFOutlineItem* getOutlineItem() { return m_outlineItem.data(); }
private:
QSharedPointer<PDFOutlineItem> m_outlineItem;
};
class PDF4QTLIBSHARED_EXPORT PDFOutlineTreeItemModel : public PDFTreeItemModel
{
Q_OBJECT
public:
PDFOutlineTreeItemModel(QIcon icon, bool editable, QObject* parent) :
PDFTreeItemModel(parent),
m_icon(qMove(icon)),
m_editable(editable)
{
}
virtual int columnCount(const QModelIndex& parent) const override;
virtual QVariant data(const QModelIndex& index, int role) const override;
virtual void update() override;
virtual Qt::ItemFlags flags(const QModelIndex& index) const override;
virtual bool setData(const QModelIndex& index, const QVariant& value, int role) override;
virtual Qt::DropActions supportedDropActions() const override;
virtual Qt::DropActions supportedDragActions() const override;
virtual bool insertRows(int row, int count, const QModelIndex& parent) override;
virtual bool removeRows(int row, int count, const QModelIndex& parent) override;
virtual bool moveRows(const QModelIndex& sourceParent, int sourceRow, int count, const QModelIndex& destinationParent, int destinationChild) override;
virtual QStringList mimeTypes() const override;
virtual QMimeData* mimeData(const QModelIndexList& indexes) const override;
virtual bool canDropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) const override;
virtual bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override;
/// Returns action assigned to the index. If index is invalid, or
/// points to the invalid item, nullptr is returned.
/// \param index Index of the outline item
const PDFAction* getAction(const QModelIndex& index) const;
/// Returns the outline item for the given index, or nullptr
/// if no outline item is assigned to that index.
const PDFOutlineItem* getOutlineItem(const QModelIndex& index) const;
/// Returns the outline item for the given index, or nullptr
/// if no outline item is assigned to that index.
PDFOutlineItem* getOutlineItem(const QModelIndex& index);
void setFontBold(const QModelIndex& index, bool value);
void setFontItalics(const QModelIndex& index, bool value);
void setDestination(const QModelIndex& index, const PDFDestination& destination);
const PDFOutlineItem* getRootOutlineItem() const;
bool isEditable() const { return m_editable; }
private:
QIcon m_icon;
bool m_editable;
mutable QSharedPointer<PDFOutlineItem> m_dragDropItem;
};
class PDF4QTLIBSHARED_EXPORT PDFSelectableOutlineTreeItemModel : public PDFOutlineTreeItemModel
{
Q_OBJECT
private:
using BaseClass = PDFOutlineTreeItemModel;
public:
PDFSelectableOutlineTreeItemModel(QIcon icon, QObject* parent) :
BaseClass(qMove(icon), false, parent)
{
}
virtual QVariant data(const QModelIndex& index, int role) const override;
virtual void update() override;
virtual Qt::ItemFlags flags(const QModelIndex& index) const override;
virtual bool setData(const QModelIndex& index, const QVariant& value, int role) override;
std::vector<const PDFOutlineItem*> getSelectedItems() const;
private:
std::set<const PDFOutlineItem*> m_selectedItems;
};
class PDFAttachmentsTreeItem : public PDFTreeItem
{
public:
explicit PDFAttachmentsTreeItem(PDFAttachmentsTreeItem* parent, QIcon icon, QString title, QString description, const PDFFileSpecification* fileSpecification);
virtual ~PDFAttachmentsTreeItem() override;
const QIcon& getIcon() const { return m_icon; }
const QString& getTitle() const { return m_title; }
const QString& getDescription() const { return m_description; }
const PDFFileSpecification* getFileSpecification() const { return m_fileSpecification.get(); }
private:
QIcon m_icon;
QString m_title;
QString m_description;
std::unique_ptr<PDFFileSpecification> m_fileSpecification;
};
class PDF4QTLIBSHARED_EXPORT PDFAttachmentsTreeItemModel : public PDFTreeItemModel
{
Q_OBJECT
public:
PDFAttachmentsTreeItemModel(QObject* parent) :
PDFTreeItemModel(parent)
{
}
enum Column
{
Title,
Description,
EndColumn
};
virtual int columnCount(const QModelIndex& parent) const override;
virtual QVariant data(const QModelIndex& index, int role) const override;
virtual void update() override;
virtual Qt::ItemFlags flags(const QModelIndex& index) const override;
const PDFFileSpecification* getFileSpecification(const QModelIndex& index) const;
};
class PDF4QTLIBSHARED_EXPORT PDFThumbnailsItemModel : public QAbstractItemModel
{
Q_OBJECT
public:
explicit PDFThumbnailsItemModel(const PDFDrawWidgetProxy* proxy, QObject* parent);
bool isEmpty() const;
virtual QModelIndex index(int row, int column, const QModelIndex& parent) const override;
virtual QModelIndex parent(const QModelIndex& child) const override;
virtual int rowCount(const QModelIndex& parent) const override;
virtual int columnCount(const QModelIndex& parent) const override;
virtual QVariant data(const QModelIndex& index, int role) const override;
void setThumbnailsSize(int size);
void setDocument(const PDFModifiedDocument& document);
/// Sets the extra item width/height for size hint. This space will be added to the size hint (pixmap size)
void setExtraItemSizeHint(int width, int height) { m_extraItemWidthHint = width; m_extraItemHeighHint = height; }
PDFInteger getPageIndex(const QModelIndex& index) const;
private:
void onPageImageChanged(bool all, const std::vector<PDFInteger>& pages);
/// Returns generated key for page index
QString getKey(int pageIndex) const;
const PDFDrawWidgetProxy* m_proxy;
int m_thumbnailSize;
int m_extraItemWidthHint;
int m_extraItemHeighHint;
int m_pageCount;
const PDFDocument* m_document;
QPixmapCache m_thumbnailCache;
};
} // namespace pdf
#endif // PDFITEMMODELS_H

View File

@@ -57,7 +57,7 @@ struct PDFJavaScriptEntry
/// Scans document for all javascript presence (in actions). Several option
/// can be set, for example, scan only document actions, or stop scanning,
/// when first javascript is found.
class PDF4QTLIBSHARED_EXPORT PDFJavaScriptScanner
class PDF4QTLIBCORESHARED_EXPORT PDFJavaScriptScanner
{
public:
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
/// 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).
class PDF4QTLIBSHARED_EXPORT PDFJBIG2ArithmeticDecoderState
class PDF4QTLIBCORESHARED_EXPORT PDFJBIG2ArithmeticDecoderState
{
public:
explicit inline PDFJBIG2ArithmeticDecoderState() = default;
@@ -139,7 +139,7 @@ private:
/// 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
/// arithmetic described in the specification (it is much faster).
class PDF4QTLIBSHARED_EXPORT PDFJBIG2ArithmeticDecoder
class PDF4QTLIBCORESHARED_EXPORT PDFJBIG2ArithmeticDecoder
{
public:
explicit inline PDFJBIG2ArithmeticDecoder(PDFBitReader* reader) :
@@ -323,7 +323,7 @@ private:
std::vector<PDFJBIG2HuffmanTableEntry> m_entries;
};
class PDF4QTLIBSHARED_EXPORT PDFJBIG2Bitmap : public PDFJBIG2Segment
class PDF4QTLIBCORESHARED_EXPORT PDFJBIG2Bitmap : public PDFJBIG2Segment
{
public:
explicit PDFJBIG2Bitmap();
@@ -427,7 +427,7 @@ using PDFJBIG2ATPositions = std::array<PDFJBIG2ATPosition, 4>;
/// Decoder of JBIG2 data streams. Decodes the black/white monochrome image.
/// Handles also global segments. Decoder decodes data using the specification
/// ISO/IEC 14492:2001, T.88.
class PDF4QTLIBSHARED_EXPORT PDFJBIG2Decoder
class PDF4QTLIBCORESHARED_EXPORT PDFJBIG2Decoder
{
public:
explicit inline PDFJBIG2Decoder(QByteArray data, QByteArray globalData, PDFRenderErrorReporter* errorReporter) :

View File

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

View File

@@ -112,7 +112,7 @@ struct PDFInplaceString
};
/// Reference to the string implementations
struct PDF4QTLIBSHARED_EXPORT PDFStringRef
struct PDF4QTLIBCORESHARED_EXPORT PDFStringRef
{
const PDFInplaceString* inplaceString = 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),
/// or classic byte array string, if not enough space for embedded string.
class PDF4QTLIBSHARED_EXPORT PDFInplaceOrMemoryString
class PDF4QTLIBCORESHARED_EXPORT PDFInplaceOrMemoryString
{
public:
constexpr PDFInplaceOrMemoryString() = default;
@@ -158,7 +158,7 @@ private:
std::variant<typename std::monostate, PDFInplaceString, QByteArray> m_value;
};
class PDF4QTLIBSHARED_EXPORT PDFObject
class PDF4QTLIBCORESHARED_EXPORT PDFObject
{
public:
enum class Type : uint8_t
@@ -311,7 +311,7 @@ private:
};
/// Represents an array of objects in the PDF file.
class PDF4QTLIBSHARED_EXPORT PDFArray : public PDFObjectContent
class PDF4QTLIBCORESHARED_EXPORT PDFArray : public PDFObjectContent
{
public:
inline PDFArray() = default;
@@ -353,7 +353,7 @@ private:
/// 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
/// map, because dictionaries are usually small.
class PDF4QTLIBSHARED_EXPORT PDFDictionary : public PDFObjectContent
class PDF4QTLIBCORESHARED_EXPORT PDFDictionary : public PDFObjectContent
{
public:
using DictionaryEntry = std::pair<PDFInplaceOrMemoryString, PDFObject>;
@@ -464,7 +464,7 @@ private:
/// Represents a stream object in the PDF file. Stream consists of dictionary
/// and stream content - byte array.
class PDF4QTLIBSHARED_EXPORT PDFStream : public PDFObjectContent
class PDF4QTLIBCORESHARED_EXPORT PDFStream : public PDFObjectContent
{
public:
inline explicit PDFStream() = default;
@@ -493,7 +493,7 @@ private:
QByteArray m_content;
};
class PDF4QTLIBSHARED_EXPORT PDFObjectManipulator
class PDF4QTLIBCORESHARED_EXPORT PDFObjectManipulator
{
public:
explicit PDFObjectManipulator() = delete;

View File

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

View File

@@ -32,7 +32,7 @@ class PDFObjectStorage;
class PDFDocument;
/// Utilities for manipulation with objects
class PDF4QTLIBSHARED_EXPORT PDFObjectUtils
class PDF4QTLIBCORESHARED_EXPORT PDFObjectUtils
{
public:
/// 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
/// when object type is missing or document is not well-formed.
class PDF4QTLIBSHARED_EXPORT PDFObjectClassifier
class PDF4QTLIBCORESHARED_EXPORT PDFObjectClassifier
{
public:

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -1,626 +0,0 @@
// Copyright (C) 2022 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/>.
#ifndef PDFPAGECONTENTELEMENTS_H
#define PDFPAGECONTENTELEMENTS_H
#include "pdfdocumentdrawinterface.h"
#include <QPen>
#include <QFont>
#include <QBrush>
#include <QCursor>
#include <QPainterPath>
#include <set>
class QSvgRenderer;
namespace pdf
{
class PDFWidget;
class PDFDocument;
class PDFPageContentScene;
class PDF4QTLIBSHARED_EXPORT PDFPageContentElement
{
public:
explicit PDFPageContentElement() = default;
virtual ~PDFPageContentElement() = default;
virtual PDFPageContentElement* clone() const = 0;
virtual void drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const = 0;
/// Returns manipulation mode. If manipulation mode is zero, then element
/// cannot be manipulated. If it is nonzero, then element can be manipulated
/// in some way.
/// \param point Point on page
/// \param snapPointDistanceTreshold Snap point threshold
virtual uint getManipulationMode(const QPointF& point, PDFReal snapPointDistanceThreshold) const = 0;
/// Performs manipulation of given mode. Mode must be the one returned
/// from function getManipulationMode. \sa getManipulationMode
/// \param mode Mode
/// \param offset Offset
virtual void performManipulation(uint mode, const QPointF& offset) = 0;
/// Returns bounding box of the element
virtual QRectF getBoundingBox() const = 0;
/// Sets size to the elements that supports it. Does
/// nothing for elements, which does not support it.
virtual void setSize(QSizeF size) = 0;
/// Returns description of the element
virtual QString getDescription() const = 0;
PDFInteger getPageIndex() const;
void setPageIndex(PDFInteger newPageIndex);
PDFInteger getElementId() const;
void setElementId(PDFInteger newElementId);
/// Returns cursor shape for manipulation mode
/// \param mode Manipulation mode
static Qt::CursorShape getCursorShapeForManipulationMode(uint mode);
enum ManipulationModes : uint
{
None = 0,
Translate,
Top,
Left,
Right,
Bottom,
TopLeft,
TopRight,
BottomLeft,
BottomRight,
Pt1,
Pt2
};
protected:
uint getRectangleManipulationMode(const QRectF& rectangle,
const QPointF& point,
PDFReal snapPointDistanceThreshold) const;
void performRectangleManipulation(QRectF& rectangle,
uint mode,
const QPointF& offset);
void performRectangleSetSize(QRectF& rectangle, QSizeF size);
QString formatDescription(const QString& description) const;
PDFInteger m_elementId = -1;
PDFInteger m_pageIndex = -1;
};
class PDF4QTLIBSHARED_EXPORT PDFPageContentStyledElement : public PDFPageContentElement
{
public:
explicit PDFPageContentStyledElement() = default;
virtual ~PDFPageContentStyledElement() = default;
const QPen& getPen() const;
void setPen(const QPen& newPen);
const QBrush& getBrush() const;
void setBrush(const QBrush& newBrush);
protected:
QPen m_pen;
QBrush m_brush;
};
class PDF4QTLIBSHARED_EXPORT PDFPageContentElementRectangle : public PDFPageContentStyledElement
{
public:
virtual ~PDFPageContentElementRectangle() = default;
virtual PDFPageContentElementRectangle* clone() const override;
bool isRounded() const;
void setRounded(bool newRounded);
const QRectF& getRectangle() const;
void setRectangle(const QRectF& newRectangle);
virtual void drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual uint getManipulationMode(const QPointF& point,
PDFReal snapPointDistanceThreshold) const override;
virtual void performManipulation(uint mode, const QPointF& offset) override;
virtual QRectF getBoundingBox() const override;
virtual void setSize(QSizeF size) override;
virtual QString getDescription() const override;
private:
bool m_rounded = false;
QRectF m_rectangle;
};
class PDF4QTLIBSHARED_EXPORT PDFPageContentElementLine : public PDFPageContentStyledElement
{
public:
virtual ~PDFPageContentElementLine() = default;
virtual PDFPageContentElementLine* clone() const override;
enum class LineGeometry
{
General,
Horizontal,
Vertical
};
virtual void drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual uint getManipulationMode(const QPointF& point,
PDFReal snapPointDistanceThreshold) const override;
virtual void performManipulation(uint mode, const QPointF& offset) override;
virtual QRectF getBoundingBox() const override;
virtual void setSize(QSizeF size) override;
virtual QString getDescription() const override;
LineGeometry getGeometry() const;
void setGeometry(LineGeometry newGeometry);
const QLineF& getLine() const;
void setLine(const QLineF& newLine);
private:
LineGeometry m_geometry = LineGeometry::General;
QLineF m_line;
};
class PDF4QTLIBSHARED_EXPORT PDFPageContentElementDot : public PDFPageContentStyledElement
{
public:
virtual ~PDFPageContentElementDot() = default;
virtual PDFPageContentElementDot* clone() const override;
virtual void drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual uint getManipulationMode(const QPointF& point,
PDFReal snapPointDistanceThreshold) const override;
virtual void performManipulation(uint mode, const QPointF& offset) override;
virtual QRectF getBoundingBox() const override;
virtual void setSize(QSizeF size) override;
virtual QString getDescription() const override;
QPointF getPoint() const;
void setPoint(QPointF newPoint);
private:
QPointF m_point;
};
class PDF4QTLIBSHARED_EXPORT PDFPageContentElementFreehandCurve : public PDFPageContentStyledElement
{
public:
virtual ~PDFPageContentElementFreehandCurve() = default;
virtual PDFPageContentElementFreehandCurve* clone() const override;
virtual void drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual uint getManipulationMode(const QPointF& point,
PDFReal snapPointDistanceThreshold) const override;
virtual void performManipulation(uint mode, const QPointF& offset) override;
virtual QRectF getBoundingBox() const override;
virtual void setSize(QSizeF size);
virtual QString getDescription() const override;
QPainterPath getCurve() const;
void setCurve(QPainterPath newCurve);
bool isEmpty() const { return m_curve.isEmpty(); }
void addStartPoint(const QPointF& point);
void addPoint(const QPointF& point);
void clear();
private:
QPainterPath m_curve;
};
class PDF4QTLIBSHARED_EXPORT PDFPageContentImageElement : public PDFPageContentElement
{
public:
PDFPageContentImageElement();
virtual ~PDFPageContentImageElement();
virtual PDFPageContentImageElement* clone() const override;
virtual void drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual uint getManipulationMode(const QPointF& point,
PDFReal snapPointDistanceThreshold) const override;
virtual void performManipulation(uint mode, const QPointF& offset) override;
virtual QRectF getBoundingBox() const override;
virtual void setSize(QSizeF size);
virtual QString getDescription() const override;
const QByteArray& getContent() const;
void setContent(const QByteArray& newContent);
const QRectF& getRectangle() const;
void setRectangle(const QRectF& newRectangle);
private:
QRectF m_rectangle;
QByteArray m_content;
QImage m_image;
std::unique_ptr<QSvgRenderer> m_renderer;
};
class PDF4QTLIBSHARED_EXPORT PDFPageContentElementTextBox : public PDFPageContentStyledElement
{
public:
virtual ~PDFPageContentElementTextBox() = default;
virtual PDFPageContentElementTextBox* clone() const override;
const QRectF& getRectangle() const { return m_rectangle; }
void setRectangle(const QRectF& newRectangle) { m_rectangle = newRectangle; }
virtual void drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual uint getManipulationMode(const QPointF& point,
PDFReal snapPointDistanceThreshold) const override;
virtual void performManipulation(uint mode, const QPointF& offset) override;
virtual QRectF getBoundingBox() const override;
virtual void setSize(QSizeF size) override;
virtual QString getDescription() const override;
const QString& getText() const;
void setText(const QString& newText);
const QFont& getFont() const;
void setFont(const QFont& newFont);
PDFReal getAngle() const;
void setAngle(PDFReal newAngle);
const Qt::Alignment& getAlignment() const;
void setAlignment(const Qt::Alignment& newAlignment);
private:
QString m_text;
QRectF m_rectangle;
QFont m_font;
PDFReal m_angle = 0.0;
Qt::Alignment m_alignment = Qt::AlignCenter;
};
class PDF4QTLIBSHARED_EXPORT PDFPageContentElementManipulator : public QObject
{
Q_OBJECT
public:
PDFPageContentElementManipulator(PDFPageContentScene* scene, QObject* parent);
enum class Operation
{
AlignTop,
AlignCenterVertically,
AlignBottom,
AlignLeft,
AlignCenterHorizontally,
AlignRight,
SetSameHeight,
SetSameWidth,
SetSameSize,
CenterHorizontally,
CenterVertically,
CenterHorAndVert,
LayoutVertically,
LayoutHorizontally,
LayoutForm,
LayoutGrid
};
enum SelectionMode
{
NoUpdate = 0x0000,
Clear = 0x0001, ///< Clears current selection
Select = 0x0002, ///< Selects item
Deselect = 0x0004, ///< Deselects item
Toggle = 0x0008, ///< Toggles selection of the item
};
Q_DECLARE_FLAGS(SelectionModes, SelectionMode)
/// Returns true, if element with given id is selected
/// \param id Element id
bool isSelected(PDFInteger id) const;
/// Returns true, if all elements are selected
/// \param ids Element ids
bool isAllSelected(const std::set<PDFInteger>& elementIds) const;
/// Returns true, if selection is empty
bool isSelectionEmpty() const { return m_selection.empty(); }
/// Clear all selection, stop manipulation
void reset();
void update(PDFInteger id, SelectionModes modes);
void update(const std::set<PDFInteger>& ids, SelectionModes modes);
void select(PDFInteger id);
void select(const std::set<PDFInteger>& ids);
void selectNew(PDFInteger id);
void selectNew(const std::set<PDFInteger>& ids);
void deselect(PDFInteger id);
void deselect(const std::set<PDFInteger>& ids);
void selectAll();
void deselectAll();
bool isManipulationAllowed(PDFInteger pageIndex) const;
bool isManipulationInProgress() const { return m_isManipulationInProgress; }
void performOperation(Operation operation);
void performDeleteSelection();
void startManipulation(PDFInteger pageIndex,
const QPointF& startPoint,
const QPointF& currentPoint,
PDFReal snapPointDistanceThreshold);
void updateManipulation(PDFInteger pageIndex,
const QPointF& startPoint,
const QPointF& currentPoint);
void finishManipulation(PDFInteger pageIndex,
const QPointF& startPoint,
const QPointF& currentPoint,
bool createCopy);
void cancelManipulation();
void drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const;
/// Returns bounding box of whole selection
QRectF getSelectionBoundingRect() const;
/// Returns page rectangle for the page
QRectF getPageMediaBox(PDFInteger pageIndex) const;
signals:
void selectionChanged();
void stateChanged();
private:
void eraseSelectedElementById(PDFInteger id);
PDFPageContentScene* m_scene;
std::vector<PDFInteger> m_selection;
bool m_isManipulationInProgress;
std::vector<std::unique_ptr<PDFPageContentElement>> m_manipulatedElements;
std::map<PDFInteger, uint> m_manipulationModes;
QPointF m_lastUpdatedPoint;
};
class PDF4QTLIBSHARED_EXPORT PDFPageContentScene : public QObject,
public IDocumentDrawInterface,
public IDrawWidgetInputInterface
{
Q_OBJECT
public:
explicit PDFPageContentScene(QObject* parent);
virtual ~PDFPageContentScene();
static constexpr PDFInteger INVALID_ELEMENT_ID = 0;
/// Add new element to page content scene, scene
/// takes ownership over the element.
/// \param element Element
void addElement(PDFPageContentElement* element);
/// Replaces element in the page content scene, scene
/// takes ownership over the element.
/// \param element Element
void replaceElement(PDFPageContentElement* element);
/// Returns element by its id (identifier number)
/// \param id Element id
PDFPageContentElement* getElementById(PDFInteger id) const;
/// Clear whole scene - remove all page content elements
void clear();
/// Returns true, if scene is empty
bool isEmpty() const { return m_elements.empty(); }
bool isActive() const;
void setActive(bool newIsActive);
/// Returns set of all element ids
std::set<PDFInteger> getElementIds() const;
/// Returns set of selected element ids
std::set<PDFInteger> getSelectedElementIds() const;
/// Returns set of involved pages
std::set<PDFInteger> getPageIndices() const;
/// Returns bounding box of elements on page
QRectF getBoundingBox(PDFInteger pageIndex) const;
/// Set selected items
void setSelectedElementIds(const std::set<PDFInteger>& selectedElementIds);
/// Removes elements specified in selection
/// \param selection Items to be removed
void removeElementsById(const std::vector<PDFInteger>& selection);
/// Performs manipulation of selected elements with manipulator
void performOperation(int operation);
/// Returns document (or nullptr)
const PDFDocument* getDocument() const;
// IDrawWidgetInputInterface interface
public:
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;
virtual QString getTooltip() const override;
virtual const std::optional<QCursor>& getCursor() const override;
virtual int getInputPriority() const override;
virtual void drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
PDFWidget* widget() const;
void setWidget(PDFWidget* newWidget);
void drawElements(QPainter* painter,
PDFInteger pageIndex,
PDFTextLayoutGetter& layoutGetter,
const QTransform& pagePointToDevicePointMatrix,
const PDFPrecompiledPage* compiledPage,
QList<PDFRenderError>& errors) const;
signals:
/// This signal is emitted when scene has changed (including graphics)
void sceneChanged(bool graphicsOnly);
void selectionChanged();
/// Request to edit the elements
void editElementRequest(const std::set<PDFInteger>& elements);
private:
struct MouseEventInfo
{
std::set<PDFInteger> hoveredElementIds;
QPoint widgetMouseStartPos;
QPoint widgetMouseCurrentPos;
QElapsedTimer timer;
PDFInteger pageIndex = -1;
QPointF pagePos;
bool isValid() const { return !hoveredElementIds.empty(); }
};
MouseEventInfo getMouseEventInfo(QWidget* widget, QPoint point);
struct MouseGrabInfo
{
MouseEventInfo info;
int mouseGrabNesting = 0;
bool isMouseGrabbed() const { return mouseGrabNesting > 0; }
};
PDFReal getSnapPointDistanceThreshold() const;
bool isMouseGrabbed() const { return m_mouseGrabInfo.isMouseGrabbed(); }
/// Grabs mouse input, if mouse is already grabbed, or if event
/// is accepted.
/// \param info Mouse event info
/// \param event Mouse event
void grabMouse(const MouseEventInfo& info, QMouseEvent* event);
/// Release mouse input
/// \param info Mouse event info
/// \param event Mouse event
void ungrabMouse(const MouseEventInfo& info, QMouseEvent* event);
/// Updates mouse cursor
/// \param info Mouse event info
/// \param snapPointDistanceTreshold Snap point threshold
void updateMouseCursor(const MouseEventInfo& info, PDFReal snapPointDistanceThreshold);
/// Reaction on selection changed
void onSelectionChanged();
PDFInteger m_firstFreeId;
bool m_isActive;
PDFWidget* m_widget;
std::vector<std::unique_ptr<PDFPageContentElement>> m_elements;
std::optional<QCursor> m_cursor;
PDFPageContentElementManipulator m_manipulator;
MouseGrabInfo m_mouseGrabInfo;
};
} // namespace pdf
Q_DECLARE_OPERATORS_FOR_FLAGS(pdf::PDFPageContentElementManipulator::SelectionModes)
#endif // PDFPAGECONTENTELEMENTS_H

View File

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

View File

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

View File

@@ -364,7 +364,7 @@ private:
/// 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.
class PDF4QTLIBSHARED_EXPORT PDFPrecompiledPageGenerator : public PDFPainterBase
class PDF4QTLIBCORESHARED_EXPORT PDFPrecompiledPageGenerator : public PDFPainterBase
{
using BaseClass = PDFPainterBase;

View File

@@ -44,7 +44,7 @@ private:
QPainter* m_painter;
};
class PDF4QTLIBSHARED_EXPORT PDFPainterHelper
class PDF4QTLIBCORESHARED_EXPORT PDFPainterHelper
{
public:
/// 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_END_COMMAND = "endstream";
class PDF4QTLIBSHARED_EXPORT PDFLexicalAnalyzer
class PDF4QTLIBCORESHARED_EXPORT PDFLexicalAnalyzer
{
Q_GADGET
Q_DECLARE_TR_FUNCTIONS(pdf::PDFLexicalAnalyzer)
@@ -283,7 +283,7 @@ private:
/// Class for parsing objects. Checks cyclical references. If
/// 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)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -21,7 +21,7 @@
#include <QStyle>
#include <QKeyEvent>
#include <QMouseEvent>
#include <QApplication>
#include <QCoreApplication>
#include <QClipboard>
namespace pdf
@@ -35,7 +35,7 @@ PDFTextEditPseudowidget::PDFTextEditPseudowidget(PDFFormField::FieldFlags flags)
m_maxTextLength(0)
{
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)

View File

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

View File

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

View File

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

View File

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