#include "core/fpdfdoc/cpdf_generateap.h"
#include <algorithm>
#include <sstream>
#include <utility>
#include "constants/annotation_common.h"
#include "constants/appearance.h"
#include "constants/font_encodings.h"
#include "constants/form_fields.h"
#include "core/fpdfapi/edit/cpdf_contentstream_write_utils.h"
#include "core/fpdfapi/font/cpdf_font.h"
#include "core/fpdfapi/page/cpdf_docpagedata.h"
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_boolean.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_document.h"
#include "core/fpdfapi/parser/cpdf_name.h"
#include "core/fpdfapi/parser/cpdf_number.h"
#include "core/fpdfapi/parser/cpdf_reference.h"
#include "core/fpdfapi/parser/cpdf_stream.h"
#include "core/fpdfapi/parser/cpdf_string.h"
#include "core/fpdfapi/parser/fpdf_parser_decode.h"
#include "core/fpdfapi/parser/fpdf_parser_utility.h"
#include "core/fpdfdoc/cpdf_annot.h"
#include "core/fpdfdoc/cpdf_color_utils.h"
#include "core/fpdfdoc/cpdf_defaultappearance.h"
#include "core/fpdfdoc/cpdf_formfield.h"
#include "core/fpdfdoc/cpvt_fontmap.h"
#include "core/fpdfdoc/cpvt_variabletext.h"
#include "core/fpdfdoc/cpvt_word.h"
#include "core/fxcrt/fx_string_wrappers.h"
#include "core/fxge/cfx_renderdevice.h"
namespace {
struct CPVT_Dash { … };
enum class PaintOperation { … };
ByteString GetPDFWordString(IPVT_FontMap* pFontMap,
int32_t nFontIndex,
uint16_t Word,
uint16_t SubWord) { … }
ByteString GetWordRenderString(ByteStringView strWords) { … }
ByteString GetFontSetString(IPVT_FontMap* pFontMap,
int32_t nFontIndex,
float fFontSize) { … }
ByteString GenerateEditAP(IPVT_FontMap* pFontMap,
CPVT_VariableText::Iterator* pIterator,
const CFX_PointF& ptOffset,
bool bContinuous,
uint16_t SubWord) { … }
ByteString GenerateColorAP(const CFX_Color& color, PaintOperation nOperation) { … }
ByteString GenerateBorderAP(const CFX_FloatRect& rect,
float width,
const CFX_Color& color,
const CFX_Color& crLeftTop,
const CFX_Color& crRightBottom,
BorderStyle nStyle,
const CPVT_Dash& dash) { … }
ByteString GetColorStringWithDefault(const CPDF_Array* pColor,
const CFX_Color& crDefaultColor,
PaintOperation nOperation) { … }
float GetBorderWidth(const CPDF_Dictionary* pDict) { … }
RetainPtr<const CPDF_Array> GetDashArray(const CPDF_Dictionary* pDict) { … }
ByteString GetDashPatternString(const CPDF_Dictionary* pDict) { … }
ByteString GetPopupContentsString(CPDF_Document* pDoc,
const CPDF_Dictionary& pAnnotDict,
RetainPtr<CPDF_Font> pDefFont,
const ByteString& sFontName) { … }
RetainPtr<CPDF_Dictionary> GenerateFallbackFontDict(CPDF_Document* doc) { … }
RetainPtr<CPDF_Dictionary> GenerateResourceFontDict(
CPDF_Document* doc,
const ByteString& font_name,
uint32_t font_dict_obj_num) { … }
ByteString GetPaintOperatorString(bool bIsStrokeRect, bool bIsFillRect) { … }
ByteString GenerateTextSymbolAP(const CFX_FloatRect& rect) { … }
RetainPtr<CPDF_Dictionary> GenerateExtGStateDict(
const CPDF_Dictionary& pAnnotDict,
const ByteString& sExtGSDictName,
const ByteString& sBlendMode) { … }
RetainPtr<CPDF_Dictionary> GenerateResourceDict(
CPDF_Document* pDoc,
RetainPtr<CPDF_Dictionary> pExtGStateDict,
RetainPtr<CPDF_Dictionary> pResourceFontDict) { … }
void GenerateAndSetAPDict(CPDF_Document* doc,
CPDF_Dictionary* annot_dict,
fxcrt::ostringstream* app_stream,
RetainPtr<CPDF_Dictionary> resource_dict,
bool is_text_markup_annotation) { … }
bool GenerateCircleAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) { … }
bool GenerateHighlightAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) { … }
bool GenerateInkAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) { … }
bool GenerateTextAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) { … }
bool GenerateUnderlineAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) { … }
bool GeneratePopupAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) { … }
bool GenerateSquareAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) { … }
bool GenerateSquigglyAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) { … }
bool GenerateStrikeOutAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) { … }
}
void CPDF_GenerateAP::GenerateFormAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict,
FormType type) { … }
void CPDF_GenerateAP::GenerateEmptyAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict) { … }
bool CPDF_GenerateAP::GenerateAnnotAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict,
CPDF_Annot::Subtype subtype) { … }