1 /* PSPPIRE - a graphical user interface for PSPP.
2 Copyright (C) 2015, 2017, 2020 Free Software Foundation
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18 #ifndef __PSPPIRE_IMPORT_ASSISTANT_H__
19 #define __PSPPIRE_IMPORT_ASSISTANT_H__
21 #include <glib-object.h>
26 #include "psppire-dict.h"
27 #include "data/spreadsheet-reader.h"
28 #include "psppire-text-file.h"
29 #include "psppire-delimited-text.h"
31 #include <ssw-sheet.h>
38 #define PSPPIRE_TYPE_IMPORT_ASSISTANT (psppire_import_assistant_get_type ())
40 #define PSPPIRE_IMPORT_ASSISTANT(obj) \
41 (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
42 PSPPIRE_TYPE_IMPORT_ASSISTANT, PsppireImportAssistant))
44 #define PSPPIRE_IMPORT_ASSISTANT_CLASS(klass) \
45 (G_TYPE_CHECK_CLASS_CAST ((klass), \
46 PSPPIRE_TYPE_IMPORT_ASSISTANT, \
47 PsppireImportAssistantClass))
49 #define PSPPIRE_IS_IMPORT_ASSISTANT(obj) \
50 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_TYPE_IMPORT_ASSISTANT))
52 #define PSPPIRE_IS_IMPORT_ASSISTANT_CLASS(klass) \
53 (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_TYPE_IMPORT_ASSISTANT))
56 #define PSPPIRE_IMPORT_ASSISTANT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
57 PSPPIRE_TYPE_IMPORT_ASSISTANT, \
58 PsppireImportAssistantClass))
60 typedef struct _PsppireImportAssistant PsppireImportAssistant;
61 typedef struct _PsppireImportAssistantClass PsppireImportAssistantClass;
63 enum IMPORT_ASSISTANT_DIRECTION {IMPORT_ASSISTANT_FORWARDS, IMPORT_ASSISTANT_BACKWARDS};
65 struct _PsppireImportAssistant
72 GtkWidget *paste_button;
73 GtkWidget *reset_button;
76 struct dictionary *dict;
77 struct dictionary *casereader_dict;
80 GtkWidget *data_sheet;
83 /* START The chooser page of the assistant. */
84 GtkWidget *encoding_selector;
85 GtkFileFilter *default_filter;
86 /* END The chooser page of the assistant. */
89 GtkBuilder *text_builder;
92 /* START The introduction page of the assistant. */
93 GtkWidget *all_cases_button;
94 GtkWidget *n_cases_button;
95 GtkWidget *n_cases_spin;
96 GtkWidget *percent_button;
97 GtkWidget *percent_spin;
98 /* END The introduction page of the assistant. */
101 /* START Page where the user chooses field separators. */
103 /* How to break lines into columns. */
104 struct string quotes; /* Quote characters. */
106 GtkWidget *custom_cb;
107 GtkWidget *custom_entry;
108 GtkWidget *quote_none;
109 GtkWidget *quote_single;
110 GtkWidget *quote_double;
111 GtkWidget *quote_custom;
112 GtkWidget *quote_custom_entry;
114 GtkWidget *fields_tree_view;
116 /* END Page where the user chooses field separators. */
119 /* START first line page */
120 GtkWidget *first_line_tree_view;
121 GtkWidget *variable_names_cb;
122 /* END first line page */
124 PsppireTextFile *text_file;
125 PsppireDelimitedText *delimiters_model;
127 /* START spreadsheet related things */
128 GtkBuilder *spread_builder;
129 GtkWidget *preview_sheet;
130 struct spreadsheet *spreadsheet;
132 bool updating_selection;
135 struct _PsppireImportAssistantClass
137 GtkAssistantClass parent_class;
140 GType psppire_import_assistant_get_type (void) ;
143 GtkWidget *psppire_import_assistant_new (GtkWindow *toplevel);
145 gchar *psppire_import_assistant_generate_syntax (PsppireImportAssistant *);
147 int psppire_import_assistant_run (PsppireImportAssistant *asst);
149 GtkWidget *add_page_to_assistant (PsppireImportAssistant *ia,
150 GtkWidget *page, GtkAssistantPageType type, const gchar *title);
154 #endif /* __PSPPIRE_IMPORT_ASSISTANT_H__ */