7#ifndef PDF_ANNOTATION_ACTION_BASE_H
8#define PDF_ANNOTATION_ACTION_BASE_H
10#include "PdfAnnotation.h"
12#include "PdfDictionary.h"
16 class PODOFO_API PdfAppearanceCharacteristics final :
public PdfDictionaryElement
19 friend class PdfAppearanceCharacteristicsProvider;
22 PdfAppearanceCharacteristics(PdfDocument& parent);
23 PdfAppearanceCharacteristics(PdfObject& obj);
26 void SetBorderColor(nullable<const PdfColor&> color);
28 PdfColor GetBorderColor()
const;
30 void SetBackgroundColor(nullable<const PdfColor&> color);
32 PdfColor GetBackgroundColor()
const;
34 void SetRolloverCaption(nullable<const PdfString&> text);
36 nullable<const PdfString&> GetRolloverCaption()
const;
38 void SetAlternateCaption(nullable<const PdfString&> text);
40 nullable<const PdfString&> GetAlternateCaption()
const;
42 void SetCaption(nullable<const PdfString&> text);
44 nullable<const PdfString&> GetCaption()
const;
48 class PdfAppearanceCharacteristicsProvider
50 friend class PdfAnnotationWidget;
51 friend class PdfAnnotationScreen;
54 PdfAppearanceCharacteristicsProvider()
56 auto& dict =
static_cast<T&
>(*this).GetDictionary();
57 auto mkObj = dict.FindKey(
"MK");
59 m_AppearanceCharacteristics.reset(
new PdfAppearanceCharacteristics(*mkObj));
63 PdfAppearanceCharacteristics& GetOrCreateAppearanceCharacteristics()
65 if (m_AppearanceCharacteristics ==
nullptr)
67 auto& ref =
static_cast<T&
>(*this);
68 m_AppearanceCharacteristics.reset(
new PdfAppearanceCharacteristics(ref.GetDocument()));
69 ref.GetDictionary().AddKeyIndirect(
"MK"_n, m_AppearanceCharacteristics->GetObject());
72 return *m_AppearanceCharacteristics;
75 PdfAppearanceCharacteristics* GetAppearanceCharacteristics()
77 return m_AppearanceCharacteristics.get();
80 const PdfAppearanceCharacteristics* GetAppearanceCharacteristics()
const
82 return m_AppearanceCharacteristics.get();
86 std::unique_ptr<PdfAppearanceCharacteristics> m_AppearanceCharacteristics;
89 class PODOFO_API PdfAnnotationActionBase :
public PdfAnnotation
91 friend class PdfAnnotationWidget;
92 friend class PdfAnnotationLink;
93 friend class PdfAnnotationScreen;
96 PdfAnnotationActionBase(PdfPage& page, PdfAnnotationType annotType,
const Rect& rect);
97 PdfAnnotationActionBase(PdfObject& obj, PdfAnnotationType annotType);
105 void SetAction(nullable<const PdfAction&> action);
113 nullable<PdfAction&> GetAction();
114 nullable<const PdfAction&> GetAction()
const;
117 virtual void onActionSet();
121 nullable<PdfAction&> getAction();
124 nullable<std::unique_ptr<PdfAction>> m_Action;
SPDX-FileCopyrightText: (C) 2022 Francesco Pretto ceztko@gmail.com SPDX-License-Identifier: LGPL-2....
Definition basetypes.h:16