1 #ifndef _GNM_CLIPBOARD_H_
2 # define _GNM_CLIPBOARD_H_
5 #include <goffice/goffice.h>
10 PASTE_CONTENTS
= 1 << 0, /* either CONTENTS or AS_VALUES */
11 PASTE_AS_VALUES
= 1 << 1, /* can be applied, not both */
12 PASTE_FORMATS
= 1 << 2,
13 PASTE_COMMENTS
= 1 << 3,
14 PASTE_OBJECTS
= 1 << 4,
16 /* Operations that can be performed at paste time on a cell */
17 PASTE_OPER_ADD
= 1 << 5,
18 PASTE_OPER_SUB
= 1 << 6,
19 PASTE_OPER_MULT
= 1 << 7,
20 PASTE_OPER_DIV
= 1 << 8,
22 /* Whether the paste transposes or not */
23 PASTE_TRANSPOSE
= 1 << 9,
27 /* If copying a range that includes blank cells, this
28 prevents pasting blank cells over existing data */
29 PASTE_SKIP_BLANKS
= 1 << 11,
31 /* Do not paste merged regions (probably not needed) */
32 PASTE_DONT_MERGE
= 1 << 12,
34 /* Internal flag : see cmd_merge_cells_undo for details */
35 PASTE_IGNORE_COMMENTS_AT_ORIGIN
= 1 << 13,
38 PASTE_COLUMN_WIDTHS
= 1 << 14,
39 PASTE_COLUMN_WIDTHS_AUTO
= 1 << 15,
40 PASTE_COLUMN_WIDTHS_MASK
= (PASTE_COLUMN_WIDTHS
| PASTE_COLUMN_WIDTHS_AUTO
),
43 PASTE_ROW_HEIGHTS
= 1 << 16,
44 PASTE_ROW_HEIGHTS_AUTO
= 1 << 17,
45 PASTE_ROW_HEIGHTS_MASK
= (PASTE_ROW_HEIGHTS
| PASTE_ROW_HEIGHTS_AUTO
),
47 PASTE_EXPR_LOCAL_RELOCATE
= 1 << 18,
49 /* Avoid flagging dependencies. */
50 PASTE_NO_RECALC
= 1 << 19,
52 /* Whether the paste flips or not */
53 PASTE_FLIP_H
= 1 << 20,
54 PASTE_FLIP_V
= 1 << 21,
56 PASTE_ALL_CELL
= (PASTE_CONTENTS
| PASTE_FORMATS
| PASTE_COMMENTS
| PASTE_OBJECTS
),
57 PASTE_ALL_SHEET
= (PASTE_ALL_CELL
| PASTE_COLUMN_WIDTHS_AUTO
| PASTE_ROW_HEIGHTS_AUTO
),
58 PASTE_DEFAULT
= PASTE_ALL_SHEET
61 #define PASTE_OPER_MASK (PASTE_OPER_ADD | PASTE_OPER_SUB | PASTE_OPER_MULT | PASTE_OPER_DIV)
64 GnmCellPos
const offset
; /* must be first element */
66 GnmExprTop
const *texpr
;
69 GType
gnm_cell_copy_get_type (void);
71 struct _GnmCellRegion
{
72 Sheet
*origin_sheet
; /* can be NULL */
73 const GODateConventions
*date_conv
; /* can be NULL */
76 ColRowStateList
*col_state
, *row_state
;
77 GHashTable
*cell_content
;
81 gboolean not_as_contents
;
86 struct _GnmPasteTarget
{
89 GnmPasteFlags paste_flags
;
92 GType
gnm_paste_target_get_type (void);
94 GnmPasteTarget
*gnm_paste_target_new (Sheet
*sheet
, GnmRange
*r
, GnmPasteFlags flags
);
96 GnmCellRegion
*clipboard_copy_range (Sheet
*sheet
, GnmRange
const *r
);
97 GOUndo
*clipboard_copy_range_undo (Sheet
*sheet
, GnmRange
const *r
);
98 GOUndo
*clipboard_copy_ranges_undo (Sheet
*sheet
, GSList
*ranges
);
99 GnmCellRegion
*clipboard_copy_obj (Sheet
*sheet
, GSList
*objects
);
100 gboolean
clipboard_paste_region (GnmCellRegion
const *cr
,
101 GnmPasteTarget
const *pt
,
103 GnmPasteTarget
*paste_target_init (GnmPasteTarget
*pt
,
104 Sheet
*sheet
, GnmRange
const *r
,
105 GnmPasteFlags flags
);
107 GType
gnm_cell_region_get_type (void);
108 GnmCellRegion
*gnm_cell_region_new (Sheet
*origin_sheet
);
109 GnmCellRegion
*cellregion_ref (GnmCellRegion
*cr
);
110 void cellregion_unref (GnmCellRegion
*cr
);
111 GString
*cellregion_to_string (GnmCellRegion
const *cr
,
112 gboolean only_visible
,
113 GODateConventions
const *date_conv
);
114 int cellregion_cmd_size (GnmCellRegion
const *cr
);
115 void cellregion_invalidate_sheet (GnmCellRegion
*cr
, Sheet
*sheet
);
117 GnmCellCopy
*gnm_cell_copy_new (GnmCellRegion
*cr
,
118 int col_offset
, int row_offset
);
120 void clipboard_init (void);
121 void clipboard_shutdown (void);
126 #endif /* _GNM_CLIPBOARD_H_ */