Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: core/fpdfdoc/cpdf_annot.cpp

Issue 2273893002: Display content of the annotation when mouse hover. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Removing useless comments. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fpdfdoc/include/cpdf_annot.h" 7 #include "core/fpdfdoc/include/cpdf_annot.h"
8 8
9 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" 9 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
10 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" 10 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
11 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 11 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
12 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 12 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
13 #include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" 13 #include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h"
14 #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" 14 #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h"
15 #include "core/fpdfdoc/cpvt_generateap.h" 15 #include "core/fpdfdoc/cpvt_generateap.h"
16 #include "core/fxcrt/include/fx_memory.h" 16 #include "core/fxcrt/include/fx_memory.h"
17 #include "core/fxge/include/cfx_graphstatedata.h" 17 #include "core/fxge/include/cfx_graphstatedata.h"
18 #include "core/fxge/include/cfx_pathdata.h" 18 #include "core/fxge/include/cfx_pathdata.h"
19 #include "core/fxge/include/cfx_renderdevice.h" 19 #include "core/fxge/include/cfx_renderdevice.h"
20 20
21 CPDF_Annot::CPDF_Annot(CPDF_Dictionary* pDict, CPDF_Document* pDocument) 21 CPDF_Annot::CPDF_Annot(CPDF_Dictionary* pDict, CPDF_Document* pDocument)
22 : m_pAnnotDict(pDict), 22 : m_pAnnotDict(pDict),
23 m_pDocument(pDocument), 23 m_pDocument(pDocument),
24 m_sSubtype(m_pAnnotDict->GetStringBy("Subtype")) { 24 m_sSubtype(m_pAnnotDict->GetStringBy("Subtype")),
25 m_bOpenState(false),
26 m_pPopupAnnot(nullptr) {
25 if (m_sSubtype == "Circle") 27 if (m_sSubtype == "Circle")
26 CPVT_GenerateAP::GenerateCircleAP(m_pDocument, m_pAnnotDict); 28 CPVT_GenerateAP::GenerateCircleAP(m_pDocument, m_pAnnotDict);
27 else if (m_sSubtype == "Highlight") 29 else if (m_sSubtype == "Highlight")
28 CPVT_GenerateAP::GenerateHighlightAP(m_pDocument, m_pAnnotDict); 30 CPVT_GenerateAP::GenerateHighlightAP(m_pDocument, m_pAnnotDict);
29 else if (m_sSubtype == "Ink") 31 else if (m_sSubtype == "Ink")
30 CPVT_GenerateAP::GenerateInkAP(m_pDocument, m_pAnnotDict); 32 CPVT_GenerateAP::GenerateInkAP(m_pDocument, m_pAnnotDict);
33 else if (m_sSubtype == "Popup")
dsinclair 2016/08/24 14:00:20 Should we switch m_sSubtype to be an enum class? W
jaepark 2016/08/24 18:37:48 I'd like to do this in another CL if that's OK sin
dsinclair 2016/08/24 18:56:26 As a followup Cl is fine.
jaepark 2016/08/26 02:37:29 Acknowledged.
34 CPVT_GenerateAP::GeneratePopupAP(m_pDocument, m_pAnnotDict);
31 else if (m_sSubtype == "Square") 35 else if (m_sSubtype == "Square")
32 CPVT_GenerateAP::GenerateSquareAP(m_pDocument, m_pAnnotDict); 36 CPVT_GenerateAP::GenerateSquareAP(m_pDocument, m_pAnnotDict);
33 else if (m_sSubtype == "Squiggly") 37 else if (m_sSubtype == "Squiggly")
34 CPVT_GenerateAP::GenerateSquigglyAP(m_pDocument, m_pAnnotDict); 38 CPVT_GenerateAP::GenerateSquigglyAP(m_pDocument, m_pAnnotDict);
35 else if (m_sSubtype == "StrikeOut") 39 else if (m_sSubtype == "StrikeOut")
36 CPVT_GenerateAP::GenerateStrikeOutAP(m_pDocument, m_pAnnotDict); 40 CPVT_GenerateAP::GenerateStrikeOutAP(m_pDocument, m_pAnnotDict);
37 else if (m_sSubtype == "Text") 41 else if (m_sSubtype == "Text")
38 CPVT_GenerateAP::GenerateTextAP(m_pDocument, m_pAnnotDict); 42 CPVT_GenerateAP::GenerateTextAP(m_pDocument, m_pAnnotDict);
39 else if (m_sSubtype == "Underline") 43 else if (m_sSubtype == "Underline")
40 CPVT_GenerateAP::GenerateUnderlineAP(m_pDocument, m_pAnnotDict); 44 CPVT_GenerateAP::GenerateUnderlineAP(m_pDocument, m_pAnnotDict);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 146 }
143 147
144 FX_BOOL CPDF_Annot::DrawAppearance(CPDF_Page* pPage, 148 FX_BOOL CPDF_Annot::DrawAppearance(CPDF_Page* pPage,
145 CFX_RenderDevice* pDevice, 149 CFX_RenderDevice* pDevice,
146 const CFX_Matrix* pUser2Device, 150 const CFX_Matrix* pUser2Device,
147 AppearanceMode mode, 151 AppearanceMode mode,
148 const CPDF_RenderOptions* pOptions) { 152 const CPDF_RenderOptions* pOptions) {
149 if (IsAnnotationHidden(m_pAnnotDict)) 153 if (IsAnnotationHidden(m_pAnnotDict))
150 return FALSE; 154 return FALSE;
151 155
156 if (m_sSubtype == "Popup" && !m_bOpenState)
157 return FALSE;
158
152 CFX_Matrix matrix; 159 CFX_Matrix matrix;
153 CPDF_Form* pForm = 160 CPDF_Form* pForm =
154 FPDFDOC_Annot_GetMatrix(pPage, this, mode, pUser2Device, matrix); 161 FPDFDOC_Annot_GetMatrix(pPage, this, mode, pUser2Device, matrix);
155 if (!pForm) { 162 if (!pForm) {
156 return FALSE; 163 return FALSE;
157 } 164 }
158 CPDF_RenderContext context(pPage); 165 CPDF_RenderContext context(pPage);
159 context.AppendLayer(pForm, &matrix); 166 context.AppendLayer(pForm, &matrix);
160 context.Render(pDevice, pOptions, nullptr); 167 context.Render(pDevice, pOptions, nullptr);
161 return TRUE; 168 return TRUE;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 CFX_PathData path; 273 CFX_PathData path;
267 width /= 2; 274 width /= 2;
268 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width, 275 path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width,
269 rect.top - width); 276 rect.top - width);
270 int fill_type = 0; 277 int fill_type = 0;
271 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) { 278 if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH)) {
272 fill_type |= FXFILL_NOPATHSMOOTH; 279 fill_type |= FXFILL_NOPATHSMOOTH;
273 } 280 }
274 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type); 281 pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type);
275 } 282 }
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | core/fpdfdoc/cpdf_annotlist.cpp » ('j') | core/fpdfdoc/cpdf_annotlist.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698