GUI: Move .ui files from goffice resources to glib resources
[gnumeric.git] / src / clipboard.h
blob89fc8ca7235e1f4c80347eb7475bfdf2b95de509
1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 #ifndef _GNM_CLIPBOARD_H_
3 # define _GNM_CLIPBOARD_H_
5 #include "gnumeric.h"
6 #include <goffice/goffice.h>
8 G_BEGIN_DECLS
10 typedef enum {
11 PASTE_CONTENTS = 1 << 0, /* either CONTENTS or AS_VALUES */
12 PASTE_AS_VALUES = 1 << 1, /* can be applied, not both */
13 PASTE_FORMATS = 1 << 2,
14 PASTE_COMMENTS = 1 << 3,
15 PASTE_OBJECTS = 1 << 4,
17 /* Operations that can be performed at paste time on a cell */
18 PASTE_OPER_ADD = 1 << 5,
19 PASTE_OPER_SUB = 1 << 6,
20 PASTE_OPER_MULT = 1 << 7,
21 PASTE_OPER_DIV = 1 << 8,
23 /* Whether the paste transposes or not */
24 PASTE_TRANSPOSE = 1 << 9,
26 PASTE_LINK = 1 << 10,
28 /* If copying a range that includes blank cells, this
29 prevents pasting blank cells over existing data */
30 PASTE_SKIP_BLANKS = 1 << 11,
32 /* Do not paste merged regions (probably not needed) */
33 PASTE_DONT_MERGE = 1 << 12,
35 /* Internal flag : see cmd_merge_cells_undo for details */
36 PASTE_IGNORE_COMMENTS_AT_ORIGIN = 1 << 13,
38 // Copy column widths
39 PASTE_COLUMN_WIDTHS = 1 << 14,
40 PASTE_COLUMN_WIDTHS_AUTO = 1 << 15,
41 PASTE_COLUMN_WIDTHS_MASK = (PASTE_COLUMN_WIDTHS | PASTE_COLUMN_WIDTHS_AUTO),
43 // Copy row heights
44 PASTE_ROW_HEIGHTS = 1 << 16,
45 PASTE_ROW_HEIGHTS_AUTO = 1 << 17,
46 PASTE_ROW_HEIGHTS_MASK = (PASTE_ROW_HEIGHTS | PASTE_ROW_HEIGHTS_AUTO),
48 PASTE_EXPR_LOCAL_RELOCATE = 1 << 18,
50 /* Avoid flagging dependencies. */
51 PASTE_NO_RECALC = 1 << 19,
53 /* Whether the paste flips or not */
54 PASTE_FLIP_H = 1 << 20,
55 PASTE_FLIP_V = 1 << 21,
57 PASTE_ALL_CELL = (PASTE_CONTENTS | PASTE_FORMATS | PASTE_COMMENTS | PASTE_OBJECTS),
58 PASTE_ALL_SHEET = (PASTE_ALL_CELL | PASTE_COLUMN_WIDTHS_AUTO | PASTE_ROW_HEIGHTS_AUTO),
59 PASTE_DEFAULT = PASTE_ALL_SHEET
60 } GnmPasteFlags;
62 #define PASTE_OPER_MASK (PASTE_OPER_ADD | PASTE_OPER_SUB | PASTE_OPER_MULT | PASTE_OPER_DIV)
64 typedef struct {
65 GnmCellPos const offset; /* must be first element */
66 GnmValue *val;
67 GnmExprTop const *texpr;
68 } GnmCellCopy;
70 GType gnm_cell_copy_get_type (void);
72 struct _GnmCellRegion {
73 Sheet *origin_sheet; /* can be NULL */
74 const GODateConventions *date_conv; /* can be NULL */
75 GnmCellPos base;
76 int cols, rows;
77 ColRowStateList *col_state, *row_state;
78 GHashTable *cell_content;
79 GnmStyleList *styles;
80 GSList *merged;
81 GSList *objects;
82 gboolean not_as_contents;
84 unsigned ref_count;
87 struct _GnmPasteTarget {
88 Sheet *sheet;
89 GnmRange range;
90 GnmPasteFlags paste_flags;
93 GType gnm_paste_target_get_type (void);
95 GnmPasteTarget *gnm_paste_target_new (Sheet *sheet, GnmRange *r, GnmPasteFlags flags);
97 GnmCellRegion *clipboard_copy_range (Sheet *sheet, GnmRange const *r);
98 GOUndo *clipboard_copy_range_undo (Sheet *sheet, GnmRange const *r);
99 GOUndo *clipboard_copy_ranges_undo (Sheet *sheet, GSList *ranges);
100 GnmCellRegion *clipboard_copy_obj (Sheet *sheet, GSList *objects);
101 gboolean clipboard_paste_region (GnmCellRegion const *cr,
102 GnmPasteTarget const *pt,
103 GOCmdContext *cc);
104 GnmPasteTarget *paste_target_init (GnmPasteTarget *pt,
105 Sheet *sheet, GnmRange const *r,
106 GnmPasteFlags flags);
108 GType gnm_cell_region_get_type (void);
109 GnmCellRegion *gnm_cell_region_new (Sheet *origin_sheet);
110 GnmCellRegion *cellregion_ref (GnmCellRegion *cr);
111 void cellregion_unref (GnmCellRegion *cr);
112 GString *cellregion_to_string (GnmCellRegion const *cr,
113 gboolean only_visible,
114 GODateConventions const *date_conv);
115 int cellregion_cmd_size (GnmCellRegion const *cr);
116 void cellregion_invalidate_sheet (GnmCellRegion *cr, Sheet *sheet);
118 GnmCellCopy *gnm_cell_copy_new (GnmCellRegion *cr,
119 int col_offset, int row_offset);
121 void clipboard_init (void);
122 void clipboard_shutdown (void);
125 G_END_DECLS
127 #endif /* _GNM_CLIPBOARD_H_ */