1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef MEDIAPROVIDER_PDF_JNI_PDFCLIENT_UTILS_ANNOT_H_
18 #define MEDIAPROVIDER_PDF_JNI_PDFCLIENT_UTILS_ANNOT_H_
19 
20 #include <span>
21 #include <unordered_set>
22 #include <vector>
23 
24 #include "cpp/fpdf_scopers.h"
25 #include "fpdfview.h"
26 
27 namespace pdfClient_utils {
28 
29 // Gets all visible annotations on |page| excluding the types in |types_to_exclude| and stores them
30 // in |annots|. See external/pdfium/public/fpdf_annot.h for type definitions.
31 void GetVisibleAnnots(FPDF_PAGE page, const std::unordered_set<int>& types_to_exclude,
32                       std::vector<ScopedFPDFAnnotation>* annots);
33 
34 // Gets all annotations of the types in |types| on |page| and stores them in
35 // |annots|. See external/pdfium/public/fpdf_annot.h for type definitions.
36 void GetVisibleAnnotsOfType(FPDF_PAGE page, const std::unordered_set<int>& types,
37                             std::vector<ScopedFPDFAnnotation>* annots);
38 
39 // Adds the hidden flag to each of the annotations in |annots|.
40 void HideAnnots(std::span<const ScopedFPDFAnnotation> annots);
41 
42 // Removes the hidden flag from each of the annotations in |annots|.
43 void UnhideAnnots(std::span<const ScopedFPDFAnnotation> annots);
44 
45 }  // namespace pdfClient_utils
46 
47 #endif  // MEDIAPROVIDER_PDF_JNI_PDFCLIENT_UTILS_ANNOT_H_