2
0

default_factory.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * JavaScript code in this page
  4. *
  5. * Copyright 2022 Mozilla Foundation
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. *
  19. * @licend The above is the entire license notice for the
  20. * JavaScript code in this page
  21. */
  22. "use strict";
  23. Object.defineProperty(exports, "__esModule", {
  24. value: true
  25. });
  26. exports.DefaultXfaLayerFactory = exports.DefaultTextLayerFactory = exports.DefaultStructTreeLayerFactory = exports.DefaultAnnotationLayerFactory = exports.DefaultAnnotationEditorLayerFactory = void 0;
  27. var _annotation_editor_layer_builder = require("./annotation_editor_layer_builder.js");
  28. var _annotation_layer_builder = require("./annotation_layer_builder.js");
  29. var _l10n_utils = require("./l10n_utils.js");
  30. var _pdf_link_service = require("./pdf_link_service.js");
  31. var _struct_tree_layer_builder = require("./struct_tree_layer_builder.js");
  32. var _text_layer_builder = require("./text_layer_builder.js");
  33. var _xfa_layer_builder = require("./xfa_layer_builder.js");
  34. class DefaultAnnotationLayerFactory {
  35. createAnnotationLayerBuilder({
  36. pageDiv,
  37. pdfPage,
  38. annotationStorage = null,
  39. imageResourcesPath = "",
  40. renderForms = true,
  41. l10n = _l10n_utils.NullL10n,
  42. enableScripting = false,
  43. hasJSActionsPromise = null,
  44. mouseState = null,
  45. fieldObjectsPromise = null,
  46. annotationCanvasMap = null,
  47. accessibilityManager = null
  48. }) {
  49. return new _annotation_layer_builder.AnnotationLayerBuilder({
  50. pageDiv,
  51. pdfPage,
  52. imageResourcesPath,
  53. renderForms,
  54. linkService: new _pdf_link_service.SimpleLinkService(),
  55. l10n,
  56. annotationStorage,
  57. enableScripting,
  58. hasJSActionsPromise,
  59. fieldObjectsPromise,
  60. mouseState,
  61. annotationCanvasMap,
  62. accessibilityManager
  63. });
  64. }
  65. }
  66. exports.DefaultAnnotationLayerFactory = DefaultAnnotationLayerFactory;
  67. class DefaultAnnotationEditorLayerFactory {
  68. createAnnotationEditorLayerBuilder({
  69. uiManager = null,
  70. pageDiv,
  71. pdfPage,
  72. accessibilityManager = null,
  73. l10n,
  74. annotationStorage = null
  75. }) {
  76. return new _annotation_editor_layer_builder.AnnotationEditorLayerBuilder({
  77. uiManager,
  78. pageDiv,
  79. pdfPage,
  80. accessibilityManager,
  81. l10n,
  82. annotationStorage
  83. });
  84. }
  85. }
  86. exports.DefaultAnnotationEditorLayerFactory = DefaultAnnotationEditorLayerFactory;
  87. class DefaultStructTreeLayerFactory {
  88. createStructTreeLayerBuilder({
  89. pdfPage
  90. }) {
  91. return new _struct_tree_layer_builder.StructTreeLayerBuilder({
  92. pdfPage
  93. });
  94. }
  95. }
  96. exports.DefaultStructTreeLayerFactory = DefaultStructTreeLayerFactory;
  97. class DefaultTextLayerFactory {
  98. createTextLayerBuilder({
  99. textLayerDiv,
  100. pageIndex,
  101. viewport,
  102. eventBus,
  103. highlighter,
  104. accessibilityManager = null
  105. }) {
  106. return new _text_layer_builder.TextLayerBuilder({
  107. textLayerDiv,
  108. pageIndex,
  109. viewport,
  110. eventBus,
  111. highlighter,
  112. accessibilityManager
  113. });
  114. }
  115. }
  116. exports.DefaultTextLayerFactory = DefaultTextLayerFactory;
  117. class DefaultXfaLayerFactory {
  118. createXfaLayerBuilder({
  119. pageDiv,
  120. pdfPage,
  121. annotationStorage = null
  122. }) {
  123. return new _xfa_layer_builder.XfaLayerBuilder({
  124. pageDiv,
  125. pdfPage,
  126. annotationStorage,
  127. linkService: new _pdf_link_service.SimpleLinkService()
  128. });
  129. }
  130. }
  131. exports.DefaultXfaLayerFactory = DefaultXfaLayerFactory;