mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Editor plugin: WIP
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "pdfdrawspacecontroller.h"
|
||||
#include "pdfwidgetutils.h"
|
||||
#include "pdfutils.h"
|
||||
#include "pdfpagecontenteditorprocessor.h"
|
||||
|
||||
#include <QBuffer>
|
||||
#include <QPainter>
|
||||
@@ -61,6 +62,7 @@ Qt::CursorShape PDFPageContentElement::getCursorShapeForManipulationMode(uint mo
|
||||
case Pt1:
|
||||
case Pt2:
|
||||
case Translate:
|
||||
case Select:
|
||||
return Qt::ArrowCursor;
|
||||
|
||||
case Top:
|
||||
@@ -154,6 +156,7 @@ void PDFPageContentElement::performRectangleManipulation(QRectF& rectangle,
|
||||
switch (mode)
|
||||
{
|
||||
case None:
|
||||
case Select:
|
||||
break;
|
||||
|
||||
case Translate:
|
||||
@@ -2533,4 +2536,52 @@ void PDFPageContentElementTextBox::setAlignment(const Qt::Alignment& newAlignmen
|
||||
m_alignment = newAlignment;
|
||||
}
|
||||
|
||||
PDFPageContentElementEdited::PDFPageContentElementEdited(const PDFEditedPageContentElement* element) :
|
||||
m_element(element->clone())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
PDFPageContentElementEdited::~PDFPageContentElementEdited()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
PDFPageContentElementEdited* PDFPageContentElementEdited::clone() const
|
||||
{
|
||||
return new PDFPageContentElementEdited(m_element.get());
|
||||
}
|
||||
|
||||
void PDFPageContentElementEdited::drawPage(QPainter* painter, PDFInteger pageIndex, const PDFPrecompiledPage* compiledPage, PDFTextLayoutGetter& layoutGetter, const QTransform& pagePointToDevicePointMatrix, QList<PDFRenderError>& errors) const
|
||||
{
|
||||
}
|
||||
|
||||
uint PDFPageContentElementEdited::getManipulationMode(const QPointF& point, PDFReal snapPointDistanceThreshold) const
|
||||
{
|
||||
Q_UNUSED(point);
|
||||
Q_UNUSED(snapPointDistanceThreshold);
|
||||
|
||||
return None;
|
||||
}
|
||||
|
||||
void PDFPageContentElementEdited::performManipulation(uint mode, const QPointF& offset)
|
||||
{
|
||||
Q_UNUSED(mode);
|
||||
Q_UNUSED(offset);
|
||||
}
|
||||
|
||||
QRectF PDFPageContentElementEdited::getBoundingBox() const
|
||||
{
|
||||
return m_element->getState()
|
||||
}
|
||||
|
||||
void PDFPageContentElementEdited::setSize(QSizeF size)
|
||||
{
|
||||
}
|
||||
|
||||
QString PDFPageContentElementEdited::getDescription() const
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace pdf
|
||||
|
||||
|
@@ -37,6 +37,7 @@ namespace pdf
|
||||
class PDFWidget;
|
||||
class PDFDocument;
|
||||
class PDFPageContentScene;
|
||||
class PDFEditedPageContentElement;
|
||||
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFPageContentElement
|
||||
{
|
||||
@@ -89,6 +90,7 @@ public:
|
||||
enum ManipulationModes : uint
|
||||
{
|
||||
None = 0,
|
||||
Select,
|
||||
Translate,
|
||||
Top,
|
||||
Left,
|
||||
@@ -353,6 +355,24 @@ private:
|
||||
Qt::Alignment m_alignment = Qt::AlignCenter;
|
||||
};
|
||||
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFPageContentElementEdited : public PDFPageContentElement
|
||||
{
|
||||
public:
|
||||
PDFPageContentElementEdited(const PDFEditedPageContentElement* element);
|
||||
virtual ~PDFPageContentElementEdited();
|
||||
|
||||
virtual PDFPageContentElementEdited* 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;
|
||||
|
||||
private:
|
||||
std::unique_ptr<PDFEditedPageContentElement> m_element;
|
||||
};
|
||||
|
||||
class PDF4QTLIBWIDGETSSHARED_EXPORT PDFPageContentElementManipulator : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
Reference in New Issue
Block a user