2022-02-24 20:25:18 +01:00
|
|
|
// 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 PDFPAGECONTENTEDITORWIDGET_H
|
|
|
|
#define PDFPAGECONTENTEDITORWIDGET_H
|
|
|
|
|
|
|
|
#include "pdfglobal.h"
|
|
|
|
|
|
|
|
#include <QDockWidget>
|
2022-02-26 19:46:13 +01:00
|
|
|
#include <QSignalMapper>
|
2022-02-24 20:25:18 +01:00
|
|
|
|
2022-04-02 16:29:31 +02:00
|
|
|
#include <set>
|
|
|
|
|
2022-03-20 19:26:54 +01:00
|
|
|
class QToolButton;
|
|
|
|
|
2022-02-24 20:25:18 +01:00
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class PDFPageContentEditorWidget;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace pdf
|
|
|
|
{
|
2022-04-02 16:29:31 +02:00
|
|
|
class PDFPageContentScene;
|
2022-04-10 19:30:12 +02:00
|
|
|
class PDFPageContentElement;
|
2022-07-16 18:46:23 +02:00
|
|
|
class PDFPageContentEditorStyleSettings;
|
2022-02-24 20:25:18 +01:00
|
|
|
|
|
|
|
class PDF4QTLIBSHARED_EXPORT PDFPageContentEditorWidget : public QDockWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit PDFPageContentEditorWidget(QWidget* parent);
|
|
|
|
virtual ~PDFPageContentEditorWidget() override;
|
|
|
|
|
2022-02-26 19:46:13 +01:00
|
|
|
/// Adds external action to the tool box
|
|
|
|
void addAction(QAction* action);
|
|
|
|
|
2022-03-20 19:26:54 +01:00
|
|
|
QToolButton* getToolButtonForOperation(int operation) const;
|
|
|
|
|
2022-04-02 16:29:31 +02:00
|
|
|
/// Update items in list widget
|
|
|
|
void updateItemsInListWidget();
|
|
|
|
|
|
|
|
PDFPageContentScene* scene() const;
|
|
|
|
void setScene(PDFPageContentScene* newScene);
|
|
|
|
|
|
|
|
std::set<PDFInteger> getSelection() const;
|
|
|
|
void setSelection(const std::set<PDFInteger>& selection);
|
|
|
|
|
2022-04-10 19:30:12 +02:00
|
|
|
/// Loads style from element, element can be nullptr
|
|
|
|
/// \param element Element
|
|
|
|
void loadStyleFromElement(const PDFPageContentElement* element);
|
|
|
|
|
2022-03-13 19:37:36 +01:00
|
|
|
signals:
|
|
|
|
void operationTriggered(int operation);
|
2022-04-02 16:29:31 +02:00
|
|
|
void itemSelectionChangedByUser();
|
2022-03-13 19:37:36 +01:00
|
|
|
|
2022-04-10 19:30:12 +02:00
|
|
|
void penChanged(const QPen& pen);
|
|
|
|
void brushChanged(const QBrush& brush);
|
|
|
|
void fontChanged(const QFont& font);
|
|
|
|
void alignmentChanged(Qt::Alignment alignment);
|
|
|
|
void textAngleChanged(pdf::PDFReal angle);
|
|
|
|
|
2022-02-24 20:25:18 +01:00
|
|
|
private:
|
2022-02-26 19:46:13 +01:00
|
|
|
void onActionTriggerRequest(QObject* actionObject);
|
|
|
|
void onActionChanged();
|
2022-04-02 16:29:31 +02:00
|
|
|
void onItemSelectionChanged();
|
2022-02-26 19:46:13 +01:00
|
|
|
|
2022-02-24 20:25:18 +01:00
|
|
|
Ui::PDFPageContentEditorWidget* ui;
|
2022-07-16 18:46:23 +02:00
|
|
|
PDFPageContentEditorStyleSettings* m_settingsWidget;
|
2022-02-26 19:46:13 +01:00
|
|
|
QSignalMapper m_actionMapper;
|
2022-03-13 19:37:36 +01:00
|
|
|
QSignalMapper m_operationMapper;
|
2022-02-26 19:46:13 +01:00
|
|
|
int m_toolBoxColumnCount;
|
2022-02-27 17:08:24 +01:00
|
|
|
QSize m_toolButtonIconSize;
|
2022-04-02 16:29:31 +02:00
|
|
|
PDFPageContentScene* m_scene;
|
|
|
|
bool m_selectionChangeEnabled;
|
2022-04-10 19:30:12 +02:00
|
|
|
bool m_updatesEnabled;
|
2022-02-24 20:25:18 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace pdf
|
|
|
|
|
|
|
|
#endif // PDFPAGECONTENTEDITORWIDGET_H
|