mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Library renamed to Pdf4Qt
This commit is contained in:
82
Pdf4QtLib/sources/pdfoutline.h
Normal file
82
Pdf4QtLib/sources/pdfoutline.h
Normal file
@@ -0,0 +1,82 @@
|
||||
// Copyright (C) 2019-2020 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
|
||||
// (at your option) 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 PDFOUTLINE_H
|
||||
#define PDFOUTLINE_H
|
||||
|
||||
#include "pdfglobal.h"
|
||||
#include "pdfobject.h"
|
||||
#include "pdfaction.h"
|
||||
|
||||
#include <QSharedPointer>
|
||||
|
||||
#include <set>
|
||||
|
||||
namespace pdf
|
||||
{
|
||||
class PDFDocument;
|
||||
|
||||
/// Outline item
|
||||
class Pdf4QtLIBSHARED_EXPORT PDFOutlineItem
|
||||
{
|
||||
public:
|
||||
explicit PDFOutlineItem() = default;
|
||||
|
||||
const QString& getTitle() const { return m_title; }
|
||||
void setTitle(const QString& title) { m_title = title; }
|
||||
|
||||
size_t getChildCount() const { return m_children.size(); }
|
||||
size_t getTotalCount() const;
|
||||
const PDFOutlineItem* getChild(size_t index) const { return m_children[index].get(); }
|
||||
void addChild(QSharedPointer<PDFOutlineItem> child) { m_children.emplace_back(qMove(child)); }
|
||||
QSharedPointer<PDFOutlineItem> getChildPtr(size_t index) const { return m_children[index]; }
|
||||
|
||||
static QSharedPointer<PDFOutlineItem> parse(const PDFDocument* document, const PDFObject& root);
|
||||
|
||||
const PDFAction* getAction() const;
|
||||
void setAction(const PDFActionPtr& action);
|
||||
|
||||
QColor getTextColor() const;
|
||||
void setTextColor(const QColor& textColor);
|
||||
|
||||
bool isFontItalics() const;
|
||||
void setFontItalics(bool fontItalics);
|
||||
|
||||
bool isFontBold() const;
|
||||
void setFontBold(bool fontBold);
|
||||
|
||||
PDFObjectReference getStructureElement() const;
|
||||
void setStructureElement(PDFObjectReference structureElement);
|
||||
|
||||
private:
|
||||
static void parseImpl(const PDFDocument* document,
|
||||
PDFOutlineItem* parent,
|
||||
PDFObjectReference currentItem,
|
||||
std::set<PDFObjectReference>& visitedOutlineItems);
|
||||
|
||||
QString m_title;
|
||||
std::vector<QSharedPointer<PDFOutlineItem>> m_children;
|
||||
PDFActionPtr m_action;
|
||||
PDFObjectReference m_structureElement;
|
||||
QColor m_textColor;
|
||||
bool m_fontItalics = false;
|
||||
bool m_fontBold = false;
|
||||
};
|
||||
|
||||
} // namespace pdf
|
||||
|
||||
#endif // PDFOUTLINE_H
|
Reference in New Issue
Block a user