Updating the changelog in the VERSION file, and version_sync.
[shapes.git] / source / annotations.h
blob646164bb8715e42be4c177ec955c2d127c17118e
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
6 * any later version.
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
19 #pragma once
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"
27 #include "hottypes.h"
28 #include "tagtypes.h"
31 namespace Shapes
33 namespace Lang
36 class AnnotationSite : public Lang::NoOperatorOverloadGeometric2D
38 public:
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)};
40 protected:
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...
44 size_t flags_;
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.
50 Concrete::RGB color_;
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.
58 public:
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;
72 TYPEINFODECL;
75 class AnnotationBase : public Lang::NoOperatorOverloadGeometric2D
77 protected:
78 RefCountPtr< const Lang::AnnotationSite > site_;
79 public:
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;
90 TYPEINFODECL;
93 class TextAnnotation : public Lang::AnnotationBase
95 RefCountPtr< const char > title_;
96 bool open_;
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.
98 public:
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
109 public:
110 enum Kind{ LAUNCH_FILE, LAUNCH_URI, DOC_LINK };
111 private:
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_;
115 Kind kind_;
116 public:
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 );