1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 /***************************************************************************
8 	begin                : 2005
9 	copyright            : (C) 2005 by Craig Bradney
10 	email                : cbradney@zip.com.au
11 ***************************************************************************/
12 
13 /***************************************************************************
14 *                                                                         *
15 *   This program is free software; you can redistribute it and/or modify  *
16 *   it under the terms of the GNU General Public License as published by  *
17 *   the Free Software Foundation; either version 2 of the License, or     *
18 *   (at your option) any later version.                                   *
19 *                                                                         *
20 ***************************************************************************/
21 
22 #ifndef ANNOTATION_H
23 #define ANNOTATION_H
24 
25 #ifdef HAVE_CONFIG_H
26 #include "scconfig.h"
27 #endif
28 
29 #include <QString>
30 #include "scribusapi.h"
31 
32 //FIXME: Someone please fix these variable names..
33 //They are simply moved here, not all fixed.
34 //TODO make the usage in various places a little simpler
35 class SCRIBUS_API Annotation // : public SaxIO
36 {
37 	public:
38 		Annotation() = default;
39 		enum AnnotationType
40 		{
41 			Button		= 2,
42 			Textfield	= 3,
43 			Checkbox	= 4,
44 			Combobox	= 5,
45 			Listbox		= 6,
46 			Text		= 10,
47 			Link		= 11,
48 			Annot3D		= 12,
49 			RadioButton	= 13
50 		};
51 		enum AnnotationAction
52 		{
53 			Action_None				= 0,
54 			Action_JavaScript		= 1,
55 			Action_GoTo				= 2,
56 			Action_SubmitForm		= 3,
57 			Action_ResetForm		= 4,
58 			Action_ImportData		= 5,
59 			Action_GoToR_FileRel	= 7,
60 			Action_URI				= 8,
61 			Action_GoToR_FileAbs	= 9,
62 			Action_Named			= 10
63 		};
64 		enum AnnotationScriptEvents
65 		{
66 			Java_ReleaseButton	= 0,
67 			Java_PressButton	= 1,
68 			Java_EnterWidget	= 2,
69 			Java_LeaveWidget	= 3,
70 			Java_FocusIn		= 4,
71 			Java_FocusOut		= 5,
72 			Java_SelectionChg	= 6,
73 			Java_FieldFormat	= 7,
74 			Java_FieldValidate	= 8,
75 			Java_FieldCalculate	= 9
76 		};
77 		enum AnnotationIconType
78 		{
79 			Icon_Note			= 0,
80 			Icon_Comment		= 1,
81 			Icon_Key			= 2,
82 			Icon_Help			= 3,
83 			Icon_NewParagraph	= 4,
84 			Icon_Paragraph		= 5,
85 			Icon_Insert			= 6,
86 			Icon_Cross			= 7,
87 			Icon_Circle			= 8
88 		};
89 		enum AnnotationFlags
90 		{
91 			Flag_ReadOnly			=		   1,	// Bit  1
92 			Flag_Required			=		   2,	// Bit  2
93 			Flag_NoExport			=		   4,	// Bit  3
94 			Flag_Multiline			=		4096,	// Bit 13
95 			Flag_Password			=		8192,	// Bit 14
96 			Flag_NoToggleToOff		=	   16384,	// Bit 15
97 			Flag_Radio				=	   32768,	// Bit 16
98 			Flag_PushButton			=	   65536,	// Bit 17
99 			Flag_Combo				=	  131072,	// Bit 18
100 			Flag_Edit				=	  262144,	// Bit 19
101 			Flag_Sort				=	  524288,	// Bit 20
102 			Flag_FileSelect			=	 1048576,	// Bit 21
103 			Flag_MultiSelect		=	 2097152,	// Bit 22
104 			Flag_DoNotSpellCheck	=	 4194304,	// Bit 23
105 			Flag_DoNotScroll		=	 8388608,	// Bit 24
106 			Flag_Comb				=	16777216,	// Bit 25
107 			Flag_RichText			=	33554432,	// Bit 26 for Textfields only
108 			Flag_RadiosInUnison		=	33554432,	// Bit 26 for Radio Buttons only
109 			Flag_CommitOnSelChange	=	67108864	// Bit 27
110 		};
111 
isAcroFormField()112 		bool isAcroFormField() const
113 		{
114 			return m_type == Annotation::Button ||
115 				m_type == Annotation::Textfield ||
116 				m_type == Annotation::Checkbox ||
117 				m_type == Annotation::Combobox ||
118 				m_type == Annotation::Listbox ||
119 				m_type == Annotation::RadioButton;
120 		}
121 
setType(int newType)122 		void setType(int newType) { m_type = newType; }
setAction(const QString & newAction)123 		void setAction(const QString& newAction) { m_action = newAction; }
setE_act(const QString & newE_act)124 		void setE_act(const QString& newE_act) { m_E_act = newE_act; }
setX_act(const QString & newX_act)125 		void setX_act(const QString& newX_act) { m_X_act = newX_act; }
setD_act(const QString & newD_act)126 		void setD_act(const QString& newD_act) { m_D_act = newD_act; }
setFo_act(const QString & newFo_act)127 		void setFo_act(const QString& newFo_act) { m_Fo_act = newFo_act; }
setBl_act(const QString & newBl_act)128 		void setBl_act(const QString& newBl_act) { m_Bl_act = newBl_act; }
setK_act(const QString & newK_act)129 		void setK_act(const QString& newK_act) { m_K_act = newK_act; }
setF_act(const QString & newF_act)130 		void setF_act(const QString& newF_act) { m_F_act = newF_act; }
setV_act(const QString & newV_act)131 		void setV_act(const QString& newV_act) { m_V_act = newV_act; }
setC_act(const QString & newC_act)132 		void setC_act(const QString& newC_act) { m_C_act = newC_act; }
setExtern(const QString & newExtern)133 		void setExtern(const QString& newExtern) { m_extern = newExtern; }
setZiel(int newZiel)134 		void setZiel(int newZiel) { m_ziel = newZiel; }
setActionType(int newActType)135 		void setActionType(int newActType) { m_actType = newActType; }
setToolTip(const QString & newToolTip)136 		void setToolTip(const QString& newToolTip) { m_toolTip = newToolTip; }
setRollOver(const QString & newRollOver)137 		void setRollOver(const QString& newRollOver) { m_rollOver = newRollOver; }
setDown(const QString & newDown)138 		void setDown(const QString& newDown) { m_down = newDown; }
setBorderColor(const QString & newBorderColor)139 		void setBorderColor(const QString& newBorderColor) { m_borderColor = newBorderColor; }
setBorderWidth(int newBorderWidth)140 		void setBorderWidth(int newBorderWidth) { m_borderWidth = newBorderWidth; }
setBorderStyle(int newBorderStyle)141 		void setBorderStyle(int newBorderStyle) { m_borderStyle = newBorderStyle; }
setFeed(int newFeed)142 		void setFeed(int newFeed) { m_feed = newFeed; }
setFlag(int newFlag)143 		void setFlag(int newFlag) { m_flag = newFlag; }
addToFlag(int dFlag)144 		void addToFlag(int dFlag) { m_flag += dFlag; }
setMaxChar(int newMaxChar)145 		void setMaxChar(int newMaxChar) { m_maxChar = newMaxChar; }
setVis(int newVis)146 		void setVis(int newVis) { m_vis = newVis; }
setFont(int newFont)147 		void setFont(int newFont) { m_font = newFont; }
setChkStil(int newChkStil)148 		void setChkStil(int newChkStil) { m_chkStil = newChkStil; }
setFormat(int newFormat)149 		void setFormat(int newFormat) { m_format = newFormat; }
setIsChk(bool newIsChk)150 		void setIsChk(bool newIsChk) { m_isChk = newIsChk; }
setCheckState(bool newCheckState)151 		void setCheckState(bool newCheckState) { tmp_Chk = newCheckState; }
setOpen(bool newIsOpen)152 		void setOpen(bool newIsOpen) { is_Open = newIsOpen; }
setOnState(bool newOnState)153 		void setOnState(bool newOnState) { on_State = newOnState; }
setAAact(bool newAAct)154 		void setAAact(bool newAAct) { m_aAact = newAAct; }
setHTML(int newHTML)155 		void setHTML(int newHTML) { m_html = newHTML; }
setUseIcons(bool newUseIcons)156 		void setUseIcons(bool newUseIcons) { m_useIcons = newUseIcons; }
setIPlace(int newIPlace)157 		void setIPlace(int newIPlace) { m_iPlace = newIPlace; }
setScaleW(int newScaleW)158 		void setScaleW(int newScaleW) { m_scaleW = newScaleW; }
setAnOpen(bool newIsOpen)159 		void setAnOpen(bool newIsOpen) { m_isOpen = newIsOpen; }
setIcon(int newIcon)160 		void setIcon(int newIcon) { m_icon = newIcon; }
161 
Type()162 		int Type() const { return m_type; }
Action()163 		QString Action() const { return m_action; }
E_act()164 		QString E_act() const { return m_E_act; }
X_act()165 		QString X_act() const { return m_X_act; }
D_act()166 		QString D_act() const { return m_D_act; }
Fo_act()167 		QString Fo_act() const { return m_Fo_act; }
Bl_act()168 		QString Bl_act() const { return m_Bl_act; }
K_act()169 		QString K_act() const { return m_K_act; }
F_act()170 		QString F_act() const { return m_F_act; }
V_act()171 		QString V_act() const { return m_V_act; }
C_act()172 		QString C_act() const { return m_C_act; }
Extern()173 		QString Extern() const { return m_extern; }
Ziel()174 		int Ziel() const { return m_ziel; }
ActionType()175 		int ActionType() const { return m_actType; }
ToolTip()176 		QString ToolTip() const { return m_toolTip; }
RollOver()177 		QString RollOver() const { return m_rollOver; }
Down()178 		QString Down() const { return m_down; }
borderColor()179 		QString borderColor() const { return m_borderColor; }
borderWidth()180 		int borderWidth() const { return m_borderWidth; }
borderStyle()181 		int borderStyle() const { return m_borderStyle; }
Feed()182 		int Feed() const { return m_feed; }
Flag()183 		int Flag() const { return m_flag; }
MaxChar()184 		int MaxChar() const { return m_maxChar; }
Vis()185 		int Vis() const { return m_vis; }
Font()186 		int Font() const { return m_font; }
ChkStil()187 		int ChkStil() const { return m_chkStil; }
Format()188 		int Format() const { return m_format; }
IsChk()189 		bool IsChk() const { return m_isChk; }
IsChecked()190 		bool IsChecked() const { return tmp_Chk; }
IsOpen()191 		bool IsOpen() const { return is_Open; }
IsOn()192 		bool IsOn() const { return on_State; }
AAact()193 		bool AAact() const { return m_aAact; }
HTML()194 		int HTML() const { return m_html; }
UseIcons()195 		bool UseIcons() const { return m_useIcons; }
IPlace()196 		int IPlace() const { return m_iPlace; }
ScaleW()197 		int ScaleW() const { return m_scaleW; }
IsAnOpen()198 		bool IsAnOpen() const { return m_isOpen; }
Icon()199 		int Icon() const { return m_icon; }
200 
201 	private:
202 		QString m_Bl_act;
203 		QString m_C_act;
204 		QString m_D_act;
205 		QString m_E_act;
206 		QString m_F_act;
207 		QString m_Fo_act;
208 		QString m_K_act;
209 		QString m_V_act;
210 		QString m_X_act;
211 		QString m_action;
212 		QString m_borderColor;
213 		QString m_down;
214 		QString m_extern;
215 		QString m_rollOver;
216 		QString m_toolTip;
217 		bool is_Open {false};
218 		bool m_aAact {false};
219 		bool m_isChk {false};
220 		bool m_isOpen {false};
221 		bool m_useIcons {false};
222 		bool on_State {false};
223 		bool tmp_Chk {false};
224 		int m_actType {0};
225 		int m_borderStyle {0};
226 		int m_borderWidth {1};
227 		int m_chkStil {0};
228 		int m_feed {1};
229 		int m_flag {0};
230 		int m_font {4};
231 		int m_format {0};
232 		int m_html {0};
233 		int m_iPlace {1};
234 		int m_icon {0};
235 		int m_maxChar {-1};
236 		int m_scaleW {0};
237 		int m_type {0};
238 		int m_vis {0};
239 		int m_ziel {0};
240 };
241 
242 #endif
243