chromium/third_party/pdfium/fpdfsdk/cpdfsdk_appstream.cpp

// Copyright 2017 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#include "fpdfsdk/cpdfsdk_appstream.h"

#include <math.h>

#include <array>
#include <iterator>
#include <memory>
#include <sstream>
#include <utility>

#include "constants/appearance.h"
#include "constants/form_flags.h"
#include "core/fpdfapi/edit/cpdf_contentstream_write_utils.h"
#include "core/fpdfapi/font/cpdf_font.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_bafontmap.h"
#include "core/fpdfdoc/cpdf_formcontrol.h"
#include "core/fpdfdoc/cpdf_icon.h"
#include "core/fpdfdoc/cpvt_word.h"
#include "core/fxcrt/fx_string_wrappers.h"
#include "core/fxcrt/numerics/safe_conversions.h"
#include "core/fxcrt/span.h"
#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
#include "fpdfsdk/cpdfsdk_interactiveform.h"
#include "fpdfsdk/cpdfsdk_pageview.h"
#include "fpdfsdk/cpdfsdk_widget.h"
#include "fpdfsdk/pwl/cpwl_edit.h"
#include "fpdfsdk/pwl/cpwl_edit_impl.h"
#include "fpdfsdk/pwl/cpwl_wnd.h"

namespace {

// Checkbox & radiobutton styles.
enum class CheckStyle {};

// Pushbutton layout styles.
enum class ButtonStyle {};

const char kAppendRectOperator[] =;
const char kConcatMatrixOperator[] =;
const char kCurveToOperator[] =;
const char kEndPathNoFillOrStrokeOperator[] =;
const char kFillOperator[] =;
const char kFillEvenOddOperator[] =;
const char kInvokeNamedXObjectOperator[] =;
const char kLineToOperator[] =;
const char kMarkedSequenceBeginOperator[] =;
const char kMarkedSequenceEndOperator[] =;
const char kMoveTextPositionOperator[] =;
const char kMoveToOperator[] =;
const char kSetCMYKOperator[] =;
const char kSetCMKYStrokedOperator[] =;
const char kSetDashOperator[] =;
const char kSetGrayOperator[] =;
const char kSetGrayStrokedOperator[] =;
const char kSetLineCapStyleOperator[] =;
const char kSetLineJoinStyleOperator[] =;
const char kSetLineWidthOperator[] =;
const char kSetNonZeroWindingClipOperator[] =;
const char kSetRGBOperator[] =;
const char kSetRGBStrokedOperator[] =;
const char kSetTextFontAndSizeOperator[] =;
const char kShowTextOperator[] =;
const char kStateRestoreOperator[] =;
const char kStateSaveOperator[] =;
const char kStrokeOperator[] =;
const char kTextBeginOperator[] =;
const char kTextEndOperator[] =;

class AutoClosedCommand {};

class AutoClosedQCommand final : public AutoClosedCommand {};

void WriteMove(fxcrt::ostringstream& stream, const CFX_PointF& point) {}

void WriteLine(fxcrt::ostringstream& stream, const CFX_PointF& point) {}

void WriteClosedLoop(fxcrt::ostringstream& stream,
                     pdfium::span<const CFX_PointF> points) {}

void WriteBezierCurve(fxcrt::ostringstream& stream,
                      const CFX_PointF& point1,
                      const CFX_PointF& point2,
                      const CFX_PointF& point3) {}

void WriteAppendRect(fxcrt::ostringstream& stream, const CFX_FloatRect& rect) {}

ByteString GetStrokeColorAppStream(const CFX_Color& color) {}

ByteString GetFillColorAppStream(const CFX_Color& color) {}

ByteString GetAP_Check(const CFX_FloatRect& crBBox) {}

ByteString GetAP_Circle(const CFX_FloatRect& crBBox) {}

ByteString GetAP_Cross(const CFX_FloatRect& crBBox) {}

ByteString GetAP_Diamond(const CFX_FloatRect& crBBox) {}

ByteString GetAP_Square(const CFX_FloatRect& crBBox) {}

ByteString GetAP_Star(const CFX_FloatRect& crBBox) {}

ByteString GetAP_HalfCircle(const CFX_FloatRect& crBBox, float fRotate) {}

ByteString GetAppStream_Check(const CFX_FloatRect& rcBBox,
                              const CFX_Color& crText) {}

ByteString GetAppStream_Circle(const CFX_FloatRect& rcBBox,
                               const CFX_Color& crText) {}

ByteString GetAppStream_Cross(const CFX_FloatRect& rcBBox,
                              const CFX_Color& crText) {}

ByteString GetAppStream_Diamond(const CFX_FloatRect& rcBBox,
                                const CFX_Color& crText) {}

ByteString GetAppStream_Square(const CFX_FloatRect& rcBBox,
                               const CFX_Color& crText) {}

ByteString GetAppStream_Star(const CFX_FloatRect& rcBBox,
                             const CFX_Color& crText) {}

ByteString GetCircleFillAppStream(const CFX_FloatRect& rect,
                                  const CFX_Color& color) {}

ByteString GetCircleBorderAppStream(const CFX_FloatRect& rect,
                                    float fWidth,
                                    const CFX_Color& color,
                                    const CFX_Color& crLeftTop,
                                    const CFX_Color& crRightBottom,
                                    BorderStyle nStyle,
                                    const CPWL_Dash& dash) {}

ByteString GetCheckBoxAppStream(const CFX_FloatRect& rcBBox,
                                CheckStyle nStyle,
                                const CFX_Color& crText) {}

ByteString GetRadioButtonAppStream(const CFX_FloatRect& rcBBox,
                                   CheckStyle nStyle,
                                   const CFX_Color& crText) {}

ByteString GetFontSetString(IPVT_FontMap* pFontMap,
                            int32_t nFontIndex,
                            float fFontSize) {}

ByteString GetWordRenderString(ByteStringView strWords) {}

ByteString GetEditAppStream(CPWL_EditImpl* pEdit,
                            const CFX_PointF& ptOffset,
                            bool bContinuous,
                            uint16_t SubWord) {}

ByteString GenerateIconAppStream(CPDF_IconFit& fit,
                                 RetainPtr<CPDF_Stream> pIconStream,
                                 const CFX_FloatRect& rcIcon) {}

ByteString GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
                                  IPVT_FontMap* pFontMap,
                                  RetainPtr<CPDF_Stream> pIconStream,
                                  CPDF_IconFit& IconFit,
                                  const WideString& sLabel,
                                  const CFX_Color& crText,
                                  float fFontSize,
                                  ButtonStyle nLayOut) {}

ByteString GetBorderAppStreamInternal(const CFX_FloatRect& rect,
                                      float fWidth,
                                      const CFX_Color& color,
                                      const CFX_Color& crLeftTop,
                                      const CFX_Color& crRightBottom,
                                      BorderStyle nStyle,
                                      const CPWL_Dash& dash) {}

ByteString GetDropButtonAppStream(const CFX_FloatRect& rcBBox) {}

ByteString GetRectFillAppStream(const CFX_FloatRect& rect,
                                const CFX_Color& color) {}

void SetDefaultIconName(CPDF_Stream* pIcon, const char* name) {}

std::optional<CheckStyle> CheckStyleFromCaption(const WideString& caption) {}

}  // namespace

CPDFSDK_AppStream::CPDFSDK_AppStream(CPDFSDK_Widget* widget,
                                     CPDF_Dictionary* dict)
    :{}

CPDFSDK_AppStream::~CPDFSDK_AppStream() = default;

void CPDFSDK_AppStream::SetAsPushButton() {}

void CPDFSDK_AppStream::SetAsCheckBox() {}

void CPDFSDK_AppStream::SetAsRadioButton() {}

void CPDFSDK_AppStream::SetAsComboBox(std::optional<WideString> sValue) {}

void CPDFSDK_AppStream::SetAsListBox() {}

void CPDFSDK_AppStream::SetAsTextField(std::optional<WideString> sValue) {}

void CPDFSDK_AppStream::AddImage(const ByteString& sAPType,
                                 const CPDF_Stream* pImage) {}

void CPDFSDK_AppStream::Write(const ByteString& sAPType,
                              const ByteString& sContents,
                              const ByteString& sAPState) {}

void CPDFSDK_AppStream::Remove(ByteStringView sAPType) {}

ByteString CPDFSDK_AppStream::GetBackgroundAppStream() const {}

ByteString CPDFSDK_AppStream::GetBorderAppStream() const {}