mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-02-03 18:57:29 +01:00
Issue #118: Move compiler and draw space controller
This commit is contained in:
parent
0e1959b3aa
commit
cdbbe5e121
@ -31,10 +31,10 @@ add_executable(Pdf4QtDocDiff
|
||||
)
|
||||
|
||||
if(PDF4QT_ENABLE_OPENGL)
|
||||
target_link_libraries(Pdf4QtDocDiff PRIVATE Pdf4QtLibCore Qt6::OpenGLWidgets)
|
||||
target_link_libraries(Pdf4QtDocDiff PRIVATE Qt6::OpenGLWidgets)
|
||||
endif()
|
||||
|
||||
target_link_libraries(Pdf4QtDocDiff PRIVATE Pdf4QtLibCore Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
target_link_libraries(Pdf4QtDocDiff PRIVATE Pdf4QtLibCore Pdf4QtLibWidgets Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
|
||||
set_target_properties(Pdf4QtDocDiff PROPERTIES
|
||||
WIN32_EXECUTABLE ON
|
||||
|
@ -31,7 +31,7 @@ add_executable(Pdf4QtDocPageOrganizer
|
||||
icon.rc
|
||||
)
|
||||
|
||||
target_link_libraries(Pdf4QtDocPageOrganizer PRIVATE Pdf4QtLibCore Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
target_link_libraries(Pdf4QtDocPageOrganizer PRIVATE Pdf4QtLibCore Pdf4QtLibWidgets Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
|
||||
set_target_properties(Pdf4QtDocPageOrganizer PROPERTIES
|
||||
WIN32_EXECUTABLE ON
|
||||
|
@ -23,7 +23,6 @@ add_library(Pdf4QtLibCore SHARED
|
||||
sources/pdfccittfaxdecoder.cpp
|
||||
sources/pdfcertificatemanager.cpp
|
||||
sources/pdfcms.cpp
|
||||
sources/pdfcompiler.cpp
|
||||
sources/pdfdiff.cpp
|
||||
sources/pdfdocumentbuilder.cpp
|
||||
sources/pdfdocumentmanipulator.cpp
|
||||
@ -67,7 +66,6 @@ add_library(Pdf4QtLibCore SHARED
|
||||
sources/pdfcatalog.cpp
|
||||
sources/pdfpage.cpp
|
||||
sources/pdfstreamfilters.cpp
|
||||
sources/pdfdrawspacecontroller.cpp
|
||||
sources/pdfcolorspaces.cpp
|
||||
sources/pdfrenderer.cpp
|
||||
sources/pdfpagecontentprocessor.cpp
|
||||
@ -82,6 +80,10 @@ add_library(Pdf4QtLibCore SHARED
|
||||
sources/pdfimageconversion.cpp
|
||||
sources/pdfcolorconvertor.h
|
||||
sources/pdfcolorconvertor.cpp
|
||||
sources/pdftextlayoutgenerator.h
|
||||
sources/pdftextlayoutgenerator.cpp
|
||||
sources/pdfwidgetsnapshot.cpp
|
||||
sources/pdfwidgetsnapshot.h
|
||||
cmaps.qrc
|
||||
)
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "pdfdocument.h"
|
||||
#include "pdfencoding.h"
|
||||
#include "pdfpainter.h"
|
||||
#include "pdfdrawspacecontroller.h"
|
||||
#include "pdfcms.h"
|
||||
#include "pdfpagecontentprocessor.h"
|
||||
#include "pdfparser.h"
|
||||
@ -3114,7 +3113,7 @@ void PDFWidgetAnnotation::draw(AnnotationDrawParameters& parameters) const
|
||||
case PDFFormField::FieldType::Text:
|
||||
case PDFFormField::FieldType::Choice:
|
||||
{
|
||||
m_parameters.formManager->drawFormField(parameters, false);
|
||||
parameters.formManager->drawFormField(formField, parameters, false);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -25,11 +25,11 @@
|
||||
#include "pdfcms.h"
|
||||
#include "pdfmultimedia.h"
|
||||
#include "pdfmeshqualitysettings.h"
|
||||
#include "pdfdocumentdrawinterface.h"
|
||||
#include "pdfrenderer.h"
|
||||
#include "pdfblendfunction.h"
|
||||
#include "pdfdocument.h"
|
||||
#include "pdfcolorconvertor.h"
|
||||
#include "pdftextlayout.h"
|
||||
|
||||
#include <QCursor>
|
||||
#include <QPainterPath>
|
||||
@ -1432,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 PDF4QTLIBCORESHARED_EXPORT PDFAnnotationManager : public QObject, public IDocumentDrawInterface
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFAnnotationManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -1463,7 +1463,7 @@ public:
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
QList<PDFRenderError>& errors) const;
|
||||
|
||||
/// Set document
|
||||
/// \param document New document
|
||||
|
@ -21,9 +21,9 @@
|
||||
#include "pdfexecutionpolicy.h"
|
||||
#include "pdffont.h"
|
||||
#include "pdfcms.h"
|
||||
#include "pdfcompiler.h"
|
||||
#include "pdfconstants.h"
|
||||
#include "pdfalgorithmlcs.h"
|
||||
#include "pdfpainter.h"
|
||||
#include "pdfdbgheap.h"
|
||||
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
|
@ -18,16 +18,16 @@
|
||||
#include "pdfdocumenttextflow.h"
|
||||
#include "pdfdocument.h"
|
||||
#include "pdfstructuretree.h"
|
||||
#include "pdfcompiler.h"
|
||||
#include "pdfexecutionpolicy.h"
|
||||
#include "pdfconstants.h"
|
||||
#include "pdfcms.h"
|
||||
#include "pdftextlayoutgenerator.h"
|
||||
#include "pdfpagecontentprocessor.h"
|
||||
#include "pdfdbgheap.h"
|
||||
|
||||
namespace pdf
|
||||
{
|
||||
|
||||
|
||||
class PDFStructureTreeReferenceCollector : public PDFStructureTreeAbstractVisitor
|
||||
{
|
||||
public:
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include <QReadWriteLock>
|
||||
#include <QPainterPath>
|
||||
#include <QDataStream>
|
||||
#include <QTreeWidgetItem>
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
#include "Windows.h"
|
||||
@ -553,7 +552,7 @@ public:
|
||||
virtual bool isHorizontalWritingSystem() const = 0;
|
||||
|
||||
/// Dumps information about the font
|
||||
virtual void dumpFontToTreeItem(QTreeWidgetItem* item) const { Q_UNUSED(item); }
|
||||
virtual void dumpFontToTreeItem(ITreeFactory* treeFactory) const { Q_UNUSED(treeFactory); }
|
||||
|
||||
/// Returns postscript name of the font
|
||||
virtual QString getPostScriptName() const { return QString(); }
|
||||
@ -592,7 +591,7 @@ public:
|
||||
|
||||
virtual void fillTextSequence(const QByteArray& byteArray, TextSequence& textSequence, PDFRenderErrorReporter* reporter) override;
|
||||
virtual bool isHorizontalWritingSystem() const override { return !m_isVertical; }
|
||||
virtual void dumpFontToTreeItem(QTreeWidgetItem* item) const override;
|
||||
virtual void dumpFontToTreeItem(ITreeFactory* treeFactory) const override;
|
||||
virtual QString getPostScriptName() const override { return m_postScriptName; }
|
||||
virtual CharacterInfos getCharacterInfos() const override;
|
||||
|
||||
@ -883,33 +882,33 @@ CharacterInfos PDFRealizedFontImpl::getCharacterInfos() const
|
||||
return result;
|
||||
}
|
||||
|
||||
void PDFRealizedFontImpl::dumpFontToTreeItem(QTreeWidgetItem* item) const
|
||||
void PDFRealizedFontImpl::dumpFontToTreeItem(ITreeFactory* treeFactory) const
|
||||
{
|
||||
QTreeWidgetItem* root = new QTreeWidgetItem(item, { PDFTranslationContext::tr("Details") });
|
||||
treeFactory->pushItem({ PDFTranslationContext::tr("Details") });
|
||||
|
||||
if (m_face->family_name)
|
||||
{
|
||||
new QTreeWidgetItem(root, { PDFTranslationContext::tr("Font"), QString::fromLatin1(m_face->family_name) });
|
||||
treeFactory->addItem({ PDFTranslationContext::tr("Font"), QString::fromLatin1(m_face->family_name) });
|
||||
}
|
||||
if (m_face->style_name)
|
||||
{
|
||||
new QTreeWidgetItem(root, { PDFTranslationContext::tr("Style"), QString::fromLatin1(m_face->style_name) });
|
||||
treeFactory->addItem({ PDFTranslationContext::tr("Style"), QString::fromLatin1(m_face->style_name) });
|
||||
}
|
||||
|
||||
QString yesString = PDFTranslationContext::tr("Yes");
|
||||
QString noString = PDFTranslationContext::tr("No");
|
||||
|
||||
new QTreeWidgetItem(root, { PDFTranslationContext::tr("Glyph count"), QString::number(m_face->num_glyphs) });
|
||||
new QTreeWidgetItem(root, { PDFTranslationContext::tr("Is CID keyed"), (m_face->face_flags & FT_FACE_FLAG_CID_KEYED) ? yesString : noString });
|
||||
new QTreeWidgetItem(root, { PDFTranslationContext::tr("Is bold"), (m_face->style_flags & FT_STYLE_FLAG_BOLD) ? yesString : noString });
|
||||
new QTreeWidgetItem(root, { PDFTranslationContext::tr("Is italics"), (m_face->style_flags & FT_STYLE_FLAG_ITALIC) ? yesString : noString });
|
||||
new QTreeWidgetItem(root, { PDFTranslationContext::tr("Has vertical writing system"), (m_face->face_flags & FT_FACE_FLAG_VERTICAL) ? yesString : noString });
|
||||
new QTreeWidgetItem(root, { PDFTranslationContext::tr("Has SFNT storage scheme"), (m_face->face_flags & FT_FACE_FLAG_SFNT) ? yesString : noString });
|
||||
new QTreeWidgetItem(root, { PDFTranslationContext::tr("Has glyph names"), (m_face->face_flags & FT_FACE_FLAG_GLYPH_NAMES) ? yesString : noString });
|
||||
treeFactory->addItem( { PDFTranslationContext::tr("Glyph count"), QString::number(m_face->num_glyphs) });
|
||||
treeFactory->addItem( { PDFTranslationContext::tr("Is CID keyed"), (m_face->face_flags & FT_FACE_FLAG_CID_KEYED) ? yesString : noString });
|
||||
treeFactory->addItem( { PDFTranslationContext::tr("Is bold"), (m_face->style_flags & FT_STYLE_FLAG_BOLD) ? yesString : noString });
|
||||
treeFactory->addItem( { PDFTranslationContext::tr("Is italics"), (m_face->style_flags & FT_STYLE_FLAG_ITALIC) ? yesString : noString });
|
||||
treeFactory->addItem( { PDFTranslationContext::tr("Has vertical writing system"), (m_face->face_flags & FT_FACE_FLAG_VERTICAL) ? yesString : noString });
|
||||
treeFactory->addItem( { PDFTranslationContext::tr("Has SFNT storage scheme"), (m_face->face_flags & FT_FACE_FLAG_SFNT) ? yesString : noString });
|
||||
treeFactory->addItem( { PDFTranslationContext::tr("Has glyph names"), (m_face->face_flags & FT_FACE_FLAG_GLYPH_NAMES) ? yesString : noString });
|
||||
|
||||
if (m_face->num_charmaps > 0)
|
||||
{
|
||||
QTreeWidgetItem* encodingRoot = new QTreeWidgetItem(item, { PDFTranslationContext::tr("Encoding") });
|
||||
treeFactory->pushItem({ PDFTranslationContext::tr("Encoding") });
|
||||
for (FT_Int i = 0; i < m_face->num_charmaps; ++i)
|
||||
{
|
||||
FT_CharMap charMap = m_face->charmaps[i];
|
||||
@ -979,9 +978,12 @@ void PDFRealizedFontImpl::dumpFontToTreeItem(QTreeWidgetItem* item) const
|
||||
}
|
||||
|
||||
QString encodingString = PDFTranslationContext::tr("Platform/Encoding = %1 %2").arg(charMap->platform_id).arg(charMap->encoding_id);
|
||||
new QTreeWidgetItem(encodingRoot, { encodingName, encodingString });
|
||||
treeFactory->addItem({ encodingName, encodingString });
|
||||
}
|
||||
treeFactory->popItem();
|
||||
}
|
||||
|
||||
treeFactory->popItem();
|
||||
}
|
||||
|
||||
int PDFRealizedFontImpl::outlineMoveTo(const FT_Vector* to, void* user)
|
||||
@ -1085,9 +1087,9 @@ bool PDFRealizedFont::isHorizontalWritingSystem() const
|
||||
return m_impl->isHorizontalWritingSystem();
|
||||
}
|
||||
|
||||
void PDFRealizedFont::dumpFontToTreeItem(QTreeWidgetItem* item) const
|
||||
void PDFRealizedFont::dumpFontToTreeItem(ITreeFactory* treeFactory) const
|
||||
{
|
||||
m_impl->dumpFontToTreeItem(item);
|
||||
m_impl->dumpFontToTreeItem(treeFactory);
|
||||
}
|
||||
|
||||
QString PDFRealizedFont::getPostScriptName() const
|
||||
@ -1885,9 +1887,9 @@ PDFInteger PDFSimpleFont::getGlyphAdvance(size_t index) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PDFSimpleFont::dumpFontToTreeItem(QTreeWidgetItem* item) const
|
||||
void PDFSimpleFont::dumpFontToTreeItem(ITreeFactory* treeFactory) const
|
||||
{
|
||||
BaseClass::dumpFontToTreeItem(item);
|
||||
BaseClass::dumpFontToTreeItem(treeFactory);
|
||||
|
||||
QString encodingTypeString;
|
||||
switch (m_encodingType)
|
||||
@ -1935,7 +1937,7 @@ void PDFSimpleFont::dumpFontToTreeItem(QTreeWidgetItem* item) const
|
||||
}
|
||||
}
|
||||
|
||||
new QTreeWidgetItem(item, { PDFTranslationContext::tr("Encoding"), encodingTypeString });
|
||||
treeFactory->addItem({ PDFTranslationContext::tr("Encoding"), encodingTypeString });
|
||||
}
|
||||
|
||||
PDFType1Font::PDFType1Font(FontType fontType,
|
||||
@ -1962,9 +1964,9 @@ FontType PDFType1Font::getFontType() const
|
||||
return m_fontType;
|
||||
}
|
||||
|
||||
void PDFType1Font::dumpFontToTreeItem(QTreeWidgetItem* item) const
|
||||
void PDFType1Font::dumpFontToTreeItem(ITreeFactory* treeFactory) const
|
||||
{
|
||||
BaseClass::dumpFontToTreeItem(item);
|
||||
BaseClass::dumpFontToTreeItem(treeFactory);
|
||||
|
||||
if (m_standardFontType != StandardFontType::Invalid)
|
||||
{
|
||||
@ -2005,7 +2007,7 @@ void PDFType1Font::dumpFontToTreeItem(QTreeWidgetItem* item) const
|
||||
break;
|
||||
}
|
||||
|
||||
new QTreeWidgetItem(item, { PDFTranslationContext::tr("Standard font"), standardFontTypeString });
|
||||
treeFactory->addItem({ PDFTranslationContext::tr("Standard font"), standardFontTypeString });
|
||||
}
|
||||
}
|
||||
|
||||
@ -2598,9 +2600,9 @@ FontType PDFType3Font::getFontType() const
|
||||
return FontType::Type3;
|
||||
}
|
||||
|
||||
void PDFType3Font::dumpFontToTreeItem(QTreeWidgetItem* item) const
|
||||
void PDFType3Font::dumpFontToTreeItem(ITreeFactory* treeFactory) const
|
||||
{
|
||||
new QTreeWidgetItem(item, { PDFTranslationContext::tr("Character count"), QString::number(m_characterContentStreams.size()) });
|
||||
treeFactory->addItem({ PDFTranslationContext::tr("Character count"), QString::number(m_characterContentStreams.size()) });
|
||||
}
|
||||
|
||||
double PDFType3Font::getWidth(int characterIndex) const
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include <unordered_map>
|
||||
|
||||
class QPainterPath;
|
||||
class QTreeWidgetItem;
|
||||
|
||||
namespace pdf
|
||||
{
|
||||
@ -56,6 +55,16 @@ enum class TextRenderingMode
|
||||
Clip = 7
|
||||
};
|
||||
|
||||
class ITreeFactory
|
||||
{
|
||||
public:
|
||||
virtual ~ITreeFactory() = default;
|
||||
|
||||
virtual void pushItem(QStringList texts) = 0;
|
||||
virtual void addItem(QStringList texts) = 0;
|
||||
virtual void popItem() = 0;
|
||||
};
|
||||
|
||||
/// Item of the text sequence (either single character, or advance)
|
||||
struct TextSequenceItem
|
||||
{
|
||||
@ -261,7 +270,7 @@ public:
|
||||
bool isHorizontalWritingSystem() const;
|
||||
|
||||
/// Adds information about the font into tree item
|
||||
void dumpFontToTreeItem(QTreeWidgetItem* item) const;
|
||||
void dumpFontToTreeItem(ITreeFactory* treeFactory) const;
|
||||
|
||||
/// Returns postscript name of the font
|
||||
QString getPostScriptName() const;
|
||||
@ -303,7 +312,7 @@ public:
|
||||
const CIDSystemInfo* getCIDSystemInfo() const { return &m_CIDSystemInfo; }
|
||||
|
||||
/// Adds information about the font into tree item
|
||||
virtual void dumpFontToTreeItem(QTreeWidgetItem* item) const { Q_UNUSED(item); }
|
||||
virtual void dumpFontToTreeItem(ITreeFactory* treeFactory) const { Q_UNUSED(treeFactory); }
|
||||
|
||||
/// Creates font from the object. If font can't be created, exception is thrown.
|
||||
/// \param object Font dictionary
|
||||
@ -351,7 +360,7 @@ public:
|
||||
/// Returns the glyph advance (or zero, if glyph advance is invalid)
|
||||
PDFInteger getGlyphAdvance(size_t index) const;
|
||||
|
||||
virtual void dumpFontToTreeItem(QTreeWidgetItem* item) const override;
|
||||
virtual void dumpFontToTreeItem(ITreeFactory* treeFactory) const override;
|
||||
|
||||
protected:
|
||||
QByteArray m_name;
|
||||
@ -384,7 +393,7 @@ public:
|
||||
virtual ~PDFType1Font() override = default;
|
||||
|
||||
virtual FontType getFontType() const override;
|
||||
virtual void dumpFontToTreeItem(QTreeWidgetItem*item) const override;
|
||||
virtual void dumpFontToTreeItem(ITreeFactory* treeFactory) const override;
|
||||
|
||||
/// Returns the assigned standard font (or invalid, if font is not standard)
|
||||
StandardFontType getStandardFontType() const { return m_standardFontType; }
|
||||
@ -598,7 +607,7 @@ public:
|
||||
PDFFontCMap toUnicode);
|
||||
|
||||
virtual FontType getFontType() const override;
|
||||
virtual void dumpFontToTreeItem(QTreeWidgetItem*item) const override;
|
||||
virtual void dumpFontToTreeItem(ITreeFactory* treeFactory) const override;
|
||||
virtual const PDFFontCMap* getToUnicode() const override { return &m_toUnicode; }
|
||||
|
||||
/// Returns width of the character. If character doesn't exist, then zero is returned.
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
#include "pdfform.h"
|
||||
#include "pdfdocument.h"
|
||||
#include "pdfdrawspacecontroller.h"
|
||||
#include "pdfdocumentbuilder.h"
|
||||
#include "pdfpainterutils.h"
|
||||
#include "pdfdbgheap.h"
|
||||
@ -912,6 +911,19 @@ bool PDFFormManager::isEditorDrawEnabled(const PDFObjectReference& reference) co
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PDFFormManager::isEditorDrawEnabled(const PDFFormField* formField) const
|
||||
{
|
||||
Q_UNUSED(formField);
|
||||
return false;
|
||||
}
|
||||
|
||||
void PDFFormManager::drawFormField(const PDFFormField* formField, AnnotationDrawParameters& parameters, bool edit) const
|
||||
{
|
||||
Q_UNUSED(formField);
|
||||
Q_UNUSED(parameters);
|
||||
Q_UNUSED(edit);
|
||||
}
|
||||
|
||||
void PDFFormManager::updateFieldValues()
|
||||
{
|
||||
if (m_document)
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "pdfobject.h"
|
||||
#include "pdfdocument.h"
|
||||
#include "pdfannotation.h"
|
||||
#include "pdfdocumentdrawinterface.h"
|
||||
#include "pdfsignaturehandler.h"
|
||||
#include "pdfxfaengine.h"
|
||||
|
||||
|
@ -23,8 +23,8 @@
|
||||
#include "pdfrenderer.h"
|
||||
#include "pdfpagecontentprocessor.h"
|
||||
#include "pdftextlayout.h"
|
||||
#include "pdfsnapper.h"
|
||||
#include "pdfcolorconvertor.h"
|
||||
#include "pdfsnapper.h"
|
||||
|
||||
#include <QPen>
|
||||
#include <QBrush>
|
||||
|
@ -16,9 +16,10 @@
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "pdfsnapper.h"
|
||||
#include "pdfcompiler.h"
|
||||
#include "pdfdrawspacecontroller.h"
|
||||
#include "pdfutils.h"
|
||||
#include "pdfdbgheap.h"
|
||||
#include "pdfpainter.h"
|
||||
#include "pdfwidgetsnapshot.h"
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
|
71
Pdf4QtLibCore/sources/pdftextlayoutgenerator.cpp
Normal file
71
Pdf4QtLibCore/sources/pdftextlayoutgenerator.cpp
Normal file
@ -0,0 +1,71 @@
|
||||
// Copyright (C) 2023 Jakub Melka
|
||||
//
|
||||
// This file is part of PDF4QT.
|
||||
//
|
||||
// PDF4QT is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// with the written consent of the copyright owner, any later version.
|
||||
//
|
||||
// PDF4QT is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "pdftextlayoutgenerator.h"
|
||||
|
||||
namespace pdf
|
||||
{
|
||||
|
||||
PDFTextLayout PDFTextLayoutGenerator::createTextLayout()
|
||||
{
|
||||
m_textLayout.perform();
|
||||
m_textLayout.optimize();
|
||||
return qMove(m_textLayout);
|
||||
}
|
||||
|
||||
bool PDFTextLayoutGenerator::isContentSuppressedByOC(PDFObjectReference ocgOrOcmd)
|
||||
{
|
||||
if (m_features.testFlag(PDFRenderer::IgnoreOptionalContent))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return PDFPageContentProcessor::isContentSuppressedByOC(ocgOrOcmd);
|
||||
}
|
||||
|
||||
bool PDFTextLayoutGenerator::isContentKindSuppressed(ContentKind kind) const
|
||||
{
|
||||
switch (kind)
|
||||
{
|
||||
case ContentKind::Shapes:
|
||||
case ContentKind::Text:
|
||||
case ContentKind::Images:
|
||||
case ContentKind::Shading:
|
||||
return true;
|
||||
|
||||
case ContentKind::Tiling:
|
||||
return false; // Tiling can have text
|
||||
|
||||
default:
|
||||
{
|
||||
Q_ASSERT(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void PDFTextLayoutGenerator::performOutputCharacter(const PDFTextCharacterInfo& info)
|
||||
{
|
||||
if (!isContentSuppressed() && !info.character.isSpace())
|
||||
{
|
||||
m_textLayout.addCharacter(info);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace pdf
|
55
Pdf4QtLibCore/sources/pdftextlayoutgenerator.h
Normal file
55
Pdf4QtLibCore/sources/pdftextlayoutgenerator.h
Normal file
@ -0,0 +1,55 @@
|
||||
// Copyright (C) 2023 Jakub Melka
|
||||
//
|
||||
// This file is part of PDF4QT.
|
||||
//
|
||||
// PDF4QT is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// with the written consent of the copyright owner, any later version.
|
||||
//
|
||||
// PDF4QT is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "pdfpagecontentprocessor.h"
|
||||
|
||||
namespace pdf
|
||||
{
|
||||
|
||||
class PDFTextLayoutGenerator : public PDFPageContentProcessor
|
||||
{
|
||||
using BaseClass = PDFPageContentProcessor;
|
||||
|
||||
public:
|
||||
explicit PDFTextLayoutGenerator(PDFRenderer::Features features,
|
||||
const PDFPage* page,
|
||||
const PDFDocument* document,
|
||||
const PDFFontCache* fontCache,
|
||||
const PDFCMS* cms,
|
||||
const PDFOptionalContentActivity* optionalContentActivity,
|
||||
QTransform pagePointToDevicePointMatrix,
|
||||
const PDFMeshQualitySettings& meshQualitySettings) :
|
||||
BaseClass(page, document, fontCache, cms, optionalContentActivity, pagePointToDevicePointMatrix, meshQualitySettings),
|
||||
m_features(features)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// Creates text layout from the text
|
||||
PDFTextLayout createTextLayout();
|
||||
|
||||
protected:
|
||||
virtual bool isContentSuppressedByOC(PDFObjectReference ocgOrOcmd) override;
|
||||
virtual bool isContentKindSuppressed(ContentKind kind) const override;
|
||||
virtual void performOutputCharacter(const PDFTextCharacterInfo& info) override;
|
||||
|
||||
private:
|
||||
PDFRenderer::Features m_features;
|
||||
PDFTextLayout m_textLayout;
|
||||
};
|
||||
|
||||
} // namespace pdf
|
34
Pdf4QtLibCore/sources/pdfwidgetsnapshot.cpp
Normal file
34
Pdf4QtLibCore/sources/pdfwidgetsnapshot.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
// Copyright (C) 2023 Jakub Melka
|
||||
//
|
||||
// This file is part of PDF4QT.
|
||||
//
|
||||
// PDF4QT is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// with the written consent of the copyright owner, any later version.
|
||||
//
|
||||
// PDF4QT is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "pdfwidgetsnapshot.h"
|
||||
|
||||
namespace pdf
|
||||
{
|
||||
|
||||
const PDFWidgetSnapshot::SnapshotItem* PDFWidgetSnapshot::getPageSnapshot(PDFInteger pageIndex) const
|
||||
{
|
||||
auto it = std::find_if(items.cbegin(), items.cend(), [pageIndex](const auto& item) { return item.pageIndex == pageIndex; });
|
||||
if (it != items.cend())
|
||||
{
|
||||
return &*it;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace pdf
|
45
Pdf4QtLibCore/sources/pdfwidgetsnapshot.h
Normal file
45
Pdf4QtLibCore/sources/pdfwidgetsnapshot.h
Normal file
@ -0,0 +1,45 @@
|
||||
// Copyright (C) 2023 Jakub Melka
|
||||
//
|
||||
// This file is part of PDF4QT.
|
||||
//
|
||||
// PDF4QT is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// with the written consent of the copyright owner, any later version.
|
||||
//
|
||||
// PDF4QT is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "pdfglobal.h"
|
||||
|
||||
#include <QRectF>
|
||||
#include <QTransform>
|
||||
|
||||
namespace pdf
|
||||
{
|
||||
class PDFPrecompiledPage;
|
||||
|
||||
/// Snapshot for current widget viewable items.
|
||||
struct PDFWidgetSnapshot
|
||||
{
|
||||
struct SnapshotItem
|
||||
{
|
||||
PDFInteger pageIndex = -1; ///< Index of page
|
||||
QRectF rect; ///< Page rectangle on viewport
|
||||
QTransform pageToDeviceMatrix; ///< Transforms page coordinates to widget coordinates
|
||||
const PDFPrecompiledPage* compiledPage = nullptr; ///< Compiled page (can be nullptr)
|
||||
};
|
||||
|
||||
bool hasPage(PDFInteger pageIndex) const { return getPageSnapshot(pageIndex) != nullptr; }
|
||||
const SnapshotItem* getPageSnapshot(PDFInteger pageIndex) const;
|
||||
|
||||
using SnapshotItems = std::vector<SnapshotItem>;
|
||||
SnapshotItems items;
|
||||
};
|
||||
|
||||
} // namespace pdf
|
@ -57,13 +57,19 @@ add_library(Pdf4QtLibWidgets SHARED
|
||||
sources/pdfwidgetformmanager.cpp
|
||||
sources/pdftexteditpseudowidget.cpp
|
||||
sources/pdftexteditpseudowidget.h
|
||||
sources/pdfdrawspacecontroller.cpp
|
||||
sources/pdfdrawspacecontroller.h
|
||||
sources/pdfcompiler.cpp
|
||||
sources/pdfcompiler.h
|
||||
sources/pdfdocumentdrawinterface.h
|
||||
sources/pdfwidgetsglobal.h
|
||||
)
|
||||
|
||||
include(GenerateExportHeader)
|
||||
|
||||
GENERATE_EXPORT_HEADER(Pdf4QtLibWidgets
|
||||
EXPORT_MACRO_NAME
|
||||
PDF4QTLIBCORESHARED_EXPORT
|
||||
PDF4QTLIBWIDGETSSHARED_EXPORT
|
||||
EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/pdf4qtlibwidgets_export.h")
|
||||
|
||||
if(PDF4QT_ENABLE_OPENGL)
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "pdfdrawwidget.h"
|
||||
#include "pdfutils.h"
|
||||
#include "pdfcompiler.h"
|
||||
#include "pdfwidgetformmanager.h"
|
||||
#include "pdfdbgheap.h"
|
||||
|
||||
#include <QActionGroup>
|
||||
|
@ -18,6 +18,7 @@
|
||||
#ifndef PDFADVANCEDTOOLS_H
|
||||
#define PDFADVANCEDTOOLS_H
|
||||
|
||||
#include "pdfwidgetsglobal.h"
|
||||
#include "pdfwidgettool.h"
|
||||
#include "pdfannotation.h"
|
||||
|
||||
@ -29,7 +30,7 @@ namespace pdf
|
||||
/// Tool that creates 'sticky note' annotations. Multiple types of sticky
|
||||
/// notes are available, user can select a type of sticky note. When
|
||||
/// user select a point, popup window appears and user can enter a text.
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFCreateStickyNoteTool : public PDFWidgetTool
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFCreateStickyNoteTool : public PDFWidgetTool
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -52,7 +53,7 @@ private:
|
||||
TextAnnotationIcon m_icon;
|
||||
};
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFCreateAnnotationTool : public PDFWidgetTool
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFCreateAnnotationTool : public PDFWidgetTool
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -69,7 +70,7 @@ protected:
|
||||
/// Tool that creates url link annotation. Multiple types of link highlights
|
||||
/// are available, user can select a link highlight. When link annotation
|
||||
/// is clicked, url address is triggered.
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFCreateHyperlinkTool : public PDFCreateAnnotationTool
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFCreateHyperlinkTool : public PDFCreateAnnotationTool
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -91,7 +92,7 @@ private:
|
||||
};
|
||||
|
||||
/// Tool that creates free text note without callout line.
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFCreateFreeTextTool : public PDFCreateAnnotationTool
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFCreateFreeTextTool : public PDFCreateAnnotationTool
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -109,7 +110,7 @@ private:
|
||||
};
|
||||
|
||||
/// Tool that creates line/polyline/polygon annotations.
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFCreateLineTypeTool : public PDFCreateAnnotationTool
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFCreateLineTypeTool : public PDFCreateAnnotationTool
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -160,7 +161,7 @@ private:
|
||||
};
|
||||
|
||||
/// Tool that creates ellipse annotation.
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFCreateEllipseTool : public PDFCreateAnnotationTool
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFCreateEllipseTool : public PDFCreateAnnotationTool
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -196,7 +197,7 @@ private:
|
||||
QColor m_fillColor;
|
||||
};
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFCreateFreehandCurveTool : public PDFCreateAnnotationTool
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFCreateFreehandCurveTool : public PDFCreateAnnotationTool
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -234,7 +235,7 @@ private:
|
||||
|
||||
/// Tool that creates 'stamp' annotations. Multiple types of stamps
|
||||
/// are available, user can select a type of stamp (text).
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFCreateStampTool : public PDFWidgetTool
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFCreateStampTool : public PDFWidgetTool
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -267,7 +268,7 @@ private:
|
||||
};
|
||||
|
||||
/// Tool for highlighting of text in document
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFCreateHighlightTextTool : public PDFWidgetTool
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFCreateHighlightTextTool : public PDFWidgetTool
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -319,7 +320,7 @@ private:
|
||||
|
||||
/// Tool that creates redaction annotation from rectangle. Rectangle is not
|
||||
/// selected from the text, it is just any rectangle.
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFCreateRedactRectangleTool : public PDFCreateAnnotationTool
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFCreateRedactRectangleTool : public PDFCreateAnnotationTool
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -337,7 +338,7 @@ private:
|
||||
};
|
||||
|
||||
/// Tool for redaction of text in document. Creates redaction annotation from text selection.
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFCreateRedactTextTool : public PDFWidgetTool
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFCreateRedactTextTool : public PDFWidgetTool
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#ifndef PDFCERTIFICATEMANAGERDIALOG_H
|
||||
#define PDFCERTIFICATEMANAGERDIALOG_H
|
||||
|
||||
#include "pdfwidgetsglobal.h"
|
||||
#include "pdfcertificatemanager.h"
|
||||
|
||||
#include <QDialog>
|
||||
@ -33,7 +34,7 @@ class PDFCertificateManagerDialog;
|
||||
namespace pdf
|
||||
{
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFCertificateManagerDialog : public QDialog
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFCertificateManagerDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -17,9 +17,10 @@
|
||||
|
||||
#include "pdfcompiler.h"
|
||||
#include "pdfcms.h"
|
||||
#include "pdfdrawspacecontroller.h"
|
||||
#include "pdfprogress.h"
|
||||
#include "pdfexecutionpolicy.h"
|
||||
#include "pdftextlayoutgenerator.h"
|
||||
#include "pdfdrawspacecontroller.h"
|
||||
#include "pdfdbgheap.h"
|
||||
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
@ -321,54 +322,6 @@ void PDFAsynchronousPageCompiler::onPageCompiled()
|
||||
}
|
||||
}
|
||||
|
||||
PDFTextLayout PDFTextLayoutGenerator::createTextLayout()
|
||||
{
|
||||
m_textLayout.perform();
|
||||
m_textLayout.optimize();
|
||||
return qMove(m_textLayout);
|
||||
}
|
||||
|
||||
bool PDFTextLayoutGenerator::isContentSuppressedByOC(PDFObjectReference ocgOrOcmd)
|
||||
{
|
||||
if (m_features.testFlag(PDFRenderer::IgnoreOptionalContent))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return PDFPageContentProcessor::isContentSuppressedByOC(ocgOrOcmd);
|
||||
}
|
||||
|
||||
bool PDFTextLayoutGenerator::isContentKindSuppressed(ContentKind kind) const
|
||||
{
|
||||
switch (kind)
|
||||
{
|
||||
case ContentKind::Shapes:
|
||||
case ContentKind::Text:
|
||||
case ContentKind::Images:
|
||||
case ContentKind::Shading:
|
||||
return true;
|
||||
|
||||
case ContentKind::Tiling:
|
||||
return false; // Tiling can have text
|
||||
|
||||
default:
|
||||
{
|
||||
Q_ASSERT(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void PDFTextLayoutGenerator::performOutputCharacter(const PDFTextCharacterInfo& info)
|
||||
{
|
||||
if (!isContentSuppressed() && !info.character.isSpace())
|
||||
{
|
||||
m_textLayout.addCharacter(info);
|
||||
}
|
||||
}
|
||||
|
||||
PDFAsynchronousTextLayoutCompiler::PDFAsynchronousTextLayoutCompiler(PDFDrawWidgetProxy* proxy) :
|
||||
BaseClass(proxy),
|
||||
m_proxy(proxy),
|
@ -18,6 +18,7 @@
|
||||
#ifndef PDFCOMPILER_H
|
||||
#define PDFCOMPILER_H
|
||||
|
||||
#include "pdfwidgetsglobal.h"
|
||||
#include "pdfrenderer.h"
|
||||
#include "pdfpainter.h"
|
||||
#include "pdftextlayout.h"
|
||||
@ -148,7 +149,7 @@ private:
|
||||
std::map<PDFInteger, CompileTask> m_tasks;
|
||||
};
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFAsynchronousTextLayoutCompiler : public QObject
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFAsynchronousTextLayoutCompiler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -226,38 +227,6 @@ private:
|
||||
PDFTextLayoutCache m_cache;
|
||||
};
|
||||
|
||||
class PDFTextLayoutGenerator : public PDFPageContentProcessor
|
||||
{
|
||||
using BaseClass = PDFPageContentProcessor;
|
||||
|
||||
public:
|
||||
explicit PDFTextLayoutGenerator(PDFRenderer::Features features,
|
||||
const PDFPage* page,
|
||||
const PDFDocument* document,
|
||||
const PDFFontCache* fontCache,
|
||||
const PDFCMS* cms,
|
||||
const PDFOptionalContentActivity* optionalContentActivity,
|
||||
QTransform pagePointToDevicePointMatrix,
|
||||
const PDFMeshQualitySettings& meshQualitySettings) :
|
||||
BaseClass(page, document, fontCache, cms, optionalContentActivity, pagePointToDevicePointMatrix, meshQualitySettings),
|
||||
m_features(features)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// Creates text layout from the text
|
||||
PDFTextLayout createTextLayout();
|
||||
|
||||
protected:
|
||||
virtual bool isContentSuppressedByOC(PDFObjectReference ocgOrOcmd) override;
|
||||
virtual bool isContentKindSuppressed(ContentKind kind) const override;
|
||||
virtual void performOutputCharacter(const PDFTextCharacterInfo& info) override;
|
||||
|
||||
private:
|
||||
PDFRenderer::Features m_features;
|
||||
PDFTextLayout m_textLayout;
|
||||
};
|
||||
|
||||
} // namespace pdf
|
||||
|
||||
#endif // PDFCOMPILER_H
|
@ -18,6 +18,7 @@
|
||||
#ifndef PDFCREATECERTIFICATEDIALOG_H
|
||||
#define PDFCREATECERTIFICATEDIALOG_H
|
||||
|
||||
#include "pdfwidgetsglobal.h"
|
||||
#include "pdfcertificatemanager.h"
|
||||
|
||||
#include <QDialog>
|
||||
@ -30,7 +31,7 @@ class PDFCreateCertificateDialog;
|
||||
namespace pdf
|
||||
{
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFCreateCertificateDialog : public QDialog
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFCreateCertificateDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#ifndef PDFDOCUMENTDRAWINTERFACE_H
|
||||
#define PDFDOCUMENTDRAWINTERFACE_H
|
||||
|
||||
#include "pdfwidgetsglobal.h"
|
||||
#include "pdfglobal.h"
|
||||
#include "pdfexception.h"
|
||||
|
||||
@ -33,7 +34,7 @@ namespace pdf
|
||||
class PDFPrecompiledPage;
|
||||
class PDFTextLayoutGetter;
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT IDocumentDrawInterface
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT IDocumentDrawInterface
|
||||
{
|
||||
public:
|
||||
explicit inline IDocumentDrawInterface() = default;
|
@ -22,6 +22,7 @@
|
||||
#include "pdfconstants.h"
|
||||
#include "pdfcms.h"
|
||||
#include "pdfannotation.h"
|
||||
#include "pdfdrawwidget.h"
|
||||
#include "pdfdbgheap.h"
|
||||
|
||||
#include <QTimer>
|
||||
@ -1609,15 +1610,4 @@ void IDocumentDrawInterface::drawPostRendering(QPainter* painter, QRect rect) co
|
||||
Q_UNUSED(rect);
|
||||
}
|
||||
|
||||
const PDFWidgetSnapshot::SnapshotItem* PDFWidgetSnapshot::getPageSnapshot(PDFInteger pageIndex) const
|
||||
{
|
||||
auto it = std::find_if(items.cbegin(), items.cend(), [pageIndex](const auto& item) { return item.pageIndex == pageIndex; });
|
||||
if (it != items.cend())
|
||||
{
|
||||
return &*it;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace pdf
|
@ -18,11 +18,13 @@
|
||||
#ifndef PDFDRAWSPACECONTROLLER_H
|
||||
#define PDFDRAWSPACECONTROLLER_H
|
||||
|
||||
#include "pdfwidgetsglobal.h"
|
||||
#include "pdfglobal.h"
|
||||
#include "pdfdocument.h"
|
||||
#include "pdfrenderer.h"
|
||||
#include "pdffont.h"
|
||||
#include "pdfdocumentdrawinterface.h"
|
||||
#include "pdfwidgetsnapshot.h"
|
||||
|
||||
#include <QRectF>
|
||||
#include <QObject>
|
||||
@ -174,27 +176,9 @@ private:
|
||||
PDFFontCache m_fontCache;
|
||||
};
|
||||
|
||||
/// Snapshot for current widget viewable items.
|
||||
struct PDFWidgetSnapshot
|
||||
{
|
||||
struct SnapshotItem
|
||||
{
|
||||
PDFInteger pageIndex = -1; ///< Index of page
|
||||
QRectF rect; ///< Page rectangle on viewport
|
||||
QTransform pageToDeviceMatrix; ///< Transforms page coordinates to widget coordinates
|
||||
const PDFPrecompiledPage* compiledPage = nullptr; ///< Compiled page (can be nullptr)
|
||||
};
|
||||
|
||||
bool hasPage(PDFInteger pageIndex) const { return getPageSnapshot(pageIndex) != nullptr; }
|
||||
const SnapshotItem* getPageSnapshot(PDFInteger pageIndex) const;
|
||||
|
||||
using SnapshotItems = std::vector<SnapshotItem>;
|
||||
SnapshotItems items;
|
||||
};
|
||||
|
||||
/// 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 PDF4QTLIBCORESHARED_EXPORT PDFDrawWidgetProxy : public QObject
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFDrawWidgetProxy : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -20,7 +20,8 @@
|
||||
#include "pdfcompiler.h"
|
||||
#include "pdfwidgettool.h"
|
||||
#include "pdfannotation.h"
|
||||
#include "pdfform.h"
|
||||
#include "pdfwidgetannotation.h"
|
||||
#include "pdfwidgetformmanager.h"
|
||||
#include "pdfdbgheap.h"
|
||||
|
||||
#include <QPainter>
|
||||
@ -231,12 +232,12 @@ RendererEngine PDFWidget::getEffectiveRenderer(RendererEngine rendererEngine)
|
||||
return rendererEngine;
|
||||
}
|
||||
|
||||
PDFFormManager* PDFWidget::getFormManager() const
|
||||
PDFWidgetFormManager* PDFWidget::getFormManager() const
|
||||
{
|
||||
return m_formManager;
|
||||
}
|
||||
|
||||
void PDFWidget::setFormManager(PDFFormManager* formManager)
|
||||
void PDFWidget::setFormManager(PDFWidgetFormManager* formManager)
|
||||
{
|
||||
removeInputInterface(m_formManager);
|
||||
m_formManager = formManager;
|
||||
|
@ -18,6 +18,7 @@
|
||||
#ifndef PDFDRAWWIDGET_H
|
||||
#define PDFDRAWWIDGET_H
|
||||
|
||||
#include "pdfwidgetsglobal.h"
|
||||
#include "pdfglobal.h"
|
||||
#include "pdfrenderer.h"
|
||||
|
||||
@ -34,7 +35,7 @@ class PDFDocument;
|
||||
class PDFCMSManager;
|
||||
class PDFToolManager;
|
||||
class PDFDrawWidget;
|
||||
class PDFFormManager;
|
||||
class PDFWidgetFormManager;
|
||||
class PDFDrawWidgetProxy;
|
||||
class PDFModifiedDocument;
|
||||
class PDFWidgetAnnotationManager;
|
||||
@ -54,7 +55,7 @@ public:
|
||||
virtual bool doEvent(QEvent* event) = 0;
|
||||
};
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFWidget : public QWidget
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -102,8 +103,8 @@ public:
|
||||
void setToolManager(PDFToolManager* toolManager);
|
||||
void setAnnotationManager(PDFWidgetAnnotationManager* annotationManager);
|
||||
|
||||
PDFFormManager* getFormManager() const;
|
||||
void setFormManager(PDFFormManager* formManager);
|
||||
PDFWidgetFormManager* getFormManager() const;
|
||||
void setFormManager(PDFWidgetFormManager* formManager);
|
||||
|
||||
void removeInputInterface(IDrawWidgetInputInterface* inputInterface);
|
||||
void addInputInterface(IDrawWidgetInputInterface* inputInterface);
|
||||
@ -123,7 +124,7 @@ private:
|
||||
const PDFCMSManager* m_cmsManager;
|
||||
PDFToolManager* m_toolManager;
|
||||
PDFWidgetAnnotationManager* m_annotationManager;
|
||||
PDFFormManager* m_formManager;
|
||||
PDFWidgetFormManager* m_formManager;
|
||||
IDrawWidget* m_drawWidget;
|
||||
QScrollBar* m_horizontalScrollBar;
|
||||
QScrollBar* m_verticalScrollBar;
|
||||
|
@ -18,6 +18,7 @@
|
||||
#ifndef PDFITEMMODELS_H
|
||||
#define PDFITEMMODELS_H
|
||||
|
||||
#include "pdfwidgetsglobal.h"
|
||||
#include "pdfglobal.h"
|
||||
#include "pdfobject.h"
|
||||
|
||||
@ -39,7 +40,7 @@ class PDFDrawWidgetProxy;
|
||||
class PDFDestination;
|
||||
|
||||
/// Represents tree item in the GUI tree
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFTreeItem
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFTreeItem
|
||||
{
|
||||
public:
|
||||
inline explicit PDFTreeItem() = default;
|
||||
@ -89,7 +90,7 @@ private:
|
||||
/// 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 PDF4QTLIBCORESHARED_EXPORT PDFTreeItemModel : public QAbstractItemModel
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFTreeItemModel : public QAbstractItemModel
|
||||
{
|
||||
public:
|
||||
explicit PDFTreeItemModel(QObject* parent);
|
||||
@ -132,7 +133,7 @@ private:
|
||||
bool m_locked; ///< Node is locked (user can't change it)
|
||||
};
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFOptionalContentTreeItemModel : public PDFTreeItemModel
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFOptionalContentTreeItemModel : public PDFTreeItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -167,7 +168,7 @@ private:
|
||||
QSharedPointer<PDFOutlineItem> m_outlineItem;
|
||||
};
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFOutlineTreeItemModel : public PDFTreeItemModel
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFOutlineTreeItemModel : public PDFTreeItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -221,7 +222,7 @@ private:
|
||||
mutable QSharedPointer<PDFOutlineItem> m_dragDropItem;
|
||||
};
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFSelectableOutlineTreeItemModel : public PDFOutlineTreeItemModel
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFSelectableOutlineTreeItemModel : public PDFOutlineTreeItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -264,7 +265,7 @@ private:
|
||||
std::unique_ptr<PDFFileSpecification> m_fileSpecification;
|
||||
};
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFAttachmentsTreeItemModel : public PDFTreeItemModel
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFAttachmentsTreeItemModel : public PDFTreeItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -289,7 +290,7 @@ public:
|
||||
const PDFFileSpecification* getFileSpecification(const QModelIndex& index) const;
|
||||
};
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFThumbnailsItemModel : public QAbstractItemModel
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFThumbnailsItemModel : public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#ifndef PDFPAGECONTENTEDITORSTYLESETTINGS_H
|
||||
#define PDFPAGECONTENTEDITORSTYLESETTINGS_H
|
||||
|
||||
#include "pdfwidgetsglobal.h"
|
||||
#include "pdfglobal.h"
|
||||
|
||||
#include <QPen>
|
||||
@ -38,7 +39,7 @@ namespace pdf
|
||||
{
|
||||
class PDFPageContentElement;
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFPageContentEditorStyleSettings : public QWidget
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFPageContentEditorStyleSettings : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#ifndef PDFPAGECONTENTEDITORTOOLS_H
|
||||
#define PDFPAGECONTENTEDITORTOOLS_H
|
||||
|
||||
#include "pdfwidgetsglobal.h"
|
||||
#include "pdfwidgettool.h"
|
||||
|
||||
namespace pdf
|
||||
@ -33,7 +34,7 @@ class PDFPageContentElementRectangle;
|
||||
class PDFPageContentElementFreehandCurve;
|
||||
class PDFTextEditPseudowidget;
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFCreatePCElementTool : public PDFWidgetTool
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFCreatePCElementTool : public PDFWidgetTool
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -58,7 +59,7 @@ protected:
|
||||
};
|
||||
|
||||
/// Tool that creates rectangle element.
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFCreatePCElementRectangleTool : public PDFCreatePCElementTool
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFCreatePCElementRectangleTool : public PDFCreatePCElementTool
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -91,7 +92,7 @@ private:
|
||||
};
|
||||
|
||||
/// Tool that displays SVG image (or raster image)
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFCreatePCElementImageTool : public PDFCreatePCElementTool
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFCreatePCElementImageTool : public PDFCreatePCElementTool
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -131,7 +132,7 @@ private:
|
||||
};
|
||||
|
||||
/// Tool that creates line element.
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFCreatePCElementLineTool : public PDFCreatePCElementTool
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFCreatePCElementLineTool : public PDFCreatePCElementTool
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -167,7 +168,7 @@ private:
|
||||
};
|
||||
|
||||
/// Tool that creates dot element.
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFCreatePCElementDotTool : public PDFCreatePCElementTool
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFCreatePCElementDotTool : public PDFCreatePCElementTool
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -199,7 +200,7 @@ private:
|
||||
};
|
||||
|
||||
/// Tool that creates freehand curve element.
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFCreatePCElementFreehandCurveTool : public PDFCreatePCElementTool
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFCreatePCElementFreehandCurveTool : public PDFCreatePCElementTool
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -237,7 +238,7 @@ private:
|
||||
};
|
||||
|
||||
/// Tool that displays SVG image
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFCreatePCElementTextTool : public PDFCreatePCElementTool
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFCreatePCElementTextTool : public PDFCreatePCElementTool
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#ifndef PDFPAGECONTENTEDITORWIDGET_H
|
||||
#define PDFPAGECONTENTEDITORWIDGET_H
|
||||
|
||||
#include "pdfwidgetsglobal.h"
|
||||
#include "pdfglobal.h"
|
||||
|
||||
#include <QDockWidget>
|
||||
@ -38,7 +39,7 @@ class PDFPageContentScene;
|
||||
class PDFPageContentElement;
|
||||
class PDFPageContentEditorStyleSettings;
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFPageContentEditorWidget : public QDockWidget
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFPageContentEditorWidget : public QDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#ifndef PDFPAGECONTENTELEMENTS_H
|
||||
#define PDFPAGECONTENTELEMENTS_H
|
||||
|
||||
#include "pdfwidgetsglobal.h"
|
||||
#include "pdfdocumentdrawinterface.h"
|
||||
|
||||
#include <QPen>
|
||||
@ -36,7 +37,7 @@ class PDFWidget;
|
||||
class PDFDocument;
|
||||
class PDFPageContentScene;
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFPageContentElement
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFPageContentElement
|
||||
{
|
||||
public:
|
||||
explicit PDFPageContentElement() = default;
|
||||
@ -117,7 +118,7 @@ protected:
|
||||
PDFInteger m_pageIndex = -1;
|
||||
};
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFPageContentStyledElement : public PDFPageContentElement
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFPageContentStyledElement : public PDFPageContentElement
|
||||
{
|
||||
public:
|
||||
explicit PDFPageContentStyledElement() = default;
|
||||
@ -134,7 +135,7 @@ protected:
|
||||
QBrush m_brush;
|
||||
};
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFPageContentElementRectangle : public PDFPageContentStyledElement
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFPageContentElementRectangle : public PDFPageContentStyledElement
|
||||
{
|
||||
public:
|
||||
virtual ~PDFPageContentElementRectangle() = default;
|
||||
@ -167,7 +168,7 @@ private:
|
||||
QRectF m_rectangle;
|
||||
};
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFPageContentElementLine : public PDFPageContentStyledElement
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFPageContentElementLine : public PDFPageContentStyledElement
|
||||
{
|
||||
public:
|
||||
virtual ~PDFPageContentElementLine() = default;
|
||||
@ -207,7 +208,7 @@ private:
|
||||
QLineF m_line;
|
||||
};
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFPageContentElementDot : public PDFPageContentStyledElement
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFPageContentElementDot : public PDFPageContentStyledElement
|
||||
{
|
||||
public:
|
||||
virtual ~PDFPageContentElementDot() = default;
|
||||
@ -236,7 +237,7 @@ private:
|
||||
QPointF m_point;
|
||||
};
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFPageContentElementFreehandCurve : public PDFPageContentStyledElement
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFPageContentElementFreehandCurve : public PDFPageContentStyledElement
|
||||
{
|
||||
public:
|
||||
virtual ~PDFPageContentElementFreehandCurve() = default;
|
||||
@ -270,7 +271,7 @@ private:
|
||||
QPainterPath m_curve;
|
||||
};
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFPageContentImageElement : public PDFPageContentElement
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFPageContentImageElement : public PDFPageContentElement
|
||||
{
|
||||
public:
|
||||
PDFPageContentImageElement();
|
||||
@ -306,7 +307,7 @@ private:
|
||||
std::unique_ptr<QSvgRenderer> m_renderer;
|
||||
};
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFPageContentElementTextBox : public PDFPageContentStyledElement
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFPageContentElementTextBox : public PDFPageContentStyledElement
|
||||
{
|
||||
public:
|
||||
virtual ~PDFPageContentElementTextBox() = default;
|
||||
@ -351,7 +352,7 @@ private:
|
||||
Qt::Alignment m_alignment = Qt::AlignCenter;
|
||||
};
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFPageContentElementManipulator : public QObject
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFPageContentElementManipulator : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -463,7 +464,7 @@ private:
|
||||
QPointF m_lastUpdatedPoint;
|
||||
};
|
||||
|
||||
class PDF4QTLIBCORESHARED_EXPORT PDFPageContentScene : public QObject,
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFPageContentScene : public QObject,
|
||||
public IDocumentDrawInterface,
|
||||
public IDrawWidgetInputInterface
|
||||
{
|
||||
|
@ -18,6 +18,7 @@
|
||||
#ifndef PDFRENDERINGERRORSWIDGET_H
|
||||
#define PDFRENDERINGERRORSWIDGET_H
|
||||
|
||||
#include "pdfwidgetsglobal.h"
|
||||
#include "pdfglobal.h"
|
||||
|
||||
#include <QDialog>
|
||||
|
@ -18,6 +18,7 @@
|
||||
#ifndef PDFSELECTPAGESDIALOG_H
|
||||
#define PDFSELECTPAGESDIALOG_H
|
||||
|
||||
#include "pdfwidgetsglobal.h"
|
||||
#include "pdfutils.h"
|
||||
|
||||
#include <QDialog>
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <QStyle>
|
||||
#include <QKeyEvent>
|
||||
#include <QMouseEvent>
|
||||
#include <QCoreApplication>
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
|
||||
namespace pdf
|
||||
@ -35,7 +35,7 @@ PDFTextEditPseudowidget::PDFTextEditPseudowidget(PDFFormField::FieldFlags flags)
|
||||
m_maxTextLength(0)
|
||||
{
|
||||
m_textLayout.setCacheEnabled(true);
|
||||
m_passwordReplacementCharacter = QChar(QCoreApplication::style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter));
|
||||
m_passwordReplacementCharacter = QChar(QApplication::style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter));
|
||||
}
|
||||
|
||||
void PDFTextEditPseudowidget::shortcutOverrideEvent(QWidget* widget, QKeyEvent* event)
|
||||
|
@ -15,8 +15,10 @@
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "pdfwidgetannotation.h"
|
||||
#include "pdfdrawwidget.h"
|
||||
#include "pdfwidgetutils.h"
|
||||
#include "pdfdrawspacecontroller.h"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QDialog>
|
||||
@ -510,4 +512,14 @@ void PDFWidgetAnnotationManager::createWidgetsForMarkupAnnotations(QWidget* pare
|
||||
parentWidget->setFixedSize(scrollArea->sizeHint());
|
||||
}
|
||||
|
||||
void PDFWidgetAnnotationManager::drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const
|
||||
{
|
||||
BaseClass::drawPage(painter, pageIndex, compiledPage, layoutGetter, pagePointToDevicePointMatrix, errors);
|
||||
}
|
||||
|
||||
} // namespace pdf
|
||||
|
@ -15,7 +15,9 @@
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "pdfwidgetsglobal.h"
|
||||
#include "pdfannotation.h"
|
||||
#include "pdfdocumentdrawinterface.h"
|
||||
|
||||
namespace pdf
|
||||
{
|
||||
@ -24,7 +26,7 @@ class PDFDrawWidgetProxy;
|
||||
|
||||
/// Annotation manager for GUI rendering, it also manages annotations widgets
|
||||
/// for parent widget.
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFWidgetAnnotationManager : public PDFAnnotationManager, public IDrawWidgetInputInterface
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFWidgetAnnotationManager : public PDFAnnotationManager, public IDrawWidgetInputInterface, public IDocumentDrawInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -36,7 +38,6 @@ public:
|
||||
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;
|
||||
@ -46,6 +47,13 @@ public:
|
||||
virtual void mouseMoveEvent(QWidget* widget, QMouseEvent* event) override;
|
||||
virtual void wheelEvent(QWidget* widget, QWheelEvent* event) override;
|
||||
|
||||
virtual void drawPage(QPainter* painter,
|
||||
PDFInteger pageIndex,
|
||||
const PDFPrecompiledPage* compiledPage,
|
||||
PDFTextLayoutGetter& layoutGetter,
|
||||
const QTransform& pagePointToDevicePointMatrix,
|
||||
QList<PDFRenderError>& errors) const override;
|
||||
|
||||
/// Returns tooltip generated from annotation
|
||||
virtual QString getTooltip() const override { return m_tooltip; }
|
||||
|
||||
|
@ -15,7 +15,9 @@
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "pdfwidgetformmanager.h"
|
||||
#include "pdfdrawwidget.h"
|
||||
#include "pdfform.h"
|
||||
|
||||
#include <QKeyEvent>
|
||||
#include <QMouseEvent>
|
||||
|
@ -16,6 +16,7 @@
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "pdfform.h"
|
||||
#include "pdfdocumentdrawinterface.h"
|
||||
|
||||
namespace pdf
|
||||
{
|
||||
@ -53,7 +54,7 @@ public:
|
||||
/// based on field value is drawn.
|
||||
/// \param parameters Parameters
|
||||
/// \param edit Draw editor or static contents
|
||||
virtual void draw(AnnotationDrawParameters& parameters, bool edit) const override;
|
||||
virtual void draw(AnnotationDrawParameters& parameters, bool edit) const;
|
||||
|
||||
protected:
|
||||
/// This function is called every time, the focus state changes
|
||||
|
35
Pdf4QtLibWidgets/sources/pdfwidgetsglobal.h
Normal file
35
Pdf4QtLibWidgets/sources/pdfwidgetsglobal.h
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2023 Jakub Melka
|
||||
//
|
||||
// This file is part of PDF4QT.
|
||||
//
|
||||
// PDF4QT is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// with the written consent of the copyright owner, any later version.
|
||||
//
|
||||
// PDF4QT is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef PDFWIDGETSGLOBAL_H
|
||||
#define PDFWIDGETSGLOBAL_H
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtGlobal>
|
||||
|
||||
#include <pdf4qtlibwidgets_export.h>
|
||||
|
||||
#if !defined(PDF4QTLIBWIDGETSSHARED_EXPORT)
|
||||
#if defined(PDF4QTLIBWIDGETS_LIBRARY)
|
||||
# define PDF4QTLIBWIDGETSSHARED_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
# define PDF4QTLIBWIDGETSSHARED_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif // PDFWIDGETSGLOBAL_H
|
@ -18,6 +18,7 @@
|
||||
#ifndef PDFWIDGETTOOL_H
|
||||
#define PDFWIDGETTOOL_H
|
||||
|
||||
#include "pdfwidgetsglobal.h"
|
||||
#include "pdfdrawspacecontroller.h"
|
||||
#include "pdftextlayout.h"
|
||||
#include "pdfsnapper.h"
|
||||
|
@ -18,6 +18,7 @@
|
||||
#ifndef PDFWIDGETUTILS_H
|
||||
#define PDFWIDGETUTILS_H
|
||||
|
||||
#include "pdfwidgetsglobal.h"
|
||||
#include "pdfglobal.h"
|
||||
|
||||
#include <QIcon>
|
||||
|
@ -66,7 +66,7 @@ if(PDF4QT_ENABLE_OPENGL)
|
||||
target_link_libraries(Pdf4QtViewer PRIVATE Qt6::OpenGLWidgets)
|
||||
endif()
|
||||
|
||||
target_link_libraries(Pdf4QtViewer PRIVATE Pdf4QtLibCore Qt6::Core Qt6::Gui Qt6::Widgets Qt6::PrintSupport Qt6::TextToSpeech Qt6::Xml Qt6::Svg)
|
||||
target_link_libraries(Pdf4QtViewer PRIVATE Pdf4QtLibCore Pdf4QtLibWidgets Qt6::Core Qt6::Gui Qt6::Widgets Qt6::PrintSupport Qt6::TextToSpeech Qt6::Xml Qt6::Svg)
|
||||
target_include_directories(Pdf4QtViewer INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_include_directories(Pdf4QtViewer PUBLIC ${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR})
|
||||
|
||||
|
@ -27,7 +27,7 @@ if(PDF4QT_ENABLE_OPENGL)
|
||||
target_link_libraries(AudioBookPlugin PRIVATE Qt6::OpenGLWidgets)
|
||||
endif()
|
||||
|
||||
target_link_libraries(AudioBookPlugin PRIVATE Pdf4QtLibCore Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
target_link_libraries(AudioBookPlugin PRIVATE Pdf4QtLibCore Pdf4QtLibWidgets Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
|
||||
if(MINGW)
|
||||
target_link_libraries(AudioBookPlugin PRIVATE ole32 sapi)
|
||||
|
@ -27,7 +27,7 @@ if(PDF4QT_ENABLE_OPENGL)
|
||||
target_link_libraries(DimensionsPlugin PRIVATE Qt6::OpenGLWidgets)
|
||||
endif()
|
||||
|
||||
target_link_libraries(DimensionsPlugin PRIVATE Pdf4QtLibCore Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
target_link_libraries(DimensionsPlugin PRIVATE Pdf4QtLibCore Pdf4QtLibWidgets Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
|
||||
set_target_properties(DimensionsPlugin PROPERTIES
|
||||
VERSION ${PDF4QT_VERSION}
|
||||
|
@ -33,7 +33,7 @@ if(PDF4QT_ENABLE_OPENGL)
|
||||
target_link_libraries(ObjectInspectorPlugin PRIVATE Qt6::OpenGLWidgets)
|
||||
endif()
|
||||
|
||||
target_link_libraries(ObjectInspectorPlugin PRIVATE Pdf4QtLibCore Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
target_link_libraries(ObjectInspectorPlugin PRIVATE Pdf4QtLibCore Pdf4QtLibWidgets Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
|
||||
set_target_properties(ObjectInspectorPlugin PROPERTIES
|
||||
VERSION ${PDF4QT_VERSION}
|
||||
|
@ -29,7 +29,7 @@ if(PDF4QT_ENABLE_OPENGL)
|
||||
target_link_libraries(OutputPreviewPlugin PRIVATE Qt6::OpenGLWidgets)
|
||||
endif()
|
||||
|
||||
target_link_libraries(OutputPreviewPlugin PRIVATE Pdf4QtLibCore Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
target_link_libraries(OutputPreviewPlugin PRIVATE Pdf4QtLibCore Pdf4QtLibWidgets Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
|
||||
set_target_properties(OutputPreviewPlugin PROPERTIES
|
||||
VERSION ${PDF4QT_VERSION}
|
||||
|
@ -26,7 +26,7 @@ if(PDF4QT_ENABLE_OPENGL)
|
||||
target_link_libraries(RedactPlugin PRIVATE Qt6::OpenGLWidgets)
|
||||
endif()
|
||||
|
||||
target_link_libraries(RedactPlugin PRIVATE Pdf4QtLibCore Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
target_link_libraries(RedactPlugin PRIVATE Pdf4QtLibCore Pdf4QtLibWidgets Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
|
||||
set_target_properties(RedactPlugin PROPERTIES
|
||||
VERSION ${PDF4QT_VERSION}
|
||||
|
@ -26,7 +26,7 @@ if(PDF4QT_ENABLE_OPENGL)
|
||||
target_link_libraries(SignaturePlugin PRIVATE Qt6::OpenGLWidgets)
|
||||
endif()
|
||||
|
||||
target_link_libraries(SignaturePlugin PRIVATE Pdf4QtLibCore Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
target_link_libraries(SignaturePlugin PRIVATE Pdf4QtLibCore Pdf4QtLibWidgets Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
target_link_libraries(SignaturePlugin PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
||||
|
||||
set_target_properties(SignaturePlugin PROPERTIES
|
||||
|
@ -26,7 +26,7 @@ if(PDF4QT_ENABLE_OPENGL)
|
||||
target_link_libraries(SoftProofingPlugin PRIVATE Qt6::OpenGLWidgets)
|
||||
endif()
|
||||
|
||||
target_link_libraries(SoftProofingPlugin PRIVATE Pdf4QtLibCore Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
target_link_libraries(SoftProofingPlugin PRIVATE Pdf4QtLibCore Pdf4QtLibWidgets Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
|
||||
set_target_properties(SoftProofingPlugin PROPERTIES
|
||||
VERSION ${PDF4QT_VERSION}
|
||||
|
Loading…
x
Reference in New Issue
Block a user