create or replace package plpdf_reporter_util
authid current_user is
--v5.9
--
/* BASIC CONSTANT ELEMENTS */
c_create_package constant plpdf_type.v2avg := 'create or replace package ';
c_body constant plpdf_type.v2avg := c_create_package || 'body ';
c_procedure constant plpdf_type.v2avg := 'procedure ';
c_function constant plpdf_type.v2avg := 'function';
c_is constant plpdf_type.v2avg := ' is ' || plpdf_const.lf;
c_begin constant plpdf_type.v2avg := ' begin ' || plpdf_const.lf;
c_end constant plpdf_type.v2avg := 'end';
c_mark constant plpdf_type.v2avg := '''';
c_comma constant plpdf_type.v2avg := ', ';
c_eq constant plpdf_type.v2avg := ' := ';
c_point constant plpdf_type.v2avg := '.';
c_semicolon constant plpdf_type.v2avg := ';';
c_space constant plpdf_type.v2avg := ' ';
c_proc_end constant plpdf_type.v2avg := ');';
c_parameq constant plpdf_type.v2avg := ' => ';
c_slash constant plpdf_type.v2avg := '/';
--
c_nullproc constant plpdf_type.v2avg := 'null;';
--
c_header_pdf plpdf_type.v2long := ' is ' || plpdf_const.cr || plpdf_const.lf || plpdf_const.cr || plpdf_const.lf || 'procedure genPDF;' || plpdf_const.cr || plpdf_const.lf || plpdf_const.cr || plpdf_const.lf ||
'v_pdf blob;' || plpdf_const.cr || plpdf_const.lf;
c_header_pdf_nomain plpdf_type.v2long := ' is ' || plpdf_const.cr || plpdf_const.lf || plpdf_const.cr || plpdf_const.lf || plpdf_const.cr || plpdf_const.lf ||
'v_pdf blob;' || plpdf_const.cr || plpdf_const.lf;
c_header_mm_pdf plpdf_type.v2long := ' is ' || plpdf_const.cr || plpdf_const.lf || plpdf_const.cr || plpdf_const.lf || 'procedure MailMergePDF(p_params t_params);' || plpdf_const.cr || plpdf_const.lf || plpdf_const.cr || plpdf_const.lf ||
'v_pdf blob;' || plpdf_const.cr || plpdf_const.lf;
--
c_header_pdf_param_rec_1 plpdf_type.v2long := ' is ' || plpdf_const.cr || plpdf_const.lf;
c_header_pdf_param_rec_2 plpdf_type.v2long := ' procedure MailMergePDF(p_params t_params);' || plpdf_const.cr || plpdf_const.lf || plpdf_const.cr || plpdf_const.lf ||
'v_pdf blob;' || plpdf_const.cr || plpdf_const.lf;
--
c_pragma_serially_reusable constant plpdf_type.v2avg := 'PRAGMA SERIALLY_REUSABLE;';
c_header_pragma_pdf plpdf_type.v2long := ' is ' || plpdf_const.cr || plpdf_const.lf ||
c_pragma_serially_reusable || plpdf_const.cr || plpdf_const.lf ||
plpdf_const.cr || plpdf_const.lf || 'procedure genPDF;' || plpdf_const.cr || plpdf_const.lf || plpdf_const.cr || plpdf_const.lf ||
'v_pdf blob;' || plpdf_const.cr || plpdf_const.lf;
c_header_pragma_pdf_nomain plpdf_type.v2long := ' is ' || plpdf_const.cr || plpdf_const.lf ||
c_pragma_serially_reusable || plpdf_const.cr || plpdf_const.lf ||
plpdf_const.cr || plpdf_const.lf || plpdf_const.cr || plpdf_const.lf ||
'v_pdf blob;' || plpdf_const.cr || plpdf_const.lf;
--
c_header_pragma_pdf_p_rec_1 plpdf_type.v2long := ' is ' || plpdf_const.cr || plpdf_const.lf;
c_header_pragma_pdf_p_rec_2 plpdf_type.v2long := ' procedure MailMergePDF(p_params t_params);' || plpdf_const.cr || plpdf_const.lf || plpdf_const.cr || plpdf_const.lf ||
'v_pdf blob;' || plpdf_const.cr || plpdf_const.lf;
--
c_header_docx plpdf_type.v2long := ' is ' || plpdf_const.cr || plpdf_const.lf || plpdf_const.cr || plpdf_const.lf || 'procedure genDOCX;' || plpdf_const.cr || plpdf_const.lf || plpdf_const.cr || plpdf_const.lf ||
'v_docx blob;' || plpdf_const.cr || plpdf_const.lf;
--
c_header_docx_p_rec_1 plpdf_type.v2long := ' is ' || plpdf_const.cr || plpdf_const.lf ;
c_header_docx_p_rec_2 plpdf_type.v2long := ' procedure MailMergeDOCX(p_params t_params);' || plpdf_const.cr || plpdf_const.lf || plpdf_const.cr || plpdf_const.lf ||
'v_docx blob;' || plpdf_const.cr || plpdf_const.lf;
--
c_genPDF_h constant plpdf_type.v2avg := c_procedure || 'genPDF;';
c_genPDF_start constant plpdf_type.v2avg := c_procedure || 'genPDF is' || plpdf_const.lf;
c_MailMergePDF_start_rec constant plpdf_type.v2avg := c_procedure || 'MailMergePDF(p_params t_params) is' || plpdf_const.lf;
c_genDocx_start constant plpdf_type.v2avg := c_procedure || 'genDOCX is' || plpdf_const.lf;
c_MailMergeDOCX_start_rec constant plpdf_type.v2avg := c_procedure || 'MailMergeDOCX(p_params t_params) is' || plpdf_const.lf;
--
c_image_util_start constant plpdf_type.v2avg := c_function || ' image_util( ' || plpdf_const.lf || 'p_name varchar2' || plpdf_const.lf ||
                                            ') return blob is' || plpdf_const.lf || 'l_ret blob;' || plpdf_const.lf || 'begin ' || plpdf_const.lf ;
--v4.11
c_file_util_start constant plpdf_type.v2avg := c_function || ' file_util( ' || plpdf_const.lf || 'p_name varchar2' || plpdf_const.lf ||
                                            ') return blob is' || plpdf_const.lf || 'l_ret blob;' || plpdf_const.lf || 'begin ' || plpdf_const.lf ;
--
c_header_start constant plpdf_type.v2avg := c_procedure || 'header_';
c_footer_start constant plpdf_type.v2avg := c_procedure || 'footer_';
--
c_SDT_CODE constant plpdf_type.v2avg := 'CODE';
c_SDT_COLUMN constant plpdf_type.v2avg := 'COLUMN';
c_SDT_COLUMN_LINK constant plpdf_type.v2avg := 'COLUMN_LINK'; --v4.9.8
c_SDT_HTMLCOLUMN constant plpdf_type.v2avg := 'HTMLCOLUMN'; --v4.8.0
c_SDT_COMMENT constant plpdf_type.v2avg := 'COMMENT';
c_SDT_CUSTOMRUN constant plpdf_type.v2avg := 'CUSTOMRUN';
c_SDT_EXPRESSION constant plpdf_type.v2avg := 'EXPRESSION';
c_SDT_FORMAT constant plpdf_type.v2avg := 'FORMAT';
c_SDT_FORMAT2 constant plpdf_type.v2avg := 'FORMAT2'; --v4.9.8
c_SDT_GFOOTER constant plpdf_type.v2avg := 'GFOOTER';
c_SDT_GHEADER constant plpdf_type.v2avg := 'GHEADER';
c_SDT_GROUP constant plpdf_type.v2avg := 'GROUP';
c_SDT_IF constant plpdf_type.v2avg := 'IF';
c_SDT_IMAGE constant plpdf_type.v2avg := 'IMAGE';
c_SDT_ORIGIMAGE constant plpdf_type.v2avg := 'ORIGIMAGE'; --v4.9.2
c_SDT_FACTORIMAGE constant plpdf_type.v2avg := 'FACTORIMAGE'; --v4.9.3
c_SDT_BARCODE constant plpdf_type.v2avg := 'BARCODE';
c_SDT_CHART constant plpdf_type.v2avg := 'CHART';
c_SDT_TEXTFIELD constant plpdf_type.v2avg := 'TEXTFIELD'; --v5.0

--v4.8.0
c_006_err_msg constant plpdf_type.v2long := 'If the owner of this package is different from the main owner of the plpdf then still needed to prevent "ERR-006 Procedure call error": ' || plpdf_const.cr || plpdf_const.lf ||
'"GRANT EXECUTE ON <package> TO <plpdf_owner>" as package owner and ' || plpdf_const.cr || plpdf_const.lf ||
'"CREATE SYNONYM <package> FOR <package_owner>.<package>;"';

--v4.9.6
c_mm_param_data_type constant plpdf_type.v2avg := 'varchar2(4000 char)';

----------------------------------------
--v4.2.0
function getSection
  return varchar2;
----------------------------------------
--v4.2.0
procedure setSection(
  p_section varchar2 default null
  );
----------------------------------------
-- v3.0.8
-- variableComparator
function variableComparator(
  p_parameters plpdf_reporter_types.t_params,
  p_variableList plpdf_reporter_types.t_varList,
  p_force_new boolean --v4.6.0
  ) return varchar2;
----------------------------------------
-- v1.0.0
-- AppendToCodeSection
procedure AppendToCodeSection(
  p_target in out clob,
  p_source clob default null
  );
----------------------------------------
-- v3.0.8
-- CommonCodeGen
procedure CommonCodeGenerator(
  p_codeSection in out plpdf_reporter_types.t_codeUnit,
  p_codeblock in out plpdf_reporter_types.t_codeblock
  );
----------------------------------------
-- v3.4.0
-- crParam
function crParam(
  p_name varchar2 default null,
  p_value varchar2 default null,
  p_isText boolean default false
  ) return plpdf_reporter_types.t_param;
----------------------------------------
-- v3.4.0
-- addParam
procedure addParam(
  p_param plpdf_reporter_types.t_param,
  p_table in out plpdf_reporter_types.t_params
  );
----------------------------------------
-- v3.4.0
-- addParam
procedure addInternalLink(
  p_name varchar2,
  p_id varchar2,
  p_internalLinks in out plpdf_reporter_types.t_linkStore_
  );
----------------------------------------
-- v1.0.0
-- addCodeblock
procedure addCodeblock(
  p_table in out plpdf_reporter_types.t_codeblocks,
  p_codeblock plpdf_reporter_types.t_codeblock
  );
----------------------------------------
-- v1.0.0
-- log
procedure log(
  p_proc varchar2,
  p_params varchar2 default null,
  p_text varchar2 default null,
  p_log_ouptut varchar2 default null
  );
----------------------------------------
-- v1.0.0
-- addLine
procedure addLine(
  p_clob in out clob,
  p_text varchar2
  );
----------------------------------------
-- v1.0.0
-- AddComment
procedure AddComment(
  p_clob in out clob,
  p_commentText varchar2
  );
----------------------------------------
-- v1.0.0
-- AddCommentLines
procedure AddCommentLines(
  p_clob in out clob,
  p_commentTextLines plpdf_type.t_v2avgs
  );
----------------------------------------
-- v1.0.0
-- HexColorConverter
function HexColorConverter(
  p_hex varchar2
  ) return plpdf_type.t_color;
----------------------------------------
-- v1.0.0
-- HalfToPoint
function HalfToPoint(
  p_hfp number
) return number;
----------------------------------------
-- v1.0.0
-- TwipsToPoint
function TwipsToPoint(
  p_twp number
) return number;
----------------------------------------
-- v1.0.0
-- EightPointToPoint
function EightPointToPoint(
  p_epm number
) return number;
----------------------------------------
-- v1.0.0
-- 240thPointToPoint
function ThfPointToPoint(
  p_thf number
) return number;
----------------------------------------
-- v1.0.0
-- 50thPercentToPercent
function FthToPercent(
  p_fth number
) return number;
----------------------------------------
-- v1.0.0
-- orientationConvert
function OrientationConvert(
  p_orientation varchar2
) return varchar2;
----------------------------------------
-- v1.0.0
-- DateFormat
function DateFormat(
  p_date date
) return varchar2;
----------------------------------------
-- v1.0.0
-- EMUToPoint
function EMUToPoint(
  p_emu number
) return number;
----------------------------------------
-- v3.3.0
-- SpecCharHandler
function SpecCharHandle(
  p_text varchar2
  ) return varchar;
----------------------------------------
-- v1.0.0
-- isPaddingExist
function isPaddingExist(
  p_pBdr ploffx_document_type.CT_PBdr
  ) return boolean;
----------------------------------------
-- v1.0.0
-- isFontExist
function isFontExist(
  p_rpr ploffx_document_type.CT_RPr
  ) return boolean;
----------------------------------------
-- v1.0.0
-- isRunBoxExist
function isRunBoxExist(
  p_rpr ploffx_document_type.CT_RPr
  ) return boolean;
--v4.9.0
function isParagraphBoxExist(
  p_ppr ploffx_document_type.CT_PPr
  ) return boolean;
----------------------------------------
-- v4.9.1
-- isCellMargin
function isCellMarginExist(
  p_tcBorders ploffx_document_type.CT_TcBorders
  ) return boolean;
-- v4.9.1
-- isCellPadding
function isCellPaddingExist(
  p_tcMar ploffx_document_type.CT_TcMar
  ) return boolean;
----------------------------------------
-- v1.0.0
-- isHeaderFooterExist
function isHeaderFooterExist(
  p_hdrftr ploffx_headerfooter.XT_HdrFtr
  ) return boolean;
--v4.3.0
-- isHeaderExist
function isHeaderExist(
  p_hdrftr ploffx_headerfooter.XT_HdrFtr
  ) return boolean;
--v4.3.0
-- isFooterExist
function isFooterExist(
  p_hdrftr ploffx_headerfooter.XT_HdrFtr
  ) return boolean;
----------------------------------------
-- v3.1.0
-- isBorder1Exist
function isBorder1Exist(
 p_border ploffx_document_type.CT_Border
 ) return boolean;
----------------------------------------
-- v3.1.0
-- isCellBorderExist
function isCellBorderExist(
  p_cellBorder ploffx_document_type.CT_TcBorders
  ) return boolean;
----------------------------------------
-- v3.1.0
-- isCellBoxExist
function isCellBoxExist(
  p_tcPr ploffx_document_type.CT_TcPr
  ) return boolean;
----------------------------------------
-- v3.1.0
-- isImgesExist
function isImageExist(
  p_id varchar2 default null,
  p_imageTable varchar2 default null
  ) return boolean;
----------------------------------------
-- v3.1.0
-- isExistingLink
function isExistingLink(
  p_name varchar2 default null,
  p_internalLinks plpdf_reporter_types.t_linkStore_
  ) return varchar2;
----------------------------------------
--v4.2.0
function crUniString(
  p_text varchar2
  ) return varchar2;
----------------------------------------
function mapToPDFCompatibleChar(
  p_character varchar2 default null,
  p_rpr ploffx_document_type.CT_RPr
  ) return varchar2;
----------------------------------------
function equalFonts(
    p_font1 plpdf_reporter_types.t_font_item,
    p_font2 plpdf_reporter_types.t_font_item
    ) return boolean;
----------------------------------------
--v4.7.0
function ExecExp(
  p_expression varchar2
  ) return varchar2;
----------------------------------------
--v4.8.3
function QuoteToAscii(
  p_txt varchar2
  ) return varchar2;
---------------------------------------
--v4.9.6
function get_param_rec_string(
  p_params_arr plpdf_type.t_v2longs
  ) return varchar2;
----------------------------------------
end plpdf_reporter_util;
/

