1 /* This file is part of Shapes.
3 * Shapes is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
8 * Shapes is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright 2008 Henrik Tidefelt
21 #include "Shapes_Ast_decls.h"
22 #include "Shapes_Kernel_decls.h"
23 #include "Shapes_Lang_decls.h"
24 #include "FontMetrics_decls.h"
25 #include "SimplePDF_decls.h"
36 class AnnotationSite
: public Lang::NoOperatorOverloadGeometric2D
39 enum Flags
{ INVISIBLE
= 1<<(1-1), HIDDEN
= 1<<(2-1), PRINT
= 1<<(3-1), NO_ZOOM
= 1<<(4-1), NO_ROTATE
= 1<<(5-1), NO_VIEW
= 1<<(6-1), READ_ONLY
= 1<<(7-1), LOCKED
= 1<<(8-1), TOGGLE_NO_VIEW
= 1<<(9-1)};
41 RefCountPtr
< const Lang::Drawable2D
> target_
; // In the end, this just defines a rectangle.
42 RefCountPtr
< const char > contentText_
;
43 RefCountPtr
< const char > identifier_
; // Perhaps we don't have to use this, but it is included just in case...
46 char borderStyle_
; // Ensure that the value is any of the characters in "SDBIU"!
47 Concrete::Length borderWidth_
; // Use 0 to get no border at all.
48 RefCountPtr
< const Lang::Dash
> borderDash_
; // May be null.
49 double borderCloudy_
; // Use negative value to avoid the border effect alltogether. Suggested values are in the range 0--2.
52 /* At the moment, appearance states are not supported.
54 RefCountPtr
< const Lang::XObject
> appearanceNormal_
; // May be null.
55 RefCountPtr
< const Lang::XObject
> appearanceRollover_
; // May be null.
56 RefCountPtr
< const Lang::XObject
> appearanceDown_
; // May be null.
59 AnnotationSite( const RefCountPtr
< const Lang::Drawable2D
> & target
, const RefCountPtr
< const char > & contentText
, const RefCountPtr
< const char > & identifier
, size_t flags
,
60 char borderStyle
, const Concrete::Length
& borderWidth
, const RefCountPtr
< const Lang::Dash
> & borderDash
, double borderCloudy
, const Concrete::RGB
& color
,
61 const RefCountPtr
< const Lang::XObject
> & appearanceNormal
, const RefCountPtr
< const Lang::XObject
> & appearanceRollover
, const RefCountPtr
< const Lang::XObject
> & appearanceDown
);
62 virtual ~AnnotationSite( );
64 RefCountPtr
< const Lang::AnnotationSite
> typed_transformed( const Lang::Transform2D
& transform
) const;
65 virtual RefCountPtr
< const Lang::Geometric2D
> transformed( const Lang::Transform2D
& transform
, const RefCountPtr
< const Lang::Geometric2D
> & self
) const;
66 virtual RefCountPtr
< const Lang::Geometric3D
> to3D( const RefCountPtr
< const Lang::Geometric2D
> & self
) const;
68 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
70 RefCountPtr
< SimplePDF::PDF_Dictionary
> getDictionary( const char * subtype
, const RefCountPtr
< SimplePDF::PDF_Indirect_out
> & i_page
) const;
75 class AnnotationBase
: public Lang::NoOperatorOverloadGeometric2D
78 RefCountPtr
< const Lang::AnnotationSite
> site_
;
80 AnnotationBase( const RefCountPtr
< const Lang::AnnotationSite
> & site
);
81 virtual ~AnnotationBase( );
83 RefCountPtr
< SimplePDF::PDF_Dictionary
> virtual getDictionary( const RefCountPtr
< SimplePDF::PDF_Indirect_out
> & i_page
, const std::map
< RefCountPtr
< const char >, RefCountPtr
< SimplePDF::PDF_Vector
>, charRefPtrLess
> & namedDestinations
) const = 0;
85 virtual RefCountPtr
< const Lang::Geometric3D
> to3D( const RefCountPtr
< const Lang::Geometric2D
> & self
) const;
87 virtual void gcMark( Kernel::GCMarkedSet
& marked
);
88 virtual void subtypeGcMark( Kernel::GCMarkedSet
& marked
) = 0;
93 class TextAnnotation
: public Lang::AnnotationBase
95 RefCountPtr
< const char > title_
;
97 RefCountPtr
< const char > icon_
; // If present, this string should belong to the set listed in table 8.19 (page 586) in the PDF-1.6 reference.
99 TextAnnotation( const RefCountPtr
< const Lang::AnnotationSite
> & site
, const RefCountPtr
< const char > & title
, bool open
, const RefCountPtr
< const char > & icon
);
100 virtual ~TextAnnotation( );
102 virtual RefCountPtr
< const Lang::Geometric2D
> transformed( const Lang::Transform2D
& transform
, const RefCountPtr
< const Lang::Geometric2D
> & self
) const;
103 RefCountPtr
< SimplePDF::PDF_Dictionary
> virtual getDictionary( const RefCountPtr
< SimplePDF::PDF_Indirect_out
> & i_page
, const std::map
< RefCountPtr
< const char >, RefCountPtr
< SimplePDF::PDF_Vector
>, charRefPtrLess
> & namedDestinations
) const;
104 virtual void subtypeGcMark( Kernel::GCMarkedSet
& marked
);
107 class LinkAnnotation
: public Lang::AnnotationBase
110 enum Kind
{ LAUNCH_FILE
, LAUNCH_URI
, DOC_LINK
};
112 Ast::SourceLocation loc_
;
113 char highlight_
; // Make sure that this is a value from table 8.20 in the PDF-1.6 reference.
114 RefCountPtr
< const char > destination_
;
117 LinkAnnotation( const RefCountPtr
< const Lang::AnnotationSite
> & site
, const Ast::SourceLocation
& loc
, char highlight
, const RefCountPtr
< const char > & destination
, Kind kind
);
118 virtual ~LinkAnnotation( );
120 virtual RefCountPtr
< const Lang::Geometric2D
> transformed( const Lang::Transform2D
& transform
, const RefCountPtr
< const Lang::Geometric2D
> & self
) const;
121 RefCountPtr
< SimplePDF::PDF_Dictionary
> virtual getDictionary( const RefCountPtr
< SimplePDF::PDF_Indirect_out
> & i_page
, const std::map
< RefCountPtr
< const char >, RefCountPtr
< SimplePDF::PDF_Vector
>, charRefPtrLess
> & namedDestinations
) const;
122 virtual void subtypeGcMark( Kernel::GCMarkedSet
& marked
);